/* =====================================================================
   PHILLIP CASTRO — PORTFOLIO
   Refined-technical / blueprint aesthetic.
   Palette: warm off-white base, ink text, muted grey, red accent,
   near-black "lab" surface for media + CAD viewer.
   Type: Bricolage Grotesque (display) · Hanken Grotesk (body) ·
         JetBrains Mono (technical labels).
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700;12..96,800&family=Hanken+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ----------------------------------------------------------------- *
 * Design tokens
 * ----------------------------------------------------------------- */
:root {
    /* Color */
    --base:        #f4f2ee; /* warm off-white */
    --base-2:      #ebe8e1; /* slightly deeper panel */
    --ink:         #0e0f11; /* near-black text */
    --ink-soft:    #3a3b3d;
    --muted:       #8a8a82; /* labels / secondary */
    --hairline:    #d6d2c8; /* hairline borders */
    --accent:      #c8102e; /* signature red */
    --accent-dim:  #a50d26;
    --lab:         #0a0b0d; /* dark media / CAD surface */
    --lab-2:       #15171b;
    --lab-line:    #2a2d33;
    --on-lab:      #e8e9eb;
    --on-lab-mute: #8b9098;

    /* Type */
    --font-display: 'Bricolage Grotesque', Georgia, serif;
    --font-body:    'Hanken Grotesk', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, monospace;

    /* Spacing scale (4 / 8 px rhythm) */
    --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem;
    --s5: 1.5rem;  --s6: 2rem;   --s8: 3rem;     --s10: 4rem;
    --s12: 6rem;   --s16: 8rem;

    /* Layout */
    --maxw: 1280px;
    --measure: 70ch;
    --gutter: clamp(1.25rem, 4vw, 3rem);
    --header-h: 68px;
    --radius: 2px;

    /* Motion */
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
    --dur-fast: 160ms;
    --dur: 240ms;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    /* faint blueprint grid */
    background-image:
        linear-gradient(to right, rgba(14,15,17,0.022) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(14,15,17,0.022) 1px, transparent 1px);
    background-size: 64px 64px;
}

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }

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

/* ----------------------------------------------------------------- *
 * Typography
 * ----------------------------------------------------------------- */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.04;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

p { text-wrap: pretty; }

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

.mono {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Eyebrow / kicker label */
.kicker {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}
.kicker::before {
    content: "";
    width: 1.75rem;
    height: 1px;
    background: var(--accent);
}

/* ----------------------------------------------------------------- *
 * Layout helpers
 * ----------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding-inline: var(--gutter);
}

.section { padding-block: clamp(3.5rem, 9vw, 7rem); }

.divider {
    height: 1px;
    background: var(--hairline);
    border: 0;
}

/* Generic mono section index, e.g. [ 02 / VISION ] */
.section-index {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: var(--s5);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.section-index .tick { color: var(--accent); }

/* ----------------------------------------------------------------- *
 * Custom cursor (desktop pointer only)
 * ----------------------------------------------------------------- */
.cursor-dot, .cursor-ring {
    position: fixed;
    top: 0; left: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    mix-blend-mode: difference;
    will-change: transform;
}
.cursor-dot { width: 6px; height: 6px; background: #fff; }
.cursor-ring {
    width: 34px; height: 34px;
    border: 1px solid #fff;
    transition: width var(--dur) var(--ease-out),
                height var(--dur) var(--ease-out),
                opacity var(--dur) var(--ease-out);
}
.cursor-ring.is-hover { width: 56px; height: 56px; }
body.cursor-ready { cursor: none; }
body.cursor-ready a, body.cursor-ready button { cursor: none; }

/* ----------------------------------------------------------------- *
 * Buttons
 * ----------------------------------------------------------------- */
.btn {
    --b: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink);
    padding: 0.85rem 1.4rem;
    border: 1px solid var(--b);
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: color var(--dur) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
    min-height: 44px;
}
.btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--ink);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--dur) var(--ease-out);
    z-index: -1;
}
.btn span, .btn svg { position: relative; z-index: 1; }
.btn:active { transform: scale(0.97); }
.btn-primary { color: #fff; background: var(--ink); }
.btn-primary::after { background: var(--accent); transform: scaleX(0); }

@media (hover: hover) and (pointer: fine) {
    .btn:hover { color: #fff; }
    .btn:hover::after { transform: scaleX(1); }
    .btn-primary:hover { color: #fff; }
    .btn-primary:hover::after { transform: scaleX(1); }
}

.btn svg { width: 14px; height: 14px; }

/* Mono tag chips */
.tag {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    border: 1px solid var(--hairline);
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius);
    white-space: nowrap;
}

/* ----------------------------------------------------------------- *
 * Header
 * ----------------------------------------------------------------- */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    z-index: 100;
    display: flex;
    align-items: center;
    background: color-mix(in srgb, var(--base) 78%, transparent);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--dur) var(--ease-out),
                transform 360ms var(--ease-out);
}
.site-header.is-scrolled { border-bottom-color: var(--hairline); }
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s4);
}

