/* ─── Tokens ─── */
:root {
    --bg: #0F0F0D;
    --text: #F0EDE6;
    --accent: #C8B89A;
    --text-dim: rgba(240, 237, 230, 0.4);
    --text-faint: rgba(240, 237, 230, 0.08);
    --text-subtle: rgba(240, 237, 230, 0.3);
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --serif: 'Cormorant Garamond', 'Georgia', serif;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Light Mode ─── */
:root.light {
    --bg: #F5F2EC;
    --text: #1A1A18;
    --accent: #8B6B4A;
    --text-dim: rgba(26, 26, 24, 0.45);
    --text-faint: rgba(26, 26, 24, 0.08);
    --text-subtle: rgba(26, 26, 24, 0.3);
}

/* ─── Reset ─── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
    background: var(--bg);
    transition: background 300ms ease;
}

body {
    font-family: var(--sans);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    opacity: 0;
    transition: opacity 400ms ease, color 300ms ease, background 300ms ease;
}

body.loaded {
    opacity: 1;
}

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

::selection {
    background: var(--accent);
    color: var(--bg);
}

/* ─── Custom Cursor ─── */
.cursor-dot,
.cursor-ring {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transition: opacity 300ms ease;
}

.cursor-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
}

.cursor-ring {
    width: 32px;
    height: 32px;
    border: 1px solid var(--text-dim);
    transition: width 300ms var(--ease), height 300ms var(--ease), border-color 300ms ease, background 300ms ease, opacity 300ms ease;
}

.cursor-ring.hovered {
    width: 48px;
    height: 48px;
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

@media (hover: hover) and (pointer: fine) {
    html {
        cursor: none;
    }

    .cursor-dot,
    .cursor-ring {
        display: block;
    }
}

/* ─── Navigation ─── */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 40px;
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-name {
    font-family: var(--sans);
    font-weight: 400;
    font-size: 13px;
    color: var(--text);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-dim);
    transition: color 150ms ease;
}

.nav-links a:hover {
    color: var(--text);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    font-family: var(--sans);
    cursor: pointer;
    padding: 4px 8px;
    transition: color 150ms ease;
}

.nav-toggle:hover {
    color: var(--text);
}

/* ─── Theme Toggle ─── */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    font-family: var(--sans);
    line-height: 1;
    padding: 2px 4px;
    transition: color 150ms ease;
}

.theme-toggle:hover {
    color: var(--accent);
}

/* ─── Mobile Overlay ─── */
.mobile-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 200;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 48px;
    transform: translateX(100%);
    transition: transform 300ms var(--ease);
}

.mobile-overlay[aria-hidden="false"] {
    transform: translateX(0);
}

.mobile-overlay a {
    font-family: var(--serif);
    font-weight: 300;
    font-size: 10vw;
    color: var(--text);
    transition: color 150ms ease;
}

.mobile-overlay a:hover {
    color: var(--accent);
}

.mobile-overlay-close {
    position: absolute;
    top: 24px;
    right: 40px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 150ms ease;
}

.mobile-overlay-close:hover {
    color: var(--text);
}

.mobile-theme-toggle {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 150ms ease;
}

.mobile-theme-toggle:hover,
.mobile-theme-toggle:focus-visible {
    color: var(--accent);
}

/* ─── Layout ─── */
main {
    padding: 0 40px;
}

.spacer {
    height: 20vh;
}

.spacer-sm {
    height: 10vh;
}

/* ─── Reveal Animation ─── */
@media (prefers-reduced-motion: no-preference) {
    .reveal {
        opacity: 0;
        filter: blur(4px);
        transition: opacity 500ms ease, filter 500ms ease;
    }

    .reveal.visible {
        opacity: 1;
        filter: blur(0px);
    }
}

/* ─── Hero ─── */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding-top: 80px;
    padding-bottom: 80px;
}

.hero-quote {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(2.4rem, 5.5vw, 5.5vw);
    line-height: 1.3;
    max-width: 900px;
    letter-spacing: -0.01em;
    border: none;
    margin: 0 0 20px;
    padding: 0;
    quotes: none;
}

.hero-attribution {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 400;
    color: var(--text-dim);
    letter-spacing: 0.08em;
}

.hero-scroll {
    position: absolute;
    bottom: 48px;
    right: 0;
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 400;
    color: var(--text-dim);
    writing-mode: vertical-rl;
    letter-spacing: 0.1em;
}

/* ─── Work Section ─── */
.work-section {
    padding: 0;
}

.work-category + .work-category {
    margin-top: 80px;
}

.section-marker {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 64px;
}

.section-marker-line {
    display: block;
    width: 1px;
    height: 40px;
    background: var(--text-dim);
}

.section-marker-label {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 400;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.work-list {
    display: flex;
    flex-direction: column;
}

.work-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    padding: 24px 0;
    border-bottom: 1px solid var(--text-faint);
    cursor: default;
    transition: padding 300ms var(--ease);
}

