/*
  Noor Vellekoop: generative art studio portfolio (Screenery template)
  The page is a sheet of plotter paper: warm cotton ground, carbon-black ink, one vermilion pen. The art is canvas; the chrome is ink.
  Order: tokens, base and browser surfaces, components (buttons, fields, chips, stepper, alerts), header, Drift hero,
  works index and viewer, practice, editions table, print shop (wall, frames, receipt, checkout), exhibitions, commissions, footer, motion, narrow screens.
*/

/* ---------- 1. Tokens ---------- */
:root {
  /* Paper and ink */
  --paper: #f1ede4;          /* the sheet */
  --paper-2: #e8e3d7;        /* wells, table stripes */
  --paper-3: #ddd6c6;        /* pressed wells */
  --white: #fbf9f4;          /* mats and inputs */
  --ink: #15140f;            /* carbon ink: text, rules, primary buttons */
  --ink-2: #4a463e;          /* secondary text (7.9:1 on paper) */
  --ink-3: #6b665c;          /* tertiary text, large or bold only (4.9:1) */
  --rule: #cbc3b2;           /* hairlines */
  --verm: #b8321a;           /* the vermilion pen (5.9:1 on paper) */
  --verm-soft: #f3d9cf;      /* error wells */
  --moss: #2f6a3a;           /* success ink */
  --moss-soft: #dbe8d6;
  --oak: #b4844f;            /* frame woods */
  --oak-dark: #8c6236;
  --ash: #24211d;

  /* Type */
  --display: "Unbounded", "Ubuntu Mono", sans-serif;
  --mono: "Ubuntu Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --fs-body: 1.0625rem;      /* 17px: Ubuntu Mono runs small */
  --fs-small: 0.9375rem;     /* 15px floor */
  --fs-h3: 1.25rem;
  --fs-h2: clamp(2rem, 1.2rem + 3vw, 3.4rem);
  --fs-h1: clamp(3rem, 1.6rem + 5vw, 5.6rem);

  /* Space */
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4.5rem; --s9: 7rem;
  --gutter: clamp(1rem, 0.4rem + 2.6vw, 3rem);
  --header-h: 4.25rem;

  /* Radius and depth: paper has almost no radius */
  --r1: 2px; --r2: 4px; --r3: 999px;
  --shadow-sheet: 0 1px 1px rgb(21 20 15 / 0.08), 0 8px 24px -8px rgb(21 20 15 / 0.22);
  --shadow-frame: 0 2px 3px rgb(21 20 15 / 0.18), 0 22px 40px -14px rgb(21 20 15 / 0.45);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 160ms; --t-med: 320ms;

  color-scheme: light;
}

/* ---------- 2. Base and browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); -webkit-text-size-adjust: 100%; scrollbar-color: var(--ink-3) var(--paper-2); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--fs-body)/1.55 var(--mono);
  caret-color: var(--verm);
  accent-color: var(--verm);
  overflow-x: clip;
}
::selection { background: var(--ink); color: var(--paper); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--paper-2); }
::-webkit-scrollbar-thumb { background: var(--ink-3); border: 3px solid var(--paper-2); border-radius: 6px; }
:focus-visible { outline: 2px solid var(--verm); outline-offset: 3px; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { color: var(--verm); }
img, canvas, svg { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
.display { font-family: var(--display); font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: absolute; left: var(--s4); top: -4rem; z-index: 50; background: var(--ink); color: var(--paper); padding: var(--s3) var(--s4); }
.skip:focus { top: var(--s4); }
.skip:hover { color: var(--paper); }
dl, dd { margin: 0; }
.num, output, [data-total], .ed-table td, .caption dd, .lines dd { font-variant-numeric: tabular-nums; }

/* Sections share one rhythm: generous above the heading, tight below */
main > section { padding: var(--s8) var(--gutter) var(--s7); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--s5) var(--s7); align-items: end; margin-bottom: var(--s7); border-bottom: 1px solid var(--ink); padding-bottom: var(--s5); }
.section-head h2 { font-size: var(--fs-h2); }
.section-head p { color: var(--ink-2); max-width: 62ch; }
.prose { display: grid; gap: var(--s4); max-width: 68ch; }