.site-mark { display: inline-flex; align-items: center; line-height: 1; }
.mark-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    transition: color var(--dur) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
    .site-mark:hover .mark-name { color: var(--accent); }
}
.mark-role {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
}

.site-nav { display: flex; align-items: center; gap: 0.35rem; }
.site-nav a {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
    padding: 0.6rem 0.7rem;
    position: relative;
    transition: color var(--dur) var(--ease-out);
}
.site-nav a .nav-idx { color: var(--muted); margin-right: 0.35rem; }
.site-nav a::after {
    content: "";
    position: absolute;
    left: 0.7rem; right: 0.7rem; bottom: 0.45rem;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--dur) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
    .site-nav a:hover { color: var(--ink); }
    .site-nav a:hover::after { transform: scaleX(1); }
}
.site-nav a.active { color: var(--ink); }
.site-nav a.active::after { transform: scaleX(1); }

/* Mobile menu */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 44px; height: 44px;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    cursor: pointer;
}
.menu-toggle span {
    width: 18px; height: 1.5px; background: var(--ink);
    transition: transform var(--dur) var(--ease-out), opacity var(--dur) var(--ease-out);
}
body.menu-open .menu-toggle span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
body.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
body.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 760px) {
    .menu-toggle { display: flex; }
    .site-nav {
        position: fixed;
        inset: var(--header-h) 0 auto 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        background: var(--base);
        border-bottom: 1px solid var(--hairline);
        padding: var(--s4) var(--gutter) var(--s6);
        transform: translateY(-110%);
        transition: transform 380ms var(--ease-out);
        box-shadow: 0 30px 60px -30px rgba(0,0,0,0.25);
    }
    body.menu-open .site-nav { transform: translateY(0); }
    .site-nav a { font-size: 1.1rem; padding: 0.9rem 0; width: 100%; }
    .site-nav a::after { left: 0; right: auto; bottom: 0.6rem; width: 2rem; }
}

/* ----------------------------------------------------------------- *
 * Page shell
 * ----------------------------------------------------------------- */
.page { padding-top: var(--header-h); }

.page-head { padding-block: clamp(3rem, 8vw, 6rem) clamp(2rem, 5vw, 3.5rem); }
.page-title {
    font-size: clamp(2.6rem, 8vw, 5.5rem);
    font-weight: 700;
    line-height: 0.98;
    letter-spacing: -0.03em;
}
.page-lead {
    margin-top: var(--s5);
    max-width: 52ch;
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    color: var(--ink-soft);
    line-height: 1.55;
}

/* ----------------------------------------------------------------- *
 * Home — hero
 * ----------------------------------------------------------------- */
