/* Forma — October pattern envelope */
:root {
  --bg: #f2efe9;
  --surface: #e8e3da;
  --ink: #1a1817;
  --ink-2: #262220;
  --muted: #5c554d;
  --bone: #efe9df;
  --bone-muted: #bdb4a7;
  --accent: #6b2f26;
  --accent-deep: #55241d;
  --accent-ink: #f7f1ea;
  --line: rgba(26, 24, 23, 0.2);
  --line-dark: rgba(239, 233, 223, 0.22);

  --display: "Didot", "Bodoni 72", "Bodoni MT", "Bodoni Moda", "Playfair Display", "Times New Roman", serif;
  --sans: "Avenir Next", "Avenir", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(20px, 4vw, 64px);
  --r-sm: 2px;
  --r-md: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  overflow-x: clip;
}
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--bone); color: var(--ink); padding: 12px 20px; border-radius: var(--r-sm);
  text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }

.label {
  font: 600 12px/1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.wrap { padding-inline: var(--gutter); max-width: 1520px; margin-inline: auto; }

/* ---------- Hero: the envelope front ---------- */
.hero {
  background: var(--ink);
  color: var(--bone);
  position: relative;
  overflow: clip;
}
.hero :focus-visible { outline-color: var(--bone); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 16px;
  border-bottom: 1px solid var(--line-dark);
}
.wordmark {
  font: 400 30px/1 var(--display); letter-spacing: -0.02em;
  color: var(--bone); text-decoration: none;
  display: inline-flex; align-items: center; min-height: 44px;
}
.nav { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a, .nav button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 0 14px; white-space: nowrap;
  font: 500 15px/1 var(--sans); color: var(--bone); text-decoration: none;
  background: none; border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease);
}
.nav a:active, .nav button:active { transform: scale(0.97); }
.nav .count {
  font: 600 12px/1 var(--mono); min-width: 24px; height: 24px; padding: 0 6px;
  display: inline-grid; place-items: center; border-radius: 12px;
  background: var(--bone); color: var(--ink);
}

.hero-kicker {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-top: 28px; color: var(--bone-muted);
}
.hero h1 { font-weight: 400; }
.hero h1 .h1-small {
  display: block; margin-top: 20px;
  font: 500 clamp(17px, 1.6vw, 22px)/1.3 var(--sans); color: var(--bone);
  letter-spacing: 0.01em;
}
.giant {
  display: block;
  font: 400 clamp(72px, 19.5vw, 300px)/0.86 var(--display);
  letter-spacing: -0.045em;
  margin-left: -0.04em;
  margin-top: 4px;
}
.giant span {
  display: inline-block;
  animation: settle 900ms var(--ease) both;
}
.giant span:nth-child(2) { animation-delay: 70ms; }
.giant span:nth-child(3) { animation-delay: 140ms; }
.giant span:nth-child(4) { animation-delay: 210ms; }
.giant span:nth-child(5) { animation-delay: 280ms; }
.giant span:nth-child(6) { animation-delay: 350ms; }
.giant span:nth-child(7) { animation-delay: 420ms; }
.giant em { font-style: italic; }
@keyframes settle {
  from { opacity: 0; transform: translateY(0.18em); }
  to { opacity: 1; transform: none; }
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 24px 32px;
  padding-block: 40px 56px;
  align-items: start;
}
.hero-lead { grid-column: 1 / span 4; }
.hero-lead p { max-width: 36ch; color: var(--bone); font-size: 18px; }
.hero-lead .fine { margin-top: 16px; color: var(--bone-muted); font-size: 15px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 24px;
  border-radius: var(--r-sm); border: 1px solid transparent;
  font: 600 16px/1.2 var(--sans); text-decoration: none; cursor: pointer;
  transition: background-color 180ms var(--ease), color 180ms var(--ease), transform 180ms var(--ease), border-color 180ms var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn-invert { background: var(--bone); color: var(--ink); margin-top: 28px; }
.btn-invert .arrow { transition: transform 200ms var(--ease); }

.contents { grid-column: 6 / span 3; }
.contents h2 { color: var(--bone-muted); margin-bottom: 8px; }
.contents a {
  display: grid; grid-template-columns: 36px 1fr auto; align-items: baseline; gap: 8px;
  min-height: 44px; padding-block: 10px;
  color: var(--bone); text-decoration: none;
  border-top: 1px solid var(--line-dark);
  transition: color 180ms var(--ease), padding-left 200ms var(--ease);
}
.contents li:last-child a { border-bottom: 1px solid var(--line-dark); }
.contents .n { font: 500 13px/1 var(--mono); color: var(--bone-muted); }
.contents .t { font: 400 19px/1.2 var(--display); letter-spacing: -0.01em; }
.contents .d { font: 500 13px/1 var(--mono); color: var(--bone-muted); }
.contents a:active { transform: scale(0.98); }
.contents a:focus-visible { outline-offset: -2px; }

.plate { grid-column: 10 / span 3; position: relative; }
.plate img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 30% 50%;
  border-radius: var(--r-sm);
  filter: saturate(0.85);
}
.plate figcaption { margin-top: 10px; color: var(--bone-muted); font-size: 14px; line-height: 1.45; }
.plate .tag {
  position: absolute; top: 12px; left: 12px;
  background: var(--ink); color: var(--bone); padding: 6px 10px; border-radius: var(--r-sm);
}