/* ---------- 3. Components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4);
  font: 700 var(--fs-small)/1 var(--mono); letter-spacing: 0.02em;
  color: var(--ink); background: transparent;
  border: 1px solid var(--ink); border-radius: var(--r1);
  cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translateY(1px); background: var(--paper-3); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: #2c2a23; color: var(--white); }
.btn-ink:active { background: #000; }
.btn-big { min-height: 52px; width: 100%; font-size: 1rem; }
.btn[disabled], .btn[aria-busy="true"] { cursor: progress; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; color: var(--ink); background: transparent; border: 1px solid var(--ink); border-radius: var(--r1); cursor: pointer; }
.icon-btn:hover { background: var(--paper-2); }

.spinner { display: none; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; }
[aria-busy="true"] .spinner { display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

.field { display: grid; gap: var(--s2); align-content: start; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > label, .field > legend, .field .label, .viewer-seed > label { font-weight: 700; font-size: var(--fs-small); letter-spacing: 0.02em; padding: 0; }
.field legend { margin-bottom: var(--s2); }
.opt { font-weight: 400; color: var(--ink-2); }
input[type="text"], input[type="email"], input[type="month"], select, textarea {
  width: 100%; min-height: 44px; padding: var(--s2) var(--s3);
  font: 400 var(--fs-body)/1.3 var(--mono); color: var(--ink);
  background: var(--white); border: 1px solid var(--ink-3); border-radius: var(--r1);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea { resize: vertical; min-height: 8rem; line-height: 1.5; }
select { appearance: none; padding-right: 2.5rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 8l4.5 4.5L14.5 8' fill='none' stroke='%2315140f' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.6rem center; background-size: 20px; }
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--verm); }
[aria-invalid="true"] { border-color: var(--verm) !important; background-color: #fdf4f0; }
.help { color: var(--ink-2); font-size: var(--fs-small); }
.err { color: var(--verm); font-size: var(--fs-small); font-weight: 700; min-height: 0; }
.err:empty { display: none; }
.seed-row { display: flex; gap: var(--s2); }
.seed-row input { flex: 1; min-width: 0; letter-spacing: 0.04em; }

/* Chips: radio and checkbox labels drawn as pen-ruled tabs */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s3); border: 1px solid var(--ink-3); border-radius: var(--r1); background: var(--white); font-size: var(--fs-small); transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.chip span small { color: var(--ink-2); font-size: var(--fs-small); }
.chip:hover span { border-color: var(--ink); }
.chip input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip input:checked + span small { color: #d8d2c4; }
.chip input:focus-visible + span { outline: 2px solid var(--verm); outline-offset: 3px; }

.check { display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--fs-small); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; }

.alert { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border: 1px solid var(--verm); background: var(--verm-soft); color: #6e1c0c; border-radius: var(--r1); font-size: var(--fs-small); }
.alert .ic { margin-top: 1px; color: var(--verm); }

.toast { position: fixed; left: 50%; bottom: var(--s5); z-index: 60; transform: translate(-50%, calc(100% + 3rem)); visibility: hidden; padding: var(--s3) var(--s4); background: var(--ink); color: var(--paper); font-size: var(--fs-small); border-radius: var(--r1); box-shadow: var(--shadow-sheet); transition: transform var(--t-med) var(--ease-out); max-width: calc(100vw - 2rem); }
.toast.is-on { transform: translate(-50%, 0); visibility: visible; }

/* ---------- 4. Header ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s5);
  height: var(--header-h); padding: 0 var(--gutter);
  background: var(--paper); border-bottom: 1px solid var(--ink);
}
.brand { display: grid; text-decoration: none; line-height: 1.1; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-sub { font-size: var(--fs-small); color: var(--ink-2); }
.nav { display: flex; gap: var(--s1); }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3); text-decoration: none; font-size: var(--fs-small); border-radius: var(--r1); }
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.menu-btn { display: none; }

/* ---------- 5. Drift hero ---------- */
.drift {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "head stage" "controls stage";
  gap: var(--s5) var(--s6);
  padding: var(--s5) var(--gutter) var(--s7) !important;
  min-height: calc(100svh - var(--header-h));
}
.drift-info { display: contents; }
.drift-head { grid-area: head; display: grid; gap: var(--s4); align-content: start; }
.drift h1 { font-size: var(--fs-h1); font-weight: 300; letter-spacing: -0.04em; margin-top: var(--s2); }
.lede { color: var(--ink-2); max-width: 44ch; }
.caption { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 0 var(--s3); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); }
.caption div { display: grid; padding: var(--s2) 0; }
.caption dt { font-size: var(--fs-small); color: var(--ink-2); }
.caption dd { font-weight: 700; letter-spacing: 0.03em; overflow-wrap: anywhere; }