.hero {
    min-height: calc(100svh - var(--header-h));
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-block: var(--s10);
    position: relative;
}
.hero-kicker { margin-bottom: var(--s6); }
.hero-title {
    font-size: clamp(2.7rem, 10vw, 8rem);
    font-weight: 700;
    line-height: 0.94;
    letter-spacing: -0.035em;
    max-width: 16ch;
}
.hero-title .accent { color: var(--accent); }
.hero-meta {
    margin-top: var(--s8);
    display: flex;
    flex-wrap: wrap;
    gap: var(--s5) var(--s10);
    align-items: flex-end;
    justify-content: space-between;
}
.hero-sub {
    max-width: 46ch;
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    color: var(--ink-soft);
    line-height: 1.6;
}
.scroll-cue {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.scroll-cue .line {
    width: 1px; height: 38px;
    background: linear-gradient(var(--accent), transparent);
    display: inline-block;
    animation: cue 2.4s var(--ease-in-out) infinite;
    transform-origin: top;
}
@keyframes cue { 0%,100%{transform:scaleY(0.3);opacity:0.4} 50%{transform:scaleY(1);opacity:1} }

/* ----------------------------------------------------------------- *
 * Home — index list (Projects / Concepts / About / ...)
 * ----------------------------------------------------------------- */
.index-list { border-top: 1px solid var(--hairline); }
.index-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: var(--s5);
    padding: clamp(1.25rem, 3vw, 2.1rem) 0;
    border-bottom: 1px solid var(--hairline);
    position: relative;
    transition: color var(--dur) var(--ease-out);
}
.index-row .ir-idx { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.index-row .ir-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.8rem, 5vw, 3.4rem);
    letter-spacing: -0.02em;
    transition: transform var(--dur) var(--ease-out);
}
.index-row .ir-desc {
    font-size: 0.92rem; color: var(--muted); max-width: 30ch; text-align: right;
}
.index-row .ir-arrow {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border: 1px solid var(--hairline);
    border-radius: 50%;
    transition: background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.index-row .ir-arrow svg { width: 15px; height: 15px; }
@media (hover: hover) and (pointer: fine) {
    .index-row:hover .ir-title { transform: translateX(0.75rem); }
    .index-row:hover .ir-title { color: var(--accent); }
    .index-row:hover .ir-arrow { background: var(--accent); border-color: var(--accent); color: #fff; transform: rotate(-45deg); }
}
@media (max-width: 720px) {
    .index-row { grid-template-columns: auto 1fr auto; }
    .index-row .ir-desc { display: none; }
}

/* ----------------------------------------------------------------- *
 * NOW status panel
 * ----------------------------------------------------------------- */
.now-panel {
    background: var(--lab);
    color: var(--on-lab);
    border-radius: var(--radius);
    padding: clamp(1.75rem, 4vw, 3rem);
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s5);
    position: relative;
    overflow: hidden;
}
.now-panel::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
        linear-gradient(to right, rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}
.now-panel > * { position: relative; }
.now-status {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--on-lab-mute);
    display: inline-flex; align-items: center; gap: 0.5rem;
}
.now-status .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #45d27a; box-shadow: 0 0 0 0 rgba(69,210,122,0.6);
    animation: pulse 2.4s infinite;
}
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(69,210,122,0.5)} 70%{box-shadow:0 0 0 8px rgba(69,210,122,0)} 100%{box-shadow:0 0 0 0 rgba(69,210,122,0)} }
.now-text { font-size: clamp(1.1rem, 2.4vw, 1.5rem); font-family: var(--font-display); font-weight: 500; line-height: 1.3; max-width: 32ch; }
.now-cta { display: flex; flex-wrap: wrap; gap: var(--s4); }
.now-panel .btn { color: var(--on-lab); border-color: var(--lab-line); }
.now-panel .btn::after { background: var(--accent); }
@media (hover: hover) and (pointer: fine) {
    .now-panel .btn:hover { color: #fff; border-color: var(--accent); }
}

/* ----------------------------------------------------------------- *
 * Projects / Concepts grid (rendered by render.js)
 * ----------------------------------------------------------------- */
.work-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(1.5rem, 4vw, 3rem);
}
@media (max-width: 720px) { .work-grid { grid-template-columns: 1fr; } }

