/* ============================================================
   FORMA — “The studio after dark”
   Direction: near-black inked canvas, daylight photos glowing
   like workbench lamps. Every workshop is a numbered work order:
   condensed poster headlines (Anton), grotesque body (Archivo),
   monospaced spec rows with dotted leaders (IBM Plex Mono),
   perforated dashed rules, one marigold accent.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --ink: #151210;            /* page canvas */
  --ink-2: #1e1a15;          /* raised surface */
  --ink-3: #262019;          /* hover surface */
  --paper: #f2e9d6;          /* primary text */
  --muted: #b0a186;          /* secondary text */
  --accent: #f0b429;         /* marigold work-lamp */
  --accent-ink: #191308;     /* text on accent */
  --line: #3a3227;           /* hairlines on dark */
  --line-strong: #574c39;    /* dotted leaders */
  --focus: #f0b429;

  --font-display: "Anton", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Archivo", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --gutter: clamp(20px, 4.5vw, 64px);
  --w-sel: 3px;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font: 400 17px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* faint print grain over the flat ink — sits above content, never interactive */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="160" height="160"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="2" stitchTiles="stitch"/><feColorMatrix type="saturate" values="0"/></filter><rect width="100%" height="100%" filter="url(%23n)" opacity="0.06"/></svg>');
  z-index: 999;
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: var(--w-sel) solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip:focus-visible { top: 12px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

/* Micro label role */
.micro {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 14px 22px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-solid:hover { background: #ffd158; border-color: #ffd158; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 9px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Masthead ---------- */
.masthead {
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 18px var(--gutter) 16px;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--paper);
  text-decoration: none;
  line-height: 1;
}
.wordmark-mark { color: var(--accent); margin-left: 2px; }
.masthead-tag {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.masthead-count {
  margin: 0 0 0 auto;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  padding: 5px 12px;
  white-space: nowrap;
}
#short-count { color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  padding: 56px var(--gutter) 64px;
  position: relative;
}
/* registration ticks, print-proof style */
.hero::before, .hero::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 0 solid var(--line-strong);
  pointer-events: none;
}
.hero::before { top: 22px; left: calc(var(--gutter) - 18px); border-left-width: 1px; border-top-width: 1px; }
.hero::after  { bottom: 22px; right: calc(var(--gutter) - 18px); border-right-width: 1px; border-bottom-width: 1px; }

.hero-eyebrow {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 28px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero-eyebrow [aria-hidden="true"] { color: var(--line-strong); }

.hero-title {
  margin: 0 0 40px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(46px, 8vw, 112px);
  line-height: 0.96;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--paper);
}
.hero-line { display: block; }
.hero-line-2 { display: flex; align-items: stretch; gap: 28px; }
.hero-line-text { white-space: nowrap; }
.hero-fig {
  flex: 1;
  min-width: 120px;
  overflow: hidden;
  border: 1px solid var(--line);
  align-self: stretch;
  margin-top: 0.14em; /* sit on the baseline like a letterpress slug */
  margin-bottom: 0.06em;
}
.hero-fig img { width: 100%; height: 100%; object-fit: cover; }

.hero-lower {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 48px;
  flex-wrap: wrap;
}
.hero-copy {
  margin: 0 0 28px;
  max-width: 34em;
  font-size: 19px;
  line-height: 1.6;
  color: var(--muted);
}
.hero-copy strong { color: var(--paper); font-weight: 500; }
.hero-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, auto));
  gap: 14px 40px;
  margin: 0;
}
.hero-meta div { display: contents; }
.hero-meta dt {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  margin-bottom: 4px;
}
.hero-meta dd { margin: 0; font-size: 15px; font-weight: 500; color: var(--paper); }