.controls { grid-area: controls; display: grid; gap: var(--s4); align-content: start; }
.controls .help.status:empty { display: none; }
.swatches { display: flex; flex-wrap: wrap; gap: var(--s2); }
.swatch { position: relative; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch span { display: grid; place-items: center; width: 56px; min-height: 44px; padding: 0; border: 1px solid var(--ink-3); border-radius: var(--r1); background: var(--white); font-size: var(--fs-small); }
.swatch i { display: flex; width: 34px; height: 22px; border: 1px solid var(--ink); border-radius: 1px; overflow: hidden; }
.swatch i b { flex: 1; }
.swatch input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.swatch em { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ranges { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
.swatch input:focus-visible + span { outline: 2px solid var(--verm); outline-offset: 3px; }
.range label { display: flex; justify-content: space-between; }
.range output { font-weight: 400; color: var(--ink-2); }
input[type="range"] { width: 100%; height: 28px; margin: 0; background: transparent; appearance: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; margin-top: -8px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--ink); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--verm); }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--ink); border-radius: var(--r1); overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 42px; font-size: var(--fs-small); background: var(--white); }
.seg label + label span { border-left: 1px solid var(--ink); }
.seg input:checked + span { background: var(--ink); color: var(--paper); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--verm); outline-offset: -4px; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.actions .btn { flex: 1 1 auto; }

.drift-stage { grid-area: stage; margin: 0; display: grid; grid-template-rows: 1fr auto; gap: var(--s2); min-height: 0; }
.stage-frame { position: relative; min-height: 420px; border: 1px solid var(--ink); background: var(--paper); overflow: hidden; }
.drift-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; cursor: crosshair; }
.drift-fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
.js .drift-fallback { display: none; }
.stage-cap { display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; font-size: var(--fs-small); color: var(--ink-2); }
.hint { display: inline-flex; align-items: center; gap: var(--s2); }
.hint::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--verm); }

/* ---------- 6. Works index ---------- */
.work-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s7) var(--s6); }
.work-grid > li:nth-child(3n + 2) { margin-top: var(--s8); } /* salon hang: the middle column sits lower */
.work-nojs { grid-column: 1 / -1; margin-top: 0 !important; color: var(--ink-2); max-width: 70ch; }
.js .work-nojs { display: none; }
.work { display: grid; gap: var(--s3); width: 100%; padding: 0; text-align: left; font: inherit; color: inherit; background: none; border: 0; cursor: zoom-in; }
.work .sheet { position: relative; aspect-ratio: 1 / 1.4142; background: var(--white); box-shadow: var(--shadow-sheet); transition: transform var(--t-med) var(--ease-out), box-shadow var(--t-med) var(--ease-out); }
.work .sheet canvas { position: absolute; inset: 6%; width: 88%; height: 88%; }
.work:hover .sheet { transform: translateY(-4px); box-shadow: 0 2px 2px rgb(21 20 15 / 0.08), 0 20px 36px -12px rgb(21 20 15 / 0.32); }
.work:focus-visible { outline: none; }
.work:focus-visible .sheet { outline: 2px solid var(--verm); outline-offset: 6px; }
.work-label { display: grid; grid-template-columns: 1fr auto; gap: 0 var(--s3); border-top: 1px solid var(--ink); padding-top: var(--s2); }
.work-label strong { font-family: var(--display); font-weight: 500; font-size: 1.15rem; letter-spacing: -0.01em; }
.work-label code { font: 700 var(--fs-small)/1.6 var(--mono); color: var(--verm); letter-spacing: 0.04em; }
.work-label span { grid-column: 1 / -1; color: var(--ink-2); font-size: var(--fs-small); }

