/* Home page. Tokens and components come from src/ui/brand.css. */

:root {
    --gutter: clamp(20px, 4vw, 56px);
    --nav-h: 72px;
}

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- navigation ---------- */

.nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: var(--nav-h);
    padding: 0 var(--gutter);
    background: color-mix(in srgb, var(--porcelain) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.2) blur(14px);
    backdrop-filter: saturate(1.2) blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}
.nav.scrolled { border-bottom-color: var(--hair); }
.nav-links { display: flex; gap: 32px; font-size: 15px; }
.nav-links a { color: var(--slate); text-decoration: none; transition: color 0.15s; }
.nav-links a:hover { color: var(--graphite); }
.nav-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- hero: the product is the hero ---------- */

.hero {
    display: grid;
    grid-template-columns: minmax(320px, 5fr) 7fr;
    gap: clamp(24px, 4vw, 64px);
    align-items: end;
    min-height: calc(100vh - var(--nav-h));
    min-height: calc(100svh - var(--nav-h));
    padding: clamp(24px, 4vh, 48px) var(--gutter) clamp(40px, 7vh, 80px);
}

.hero-copy { padding-bottom: 8px; }

.hero-title {
    font-size: clamp(48px, 6.7vw, 116px);
    font-weight: 470;
    letter-spacing: -0.035em;
    line-height: 0.94;
}

.hero-title .line { display: block; white-space: nowrap; }

.hero-lead {
    max-width: 30em;
    margin: clamp(24px, 3.4vh, 36px) 0 0;
    color: var(--slate);
    font-size: clamp(17px, 1.35vw, 19px);
    line-height: 1.5;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

.hero-stage {
    position: relative;
    margin: 0;
    display: grid;
    grid-template-rows: 1fr auto;
    height: min(78vh, 780px);
    min-height: 460px;
}

.hero-frame {
    position: relative;
    min-height: 0;
    color: var(--hair-2);
}
.hero-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    opacity: 0;
    transition: opacity 0.8s var(--ease);
}
.hero-frame.ready iframe { opacity: 1; }
.hero-drawing {
    position: absolute;
    inset: 8% 14%;
    width: 72%;
    height: 84%;
    transition: opacity 0.6s;
}
.hero-frame.ready .hero-drawing { opacity: 0; }

/* live controls under the product: they drive the 3D through the embed API */
.hero-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 36px;
    padding: 18px 0 0;
    border-top: 1px solid var(--hair);
    font-size: 14px;
}
.hc-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hc-label { color: var(--slate); white-space: nowrap; }
.hc-value { min-width: 4.5em; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hc-range {
    -webkit-appearance: none;
    appearance: none;
    width: clamp(120px, 14vw, 220px);
    height: 22px;
    margin: 0;
    background: transparent;
    cursor: pointer;
}
.hc-range::-webkit-slider-runnable-track { height: 1px; background: var(--graphite); }
.hc-range::-moz-range-track { height: 1px; background: var(--graphite); }
.hc-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px; margin-top: -7.5px;
    border: 2px solid var(--graphite); border-radius: 50%; background: var(--amber);
}
.hc-range::-moz-range-thumb { width: 12px; height: 12px; border: 2px solid var(--graphite); border-radius: 50%; background: var(--amber); }
.hc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hc-chip {
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--hair-2);
    border-radius: 999px;
    background: transparent;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.hc-chip:hover { border-color: var(--graphite); }
.hc-chip[aria-pressed="true"] { background: var(--graphite); border-color: var(--graphite); color: var(--porcelain); }
.hc-chip:disabled { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }
.hc-note { color: var(--slate); margin-left: auto; white-space: nowrap; }

/* one orchestrated entrance: the headline sets line by line */
@media (prefers-reduced-motion: no-preference) {
    .hero-title .line { display: block; overflow: hidden; }
    .hero-title .line > span { display: block; transform: translateY(105%); animation: set-line 0.9s var(--ease) forwards; }
    .hero-title .line:nth-child(2) > span { animation-delay: 0.08s; }
    .hero-title .line:nth-child(3) > span { animation-delay: 0.16s; }
    @keyframes set-line { to { transform: none; } }
}

/* ---------- sections ---------- */

.platform, .work, .process {
    padding: clamp(80px, 11vw, 160px) var(--gutter);
}

.section-title {
    max-width: 16em;
    font-size: clamp(34px, 4.2vw, 60px);
    font-weight: 480;
    letter-spacing: -0.028em;
    line-height: 1;
}
.section-lead {
    max-width: 34em;
    margin: 22px 0 0;
    color: var(--slate);
    font-size: 18px;
}

/* platform: a spec sheet, not a card grid */
.platform {
    display: grid;
    grid-template-columns: 5fr 7fr;
    gap: clamp(32px, 6vw, 96px);
    border-top: 1px solid var(--hair);
}
.platform-intro { align-self: start; position: sticky; top: calc(var(--nav-h) + 40px); }
.spec { margin: 0; display: grid; gap: clamp(36px, 4.5vw, 56px); }
.spec-row { display: grid; grid-template-columns: minmax(150px, 2fr) 5fr; column-gap: 32px; row-gap: 16px; }
.spec-row .dim { grid-column: 1 / -1; }
.spec dt { font-stretch: var(--wide); font-weight: 560; font-size: 20px; letter-spacing: -0.012em; line-height: 1.25; }
.spec dd { margin: 0; max-width: 32em; color: var(--slate); font-size: 17px; }

