/* ============================================================
   Portfolio — Editorial dark theme
   Inspired by metrik.studio (warm terracotta / cream / charcoal)
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
    /* Surfaces */
    --bg: #15171c; /* main dark */
    --bg-deep: #101216; /* nav / footer */
    --bg-elev: #1c1f26; /* cards */
    --bg-elev-2: #23262f; /* hover */
    --cream: #ece8e1; /* light section */
    --cream-2: #e4dfd6;

    /* Accent (warm terracotta / salmon) */
    --accent: #d0a08b;
    --accent-deep: #b9826b;
    --accent-soft: rgba(208, 160, 139, 0.12);

    /* Text on dark */
    --text: #efe9e1;
    --text-dim: #a39d93;
    --text-mute: #726c63;

    /* Text on cream */
    --ink: #1b1d22;
    --ink-dim: #5f5b54;
    --ink-mute: #918c83;

    /* Lines */
    --line: #2a2d36;
    --line-soft: #21242c;
    --line-cream: #d3cec4;

    /* Spacing */
    --space-2xs: 6px;
    --space-xs: 10px;
    --space-sm: 18px;
    --space-md: 34px;
    --space-lg: 72px;
    --space-xl: 130px;

    --radius-card: 14px;
    --radius-btn: 7px;
    --radius-chip: 5px;

    --maxw: 1160px;
    --nav-h: 70px;

    --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

    --font-sans: "Hanken Grotesk", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 20px);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    display: block;
}
a {
    color: inherit;
    text-decoration: none;
}
ul {
    list-style: none;
}
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

/* ---------- A11y ---------- */
.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 200;
    background: var(--accent);
    color: #15171c;
    padding: 10px 16px;
    border-radius: var(--radius-btn);
    font-weight: 600;
    transition: top 0.2s var(--ease);
}
.skip-link:focus {
    top: 16px;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

/* ---------- Shared typography helpers ---------- */
.mono {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-mute);
}

.section {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: var(--space-xl) var(--space-md);
}

.section-head {
    margin-bottom: var(--space-lg);
    max-width: 680px;
}
.section-kicker {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}
.section-title {
    font-size: clamp(2.2rem, 5.5vw, 3.6rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    margin: var(--space-sm) 0 var(--space-xs);
    line-height: 1.02;
}
.section-sub {
    color: var(--text-dim);
    font-size: 1.05rem;
    max-width: 54ch;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: -0.01em;
    transition:
        transform 0.25s var(--ease),
        background-color 0.25s var(--ease),
        color 0.25s var(--ease),
        border-color 0.25s var(--ease);
}
.btn-primary {
    background: var(--accent);
    color: #1a1310;
}
.btn-primary:hover {
    background: var(--accent-deep);
    color: #fff;
    transform: translateY(-2px);
}
.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}
.btn-lg {
    padding: 15px 30px;
    font-size: 1rem;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-md);
    max-width: var(--maxw);
    margin: 0 auto;
    transition:
        background-color 0.3s var(--ease),
        border-color 0.3s var(--ease);
    border-bottom: 1px solid transparent;
}
.navbar.scrolled {
    background: rgba(16, 18, 22, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.logo {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    padding-left: 0.28em;
}
.logo .dot {
    color: var(--accent);
    margin-left: 1px;
    letter-spacing: 0;
}

.nav-links {
    display: flex;
    gap: var(--space-md);
}
.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    transition: color 0.2s var(--ease);
}
.nav-links a:hover {
    color: var(--text);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
}
.nav-toggle .bar {
    width: 24px;
    height: 1.5px;
    background: var(--text);
    border-radius: 2px;
    transition:
        transform 0.3s var(--ease),
        opacity 0.2s var(--ease);
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) {
    opacity: 0;
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
    position: relative;
    max-width: var(--maxw);
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: calc(var(--nav-h) + var(--space-lg)) var(--space-md)
        var(--space-xl);
}
.hero::before {
    content: "";
    position: absolute;
    top: 0;
    right: 8%;
    width: 520px;
    height: 520px;
    max-width: 70vw;
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 68%);
    z-index: -1;
    pointer-events: none;
}
.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--space-md);
    display: inline-flex;
    align-items: center;
    gap: 12px;
}
.hero-eyebrow::before {
    content: "";
    width: 28px;
    height: 1px;
    background: var(--accent);
}
.hero-headline {
    font-size: clamp(3.2rem, 11vw, 8rem);
    font-weight: 700;
    line-height: 0.94;
    letter-spacing: -0.05em;
    color: var(--text);
    max-width: 14ch;
}
.hero-headline .hl-line {
    display: block;
}
.hero-headline .hl-accent {
    color: var(--accent);
}
.hero-headline .hl-outline {
    color: transparent;
    -webkit-text-stroke: 1.4px var(--text-dim);
}
.hero-cta {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-top: var(--space-lg);
}
.hero-tagline {
    color: var(--text-dim);
    font-size: clamp(1.1rem, 2.2vw, 1.4rem);
    font-weight: 400;
    margin: var(--space-md) 0 var(--space-md);
    max-width: 40ch;
}
.hero-tagline strong {
    color: var(--text);
    font-weight: 600;
}
.hero-cta {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* Hero meta block (merged bio + stats) */
.hero-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: var(--space-lg);
    border-top: 1px solid var(--line);
    padding-top: var(--space-md);
}
.hero-meta-left {
    padding-right: var(--space-lg);
}
.hero-meta-right {
    padding-left: var(--space-lg);
    border-left: 1px solid var(--line);
}