/* ---------- Toolbar ---------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  gap: 32px;
  padding: 14px var(--gutter) 18px;
  background: var(--ink);
  border-top: 1px dashed var(--line-strong);
  border-bottom: 1px solid var(--line);
}
.control { display: flex; flex-direction: column; gap: 7px; }
.control-search { flex: 1 1 260px; max-width: 380px; }
.control-category { width: 200px; }

.control input,
.control select {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--paper);
  font: 400 16px/1.3 var(--font-body);
  padding: 8px 2px 9px;
  transition: border-color 0.15s ease;
}
.control input::placeholder { color: var(--muted); opacity: 0.7; }
.control input:focus-visible, .control select:focus-visible {
  outline: none;
  border-bottom-color: var(--accent);
}
.control select {
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8"><path d="M1 1l5 5 5-5" fill="none" stroke="%23f0b429" stroke-width="1.6"/></svg>');
  background-repeat: no-repeat;
  background-position: right 4px center;
  padding-right: 26px;
  cursor: pointer;
}
.control select option { background: var(--ink-2); color: var(--paper); }

.control-saved button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.control-saved .saved-filter-mark { color: var(--line-strong); font-size: 14px; transition: color 0.15s ease; }
.control-saved button:hover { border-color: var(--accent); }
.control-saved button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.control-saved button[aria-pressed="true"] .saved-filter-mark { color: var(--accent-ink); }

.toolbar-count {
  margin: 0 0 0 auto;
  align-self: flex-end;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  padding-bottom: 11px;
}
.toolbar-count #count { color: var(--paper); font-weight: 600; }

/* ---------- Ledger (workshop rows) ---------- */
.ledger {
  list-style: none;
  margin: 0;
  padding: 0 var(--gutter) 8px;
}
.ledger > li { border-bottom: 1px solid var(--line); }
.row {
  display: grid;
  grid-template-columns: 44px 96px minmax(0, 1fr) 132px 150px 64px 28px;
  align-items: center;
  gap: 24px;
  width: 100%;
  padding: 18px 0;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.row:hover { background: var(--ink-2); }

.row-index {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}
li.is-saved .row-index {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 2px 6px;
}

.row-thumb {
  width: 96px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  filter: saturate(0.92);
  transition: filter 0.2s ease;
}
.row:hover .row-thumb { filter: saturate(1.05); }

.row-main { min-width: 0; }
.row-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 23px;
  line-height: 1.05;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  color: var(--paper);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}
.row:hover .row-title { color: var(--accent); }
.row-saved-mark { color: var(--accent); }
li:not(.is-saved) .row-saved-mark { display: none; }

.row-desc {
  display: block;
  margin-top: 5px;
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-cat {
  justify-self: start;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 5px 11px;
  white-space: nowrap;
}

.row-date {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  white-space: nowrap;
}
.row-date strong { display: block; font-weight: 600; color: var(--paper); }

.row-price {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--paper);
  text-align: right;
  white-space: nowrap;
}
.row-arrow {
  font-size: 20px;
  line-height: 1;
  color: var(--accent);
  text-align: center;
  transition: transform 0.15s ease;
}
.row:hover .row-arrow { transform: translateX(4px); }

/* mobile meta line: category · date · price, compact rows only */
.row-mob-meta { display: none; }

/* ---------- Empty state ---------- */
.empty {
  margin: 0;
  padding: 72px var(--gutter) 88px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.empty-code { color: var(--accent); margin-bottom: 18px; }
.empty-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(28px, 4.5vw, 44px);
  letter-spacing: 0.015em;
  text-transform: uppercase;
  color: var(--paper);
}
.empty-copy {
  margin: 0 auto 32px;
  max-width: 36em;
  color: var(--muted);
}

/* ---------- Method ---------- */
.method {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
  padding: 88px var(--gutter) 96px;
  border-bottom: 1px dashed var(--line-strong);
}
.method-figure {
  margin: 0;
  border: 1px solid var(--line);
}
.method-figure img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.method-figure figcaption {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}
.section-title {
  margin: 0 0 40px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: 0.015em;
  text-transform: uppercase;
  color: var(--paper);
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}
.steps li {
  border-top: 2px solid var(--line-strong);
  padding-top: 18px;
}
.step-no { color: var(--accent); margin-bottom: 14px; }
.step-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 21px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--paper);
}
.step-copy { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }

/* ---------- Footer ---------- */
.footer {
  padding: 64px var(--gutter) 72px;
}
.footer-word {
  margin: 0 0 40px;
  font-family: var(--font-display);
  font-size: clamp(64px, 11vw, 140px);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-3);
  -webkit-text-stroke: 1px var(--line-strong);
}
.footer-word span { color: var(--accent); -webkit-text-stroke: 0; }
.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.footer-note { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); max-width: 34em; }
.footer-note code { font-family: var(--font-mono); font-size: 12px; color: var(--paper); }
.footer-note.micro { font-size: 11px; }