.work-card { display: block; position: relative; }
.work-card .frame {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--lab);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    overflow: hidden;
}
.work-card .frame img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 600ms var(--ease-out), opacity var(--dur) var(--ease-out);
}
.work-card .frame::after { /* corner ticks */
    content: "";
    position: absolute; inset: 10px;
    border: 1px solid rgba(255,255,255,0.0);
    transition: border-color var(--dur) var(--ease-out);
    pointer-events: none;
}
.work-card .num {
    position: absolute; top: 12px; left: 14px;
    font-family: var(--font-mono);
    font-size: 0.68rem; letter-spacing: 0.15em;
    color: rgba(255,255,255,0.75); z-index: 2;
}
.work-card .status-flag {
    position: absolute; top: 12px; right: 14px;
    font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.14em;
    text-transform: uppercase; z-index: 2;
    padding: 0.2rem 0.5rem; border-radius: var(--radius);
    background: rgba(255,255,255,0.1); color: #fff; backdrop-filter: blur(4px);
}
.work-card .status-flag.concept { background: rgba(200,16,46,0.85); }
.work-meta { padding-top: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.work-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.15rem, 2.4vw, 1.6rem);
    letter-spacing: -0.015em;
    line-height: 1.1;
    transition: color var(--dur) var(--ease-out);
}
.work-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
@media (hover: hover) and (pointer: fine) {
    .work-card:hover .frame img { transform: scale(1.05); }
    .work-card:hover .frame::after { border-color: rgba(255,255,255,0.25); }
    .work-card:hover .work-title { color: var(--accent); }
}

/* empty / loading states */
.state-msg {
    font-family: var(--font-mono);
    font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--muted); padding: var(--s10) 0; text-align: center;
}

/* ----------------------------------------------------------------- *
 * Project detail (project.html, rendered by render.js)
 * ----------------------------------------------------------------- */
.detail-head { padding-block: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2.5rem); }
.back-link {
    font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--muted);
    display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: var(--s6);
    transition: color var(--dur) var(--ease-out);
}
.back-link:hover { color: var(--accent); }
.detail-title {
    font-size: clamp(2.4rem, 7vw, 5rem);
    font-weight: 700; line-height: 0.98; letter-spacing: -0.03em;
}
.detail-subtitle { margin-top: var(--s4); font-size: clamp(1.05rem, 2vw, 1.3rem); color: var(--ink-soft); max-width: 60ch; }
.detail-tags { margin-top: var(--s5); display: flex; flex-wrap: wrap; gap: 0.4rem; }

.specs-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1px;
    background: var(--hairline);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    margin-top: var(--s8);
    overflow: hidden;
}
.spec { background: var(--base); padding: var(--s4) var(--s5); }
.spec .spec-label { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.spec .spec-value { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; margin-top: 0.25rem; }

.detail-hero {
    margin-top: var(--s8);
    background: var(--lab);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    overflow: hidden;
}
.detail-hero img { width: 100%; }

/* narrative blocks: why / how / problems */
.narrative { max-width: var(--measure); margin-inline: auto; padding-block: var(--s10); }
.narrative .block { margin-bottom: clamp(3rem, 7vw, 5rem); }
.narrative .block:last-child { margin-bottom: 0; }
.block-label {
    font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.18em;
    text-transform: uppercase; color: var(--accent);
    display: flex; align-items: center; gap: 0.6rem; margin-bottom: var(--s4);
}
.block-label .n { color: var(--muted); }
.block h2 {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem); font-weight: 600;
    letter-spacing: -0.02em; margin-bottom: var(--s5); line-height: 1.05;
}
.block .prose p { font-size: 1.075rem; line-height: 1.75; color: var(--ink-soft); margin-bottom: var(--s5); }
.block .prose p:last-child { margin-bottom: 0; }
.block .prose strong { color: var(--ink); font-weight: 600; }
.block .prose ul { margin: var(--s4) 0 var(--s5) 1.2rem; }
.block .prose li { margin-bottom: var(--s3); line-height: 1.7; color: var(--ink-soft); }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(0.75rem, 2vw, 1.25rem); padding-block: var(--s8); }
.gallery.single { grid-template-columns: 1fr; }
@media (max-width: 640px) { .gallery { grid-template-columns: 1fr; } }
.gallery figure {
    background: var(--lab); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden;
}
.gallery img { width: 100%; transition: transform 600ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .gallery figure:hover img { transform: scale(1.03); } }