.hero-bio {
    color: var(--text-dim);
    font-size: 1rem;
    max-width: 40ch;
}
.meta-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-top: var(--space-md);
}
.token .t-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-mute);
    margin-bottom: 7px;
}
.token .t-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text);
    border: 1px solid var(--line);
    background: var(--bg-elev);
    padding: 4px 9px;
    border-radius: var(--radius-chip);
}

.hero-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 0;
    border-bottom: 1px solid var(--line);
}
.hero-stat:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}
.hero-stat:first-child {
    padding-top: 0;
}
.hero-stat .hs-val {
    font-size: 1.1rem;
    font-weight: 500;
}
.hero-stat .hs-val .num {
    color: var(--accent);
    font-weight: 700;
    margin-right: 4px;
}
.hero-stat .hs-desc {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-mute);
    text-align: right;
}

/* ============================================================
   PROJECTS
   ============================================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    align-items: start;
}
.project-card {
    grid-column: span 1;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition:
        transform 0.3s var(--ease),
        box-shadow 0.3s var(--ease),
        border-color 0.3s var(--ease);
}
.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: #3a3e48;
}
.project-card.is-expanded {
    grid-column: span 2;
    border-color: var(--accent);
}

/* Card header (editorial: title + price-style + spec row) */
.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: var(--space-sm) var(--space-md) 0;
}
.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.card-title .muted {
    color: var(--text-mute);
    font-weight: 500;
}
.card-index {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent);
}
.card-desc {
    color: var(--text-dim);
    font-size: 0.95rem;
    padding: var(--space-2xs) var(--space-md) var(--space-sm);
}
.card-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 0 var(--space-md) var(--space-sm);
}
.spec {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-mute);
}
.spec.accent {
    color: var(--accent);
}

.card-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-elev-2);
    border-top: 1px solid var(--line-soft);
}
.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--ease);
}
.project-card:hover .card-thumb img {
    transform: scale(1.03);
}