/* the cut line — scissors travel along the bottom edge of the envelope */
.cutline {
  position: relative; height: 32px;
  border-top: 2px dashed var(--line-dark);
  margin-inline: var(--gutter);
}
.cutline .scissors {
  position: absolute; top: -15px; left: 0;
  width: 28px; height: 28px; color: var(--bone);
  animation: cut 14s linear infinite;
}
@keyframes cut {
  from { left: 0; }
  to { left: calc(100% - 28px); }
}

/* ---------- Workshops ---------- */
.workshops { padding-block: 96px 128px; position: relative; }
.section-head {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 32px;
  align-items: end; margin-bottom: 40px;
}
.section-head h2 {
  grid-column: 1 / span 7;
  font: 400 clamp(48px, 7vw, 104px)/0.95 var(--display); letter-spacing: -0.035em;
}
.section-head h2 em { color: var(--accent); }
.section-head p { grid-column: 9 / span 4; color: var(--muted); max-width: 42ch; }
.sideways {
  position: absolute; left: 10px; top: 96px;
  writing-mode: vertical-rl; transform: rotate(180deg);
  color: var(--muted);
}

.controls {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto auto; gap: 16px 24px;
  align-items: end;
  background: var(--bg);
  padding-block: 16px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}
.field { display: grid; gap: 6px; }
.field .label { color: var(--muted); }
.field input, .field select {
  min-height: 48px; width: 100%;
  font-size: 16px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--muted); border-radius: var(--r-sm);
  padding: 10px 14px;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease);
}
.field select {
  appearance: none; -webkit-appearance: none;
  padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
.field input:focus-visible, .field select:focus-visible { outline-offset: 1px; border-color: var(--accent); }

.toggle {
  min-height: 48px; display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px; cursor: pointer;
  background: transparent; color: var(--ink);
  border: 1px solid var(--ink); border-radius: var(--r-sm);
  font: 600 15px/1.2 var(--sans); white-space: nowrap;
  transition: background-color 180ms var(--ease), color 180ms var(--ease);
}
.toggle .box {
  width: 16px; height: 16px; border: 1.5px solid currentColor; border-radius: 1px;
  display: grid; place-items: center;
}
.toggle[aria-pressed="true"] { background: var(--ink); color: var(--bone); }
.toggle[aria-pressed="true"] .box::after { content: ""; width: 8px; height: 8px; background: currentColor; }
.toggle:active { transform: scale(0.97); }
.toggle .count { font-family: var(--mono); font-weight: 500; }
.status { color: var(--muted); padding-bottom: 14px; white-space: nowrap; }

.row {
  position: relative;
  display: grid;
  grid-template-columns: 88px 200px minmax(0, 1fr) 300px 132px;
  gap: 32px; align-items: center;
  padding-block: 28px;
  border-bottom: 1px solid var(--line);
  background-image: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 14px);
  background-size: 0% 2px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size 300ms var(--ease), background-color 180ms var(--ease);
  animation: rise 500ms var(--ease) both;
}
.row[hidden] { display: none; }
.row { scroll-margin-top: 150px; }
.row:nth-child(2) { animation-delay: 70ms; }
.row:nth-child(3) { animation-delay: 140ms; }
.row:nth-child(4) { animation-delay: 210ms; }
.row:nth-child(5) { animation-delay: 280ms; }
.row:nth-child(6) { animation-delay: 350ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.row-num {
  font: 400 clamp(56px, 5vw, 80px)/0.9 var(--display); letter-spacing: -0.04em;
  color: var(--ink);
}
.row-img { overflow: hidden; border-radius: var(--r-sm); aspect-ratio: 4 / 3; background: var(--surface); }
.row-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease); }
.row-cat { color: var(--accent); margin-bottom: 8px; }
.row-title {
  font: 400 clamp(30px, 2.6vw, 40px)/1.05 var(--display); letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.row-sum { color: var(--muted); max-width: 52ch; font-size: 16px; line-height: 1.55; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.facts dt { color: var(--muted); font: 600 11px/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.facts dd { font: 500 16px/1.35 var(--sans); font-variant-numeric: tabular-nums; }
.facts .price { font: 400 26px/1 var(--display); letter-spacing: -0.01em; }
.row-act { display: grid; gap: 10px; justify-items: end; }
.open {
  min-height: 44px; padding: 10px 18px;
  background: none; border: 1px solid var(--ink); border-radius: var(--r-sm); color: var(--ink);
  font: 600 15px/1.2 var(--sans); cursor: pointer; white-space: nowrap;
  transition: background-color 180ms var(--ease), color 180ms var(--ease);
}
/* stretch the open control across the row so the whole entry is a target */
.open::after { content: ""; position: absolute; inset: 0; }
.open:active { transform: scale(0.97); }
.row:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
.open:focus-visible { outline: none; background: var(--ink); color: var(--bone); }
.mark {
  display: none;
  align-items: center; gap: 6px;
  color: var(--accent);
}
.mark svg { width: 14px; height: 14px; }
.row.is-saved .mark { display: inline-flex; animation: stamp 260ms var(--ease) both; }
.row.is-saved .row-num { color: var(--accent); }
@keyframes stamp { from { opacity: 0; transform: scale(1.3) rotate(-6deg); } to { opacity: 1; transform: none; } }

.empty {
  padding: 64px 24px; text-align: center;
  border-top: 1px solid var(--line);
}
.empty h3 { font: 400 clamp(32px, 4vw, 48px)/1.05 var(--display); letter-spacing: -0.02em; margin-bottom: 12px; }
.empty p { color: var(--muted); margin: 0 auto 24px; max-width: 46ch; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }

/* ---------- Visiting band ---------- */
.visiting {
  background: var(--accent); color: var(--accent-ink);
  padding-block: 128px;
  overflow: clip;
}
.visiting :focus-visible { outline-color: var(--accent-ink); }
.visit-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px; align-items: start; }
.visit-grid h2 {
  grid-column: 1 / span 5;
  font: 400 clamp(44px, 5.6vw, 84px)/0.98 var(--display); letter-spacing: -0.035em;
}
.visit-grid h2 em { display: block; }
.notions { grid-column: 7 / span 6; counter-reset: notion; }
.notions li {
  display: grid; grid-template-columns: 64px 1fr; gap: 16px;
  padding-block: 20px; border-top: 1px solid rgba(247, 241, 234, 0.3);
  counter-increment: notion;
}
.notions li:last-child { border-bottom: 1px solid rgba(247, 241, 234, 0.3); }
.notions li::before {
  content: counter(notion, upper-alpha);
  font: 400 40px/1 var(--display);
}
.notions strong { display: block; font: 600 18px/1.35 var(--sans); margin-bottom: 4px; }
.notions span { color: #eadbd2; font-size: 16px; }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: var(--bone); padding-block: 64px 48px; }
.foot-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px 32px; }
.foot-word { grid-column: 1 / span 6; font: 400 clamp(56px, 9vw, 140px)/0.85 var(--display); letter-spacing: -0.045em; }
.foot-notes { grid-column: 8 / span 5; color: var(--bone-muted); font-size: 15px; display: grid; gap: 12px; align-content: end; }
.foot-notes a { color: var(--bone); text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 44px; }
.foot-notes a:active { transform: scale(0.98); }

/* ---------- Detail dialog ---------- */
.detail {
  width: min(1080px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  padding: 0; border: 0; border-radius: var(--r-md);
  background: var(--bg); color: var(--ink);
  overflow: auto;
}
.detail::backdrop { background: rgba(26, 24, 23, 0.72); }
.detail[open] { animation: open 240ms var(--ease) both; }
@keyframes open { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.detail-inner { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 560px; }
.detail-media { position: relative; background: var(--surface); }
.detail-media img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.detail-media .credit {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(26, 24, 23, 0.82); color: var(--bone); padding: 6px 10px; border-radius: var(--r-sm);
  font-size: 12px;
}
.detail-body { padding: 40px 48px 40px; display: grid; gap: 24px; align-content: start; position: relative; }
.detail-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.detail-top .label { color: var(--accent); }
.close {
  min-height: 44px; min-width: 44px; padding: 8px 14px;
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
  font: 600 14px/1 var(--sans); color: var(--ink);
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease);
}
.close:active { transform: scale(0.97); }
.close svg { width: 14px; height: 14px; }
.detail-num { font: 400 96px/0.8 var(--display); letter-spacing: -0.05em; color: var(--accent); }
.detail-title { font: 400 clamp(40px, 4.4vw, 64px)/1 var(--display); letter-spacing: -0.03em; }
.detail-text { font-size: 18px; line-height: 1.65; max-width: 48ch; }
.detail .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-block: 20px; border-block: 1px solid var(--line); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.save { background: var(--accent); color: var(--accent-ink); min-width: 230px; }
.save svg { width: 16px; height: 16px; }
.save[aria-pressed="true"] { background: var(--ink); color: var(--bone); }
.save[aria-pressed="true"] .ico-add, .save[aria-pressed="false"] .ico-done { display: none; }
.save-note { color: var(--muted); font-size: 15px; }

/* ---------- Hover (pointer devices only) ---------- */
@media (hover: hover) and (pointer: fine) {
  .nav a:hover, .nav button:hover { border-color: var(--line-dark); background: var(--ink-2); }
  .wordmark:hover { color: #fff; }
  .btn-invert:hover { background: #fff; }
  .btn-invert:hover .arrow { transform: translateY(3px); }
  .contents a:hover { padding-left: 8px; color: #fff; }
  .contents a:hover .n { color: var(--bone); }
  .field input:hover, .field select:hover { border-color: var(--ink); background-color: #f6f3ee; }
  .toggle:hover { background: var(--surface); }
  .toggle[aria-pressed="true"]:hover { background: var(--ink-2); }
  .row:hover { background-size: 100% 2px; background-color: #ede9e2; }
  .row:hover .row-img img { transform: scale(1.02); }
  .row:hover .open { background: var(--ink); color: var(--bone); }
  .btn-accent:hover, .save:hover { background: var(--accent-deep); }
  .save[aria-pressed="true"]:hover { background: var(--ink-2); }
  .close:hover { border-color: var(--ink); background: var(--surface); }
  .foot-notes a:hover { color: #fff; text-decoration-thickness: 2px; }
}
.row:focus-within { background-size: 100% 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .row { grid-template-columns: 64px 160px minmax(0, 1fr) 240px; }
  .row-act { grid-column: 3 / -1; justify-items: start; grid-auto-flow: column; justify-content: start; align-items: center; }
  .contents { grid-column: 5 / span 4; }
  .hero-lead { grid-column: 1 / span 4; }
  .plate { grid-column: 9 / span 4; }
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .hero-lead { grid-column: 1 / -1; }
  .contents { grid-column: 1 / span 1; }
  .plate { grid-column: 2 / span 1; }
  .section-head h2, .section-head p { grid-column: 1 / -1; }
  .controls { grid-template-columns: 1fr 1fr; position: static; }
  .controls .field:first-child { grid-column: 1 / -1; }
  .status { padding-bottom: 0; }
  .row { grid-template-columns: 56px 120px minmax(0, 1fr); gap: 16px 20px; align-items: start; }
  .row-main { grid-column: 3; }
  .facts { grid-column: 2 / -1; }
  .row-act { grid-column: 2 / -1; }
  .visit-grid h2, .notions { grid-column: 1 / -1; }
  .foot-word, .foot-notes { grid-column: 1 / -1; }
  .sideways { display: none; }
  .detail-inner { grid-template-columns: 1fr; min-height: 0; }
  .detail-media { aspect-ratio: 16 / 9; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .topbar { flex-wrap: wrap; }
  .nav { margin-inline-end: calc(-1 * var(--gutter)); padding-inline-end: 24px; }
  .hero-kicker .label:last-child { display: none; }
  .hero-grid { grid-template-columns: 1fr; padding-block: 32px 40px; }
  .contents, .plate { grid-column: 1 / -1; }
  .plate img { aspect-ratio: 16 / 10; }
  .workshops { padding-block: 64px 96px; }
  .controls { grid-template-columns: 1fr; }
  .toggle { justify-content: center; }
  .row { grid-template-columns: 1fr 1fr; gap: 16px; padding-block: 24px; }
  .row-num { grid-column: 1; grid-row: 1; font-size: 56px; align-self: end; }
  .row-img { grid-column: 2; grid-row: 1; }
  .row-main, .facts, .row-act { grid-column: 1 / -1; }
  .row-act { grid-auto-flow: row; justify-items: stretch; }
  .open { width: 100%; }
  .visiting { padding-block: 72px; }
  .detail { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  .detail-body { padding: 24px 20px 32px; gap: 20px; }
  .detail-top { position: sticky; top: 0; z-index: 2; background: var(--bg); margin: -24px -20px 0; padding: 12px 20px; border-bottom: 1px solid var(--line); }
  .detail-num { font-size: 64px; }
  .detail .facts { grid-template-columns: 1fr 1fr; }
  .save { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .giant span, .row, .detail[open], .row.is-saved .mark { animation-name: fadeonly; }
  .cutline .scissors { animation: none; left: 0; }
  .row, .row-img img, .btn, .open, .toggle, .contents a { transition-property: opacity, background-color, color, border-color; }
  .row:hover .row-img img { transform: none; }
  .btn:active, .open:active, .toggle:active, .close:active, .nav a:active, .nav button:active { transform: none; }
}
@keyframes fadeonly { from { opacity: 0; } to { opacity: 1; } }