a.work-row {
    cursor: pointer;
    position: relative;
}

a.work-row::after {
    content: '↗' / '';
    font-size: 18px;
    color: var(--accent);
    margin-left: auto;
    flex-shrink: 0;
    padding-left: 16px;
    transition: transform 200ms var(--ease);
}

a.work-row:hover::after {
    transform: translate(2px, -2px);
}

.work-row:first-child {
    border-top: 1px solid var(--text-faint);
}

.work-num {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 400;
    color: var(--text-subtle);
    min-width: 48px;
    flex-shrink: 0;
}

.work-name {
    font-family: var(--sans);
    font-weight: 400;
    font-size: clamp(24px, 3.5vw, 40px);
    flex-grow: 1;
    transition: font-size 300ms var(--ease), color 150ms ease;
    will-change: font-size;
}

.work-detail {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 400;
    color: var(--text-dim);
    margin-left: 32px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ─── Work Blurb ─── */
.work-blurb {
    width: 100%;
    flex-basis: 100%;
    max-height: 0;
    overflow: hidden;
    font-family: var(--sans);
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.7;
    opacity: 0;
    padding-top: 0;
    padding-left: 48px;
    transition: max-height 400ms var(--ease), opacity 300ms ease, padding-top 300ms ease;
}

.work-row:hover .work-blurb {
    max-height: 120px;
    opacity: 1;
    padding-top: 10px;
}

@media (prefers-reduced-motion: no-preference) {
    .work-row:hover .work-name {
        font-size: clamp(32px, 4.5vw, 52px);
    }

    .work-row:hover {
        padding: 32px 0;
    }
}

.work-row:hover .work-name {
    color: var(--accent);
}

/* ─── About Section ─── */
.about-section {
    max-width: 720px;
    padding: 0;
}

.about-opener {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(1.6rem, 3vw, 3vw);
    line-height: 1.3;
    margin-bottom: 64px;
}

.about-body {
    max-width: 65ch;
}

.about-body p {
    font-family: var(--sans);
    font-size: 18px;
    font-weight: 400;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 28px;
}

.about-body p:last-child {
    margin-bottom: 0;
}

/* ─── Contact Section ─── */
.contact-section {
    background: var(--text);
    color: var(--bg);
    margin: 0 -40px;
    padding: 160px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.contact-email {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(1.8rem, 4vw, 4vw);
    color: var(--bg);
    transition: color 150ms ease;
}

.contact-email:hover {
    color: #5A5347;
}

.contact-handles {
    margin-top: 32px;
    display: flex;
    gap: 32px;
}

.contact-handles a {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 400;
    color: rgba(15, 15, 13, 0.45);
    transition: color 150ms ease;
}

:root.light .contact-handles a {
    color: rgba(245, 242, 236, 0.5);
}

.contact-handles a:hover {
    color: var(--bg);
}

/* ─── Footer ─── */
footer {
    padding: 0 40px;
    background: var(--text);
    color: var(--bg);
    transition: background 300ms ease, color 300ms ease;
}

.footer-line {
    width: 100%;
    height: 1px;
    background: color-mix(in srgb, var(--bg) 15%, transparent);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 400;
    color: color-mix(in srgb, var(--bg) 45%, transparent);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    nav {
        padding: 20px 24px;
    }

    .nav-links {
        display: none;
    }

    .nav-toggle {
        display: block;
    }

    main {
        padding: 0 24px;
    }

    .hero-scroll {
        bottom: 32px;
    }

    .work-row {
        gap: 4px;
    }

    .work-detail {
        margin-left: 0;
    }

    .work-detail:nth-of-type(1) {
        margin-left: auto;
    }

    .work-blurb {
        padding-left: 32px;
    }

    .about-section {
        max-width: 100%;
    }

    .contact-section {
        margin: 0 -24px;
        padding: 100px 24px;
    }

    footer {
        padding: 0 24px;
    }

    .mobile-overlay-close {
        right: 24px;
    }
}

@media (max-width: 480px) {
    .hero {
        min-height: 100svh;
        padding-top: 60px;
        padding-bottom: 60px;
    }

    .hero-quote {
        font-size: clamp(1.6rem, 7vw, 2.5rem);
    }

    .work-num {
        min-width: 32px;
    }

    .work-detail:last-of-type {
        display: none;
    }

    .work-blurb {
        padding-left: 32px;
    }

    .about-body p {
        font-size: 16px;
    }

    .contact-handles {
        flex-direction: column;
        gap: 12px;
    }
}

/* ─── Touch / No-Hover Devices ─── */
@media (hover: none) {
    .work-blurb {
        max-height: 200px;
        opacity: 1;
        padding-top: 10px;
    }

    .work-row:active .work-name {
        color: var(--accent);
    }
}