/* Live mini-preview (real site scaled into the thumbnail) */
.thumb-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-mute);
}
.thumb-live {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.thumb-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 720px;
    border: 0;
    transform-origin: top left;
    pointer-events: none;
    background: var(--bg-elev-2);
}
.card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: var(--space-sm);
    background: linear-gradient(to top, rgba(16, 18, 22, 0.8), transparent 55%);
    opacity: 0;
    transition: opacity 0.3s var(--ease);
}
.project-card:hover .card-overlay,
.project-card:focus-within .card-overlay {
    opacity: 1;
}
.expand-btn {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: rgba(16, 18, 22, 0.85);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 9px 14px;
    border-radius: var(--radius-btn);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition:
        background-color 0.2s var(--ease),
        border-color 0.2s var(--ease),
        color 0.2s var(--ease);
}
.expand-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #1a1310;
}

/* Expanded */
.card-expanded {
    border-top: 1px solid var(--line);
    padding: var(--space-md);
    display: grid;
    gap: var(--space-md);
    animation: fadeUp 0.4s var(--ease);
}
.card-expanded[hidden] {
    display: none;
}
.card-expanded .long-desc {
    color: var(--text-dim);
    max-width: 72ch;
}

.preview-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    border: 1px solid var(--line);
    overflow: hidden;
    background: var(--bg-elev-2);
}
.preview-frame iframe,
.preview-frame img {
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
}
.preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-mute);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.card-links {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   SKILLS  (light / cream section)
   ============================================================ */
.section--light {
    background: var(--cream);
    color: var(--ink);
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}
.section--light .section-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 var(--space-md);
}
.section--light .section-kicker {
    color: var(--accent-deep);
}
.section--light .section-title {
    color: var(--ink);
}
.section--light .section-sub {
    color: var(--ink-dim);
}

.skills-wrap {
    display: grid;
    gap: 0;
}
.skill-group {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: var(--space-md);
    align-items: start;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--line-cream);
}
.skill-group:first-child {
    border-top: 1px solid var(--line-cream);
}
.skill-label {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-mute);
    padding-top: 7px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.skill-index {
    font-size: 0.66rem;
    color: var(--accent-deep);
    letter-spacing: 0.08em;
}
.skill-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.badge {
    border: 1px solid var(--line-cream);
    background: transparent;
    color: var(--ink);
    padding: 8px 16px;
    border-radius: var(--radius-chip);
    font-size: 0.9rem;
    font-weight: 500;
    transition:
        background-color 0.2s var(--ease),
        color 0.2s var(--ease),
        border-color 0.2s var(--ease),
        transform 0.2s var(--ease);
}
.badge:hover {
    background: var(--ink);
    color: var(--cream);
    border-color: var(--ink);
    transform: translateY(-2px);
}

/* ============================================================
   CONTACT / FOOTER
   ============================================================ */
.contact {
    text-align: center;
}
.contact-inner {
    max-width: 720px;
    margin: 0 auto;
}
.contact .section-kicker {
    display: inline-flex;
    margin-bottom: var(--space-md);
}
.contact-title {
    font-size: clamp(2.4rem, 7vw, 4.4rem);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.02;
    margin-bottom: var(--space-lg);
}
.contact-title .accent {
    color: var(--accent);
}

/* Big email link — the focal CTA */
.contact-email {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3em;
    font-size: clamp(1.5rem, 5vw, 3rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text);
    position: relative;
    padding-bottom: 6px;
}
.contact-email::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.45s var(--ease);
}
.contact-email:hover {
    color: var(--accent);
}
.contact-email:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}
.contact-email .ce-arrow {
    font-size: 0.6em;
    color: var(--accent);
    transition: transform 0.3s var(--ease);
}
.contact-email:hover .ce-arrow {
    transform: translate(3px, -3px);
}

.socials {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: var(--space-lg);
}
.socials a {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--text-dim);
    transition:
        color 0.2s var(--ease),
        border-color 0.2s var(--ease),
        background-color 0.2s var(--ease),
        transform 0.2s var(--ease);
}
.socials a:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-3px);
}
.socials svg {
    width: 19px;
    height: 19px;
}