/* work */
.work { border-top: 1px solid var(--hair); }
.work-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px 48px; }
.work-head .section-lead { margin: 0; max-width: 26em; }
.work-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
    gap: clamp(20px, 2.4vw, 36px) clamp(16px, 2vw, 28px);
    margin: clamp(40px, 5vw, 64px) 0 0;
    padding: 0;
    list-style: none;
}
.work-item a { display: block; text-decoration: none; color: inherit; }
.work-pic {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: var(--r-m);
    background: radial-gradient(120% 90% at 50% 35%, var(--paper) 0%, #e3e7ea 100%);
}
.work-pic img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.work-item a:hover .work-pic img { transform: scale(1.035); }
.work-pic .open {
    position: absolute; right: 12px; bottom: 12px;
    height: 32px; padding: 0 12px; display: inline-flex; align-items: center;
    border-radius: 999px; background: var(--graphite); color: var(--porcelain);
    font-size: 13px; font-weight: 550; opacity: 0; transform: translateY(4px);
    transition: opacity 0.2s, transform 0.2s var(--ease);
}
.work-item a:hover .open, .work-item a:focus-visible .open { opacity: 1; transform: none; }
.work-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 2px 0; }
.work-name { font-stretch: var(--wide); font-weight: 560; font-size: 18px; letter-spacing: -0.01em; }
.work-kind { color: var(--slate); font-size: 14px; white-space: nowrap; }

/* process: a real sequence, so it's numbered */
.process { border-top: 1px solid var(--hair); }
.steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: clamp(40px, 5vw, 72px) 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}
.steps li { position: relative; padding: 28px 28px 0 0; border-top: 1px solid var(--graphite); }
.steps li::before {
    content: "";
    position: absolute; left: 0; top: -6px;
    width: 11px; height: 11px; border-radius: 50%;
    background: var(--amber); box-shadow: 0 0 0 3px var(--porcelain);
}
.step-n { display: block; margin-bottom: 18px; color: var(--slate); font-size: 14px; }
.steps h3 { margin: 0 0 10px; font-size: 22px; font-weight: 560; }
.steps p { margin: 0; max-width: 24em; color: var(--slate); font-size: 16px; }

/* from the blog: the latest posts */
.journal { padding: clamp(80px, 11vw, 160px) var(--gutter); border-top: 1px solid var(--hair); }
.journal-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px 48px; }
.journal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: clamp(36px, 4vw, 56px) clamp(16px, 2vw, 28px);
    margin: clamp(40px, 5vw, 64px) 0 0;
    padding: 0;
    list-style: none;
}
.journal-item a { display: block; color: inherit; text-decoration: none; }
.journal-pic {
    aspect-ratio: 3 / 2;
    margin-bottom: 16px;
    overflow: hidden;
    border-radius: var(--r-m);
    background: radial-gradient(120% 90% at 50% 35%, var(--paper) 0%, #e3e7ea 100%);
}
.journal-pic img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.journal-pic > svg { width: 56px; height: 56px; margin: auto; color: var(--hair-2); }
.journal-pic:has(> svg) { display: grid; }
.journal-item a:hover .journal-pic img { transform: scale(1.035); }
.journal-meta { margin: 0; color: var(--slate); font-size: 14px; white-space: pre-wrap; }
.journal-name { margin: 10px 0 0; font-size: 22px; font-weight: 560; line-height: 1.18; }
.journal-item a:hover .journal-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.journal-excerpt {
    display: -webkit-box;
    margin: 10px 0 0;
    overflow: hidden;
    color: var(--slate);
    font-size: 16px;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* closing band */
.closing {
    padding: clamp(80px, 11vw, 150px) var(--gutter);
    background: var(--graphite);
    color: var(--porcelain);
}
.closing-title { max-width: 12em; font-size: clamp(40px, 6vw, 92px); font-weight: 470; letter-spacing: -0.032em; line-height: 0.95; }
.closing-lead { margin: 24px 0 0; color: #b9c1c7; font-size: 18px; }
.closing-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }

.foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px 24px;
    padding: 28px var(--gutter) calc(28px + env(safe-area-inset-bottom));
    background: var(--graphite);
    color: #b9c1c7;
    font-size: 14px;
    border-top: 1px solid rgba(238, 240, 241, 0.12);
}
.foot .wordmark { color: var(--porcelain); font-size: 16px; }
.foot .wordmark svg { width: 22px; height: 22px; }
.foot a { color: inherit; }

/* ---------- smaller screens ---------- */

@media (max-width: 1080px) {
    .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 48px; }
    .spec-row { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .nav { grid-template-columns: 1fr auto; }
    .nav-links { display: none; }
    .hero { grid-template-columns: 1fr; align-items: start; min-height: 0; padding-top: 8px; }
    .hero-stage { order: -1; height: 62vh; min-height: 380px; }
    .platform { grid-template-columns: 1fr; }
    .platform-intro { position: static; }
}

@media (max-width: 560px) {
    .nav-actions .btn.quiet { display: none; }
    .nav-actions .btn { height: 38px; padding: 0 14px; font-size: 14px; }
    .steps { grid-template-columns: 1fr; }
    .hc-note { margin-left: 0; }
    .hero-actions .btn, .closing-actions .btn { flex: 1 1 auto; }
}
