:root {
    --page: #111210;
    --page-soft: #171815;
    --panel: #1d1f1b;
    --panel-raised: #242721;
    --ink: #f4f3ee;
    --muted: #b8b8ae;
    --faint: #85877d;
    --line: #45483f;
    --line-strong: #686c60;
    --accent: #ddff99;
    --accent-ink: #172000;
    --radius-lg: 24px;
    --radius-md: 15px;
    --shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--page); }
body {
    margin: 0;
    background:
        radial-gradient(circle at 8% 4%, rgba(221, 255, 153, 0.08), transparent 28rem),
        radial-gradient(circle at 92% 10%, rgba(0, 255, 255, 0.05), transparent 30rem),
        var(--page);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
}

button, input, select { font: inherit; }
button, select { color: inherit; }
a { color: #b9ddff; text-underline-offset: 0.2em; }
a:hover { color: #e2f1ff; }
.shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.skip-link {
    position: fixed;
    z-index: 1000;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    border-radius: 9px;
    background: #fff;
    color: #000;
    font-weight: 800;
    transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 76px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--ink);
    font-weight: 850;
    letter-spacing: -0.02em;
    text-decoration: none;
}
.site-nav { display: flex; gap: 10px; }
.site-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 720;
    text-decoration: none;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--panel-raised); color: var(--ink); }