.footer {
    border-top: 1px solid var(--line);
    background: var(--bg-deep);
}
.footer-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    flex-wrap: wrap;
}
.footer p {
    color: var(--text-mute);
    font-size: 0.85rem;
}
.footer-note {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.footer-top {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    transition: color 0.2s var(--ease);
}
.footer-top span {
    display: inline-block;
    transition: transform 0.25s var(--ease);
}
.footer-top:hover {
    color: var(--accent);
}
.footer-top:hover span {
    transform: translateY(-3px);
}

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition:
        opacity 0.7s var(--ease),
        transform 0.7s var(--ease);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Project cards: opacity-only staggered fade so hover transform stays intact */
.project-card.reveal {
    opacity: 0;
    transform: none;
    transition:
        opacity 0.6s var(--ease),
        transform 0.3s var(--ease),
        box-shadow 0.3s var(--ease),
        border-color 0.3s var(--ease);
    transition-delay: var(--d, 0ms), 0s, 0s, 0s;
}
.project-card.reveal.visible {
    opacity: 1;
}

/* Stagger hero meta after the headline */
.hero-meta {
    transition-delay: 0.12s;
}

/* ============================================================
   ENTRANCE & AMBIENT ANIMATIONS
   ============================================================ */
.navbar {
    animation: navIn 0.7s var(--ease) both;
}
@keyframes navIn {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slow drift on the hero glow */
.hero::before {
    animation: heroDrift 18s ease-in-out infinite;
    will-change: transform;
}
@keyframes heroDrift {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(-26px, 22px) scale(1.08);
    }
}

/* Active nav link (scroll-spy) */
.nav-links a.active {
    color: var(--accent);
}

/* Button press feedback */
.btn:active {
    transform: translateY(0) scale(0.97);
}

/* Live badge on project thumbnails */
.card-live {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text);
    background: rgba(16, 18, 22, 0.72);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 4px 10px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5fcf7a;
    animation: livePulse 1.8s ease-in-out infinite;
}
@keyframes livePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(95, 207, 122, 0.55);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(95, 207, 122, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(95, 207, 122, 0);
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .skill-group {
        grid-template-columns: 1fr;
        gap: var(--space-xs);
    }
}

@media (max-width: 768px) {
    :root {
        --space-xl: 84px;
        --space-lg: 52px;
    }

    .nav-toggle {
        display: flex;
    }
    .nav-links {
        position: fixed;
        top: var(--nav-h);
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: rgba(16, 18, 22, 0.97);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-bottom: 1px solid var(--line);
        padding: var(--space-sm) var(--space-md);
        transform: translateY(-150%);
        transition: transform 0.35s var(--ease);
        z-index: 90;
    }
    .nav-links.open {
        transform: translateY(0);
    }
    .nav-links li {
        padding: 13px 0;
        border-bottom: 1px solid var(--line-soft);
    }
    .nav-links li:last-child {
        border-bottom: 0;
    }

    .hero-meta {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    .hero-meta-left {
        padding-right: 0;
    }
    .hero-meta-right {
        padding-left: 0;
        border-left: 0;
        border-top: 1px solid var(--line);
        padding-top: var(--space-md);
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }
    .project-card.is-expanded {
        grid-column: span 1;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ============================================================
   POLISH LAYER — texture, cursor, progress, marquee, motion
   ============================================================ */

/* ---------- Intro / preloader ---------- */
.preloader {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: var(--bg-deep);
    color: var(--text);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(20px, 5vw, 48px);
    overflow: hidden;
    will-change: transform;
}
/* Curtain wipe-up on completion */
.preloader.is-done {
    transform: translateY(-101%);
    transition: transform 0.95s cubic-bezier(0.76, 0, 0.24, 1);
}
.preloader.is-done::after {
    transform: scaleX(0);
}
.preloader::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform-origin: left;
    transform: scaleX(1);
    transition: transform 0.5s var(--ease);
}
/* Lock page scroll while the intro is on screen */
html.is-loading,
html.is-loading body {
    overflow: hidden;
    height: 100%;
}

.preloader-top,
.preloader-foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-mute);
}
.pre-mark {
    color: var(--accent);
}
.pre-status {
    position: relative;
    padding-right: 16px;
}
.pre-status::after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    width: 7px;
    height: 7px;
    margin-top: -3px;
    border-radius: 50%;
    background: var(--accent);
    animation: prePulse 1s ease-in-out infinite;
}
@keyframes prePulse {
    0%,
    100% {
        opacity: 0.25;
    }
    50% {
        opacity: 1;
    }
}