/* ---------- Detail sheet (dialog) ---------- */
.sheet {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(720px, 100vw);
  height: 100%;
  height: 100dvh;
  max-height: none;
  max-width: none;
  margin: 0;
  border: 0;
  border-left: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet::backdrop {
  background: rgba(10, 8, 6, 0.72);
  backdrop-filter: none;
}
.sheet-inner {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px clamp(20px, 5vw, 48px) 56px;
  min-height: 100%;
}
.sheet-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--line-strong);
}
.sheet-order { color: var(--accent); }
.sheet-fig { margin: 0; }
.sheet-fig img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 1px solid var(--line);
}
.sheet-fig figcaption { margin-top: 10px; }
.sheet-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(34px, 5vw, 46px);
  line-height: 1;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  color: var(--paper);
}
.sheet-body {
  margin: 0;
  font-size: 19px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 40em;
}

/* spec list with dotted leaders */
.spec { margin: 0; }
.spec-row {
  display: flex;
  align-items: baseline;
  gap: 0;
  padding: 11px 0;
  border-bottom: 0;
}
.spec-row dt {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.spec-row .lead {
  flex: 1;
  border-bottom: 1px dotted var(--line-strong);
  margin: 0 14px;
  transform: translateY(-4px);
}
.spec-row dd {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--paper);
  text-align: right;
}
.spec-row dd.accent { color: var(--accent); font-family: var(--font-mono); font-weight: 600; }

.sheet-actions {
  margin-top: auto;
  padding-top: 30px;
  border-top: 1px dashed var(--line-strong);
}
.btn-save {
  display: block;
  width: 100%;
  padding: 17px 20px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-save:hover { background: #ffd158; border-color: #ffd158; }
.btn-save[aria-pressed="true"] {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.btn-save[aria-pressed="true"]:hover { background: rgba(240, 180, 41, 0.08); }
.sheet-note { margin: 14px 0 0; text-align: center; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: sheet-in 0.3s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .sheet[open]::backdrop { animation: fade-in 0.3s ease; }
  @keyframes sheet-in {
    from { transform: translateX(48px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }
  @keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============================================================
   Responsive
   ============================================================ */
.ledger li.boot-error {
  list-style: none;
  padding: 32px var(--gutter);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

@media (max-width: 1080px) {
  .row {
    grid-template-columns: 72px minmax(0, 1fr) 22px;
    gap: 16px;
    padding: 16px 0;
  }
  .row-index, .row-cat, .row-date, .row-price { display: none; }
  .row-thumb { width: 72px; height: 72px; }
  .row-arrow { font-size: 17px; }
  .row-desc {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .row-mob-meta {
    display: block;
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .row-mob-meta .mob-price { color: var(--paper); font-weight: 600; }
  .method { grid-template-columns: 1fr; gap: 48px; }
  .method-figure { max-width: 480px; }
  .steps { grid-template-columns: 1fr; gap: 26px; }
  .footer-cols { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .masthead { flex-wrap: wrap; gap: 6px 16px; padding-top: 14px; }
  .masthead-tag { display: none; }
  .wordmark { font-size: 24px; }

  .hero { padding-top: 36px; padding-bottom: 48px; }
  .hero-title { font-size: clamp(44px, 12.5vw, 64px); }
  .hero-line-text { white-space: normal; }
  .hero-line-2 { display: block; }
  .hero-fig { margin: 18px 0 0; height: 180px; }
  .hero-lower { flex-direction: column; align-items: flex-start; gap: 36px; }
  .hero-meta { grid-template-columns: 1fr; gap: 10px; width: 100%; }

  .toolbar { flex-wrap: wrap; gap: 18px 20px; padding-top: 12px; }
  .control-search { flex: 1 1 100%; max-width: none; }
  .control-category { flex: 1 1 auto; width: auto; min-width: 150px; }
  .toolbar-count { margin-left: auto; }

  .ledger { padding-left: var(--gutter); padding-right: var(--gutter); }
  .row { grid-template-columns: 64px minmax(0, 1fr) 20px; gap: 16px; padding: 16px 0; }
  .row-thumb { width: 64px; height: 64px; }
  .row-title { font-size: 19px; }
  .method { padding: 64px var(--gutter) 72px; }
}
