/* ============================================================
   FORMA — THE PRINT RUN
   Two-ink risograph broadsheet: flat-gold ground, black ink,
   process-red stamp. Duotone photos, ruled ledger, paper grain.
   ============================================================ */

@font-face {
  font-family: 'Anton';
  src: url('/artifacts/forma-frontend--v1--s3-alternative-direction--glm-5.3--impeccable--2026-09-17T10-16-31-016Z/assets/fonts/anton-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Work Sans';
  src: url('/artifacts/forma-frontend--v1--s3-alternative-direction--glm-5.3--impeccable--2026-09-17T10-16-31-016Z/assets/fonts/worksans-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --yellow: #F5D90A;
  --black: #1A1608;
  --red: #E4002B;
  --paper: #FAF4E4;
  --brown: #4A431A;
  --brown-soft: #6B6132;
  --yellow-dim: rgba(245, 217, 10, 0.8);
  --yellow-faint: rgba(245, 217, 10, 0.72);
  --font-display: 'Anton', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'Work Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

* , *::before, *::after { box-sizing: border-box; }

html {
  background: var(--yellow);
  scrollbar-color: var(--black) var(--yellow);
}

body {
  margin: 0;
  background: var(--yellow);
  color: var(--black);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--black);
}
body.sheet-open { overflow: hidden; }

::selection { background: var(--black); color: var(--yellow); }

::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--yellow); }
::-webkit-scrollbar-thumb { background: var(--black); border: 3px solid var(--yellow); }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

/* Paper grain over the whole sheet */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.42'/%3E%3C/svg%3E");
  opacity: 0.14;
  mix-blend-mode: multiply;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding-inline: clamp(20px, 4vw, 48px);
}

/* ---------- Duotone photo: grayscale ink multiplied over the stock ---------- */
.ph {
  background: var(--yellow);
  overflow: hidden;
  isolation: isolate;
  margin: 0;
}
.ph img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.16) brightness(1.04);
  mix-blend-mode: multiply;
}

/* ============================ MASTHEAD ============================ */

.masthead {
  padding-top: clamp(28px, 4vw, 44px);
  border-bottom: 4px solid var(--black);
}
.masthead::after {
  content: "";
  display: block;
  height: 2px;
  background: var(--black);
  margin: 0 0 4px; /* thin rule, yellow gap, thick rule — the printed double */
}
.mast-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(24px, 4vw, 56px);
  align-items: end;
  padding-bottom: clamp(18px, 2.5vw, 26px);
  margin-bottom: 4px;
}
.mast-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.2rem, 6vw, 6rem);
  line-height: 0.88;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  /* red misregistration — the second print pass */
  text-shadow: 0.045em 0.035em 0 var(--red);
}
.mast-tag {
  margin: 18px 0 0;
  max-width: 52ch;
  font-size: 1.06rem;
  font-weight: 500;
  line-height: 1.6;
}
.mast-issue {
  margin: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brown);
}
.mast-print {
  margin: 0;
  background: var(--paper);
  border: 2px solid var(--black);
  padding: 10px 10px 12px;
  transform: rotate(-1.6deg);
  box-shadow: 10px 14px 30px rgba(26, 22, 8, 0.28);
  width: 100%;
}
.mast-ph { height: 200px; }
.mast-print figcaption {
  padding-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  color: var(--brown);
}

/* ============================ PRESS BAR ============================ */