/* ----------------------------------------------------------------- *
 * STL / CAD viewer
 * ----------------------------------------------------------------- */
.cad {
    margin-block: var(--s4) var(--s10);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    background: var(--base-2);
    overflow: hidden;
    position: relative;
}
.cad-bar {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--hairline);
    color: var(--ink);
}
.cad-bar .cad-name { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 0.5rem; }
.cad-bar .cad-name .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cad-controls { display: flex; gap: 0.4rem; }
.cad-btn {
    font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--ink-soft); background: var(--base);
    border: 1px solid var(--hairline); border-radius: var(--radius);
    padding: 0.4rem 0.6rem; cursor: pointer; min-height: 32px;
    transition: color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.cad-btn:hover { color: var(--accent); border-color: var(--accent); }
.cad-btn.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.cad-stage { position: relative; width: 100%; aspect-ratio: 16 / 10; touch-action: none; background: var(--base); }
.cad-stage canvas { width: 100% !important; height: 100% !important; }
.cad-overlay {
    position: absolute; inset: 0; display: grid; place-items: center;
    color: var(--muted); font-family: var(--font-mono); font-size: 0.74rem;
    letter-spacing: 0.14em; text-transform: uppercase; text-align: center; padding: 1rem;
    background: var(--base); transition: opacity var(--dur) var(--ease-out);
}
.cad-overlay.hidden { opacity: 0; pointer-events: none; }
.cad-spinner {
    width: 26px; height: 26px; border: 2px solid var(--hairline);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 0.75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.cad-hint {
    padding: 0.55rem 1rem; border-top: 1px solid var(--hairline);
    font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--muted);
}
.cad:fullscreen { background: var(--base-2); }
.cad:fullscreen .cad-stage { aspect-ratio: auto; height: calc(100vh - 96px); }

/* ----------------------------------------------------------------- *
 * About page
 * ----------------------------------------------------------------- */
.about-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(2.5rem, 6vw, 4rem);
    max-width: var(--measure);
}
.about-block .block-label { color: var(--accent); }
.about-block h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; letter-spacing: -0.02em; margin-bottom: var(--s4); }
.about-block p { font-size: 1.075rem; line-height: 1.75; color: var(--ink-soft); }
.about-block p a { border-bottom: 1px solid var(--accent); color: var(--ink); }

.skills-list { list-style: none; border-top: 1px solid var(--hairline); }
.skills-list li {
    display: grid; grid-template-columns: 180px 1fr; gap: var(--s4);
    padding: var(--s4) 0; border-bottom: 1px solid var(--hairline);
    font-size: 0.98rem; color: var(--ink-soft); line-height: 1.55;
}
.skills-list strong {
    font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--ink); font-weight: 600;
}
@media (max-width: 600px) { .skills-list li { grid-template-columns: 1fr; gap: 0.25rem; } }

.about-cta { display: flex; flex-wrap: wrap; gap: var(--s4); margin-top: var(--s4); }

/* ----------------------------------------------------------------- *
 * Vision essay
 * ----------------------------------------------------------------- */
.essay { max-width: var(--measure); margin-inline: auto; }
.essay-section { padding-block: clamp(2rem, 5vw, 3.5rem); border-bottom: 1px solid var(--hairline); }
.essay-section:last-of-type { border-bottom: 0; }
.essay-section .e-index { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); margin-bottom: var(--s3); }
.essay-section h2 { font-size: clamp(1.6rem, 3.6vw, 2.5rem); font-weight: 600; letter-spacing: -0.02em; margin-bottom: var(--s5); line-height: 1.05; }
.essay-section p { font-size: 1.08rem; line-height: 1.8; color: var(--ink-soft); margin-bottom: var(--s5); }
.essay-section p:last-child { margin-bottom: 0; }
.essay-section.works-cited p { font-size: 0.88rem; line-height: 1.6; color: var(--muted); margin-bottom: var(--s4); }

/* ----------------------------------------------------------------- *
 * Contact
 * ----------------------------------------------------------------- */
