:root {
    --surface: #ffffff;
    --surface-subtle: #f8f8f8;
    --surface-muted: #f1f1f3;
    --ink: #18181b;
    --ink-secondary: #52525b;
    --ink-muted: #71717a;
    --brand-muted: #666f7e;
    --border: #e4e4e7;
    --border-strong: #d4d4d8;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

html.dark-mode {
    --surface: #141416;
    --surface-subtle: #1c1c1f;
    --surface-muted: #242429;
    --ink: #f0f0f2;
    --ink-secondary: #a1a1aa;
    --ink-muted: #71717a;
    --brand-muted: #a1a1aa;
    --border: #27272a;
    --border-strong: #3f3f46;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    background-color: var(--surface);
    color: var(--ink);
    font-family: "Avenir Next", "Avenir", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

html.theme-ready,
html.theme-ready body,
html.theme-ready .site-header,
html.theme-ready .about-card,
html.theme-ready .site-footer {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
}

/* Header */
.site-header {
    background-color: var(--surface-subtle);
    border-bottom: 1px solid var(--border);
    height: 4rem;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 40;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 0.45rem;
    font-family: Arial, sans-serif;
    font-size: 0.8rem;
    letter-spacing: 2px;
    line-height: 1;
    text-transform: uppercase;
    color: var(--brand-muted);
    transition: color 0.2s ease;
}

.back-btn:hover {
    color: var(--ink);
}

.header-brand {
    font-family: Arial, sans-serif;
    font-size: 0.9rem;
    letter-spacing: 5px;
    text-indent: 5px;
    color: var(--brand-muted);
    justify-self: center;
    text-align: center;
    line-height: 1;
    white-space: nowrap;
}

/* Theme Toggle */
.theme-toggle {
    position: relative;
    justify-self: end;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-right: -0.375rem;
    padding: 0;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: var(--brand-muted);
    cursor: pointer;
    z-index: 15;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.06);
    color: var(--ink);
}

html.dark-mode .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--brand-muted);
    outline-offset: 2px;
}

.theme-toggle svg {
    width: 1.75rem;
    height: 1.75rem;
}

.theme-toggle .icon-sun {
    display: block;
}

.theme-toggle .icon-moon {
    display: none;
}

html.dark-mode .theme-toggle .icon-sun {
    display: none;
}

html.dark-mode .theme-toggle .icon-moon {
    display: block;
}

/* Main Content */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.about-intro {
    text-align: center;
    margin-bottom: 0.75rem;
}

.page-title {
    font-family: Arial, sans-serif;
    font-size: clamp(1.65rem, 3vw, 2.25rem);
    font-weight: 400;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    font-family: Arial, sans-serif;
    font-size: 0.95rem;
    font-weight: 300;
    letter-spacing: 2px;
    color: var(--brand-muted);
}

.about-card {
    background-color: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.section-label {
    font-family: Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--brand-muted);
    margin-bottom: 0.85rem;
}

.body-copy {
    font-size: 0.98rem;
    color: var(--ink-secondary);
    line-height: 1.7;
}

/* Project List */
.project-list {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.project-list li + li {
    border-top: 1px solid var(--border);
}

.project-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0.25rem;
    transition: color 0.15s ease, transform 0.15s ease;
}

.project-list li:first-child .project-row {
    padding-top: 0.25rem;
}

.project-list li:last-child .project-row {
    padding-bottom: 0.15rem;
}

.project-name {
    font-family: Arial, sans-serif;
    font-size: 0.95rem;
    letter-spacing: 1.5px;
    color: var(--ink);
    transition: color 0.15s ease;
}

.project-desc {
    font-size: 0.86rem;
    color: var(--ink-muted);
    text-align: right;
}

.project-row:hover .project-name {
    color: #2563eb;
}

html.dark-mode .project-row:hover .project-name {
    color: #93c5fd;
}

/* Contact Links */
.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.link-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    font-family: Arial, sans-serif;
    font-size: 0.78rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--ink);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.link-pill:hover {
    background-color: var(--surface-muted);
    border-color: var(--ink-muted);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 1.25rem;
    background-color: var(--surface-subtle);
    border-top: 1px solid var(--border);
}

.copyright {
    font-family: Arial, sans-serif;
    font-size: 0.75rem;
    letter-spacing: 4px;
    color: var(--brand-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .site-header {
        padding: max(env(safe-area-inset-top, 0px), 0.75rem) 1rem 0 1rem;
        height: calc(3.5rem + max(env(safe-area-inset-top, 0px), 0.75rem));
    }

    .container {
        padding: 1.5rem 1rem 3rem;
        gap: 1.25rem;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .about-card {
        padding: 1.25rem 1.25rem;
    }
}

@media (max-width: 580px) {
    .back-btn span {
        display: none;
    }

    .back-btn svg {
        width: 18px;
        height: 18px;
    }

    .header-brand {
        font-size: 0.75rem;
        letter-spacing: 3px;
        text-indent: 3px;
    }

    .project-row {
        flex-direction: column;
        gap: 0.2rem;
    }

    .project-desc {
        text-align: left;
    }
}
