@font-face {
    font-family: Anton;
    src: url(../fonts/anton-v27-latin.woff2) format("woff2");
    font-display: swap;
}
@font-face {
    font-family: Archivo;
    src: url(../fonts/archivo-v25-latin.woff2) format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --sheet: #f6f1e3;
    --ink: #172b2b;
    --muted: #59625a;
    --rule: #bdbfb0;
    --cold: #175b5c;
    --warm: #a73c26;
    --accent: #efb85a;
    --mat: #214542;
    --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    color-scheme: light;
    font-family: Archivo, "Helvetica Neue", sans-serif;
    background: var(--sheet);
    color: var(--ink);
}
* { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body { margin: 0; }
button, input, summary { font: inherit; }
button, summary, input[type="radio"], input[type="range"], input[type="color"] { cursor: pointer; }
button { background: none; border: 0; padding: 0; color: inherit; }
a { color: inherit; }
button, a, summary, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #a74124; outline-offset: 3px; }
h1, h2, p, fieldset, legend { margin: 0; }
fieldset { min-inline-size: 0; padding: 0; border: 0; }
.masthead {
    height: 60px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 clamp(20px, 3vw, 52px);
    background: var(--ink);
    color: var(--sheet);
    border-bottom: 1px solid #0b2423;
}
.masthead :focus-visible, .canvas-area :focus-visible { outline-color: var(--accent); }
.skip-print { position: absolute; z-index: 2; left: 12px; top: 6px; padding: 10px; background: var(--ink); transform: translateY(-150%); }
.skip-print:focus { transform: none; }
.brand { display: flex; align-items: center; min-height: 44px; }
.brand img { width: 148px; height: auto; }
.section-name, .back, .gesture, .text-action, .line-button, .spot-status, .mobile-return {
    font: 500 12px/1.4 var(--mono);
}
.section-name { border-left: 1px solid #6c7b71; padding-left: 19px; color: #d9d9c8; }
.back { margin-left: auto; padding: 12px 0; text-decoration: none; }
.back:hover, .mobile-return:hover { text-decoration: underline; text-underline-offset: 4px; }
.back span { margin-right: 4px; }
.container {
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    display: grid;
    grid-template-columns: clamp(320px, 28vw, 420px) minmax(0, 1fr);
}
.sidebar {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-color: #a5ad9c transparent;
    scrollbar-width: thin;
    padding: clamp(26px, 4vh, 45px) clamp(22px, 2.65vw, 44px) 24px;
    border-right: 1px solid var(--ink);
}
.intro { padding-bottom: 23px; }
.intro h1 {
    font: 400 clamp(54px, 4.65vw, 76px)/.99 Anton, Impact, sans-serif;
    letter-spacing: -.035em;
}
.intro h1 span { display: block; color: var(--cold); }
.intro p { font-size: 15px; line-height: 1.45; max-width: 35ch; margin-top: 14px; }
.settings { border-top: 2px solid var(--ink); padding-top: 21px; }
.control-section { margin-bottom: 20px; }
.control-section h2, .control-section legend, .section-head > label {
    font-size: 15px; font-weight: 720; letter-spacing: -.012em;
}
.composition legend, .breaks h2 { padding: 0 0 9px; }
.plate-switch, .seed-strip { display: grid; border: 1px solid var(--ink); }
.plate-switch { grid-template-columns: 1fr 1fr; }
.plate-switch label { position: relative; }
.plate-switch label + label { border-left: 1px solid var(--ink); }
.plate-switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; }
.plate-switch span {
    display: grid; place-items: center; min-height: 38px;
    font-size: 14px; font-weight: 650; pointer-events: none;
}
.plate-switch input:checked + span { background: var(--ink); color: var(--sheet); }
.plate-switch input:focus-visible + span { outline: 3px solid var(--warm); outline-offset: -4px; }
.plate-switch label:hover input:not(:checked) + span { background: #e9e6d8; }
.section-head, .reset-strip, .sheet-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.text-action { color: var(--cold); font-weight: 650; padding: 7px 0; }
.text-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-action span { font: 18px/0 system-ui; vertical-align: middle; }
.section-head { margin-bottom: 5px; }
.seed-strip { grid-template-columns: 44px minmax(0, 1fr) 44px; background: #fffbef; }
.seed-strip button { font: 20px/1 var(--mono); min-height: 38px; }
.seed-strip button:hover, .line-button:hover { background: #e5e1d2; }
.seed-strip input {
    width: 100%; border: 0; border-inline: 1px solid var(--rule); border-radius: 0; padding: 4px;
    text-align: center; background: transparent; color: var(--ink);
    font: 600 17px/1 var(--mono); font-variant-numeric: tabular-nums; appearance: textfield;
}
.seed-strip input::-webkit-inner-spin-button, .seed-strip input::-webkit-outer-spin-button { -webkit-appearance: none; }
.seed-strip button:disabled { opacity: .35; cursor: default; }
.spot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.spot-btn {
    text-align: left; border: 1px solid var(--rule); padding: 9px 11px 8px;
    background: #f9f5e9; color: var(--ink);
}
.spot-btn b { display: block; font-size: 14px; font-weight: 680; }
.spot-btn small { font: 10px/1.5 var(--mono); color: var(--muted); }
.spot-btn:hover, .spot-btn[aria-pressed="true"] { border-color: var(--cold); background: #e0e8d9; }
.spot-btn[aria-pressed="true"] { box-shadow: inset 3px 0 var(--cold); }
.spot-status { color: var(--muted); margin-top: 9px; font-size: 11px; }
.spot-status b { color: var(--cold); }
.drawer { border-top: 1px solid var(--rule); }
.drawer summary {
    min-height: 45px; padding: 9px 2px 9px 0; display: flex; align-items: center; justify-content: space-between;
    font-size: 15px; font-weight: 640; list-style: none;
}
.drawer summary::-webkit-details-marker { display: none; }
.drawer summary::after { content: "+"; color: var(--cold); font: 22px/1 var(--mono); }
.drawer[open] summary::after { content: "−"; }
.drawer summary:hover { color: var(--cold); }
.drawer-body { padding: 2px 1px 14px; }
.control-group { margin: 6px 0 9px; }
.control-group label { font-size: 13px; }
.slider-container { display: flex; gap: 14px; align-items: center; }
.slider-container input { min-width: 0; flex: 1; accent-color: var(--cold); height: 24px; margin: 0; }
.value-display, .color-well small { color: var(--muted); font: 11px/1.4 var(--mono); }
.value-display { text-align: end; min-width: 6ch; }
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 15px; }
.color-well { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.color-well small { display: block; }
.color-well input { width: 35px; height: 35px; border: 1px solid var(--rule); padding: 1px; background: var(--sheet); }
.reset-strip { border-top: 1px solid var(--rule); padding-top: 7px; }
.mobile-return { display: none; }

.canvas-area {
    min-width: 0; min-height: 0; display: flex; flex-direction: column;
    background: var(--mat); color: var(--sheet);
}
.mat {
    position: relative; flex: 1; min-height: 0;
    display: grid; place-items: center; overflow: auto;
    padding: 26px 30px;
    background-image: radial-gradient(#92ab921f .85px, transparent .95px);
    background-position: center; background-size: 9px 9px;
}
.mat::before, .mat::after {
    content: ""; position: absolute; pointer-events: none; opacity: .43;
}
.mat::before {
    top: 0; left: 0; right: 0; height: 7px;
    background: repeating-linear-gradient(90deg, #c0cbb2 0 1px, transparent 1px 12px);
}
.mat::after {
    left: 0; top: 0; bottom: 0; width: 7px;
    background: repeating-linear-gradient(#c0cbb2 0 1px, transparent 1px 12px);
}
.proof {
    position: relative; width: min(100%, max(365px, calc(100vh - 176px)), 1060px);
    width: min(100%, max(365px, calc(100dvh - 176px)), 1060px);
    aspect-ratio: 1; background: #eee3c9;
    box-shadow: 2px 3px 0 #bfb59a, 5px 13px 24px #091f205c;
    margin: auto;
}
#canvas-container { position: relative; width: 100%; height: 100%; }
#canvas-container .loading, #canvas-container canvas {
    width: 100% !important; height: 100% !important; display: block;
}
#canvas-container canvas { cursor: grab; touch-action: pan-y pinch-zoom; }
#canvas-container canvas:active { cursor: grabbing; }
.proof-bar {
    min-height: 64px; padding: 9px clamp(16px, 2vw, 34px); border-top: 1px solid #759287;
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    background: #183c39;
}
.proof-tools, .motion-button, .download { display: inline-flex; align-items: center; }
.proof-tools { gap: 16px; }
.motion-button, .download { min-height: 38px; gap: 8px; font-weight: 650; font-size: 14px; }
.motion-button { padding: 2px 10px; border: 1px solid #8ba197; }
.motion-button:hover { background: #29504b; }
.motion-icon { width: 9px; height: 10px; border-inline: 3px solid currentColor; }
.motion-button[data-paused="true"] .motion-icon { height: 0; width: 0; border: 0; border-block: 5px solid transparent; border-left: 8px solid currentColor; }
.gesture { color: #d2ddd1; font-size: 11px; }
.download { color: var(--ink); background: var(--accent); padding: 3px 15px; border: 1px solid #ffce7c; }
.download:hover { background: #ffd18b; }
.download-icon { font: 20px/1 var(--mono); }
.static-note { min-height: 64px; margin: 0; padding: 18px; }
.press-ready .static-note { display: none; }
body:not(.press-ready) .proof-bar, body:not(.press-ready) .settings,
body:not(.press-ready) #canvas-container canvas { display: none; }

.variation-grid, .gallery-body { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.variation { min-width: 0; text-align: center; border: 1px solid transparent; padding: 2px; }
.variation img { display: block; width: 100%; aspect-ratio: 1; }
.variation:hover, .variation[aria-current="true"] { border-color: var(--cold); background: #e5e7d9; }
.variation-seed { font: 10px/1.3 var(--mono); display: block; padding: 3px 0; overflow-wrap: anywhere; }
.sheet-actions { margin-top: 10px; }
.line-button { min-height: 36px; color: var(--ink); padding: 6px 10px; border: 1px solid var(--rule); }
#gallery {
    border: 1px solid var(--ink); padding: 0; color: var(--ink); background: var(--sheet);
    width: min(850px, 94vw); max-height: 88dvh; overflow: auto; overscroll-behavior: contain;
    box-shadow: 6px 9px 0 #112d2966;
}
#gallery::backdrop { background: #102d2bc9; }
.gallery-head {
    position: sticky; top: 0; z-index: 1; background: var(--sheet); border-bottom: 1px solid var(--rule);
    padding: 12px 18px; display: flex; justify-content: space-between; align-items: center;
}
.gallery-head h2 { font: 28px/1.2 Anton, Impact, sans-serif; }
.gallery-head p { font: 11px/1.4 var(--mono); margin-top: 4px; color: var(--muted); }
.gallery-body { padding: 14px; grid-template-columns: repeat(10, minmax(0, 1fr)); }
@media (min-width: 841px) and (max-height: 505px) {
    .mat { display: block; }
}
@media (max-width: 840px) {
    .container { display: flex; flex-direction: column; height: auto; }
    .sidebar { display: contents; }
    .intro { order: 0; padding: 16px 20px 15px; }
    .intro h1 { font-size: clamp(34px, 6.3vw, 53px); line-height: 1.1; }
    .intro h1 span { display: inline; }
    .intro p { max-width: 52ch; font-size: 14px; margin-top: 6px; }
    .canvas-area { order: 1; }
    .settings { order: 2; padding: 20px max(20px, calc((100% - 550px)/2)) calc(62px + env(safe-area-inset-bottom)); border: 0; }
    .mat { padding: 20px 24px 22px; }
    .proof { width: min(100%, 530px); }
    .proof-bar { min-height: 54px; padding: 7px 18px; }
    .masthead { height: 49px; gap: 11px; padding-inline: 18px; }
    .brand img { width: 126px; }
    .section-name { padding-left: 11px; }
    .back, .section-name { font-size: 11px; }
    .control-section { margin-bottom: 19px; }
    .plate-switch span, .seed-strip button, .motion-button, .download { min-height: 42px; }
    .proof-tools { gap: 10px; }
    .gesture { font-size: 10px; }
    .motion-button, .download { font-size: 13px; padding-inline: 9px; }
    .print-out-of-view .mobile-return {
        display: block; position: fixed; z-index: 2; right: 16px; bottom: calc(10px + env(safe-area-inset-bottom));
        padding: 11px 15px; color: var(--sheet); background: var(--ink); border: 1px solid var(--sheet);
        box-shadow: 2px 2px 0 var(--ink); text-decoration: none;
    }
    .gallery-body { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 450px) {
    .gesture { max-width: 11ch; line-height: 1.3; }
    .proof-bar { gap: 4px; }
}
@media (forced-colors: active) {
    .plate-switch input:checked + span { outline: 2px solid Highlight; outline-offset: -3px; }
}