.contact-wrap { max-width: 60ch; }
.contact-intro { font-size: clamp(1.1rem, 2.2vw, 1.4rem); line-height: 1.6; color: var(--ink-soft); margin-bottom: var(--s8); }
.contact-list { list-style: none; border-top: 1px solid var(--hairline); }
.contact-list li { border-bottom: 1px solid var(--hairline); }
.contact-list a {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
    padding: var(--s5) 0; transition: padding var(--dur) var(--ease-out);
}
.contact-list .c-label { display: flex; align-items: center; gap: var(--s4); }
.contact-list .c-label svg { width: 22px; height: 22px; color: var(--ink); }
.contact-list .c-name { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.3rem, 3vw, 2rem); letter-spacing: -0.015em; }
.contact-list .c-value { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em; color: var(--muted); }
@media (hover: hover) and (pointer: fine) {
    .contact-list a:hover { padding-left: var(--s4); }
    .contact-list a:hover .c-name { color: var(--accent); }
}
@media (max-width: 560px) { .contact-list .c-value { display: none; } }

/* ----------------------------------------------------------------- *
 * Footer
 * ----------------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--hairline);
    padding-block: var(--s10) var(--s8);
    margin-top: var(--s12);
}
.footer-grid { display: flex; flex-wrap: wrap; gap: var(--s6); justify-content: space-between; align-items: flex-end; }
.footer-mark { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.6rem, 5vw, 2.6rem); letter-spacing: -0.02em; max-width: 16ch; line-height: 1.05; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--s5); }
.footer-links a { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); transition: color var(--dur) var(--ease-out); }
.footer-links a:hover { color: var(--ink); }
.footer-base { margin-top: var(--s8); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s4); font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* ----------------------------------------------------------------- *
 * Reveal animation base (GSAP drives the rest; safe without JS)
 * ----------------------------------------------------------------- */
[data-reveal] { will-change: transform, opacity; }

/* ----------------------------------------------------------------- *
 * Accessibility / focus
 * ----------------------------------------------------------------- */
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 1px;
}
.skip-link {
    position: absolute; left: -999px; top: 0; z-index: 200;
    background: var(--ink); color: #fff; padding: 0.6rem 1rem;
    font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em;
}
.skip-link:focus { left: var(--gutter); top: 0.5rem; }

@media (prefers-contrast: more) {
    :root { --hairline: #999; --muted: #555; }
}

/* ----------------------------------------------------------------- *
 * Reduced motion — keep fades, drop movement
 * ----------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .scroll-cue .line, .now-status .dot { animation: none; }
    body.cursor-ready { cursor: auto; }
    .cursor-dot, .cursor-ring { display: none; }
}

/* ----------------------------------------------------------------- *
 * Admin (admin.html)
 * ----------------------------------------------------------------- */
.admin-shell { min-height: 100svh; display: flex; flex-direction: column; }
.admin-bar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
    padding: var(--s4) var(--gutter);
    background: color-mix(in srgb, var(--base) 85%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--hairline);
}
.admin-bar .brand { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase; display: flex; align-items: center; gap: 0.5rem; }
.admin-bar .brand .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.admin-bar .bar-actions { display: flex; gap: var(--s3); align-items: center; }
.admin-main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: var(--s8) var(--gutter) var(--s12); }

/* login card */
.login-wrap { display: grid; place-items: center; min-height: 70svh; }
.login-card {
    width: 100%; max-width: 400px;
    border: 1px solid var(--hairline); border-radius: var(--radius);
    background: var(--base); padding: clamp(1.5rem, 4vw, 2.5rem);
}
.login-card h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: var(--s2); }
.login-card .sub { color: var(--muted); font-size: 0.92rem; margin-bottom: var(--s6); }