.preloader-center {
    align-self: center;
    text-align: center;
    max-width: 94vw;
}
.pre-word {
    display: inline-block;
    overflow: hidden;
    font-size: clamp(3rem, 15vw, 9.5rem);
    font-weight: 700;
    letter-spacing: -0.06em;
    line-height: 1.06;
    padding-bottom: 0.06em;
}
.pre-word-inner {
    display: inline-block;
    color: transparent;
    -webkit-text-stroke: 1px var(--text-mute);
    background: linear-gradient(
        90deg,
        var(--text) var(--fill, 0%),
        transparent var(--fill, 0%)
    );
    -webkit-background-clip: text;
    background-clip: text;
    transform: translateY(110%);
    animation: preWordUp 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) 0.12s forwards;
}
@keyframes preWordUp {
    to {
        transform: translateY(0);
    }
}

.pre-count {
    font-size: clamp(2.6rem, 11vw, 7rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 0.9;
    color: var(--text);
    font-family: var(--font-sans);
}
.pre-count .pre-pct {
    font-size: 0.3em;
    color: var(--accent);
    vertical-align: top;
    margin-left: 4px;
}
.preloader-foot {
    align-items: flex-end;
}
.pre-meta {
    text-align: right;
    max-width: 18ch;
    line-height: 1.5;
}

.preloader-line {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: var(--line);
}
.preloader-line #preLine {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
    .pre-word-inner {
        transform: none !important;
        animation: none !important;
    }
    .pre-status::after {
        animation: none;
    }
}

/* ---------- Film grain overlay ---------- */
.grain {
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    z-index: 300;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grainShift 0.6s steps(2) infinite;
    will-change: transform;
}
@keyframes grainShift {
    0% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(-3%, 2%);
    }
    50% {
        transform: translate(2%, -4%);
    }
    75% {
        transform: translate(-2%, 3%);
    }
    100% {
        transform: translate(3%, -2%);
    }
}

/* ---------- Scroll progress bar ---------- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 250;
    background: transparent;
    pointer-events: none;
}
.scroll-progress-bar {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(
        90deg,
        var(--accent-deep),
        var(--accent),
        #f0d4c4
    );
    transform-origin: left;
    box-shadow: 0 0 12px var(--accent-soft);
}

/* ---------- Custom cursor ---------- */
.cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 600;
    pointer-events: none;
    display: none;
    mix-blend-mode: difference;
}
html.cursor-on .cursor {
    display: block;
}
html.cursor-on,
html.cursor-on a,
html.cursor-on button,
html.cursor-on .expand-btn {
    cursor: none;
}
.cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    transform: translate(-50%, -50%);
    will-change: transform;
}
.cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition:
        width 0.25s var(--ease),
        height 0.25s var(--ease),
        background-color 0.25s var(--ease),
        border-color 0.25s var(--ease);
    will-change: transform;
}
html.cursor-hover .cursor-ring {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.12);
    border-color: transparent;
}
html.cursor-down .cursor-ring {
    width: 26px;
    height: 26px;
}

/* ---------- Hero: parallax glow + word reveal + scroll cue ---------- */
.hero {
    overflow: hidden;
}
.hero-glow {
    position: absolute;
    top: -10%;
    left: -6%;
    width: 460px;
    height: 460px;
    max-width: 60vw;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(208, 160, 139, 0.1) 0%,
        transparent 70%
    );
    z-index: -1;
    pointer-events: none;
    filter: blur(10px);
    will-change: transform;
}