.hero { padding: 34px 0 30px; }
.eyebrow, .label {
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 850;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
h1, h2, h3 { color: var(--ink); line-height: 1.08; letter-spacing: -0.035em; }
h1 {
    max-width: 880px;
    margin: 8px 0 14px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3rem, 5.2vw, 4.6rem);
    font-weight: 500;
}
h2 {
    margin: 10px 0 16px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 500;
}
h3 { margin: 0; font-size: 1.15rem; }
.hero-copy, .section-intro { max-width: 760px; color: #d0d0c7; font-size: clamp(1rem, 1.5vw, 1.12rem); }
.hero-note {
    display: inline-flex;
    margin-top: 14px;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.88rem;
}
.section { padding: 30px 0 44px; border-top: 1px solid rgba(255,255,255,.08); }
.project-intro h2 { margin-block: 6px 10px; font-size: clamp(1.8rem, 3vw, 2.6rem); }
.project-intro .section-intro { margin: 0; }
.tool-shell {
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(29, 31, 27, 0.92);
    box-shadow: var(--shadow);
}
.tool-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px;
    border-bottom: 1px solid var(--line);
}
.control-label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--page);
}
.segmented button {
    min-height: 40px;
    padding: 0 13px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-weight: 760;
    cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.mix-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, .72fr) minmax(0, 1fr);
    gap: 1px;
    background: var(--line);
}
.source-panel, .result-panel { padding: clamp(22px, 4vw, 36px); background: var(--panel); }
.source-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.source-heading span { color: var(--faint); font-size: .82rem; font-weight: 800; text-transform: uppercase; }
.family-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.family-button {
    min-height: 42px;
    padding: 6px;
    border: 2px solid transparent;
    border-radius: 10px;
    background: var(--family);
    color: var(--family-ink);
    font-size: .82rem;
    font-weight: 850;
    cursor: pointer;
}
.family-button[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--page); }
.tone-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.tone-control button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--page-soft);
    color: var(--muted);
    font-weight: 750;
    cursor: pointer;
}
.tone-control button[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); }
.source-preview {
    min-height: 150px;
    margin-top: 16px;
    padding: 18px;
    border-radius: var(--radius-md);
    background: var(--swatch);
    color: var(--swatch-ink);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.source-preview strong { font-size: 1.4rem; letter-spacing: -.03em; }
.source-preview span { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.ratio-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(26px, 4vw, 38px);
    background: var(--page-soft);
    text-align: center;
}
.ratio-value { margin: 8px 0 18px; font-family: Georgia, serif; font-size: 2.3rem; line-height: 1; }
input[type="range"] {
    width: 100%;
    min-height: 44px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}
.ratio-caption { margin: 14px 0 0; color: var(--muted); font-size: .9rem; }
.result-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(250px, .75fr);
    gap: 26px;
    border-top: 1px solid var(--line);
}
.result-stage {
    min-height: 360px;
    padding: clamp(24px, 5vw, 52px);
    border-radius: var(--radius-md);
    background: var(--context, #777);
    display: grid;
    place-items: center;
    transition: background 180ms ease;
}
.result-swatch {
    width: min(100%, 440px);
    aspect-ratio: 1.5;
    padding: 22px;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 20px;
    background: var(--result);
    color: var(--result-ink);
    box-shadow: 0 24px 60px rgba(0,0,0,.3);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.result-name { font-size: clamp(1.8rem, 4vw, 3.2rem); font-weight: 850; line-height: 1; letter-spacing: -.05em; }
.result-hex { margin-top: 8px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1rem; }
.result-details { display: flex; flex-direction: column; justify-content: center; }
.value-stack { display: grid; gap: 9px; margin: 18px 0; }
.value-stack code {
    display: block;
    overflow-wrap: anywhere;
    color: #d8d8cf;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .88rem;
}
.nearest-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--page-soft);
    color: var(--muted);
}
.nearest-card strong { display: block; margin-bottom: 3px; color: var(--ink); font-size: 1.08rem; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 14px;
    padding: 0 17px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font-weight: 780;
    cursor: pointer;
}
.button:hover { border-color: var(--ink); }
.method-note {
    margin: 0;
    padding: 18px 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
}
.context-row { margin-top: 18px; }
.explain-grid, .project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 30px; }
.info-card, .project-card {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
}
.info-card p, .project-card p { margin-bottom: 0; color: var(--muted); }
.experiment {
    margin-top: 14px;
    padding: clamp(22px, 4vw, 38px);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
}
.experiment-head { display: grid; grid-template-columns: 80px 1fr; gap: 20px; align-items: start; }
.experiment-number { color: var(--accent); font-family: Georgia, serif; font-size: 3rem; line-height: 1; }
.experiment-copy p { max-width: 760px; color: var(--muted); }
.experiment-body { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); gap: 28px; margin-top: 26px; }
.experiment-controls { padding: 20px; border-radius: var(--radius-md); background: var(--page-soft); }
.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; margin-bottom: 8px; font-weight: 760; }
.field-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.field-label label { margin: 0; }
.field output { color: var(--accent); font-family: ui-monospace, Consolas, monospace; }
select {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--page);
}
.experiment-stage {
    min-height: 320px;
    border-radius: var(--radius-md);
    background: var(--stage, #777);
    overflow: hidden;
}
.brown-stage { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; }
.brown-context { display: grid; place-items: center; padding: 18px; }
.brown-chip {
    width: min(100%, 180px);
    aspect-ratio: 1;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 18px;
    background: var(--brown);
    color: var(--brown-ink);
    display: grid;
    place-content: end start;
    padding: 16px;
    font-weight: 850;
}
.brown-context:nth-child(1) { background: #fff; }
.brown-context:nth-child(2) { background: #777; }
.brown-context:nth-child(3) { background: #000; }
.hue-stage { display: grid; grid-template-rows: 1fr auto; }
.hue-color {
    display: grid;
    place-items: center;
    min-height: 260px;
    background: var(--hue-color);
    color: var(--hue-ink);
    text-align: center;
}
.hue-color strong { display: block; font-size: clamp(2rem, 5vw, 4rem); line-height: 1; }
.hue-color span { font-family: ui-monospace, Consolas, monospace; }
.hue-track { height: 38px; background: var(--hue-gradient); }
.gradient-stage { padding: 22px; background: var(--page-soft); }
.gradient-row { margin-bottom: 19px; }
.gradient-row:last-child { margin-bottom: 0; }
.gradient-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: var(--muted); font-size: .86rem; font-weight: 780; }
.gradient-strip { display: grid; grid-template-columns: repeat(21, 1fr); height: 76px; overflow: hidden; border-radius: 10px; }
.gradient-strip span { min-width: 0; }
footer { padding: 36px 0 50px; border-top: 1px solid rgba(255,255,255,.08); color: var(--faint); font-size: .9rem; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 920px) {
    .mix-layout { grid-template-columns: 1fr 1fr; }
    .ratio-panel { grid-column: 1 / -1; grid-row: 2; }
    .result-panel, .experiment-body { grid-template-columns: 1fr; }
    .explain-grid, .project-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .site-header { align-items: flex-start; flex-direction: column; gap: 8px; padding: 10px 0; }
    .site-nav { width: 100%; }
    .site-nav a { flex: 1; text-align: center; }
    .hero { padding: 40px 0 34px; }
    .hero h1 { margin-block: 10px 16px; font-size: clamp(2.8rem, 13vw, 4.1rem); }
    .hero-copy { font-size: 1rem; line-height: 1.55; }
    .hero-note { margin-top: 17px; padding: 8px 12px; }
    .section { padding: 36px 0 50px; }
    .project-intro .label, .project-intro .section-intro { display: none; }
    .project-intro h2 {
        margin: 0 0 14px;
        font-family: Inter, ui-sans-serif, system-ui, sans-serif;
        font-size: 1.35rem;
        font-weight: 820;
        letter-spacing: -0.025em;
    }
    .project-intro + .tool-shell, .project-intro + .experiment { margin-top: 14px; }
    .mix-layout { grid-template-columns: 1fr; }
    .ratio-panel { grid-column: auto; grid-row: auto; }
    .result-stage { min-height: 290px; padding: 24px; }
    .family-grid { grid-template-columns: repeat(2, 1fr); }
    .brown-stage { grid-template-columns: 1fr; }
    .brown-context { min-height: 210px; }
    .experiment-head { grid-template-columns: 52px 1fr; }
    .experiment-number { font-size: 2.3rem; }
    .gradient-strip { height: 58px; }
}

@media (max-width: 420px) {
    .shell { width: min(100% - 24px, 1120px); }
    .site-nav a { padding-inline: 6px; font-size: .82rem; }
    .segmented { width: 100%; }
    .segmented button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}