/* forms */
.field { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s5); }
.field label, .field-label {
    font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--ink-soft); font-weight: 500;
}
.field .hint { font-size: 0.74rem; color: var(--muted); }
.input, .textarea, .select {
    font-family: var(--font-body); font-size: 0.95rem; color: var(--ink);
    background: var(--base-2); border: 1px solid var(--hairline);
    border-radius: var(--radius); padding: 0.7rem 0.85rem; width: 100%;
    transition: border-color var(--dur) var(--ease-out);
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
@media (max-width: 640px) { .row-2 { grid-template-columns: 1fr; } }

.checkbox-row { display: flex; align-items: center; gap: var(--s3); }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--accent); }

/* repeatable spec rows */
.spec-rows { display: flex; flex-direction: column; gap: var(--s3); }
.spec-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: var(--s3); align-items: center; }
.icon-btn {
    width: 38px; height: 38px; display: grid; place-items: center;
    border: 1px solid var(--hairline); border-radius: var(--radius);
    background: transparent; cursor: pointer; color: var(--ink-soft);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* upload areas + thumbnails */
.dropzone {
    border: 1px dashed var(--hairline); border-radius: var(--radius);
    padding: var(--s5); text-align: center; color: var(--muted);
    font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em;
    text-transform: uppercase; cursor: pointer;
    transition: border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); color: var(--ink); }
.thumbs { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s3); }
.thumb { position: relative; width: 84px; height: 84px; border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; background: var(--lab); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button {
    position: absolute; top: 2px; right: 2px; width: 20px; height: 20px;
    border: none; border-radius: 50%; background: rgba(0,0,0,0.65); color: #fff;
    cursor: pointer; font-size: 12px; line-height: 1; display: grid; place-items: center;
}
.file-pill {
    display: inline-flex; align-items: center; gap: 0.5rem; margin-top: var(--s3);
    font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-soft);
    border: 1px solid var(--hairline); border-radius: var(--radius); padding: 0.35rem 0.6rem;
}
.file-pill button { border: none; background: none; color: var(--accent); cursor: pointer; }

/* dashboard list */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s6); flex-wrap: wrap; }
.dash-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; letter-spacing: -0.02em; }
.proj-rows { border-top: 1px solid var(--hairline); }
.proj-row {
    display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: var(--s4);
    padding: var(--s4) 0; border-bottom: 1px solid var(--hairline);
}
.proj-row .pr-title { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.proj-row .pr-meta { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 0.15rem; }
.badge { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; padding: 0.2rem 0.5rem; border-radius: var(--radius); border: 1px solid var(--hairline); color: var(--ink-soft); }
.badge.live { color: #2e7d46; border-color: #b9d8c3; background: #eef7f0; }
.badge.draft { color: #9a6b00; border-color: #e7d4a8; background: #fbf4e2; }
@media (max-width: 640px) {
    .proj-row { grid-template-columns: 1fr auto; row-gap: var(--s3); }
    .proj-row .pr-actions { grid-column: 1 / -1; display: flex; gap: var(--s3); }
}
.pr-actions { display: flex; gap: var(--s3); }
.btn-sm { padding: 0.5rem 0.8rem; min-height: 36px; font-size: 0.66rem; }
.btn-danger { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--hairline)); }
.btn-danger:hover { color: #fff; }
.btn-danger::after { background: var(--accent); }

/* editor layout */
.editor { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--s8); align-items: start; }
@media (max-width: 880px) { .editor { grid-template-columns: 1fr; } }
.editor .panel { border: 1px solid var(--hairline); border-radius: var(--radius); padding: var(--s5); }
.editor .panel h2 { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: var(--s5); font-weight: 600; }
.editor-actions { display: flex; gap: var(--s4); margin-top: var(--s6); flex-wrap: wrap; }

/* toast */
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(8px);
    background: var(--ink); color: #fff; padding: 0.75rem 1.2rem; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em;
    opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
    z-index: 999; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--accent); }
.uploading { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }
.mini-spin { width: 14px; height: 14px; border: 2px solid var(--hairline); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }

/* ----------------------------------------------------------------- *
 * Print
 * ----------------------------------------------------------------- */
@media print {
    .site-header, .site-footer, .scroll-cue, .cad, .menu-toggle, .cursor-dot, .cursor-ring { display: none !important; }
    body { background: #fff; color: #000; }
    .page { padding-top: 0; }
}