/* Per-word headline reveal */
.hero-headline .word {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    padding-bottom: 0.1em;
}
.hero-headline .word-inner {
    display: inline-block;
    transform: translateY(110%);
    transition: transform 0.8s var(--ease);
}
.hero-headline .word-inner.in {
    transform: translateY(0);
}

.scroll-cue {
    position: absolute;
    right: var(--space-md);
    bottom: var(--space-md);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-mute);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    transition: color 0.25s var(--ease);
}
.scroll-cue:hover {
    color: var(--accent);
}
.scroll-cue-line {
    width: 1px;
    height: 52px;
    background: linear-gradient(to bottom, var(--accent), transparent);
    position: relative;
    overflow: hidden;
}
.scroll-cue-line::after {
    content: "";
    position: absolute;
    top: -50%;
    left: 0;
    width: 100%;
    height: 50%;
    background: var(--accent);
    animation: scrollCue 1.8s var(--ease) infinite;
}
@keyframes scrollCue {
    0% {
        transform: translateY(-100%);
    }
    60%,
    100% {
        transform: translateY(300%);
    }
}

/* ---------- Marquee band ---------- */
.marquee {
    overflow: hidden;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: var(--space-sm) 0;
    background: var(--bg-deep);
    -webkit-mask-image: linear-gradient(
        90deg,
        transparent,
        #000 8%,
        #000 92%,
        transparent
    );
    mask-image: linear-gradient(
        90deg,
        transparent,
        #000 8%,
        #000 92%,
        transparent
    );
}
.marquee-track {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    width: max-content;
    animation: marquee 34s linear infinite;
}
.marquee:hover .marquee-track {
    animation-play-state: paused;
}
.marquee-item {
    font-size: clamp(1.4rem, 3.2vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: var(--space-md);
}
.marquee-item:nth-child(even) {
    color: transparent;
    -webkit-text-stroke: 1px var(--text-mute);
}
.marquee-item .marquee-sep {
    color: var(--accent);
    font-size: 0.7em;
}
@keyframes marquee {
    to {
        transform: translateX(-50%);
    }
}

/* ---------- Nav links: animated underline ---------- */
.nav-links a {
    position: relative;
}
.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 100%;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.35s var(--ease);
}
.nav-links a:hover::after,
.nav-links a.active::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ---------- Project card: hover sheen ---------- */
.card-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: linear-gradient(
        115deg,
        transparent 38%,
        rgba(255, 255, 255, 0.08) 50%,
        transparent 62%
    );
    transform: translateX(-120%);
    transition: transform 0.7s var(--ease);
}
.project-card:hover .card-thumb::after {
    transform: translateX(120%);
}

/* ---------- Refined section kicker (small leading rule) ---------- */
.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.section-kicker::before {
    content: "";
    width: 28px;
    height: 1px;
    background: var(--accent);
    display: inline-block;
    transform-origin: left;
}
/* Draw the kicker rule in when the heading enters the viewport */
.reveal .section-kicker::before {
    transform: scaleX(0);
    transition: transform 0.7s var(--ease) 0.15s;
}
.reveal.visible .section-kicker::before {
    transform: scaleX(1);
}

/* ---------- Project card: subtle 3D tilt ---------- */
.project-card.is-tilting {
    transition:
        transform 0.12s linear,
        box-shadow 0.3s var(--ease),
        border-color 0.3s var(--ease);
    will-change: transform;
}
.project-card.is-tilting:hover {
    box-shadow:
        0 30px 70px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(208, 160, 139, 0.18);
}

/* While JS inertia scrolling is active, kill snap jitter */
html.is-scrolling {
    scroll-behavior: auto;
}

@media (max-width: 768px) {
    .scroll-cue {
        display: none;
    }
}

/* ---------- Reduced motion: disable polish motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .grain,
    .scroll-cue-line::after,
    .marquee-track {
        animation: none !important;
    }
    .cursor {
        display: none !important;
    }
    .hero-headline .word-inner {
        transform: none !important;
    }
    .marquee-track {
        transform: none !important;
    }
}