.press {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--black);
  color: var(--yellow);
}
.press-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 280px auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding-block: 12px;
}
.field {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  border: 2px solid rgba(245, 217, 10, 0.55);
  background: var(--black);
  padding-left: 14px;
}
.field:focus-within { border-color: var(--yellow); }
.field-tag {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--yellow-dim);
  white-space: nowrap;
}
.field input, .field select {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: 0;
  color: var(--yellow);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0 12px 0 0;
  caret-color: var(--yellow);
}
.field input::placeholder { color: rgba(245, 217, 10, 0.5); }
.field input:focus-visible, .field select:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: -4px;
}
.field select {
  appearance: none;
  cursor: pointer;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23F5D90A' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.field select option { color: var(--black); background: var(--paper); }

.btn-toggle {
  height: 44px;
  border: 2px solid var(--yellow);
  background: transparent;
  color: var(--yellow);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  padding: 0 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-toggle:hover { background: rgba(245, 217, 10, 0.16); }
.btn-toggle[aria-pressed="true"] {
  background: var(--yellow);
  color: var(--black);
  font-weight: 700;
}
.btn-toggle:focus-visible { outline-color: var(--yellow); }

.press-count {
  margin: 0;
  justify-self: end;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--yellow-dim);
}

/* ============================ LEDGER ============================ */

main.wrap { padding-top: clamp(20px, 3vw, 32px); }

.ledger-head {
  display: grid;
  grid-template-columns: 168px minmax(0, 1.55fr) minmax(0, 1fr) 120px;
  gap: 24px;
  padding: 10px 12px;
  background: var(--black);
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.h-price { text-align: right; }

.ledger { border-bottom: 4px solid var(--black); }

.row {
  display: grid;
  grid-template-columns: 168px minmax(0, 1.55fr) minmax(0, 1fr) 120px;
  gap: 24px;
  padding: 20px 12px;
  border-bottom: 2px solid var(--black);
  cursor: pointer;
  animation: print-in 0.34s both;
  animation-delay: calc(var(--i, 0) * 28ms);
  transition: background-color 0.18s ease, color 0.18s ease;
}
.row:hover, .row:focus-within {
  background: var(--black);
  color: var(--yellow);
}
.row-ph { height: 120px; }
.row-main { min-width: 0; align-self: center; }
.row-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.7rem;
  line-height: 1.05;
  letter-spacing: 0.01em;
}
.row-title button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 0.055em;
  text-underline-offset: 0.14em;
}
.row-title button:hover, .row-title button:focus-visible {
  text-decoration-color: currentColor;
}
.row-meta {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brown);
}
.row:hover .row-meta, .row:focus-within .row-meta { color: var(--yellow-dim); }
.row-desc {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 60ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row:hover .row-desc, .row:focus-within .row-desc { color: rgba(245, 217, 10, 0.88); }

.chip {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  background: var(--red);
  color: var(--black);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.row-facts {
  align-self: center;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.9;
  font-variant-numeric: tabular-nums;
}
.row-facts p { margin: 0; }
.row-price { align-self: center; text-align: right; }
.price {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1;
}
.price-note {
  margin: 3px 0 0;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brown);
}
.row:hover .price-note, .row:focus-within .price-note { color: rgba(245, 217, 10, 0.7); }

/* no re-print pass on plain keystrokes */
.ledger.no-print .row, .ledger.no-print .empty { animation: none; }

@keyframes print-in {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

/* ---------- Empty state ---------- */

.empty {
  padding: clamp(44px, 6vw, 80px) 12px;
  text-align: center;
  animation: print-in 0.34s both;
}
.empty-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.2rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.empty-copy {
  max-width: 46ch;
  margin: 0 auto 24px;
  color: var(--brown);
  font-size: 1rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px solid var(--black);
  background: var(--black);
  color: var(--yellow);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  padding: 12px 22px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--red); color: var(--black); }

/* ============================ COLOPHON ============================ */

.colophon {
  margin-top: clamp(36px, 5vw, 56px);
  background: var(--black);
  color: var(--yellow);
}
.colophon-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding-block: 28px;
}
.colophon-brand {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.colophon-fine {
  margin: 0;
  max-width: 72ch;
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--yellow-faint);
}
.colophon-mark { text-align: right; }
.barcode {
  width: 132px;
  height: 32px;
  margin-left: auto;
  background: repeating-linear-gradient(90deg,
    var(--yellow) 0 2px, transparent 2px 5px,
    var(--yellow) 5px 6px, transparent 6px 8px,
    var(--yellow) 8px 11px, transparent 11px 14px);
}
.barcode-label {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--yellow-dim);
}

/* ============================ DETAIL SHEET ============================ */