/* Viewer dialog */
.viewer { width: min(1180px, calc(100vw - 2rem)); max-height: calc(100svh - 2rem); padding: 0; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-frame); }
.viewer::backdrop { background: rgb(21 20 15 / 0.62); }
.viewer[open] { animation: rise var(--t-med) var(--ease-out); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.viewer-in { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr); }
.viewer-art { display: grid; place-items: center; padding: var(--s6); background: var(--paper-2); border-right: 1px solid var(--ink); }
.viewer-art canvas { width: auto; height: min(74svh, 760px); aspect-ratio: 1 / 1.4142; max-width: 100%; background: var(--white); box-shadow: var(--shadow-sheet); }
.viewer-side { display: grid; gap: var(--s4); align-content: start; padding: var(--s6); overflow: auto; max-height: calc(100svh - 2rem); }
.viewer-head { display: flex; justify-content: space-between; align-items: start; gap: var(--s4); }
.viewer-head h2 { font-size: clamp(1.8rem, 1.2rem + 2vw, 2.6rem); }
.viewer-meta { color: var(--verm); font-weight: 700; letter-spacing: 0.03em; }
.viewer-seed { display: grid; gap: var(--s2); }
.params-title { font-size: var(--fs-small); font-weight: 700; padding-top: var(--s2); border-top: 1px solid var(--ink); }
.params { display: grid; grid-template-columns: auto 1fr; gap: 0; font-size: var(--fs-small); }
.params dt { color: var(--ink-2); padding: 3px var(--s4) 3px 0; border-bottom: 1px solid var(--rule); }
.params dd { padding: 3px 0; text-align: right; font-weight: 700; border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.viewer-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.viewer-actions .btn { flex: 1 1 auto; }

/* ---------- 7. Practice ---------- */
.practice-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s7); align-items: start; }
.code { margin: 0; border: 1px solid var(--ink); background: var(--ink); color: #ece7dc; }
.code figcaption { padding: var(--s2) var(--s4); font-size: var(--fs-small); color: #c9c2b3; border-bottom: 1px solid #3a372f; }
.code pre { margin: 0; padding: var(--s4); overflow-x: auto; font: 400 0.95rem/1.6 var(--mono); }
.facts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s5); border-top: 1px solid var(--ink); padding-top: var(--s4); }
.facts dt { font-weight: 700; font-size: var(--fs-small); }
.facts dd { color: var(--ink-2); }

/* ---------- 8. Editions ---------- */
.table-wrap { overflow-x: auto; }
.ed-table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
.ed-table th { text-align: left; font-size: var(--fs-small); font-weight: 700; padding: var(--s2) var(--s3) var(--s2) 0; border-bottom: 1px solid var(--ink); }
.ed-table td { padding: var(--s3) var(--s3) var(--s3) 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.ed-table .num { text-align: right; }
.ed-table td:last-child { text-align: right; padding-right: 0; }
.ed-work { display: flex; align-items: center; gap: var(--s3); font-weight: 700; }
.ed-work canvas { width: 34px; height: 48px; background: var(--white); box-shadow: var(--shadow-sheet); flex: none; }
.ed-table code { font: 700 1rem/1 var(--mono); color: var(--verm); letter-spacing: 0.04em; }
.left-bar { display: inline-flex; align-items: center; gap: var(--s2); }
.ed-sold td { color: var(--ink-2); }
.ed-sold .ed-work { text-decoration: line-through; text-decoration-thickness: 1px; }

/* ---------- 9. Print shop ---------- */
.shop-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--s7); align-items: start; }
.preview { position: sticky; top: calc(var(--header-h) + var(--s5)); margin: 0; display: grid; gap: var(--s3); }
.wall { display: grid; place-items: center; aspect-ratio: 1 / 1.05; padding: 8%; background: var(--paper-2); border: 1px solid var(--rule); background-image: linear-gradient(to bottom, transparent 82%, var(--paper-3) 82%, var(--paper-3) 83%, transparent 83%); }
.frame { width: 100%; transition: width var(--t-med) var(--ease-out), padding var(--t-med) var(--ease-out), background var(--t-med); background: var(--white); box-shadow: var(--shadow-sheet); }
.frame[data-size="a4"] { width: 48%; }
.frame[data-size="a3"] { width: 60%; }
.frame[data-size="a2"] { width: 76%; }
.frame[data-size="a1"] { width: 94%; }
.frame[data-frame="oak"], .frame[data-frame="ash"] { padding: clamp(8px, 3%, 16px); box-shadow: var(--shadow-frame); }
.frame[data-frame="oak"] { background: linear-gradient(135deg, var(--oak) 0%, #c69a66 40%, var(--oak-dark) 100%); }
.frame[data-frame="ash"] { background: linear-gradient(135deg, #34302a 0%, var(--ash) 60%, #110f0c 100%); }
.mat { background: var(--white); padding: 6%; transition: padding var(--t-med) var(--ease-out); }
.frame[data-frame="oak"] .mat, .frame[data-frame="ash"] .mat { padding: 11%; box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.25); }
.frame canvas { width: 100%; aspect-ratio: 1 / 1.4142; height: auto; }
.preview figcaption { font-size: var(--fs-small); color: var(--ink-2); text-align: center; }

.shop-panel { display: grid; gap: var(--s6); }
.config { display: grid; gap: var(--s5); }
.qty { grid-template-columns: 1fr auto; align-items: center; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--ink); border-radius: var(--r1); }
.stepper .icon-btn { border: 0; }
.stepper output { min-width: 3ch; text-align: center; font-weight: 700; }

.receipt { display: grid; gap: var(--s3); padding: var(--s5); background: var(--white); border: 1px solid var(--ink); }
.ed-note { font-weight: 700; color: var(--verm); }
.lines { display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s4); }
.lines dt { color: var(--ink-2); }
.lines dd { text-align: right; }
.total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--ink); padding-top: var(--s3); font-weight: 700; }
.total strong { font-family: var(--display); font-weight: 500; font-size: 1.8rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.checkout, .enquiry { display: grid; gap: var(--s4); }
.checkout h3, .enquiry h3 { font-family: var(--display); font-weight: 500; font-size: var(--fs-h3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: var(--s4); }
.done { display: grid; gap: var(--s3); justify-items: start; padding: var(--s5); border: 1px solid var(--moss); background: var(--moss-soft); color: #173d1f; }
.done:focus { outline: none; }
.done h3 { font-family: var(--display); font-weight: 500; font-size: var(--fs-h3); color: var(--ink); }
.done-ic { width: 32px; height: 32px; color: var(--moss); stroke-width: 1.5; }
.done .btn { border-color: #173d1f; color: #173d1f; }
.done .btn:hover { background: #cadcc4; }
[hidden] { display: none !important; }

/* ---------- 10. Exhibitions ---------- */
.ex-list { list-style: none; margin: 0; padding: 0; }
.ex-list li { display: grid; grid-template-columns: 9rem minmax(0, 1fr) 7rem; gap: var(--s4); align-items: baseline; padding: var(--s4) 0; border-bottom: 1px solid var(--rule); transition: background var(--t-fast); }
.ex-list li:hover { background: var(--paper-2); }
.ex-list time { font-weight: 700; font-variant-numeric: tabular-nums; }
.ex-list strong { display: block; font-family: var(--display); font-weight: 500; font-size: 1.2rem; letter-spacing: -0.01em; margin-bottom: 2px; }
.ex-list span { color: var(--ink-2); }
.ex-list em { font-style: normal; justify-self: end; font-size: var(--fs-small); padding: 2px var(--s2); border: 1px solid var(--ink-3); border-radius: var(--r1); }
.ex-list li:first-child em { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- 11. Commissions ---------- */
.com-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: var(--s7); align-items: start; }
.com-grid .facts { grid-template-columns: 1fr 1fr; margin-top: var(--s4); }
.enquiry { padding: var(--s5); background: var(--white); border: 1px solid var(--ink); }
.msg-foot { display: flex; justify-content: space-between; gap: var(--s3); align-items: start; }
.count { margin-left: auto; color: var(--ink-2); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.count.is-ok { color: var(--moss); }

.seed-sheet { margin: var(--s5) 0 0; display: grid; gap: var(--s3); padding: var(--s4); background: var(--white); border: 1px solid var(--rule); }
.sheet-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s3); }
.sheet-grid li { display: grid; gap: 2px; }
.sheet-grid canvas { width: 100%; aspect-ratio: 1 / 1.4142; background: var(--paper); }
.sheet-grid span { font-size: var(--fs-small); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sheet-grid li:nth-child(14) canvas { outline: 2px solid var(--verm); outline-offset: 2px; }
.sheet-grid li:nth-child(14) span { color: var(--verm); font-weight: 700; }
.seed-sheet figcaption { font-size: var(--fs-small); color: var(--ink-2); }

/* Without JavaScript: hide the live-only controls, keep every word */
.no-js .controls, .no-js .shop-grid, .no-js .seed-sheet, .no-js .drift-head .caption { display: none; }
.nojs-note { grid-area: controls; max-width: 62ch; padding: var(--s4); border: 1px solid var(--ink); background: var(--white); }
.nojs-row td { color: var(--ink-2); text-align: left !important; max-width: 70ch; }

/* ---------- 12. Footer ---------- */
.foot { display: grid; grid-template-columns: auto 1fr; gap: var(--s5) var(--s7); align-items: center; padding: var(--s7) var(--gutter) var(--s6); background: var(--ink); color: #e6e0d3; }
.foot-mark { display: flex; align-items: center; gap: var(--s4); }
.foot-mark canvas { width: 64px; height: 64px; border: 1px solid #5d584e; }
.foot-mark .brand-name { color: var(--paper); }
.foot-mark p:not(.brand-name) { font-size: var(--fs-small); color: #c9c2b3; }
.foot-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s1) var(--s2); }
.foot-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s2); font-size: var(--fs-small); color: #e6e0d3; }
.foot a:hover, .foot-nav a:hover { color: #ff9a80; }
.foot :focus-visible { outline-color: #ff9a80; }
.foot-small { grid-column: 1 / -1; font-size: var(--fs-small); color: #c9c2b3; border-top: 1px solid #3a372f; padding-top: var(--s4); }

/* ---------- 13. Motion: quiet supporting transitions only; Drift is the moment ---------- */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .work .sheet { animation: settle linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
    @keyframes settle { from { translate: 0 18px; } }
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- 14. Narrow screens ---------- */
@media (max-width: 1100px) {
  .nav a { padding: 0 var(--s2); }
  .facts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 960px) {
  .menu-btn { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s3); font: 700 var(--fs-small)/1 var(--mono); color: var(--ink); background: none; border: 1px solid var(--ink); border-radius: var(--r1); cursor: pointer; }
  .nav { position: absolute; top: 100%; left: 0; right: 0; display: none; flex-direction: column; padding: var(--s2) var(--gutter) var(--s4); background: var(--paper); border-bottom: 1px solid var(--ink); }
  .nav.is-open { display: flex; }
  .nav a { font-size: var(--fs-body); }
  .no-js .nav { position: static; display: flex; flex-direction: row; flex-wrap: wrap; padding: 0; border: 0; }

  .drift { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; grid-template-areas: "head" "stage" "controls"; min-height: 0; }
  .stage-frame { min-height: 0; height: min(64svh, 620px); }
  .controls { grid-template-columns: 1fr 1fr; gap: var(--s4) var(--s5); }
  .controls .seed-field, .controls .palettes, .controls .actions, .controls .status, .controls .ranges { grid-column: 1 / -1; }
  .section-head { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-grid > li:nth-child(3n + 2) { margin-top: 0; }
  .work-grid > li:nth-child(2n) { margin-top: var(--s7); }
  .practice-grid, .shop-grid, .com-grid { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; max-width: 560px; width: 100%; justify-self: center; }
  .viewer-in { grid-template-columns: 1fr; }
  .viewer-art { border-right: 0; border-bottom: 1px solid var(--ink); padding: var(--s4); }
  .viewer-art canvas { height: min(52svh, 560px); }
  .viewer-side { max-height: none; overflow: visible; }
  .viewer { overflow: auto; }
}
@media (max-width: 640px) {
  :root { --header-h: 3.75rem; --fs-body: 1.0625rem; }
  main > section { padding: var(--s8) var(--gutter) var(--s7); }
  .brand-sub { display: none; }
  .drift { gap: var(--s4); padding-top: var(--s4) !important; }
  .drift h1 { margin-top: 0; }
  .stage-frame { height: 58svh; }
  .controls { grid-template-columns: 1fr; }
  .work-grid { gap: var(--s6) var(--s4); }
  .work-label { grid-template-columns: 1fr; }
  .work-label strong { font-size: 1rem; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .facts, .com-grid .facts { grid-template-columns: 1fr; gap: var(--s3); }
  .ed-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ed-table, .ed-table tbody, .ed-table tr, .ed-table td { display: block; }
  .ed-table tr { display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s3); padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
  .ed-table td { padding: 0; border: 0; text-align: left !important; }
  .ed-table td[data-k]::before { content: attr(data-k) " "; color: var(--ink-2); font-size: var(--fs-small); }
  .ed-table td:first-child { grid-column: 1 / -1; }
  .ed-table td:last-child { grid-column: 1 / -1; margin-top: var(--s2); }
  .ed-table td:last-child .btn { width: 100%; }
  .ex-list li { grid-template-columns: 1fr auto; gap: var(--s1) var(--s3); }
  .ex-list li > div { grid-column: 1 / -1; grid-row: 2; }
  .wall { aspect-ratio: 1 / 1.15; padding: 6%; }
  .receipt, .enquiry { padding: var(--s4); }
  .foot { grid-template-columns: 1fr; }
  .foot-nav { justify-content: flex-start; }
  .viewer { width: calc(100vw - 1rem); max-height: calc(100svh - 1rem); }
  .viewer-side { padding: var(--s4); }
}