.sheet {
  width: min(840px, calc(100vw - 40px));
  margin: auto;
  border: 3px solid var(--black);
  background: var(--paper);
  color: var(--black);
  padding: 0;
}
.sheet[open] { animation: sheet-up 0.22s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes sheet-up {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet::backdrop { background: rgba(26, 22, 8, 0.62); }

.sheet-scroll {
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: clamp(18px, 3vw, 32px);
}
.sheet-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.chip-sheet { margin: 0; padding: 4px 10px; font-size: 0.66rem; }
.btn-close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--black);
  background: transparent;
  color: var(--black);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 14px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-close:hover { background: var(--black); color: var(--yellow); }

.sheet-ph {
  position: relative;
  height: min(300px, 38vh);
}
.stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  transform: rotate(-8deg);
  border: 4px solid var(--red);
  color: var(--red);
  background: rgba(250, 244, 228, 0.87);
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 14px;
}
.stamp-in { animation: stamp-in 0.3s cubic-bezier(0.16, 1.4, 0.3, 1) both; }
@keyframes stamp-in {
  from { transform: rotate(-8deg) scale(1.8); opacity: 0; }
  to { transform: rotate(-8deg) scale(1); opacity: 1; }
}
.ph-caption {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: right;
  color: var(--brown-soft);
}
.sheet-title {
  margin: 20px 0 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 2.7rem);
  line-height: 1.02;
  letter-spacing: 0.01em;
}
.sheet-meta {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brown);
}
.sheet-body {
  margin: 0 0 26px;
  max-width: 62ch;
  font-size: 1.05rem;
  line-height: 1.65;
}
.sheet-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 26px;
  border-top: 2px solid var(--black);
  border-left: 2px solid var(--black);
}
.sheet-facts > div {
  border-right: 2px solid var(--black);
  border-bottom: 2px solid var(--black);
  padding: 12px 14px;
}
.sheet-facts dt {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brown);
}
.sheet-facts dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.sheet-actions { display: flex; }
.btn-save {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--black);
  background: var(--black);
  color: var(--yellow);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  padding: 14px 22px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-save:hover { background: var(--red); color: var(--black); }
.btn-save[aria-pressed="true"] { background: var(--red); color: var(--black); }
.btn-save[aria-pressed="true"]:hover { background: var(--black); color: var(--yellow); }

/* ============================ RESPONSIVE ============================ */

@media (max-width: 1020px) {
  .press-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .field-search { grid-column: 1 / -1; grid-row: 1; }
  .field-cat { grid-column: 1; grid-row: 2; }
  .btn-toggle { grid-column: 2; grid-row: 2; justify-self: end; }
  .press-count { grid-column: 1 / -1; grid-row: 3; justify-self: start; }
}

@media (max-width: 900px) {
  .mast-grid { grid-template-columns: 1fr; align-items: start; }
  .mast-print { width: min(420px, 100%); }
  .mast-ph { height: 180px; }
}

@media (max-width: 760px) {
  .ledger-head { display: none; }
  .row {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 12px;
  }
  .row-ph { height: 200px; }
  .row-title { font-size: 1.5rem; }
  .row-main { align-self: auto; }
  .row-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 12px;
    font-size: 0.72rem;
    line-height: 1.7;
  }
  .row-price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    text-align: left;
  }
  .price-note { margin: 0; }
  .empty-title { font-size: 1.6rem; }

  .press-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .field-search { grid-column: 1 / -1; grid-row: 1; }
  .field-cat { grid-column: 1; grid-row: 2; }
  .btn-toggle { grid-column: 1 / -1; grid-row: 3; justify-self: stretch; }
  .press-count { grid-column: 1 / -1; grid-row: auto; justify-self: start; margin-top: 2px; }

  .sheet { width: calc(100vw - 16px); border-width: 2px; }
  .sheet-scroll {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 16px 14px 20px;
  }
  .sheet-ph { height: 210px; }
  .sheet-facts { grid-template-columns: 1fr 1fr; }
  .colophon-grid { grid-template-columns: 1fr; }
  .colophon-mark { text-align: left; }
  .barcode { margin-left: 0; }
}

/* ============================ MOTION ============================ */

@media (prefers-reduced-motion: reduce) {
  .row, .empty, .sheet[open], .stamp-in { animation: none !important; }
  * { transition-duration: 0.01ms !important; }
}
