/* Sheet & Slot — cobalt on sand, Rokkitt / Literata, the split stage */

:root {
  --bg: #e6dbc7;        /* paper: the reading column */
  --surface: #ddd0b9;   /* page ground, one tone down */
  --ink: #062b8a;       /* the one cobalt */
  --muted: #3a5aa8;
  --accent-ink: #e6dbc7;

  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);
  --step-head: clamp(1.75rem, 7cqi, 2.9rem);
  --step-display: 19cqi;

  --gap: 12px;
  --pad: clamp(20px, 8cqi, 60px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: "Literata", Georgia, "Times New Roman", serif;
  font-size: var(--step-body);
  line-height: 1.6;
  font-variant-numeric: lining-nums;
}
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
h1, h2, h3, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 4px; }
:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }
::selection { background: var(--ink); color: var(--bg); }
p { text-wrap: pretty; }

h1 {
  font-size: var(--step-head);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-wrap: balance;
  max-width: 13em;
}
h2 {
  font-family: "Rokkitt", "Rockwell", Georgia, serif;
  font-weight: 800;
  font-size: var(--step-head);
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h3 { font-size: var(--step-lead); font-weight: 600; line-height: 1.25; }
.narrow { max-width: 34ch; }

/* ── the one button ── */
.button {
  display: inline-block;
  background: var(--ink);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  line-height: 1;
  padding: 1.05em 1.5em;
  text-decoration: none;
  border: 0;
  transition: transform 0.18s var(--ease), background-color 0.18s;
}
.button:hover { transform: translateY(-3px); background: var(--muted); }
.button:active { transform: translateY(1px) scale(0.98); }
.field .button, .close .button.on-field { background: var(--bg); color: var(--ink); }
.field .button:hover { background: var(--surface); }
.text-link { font-weight: 600; margin-left: 1.2em; }

/* ── the plywood edge: alternating bars of ink and paper ── */
.ply { width: 100%; height: 56px; fill: var(--ink); flex: none; }
.ply-foot { height: 8px; }

/* ════════ the split ════════ */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--gap);
  padding: var(--gap);
  align-items: start;
}
.read { background: var(--bg); container-type: inline-size; }
.stage {
  position: sticky;
  top: var(--gap);
  height: calc(100svh - 2 * var(--gap));
  background: var(--ink);
  overflow: hidden;
  container-type: inline-size;
}

/* scenes crossfade slowly, like light shifting on the sheet */
.scene {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.scene.is-on { opacity: 1; }
.scene .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scene .warm, .close-ground { filter: sepia(0.55) saturate(1.5) brightness(1.06); }
.scene figcaption {
  position: absolute; left: 0; bottom: 0;
  background: var(--bg); color: var(--ink);
  font-size: var(--step-small); line-height: 1.45;
  padding: 12px 16px; max-width: min(40ch, 86%);
}
@keyframes drift { from { transform: scale(1); } to { transform: scale(1.07); } }
.scene.is-on .drift { animation: drift 24s ease-in-out infinite alternate; }

/* the sheet, drawn to scale on its photograph */
.sheet {
  position: absolute;
  top: 3.5%; left: 50%;
  height: 84%; aspect-ratio: 1 / 2;
  transform: translateX(-50%);
  background: #d9d5cd;
}
.sheet img { width: 100%; height: 100%; object-fit: cover; filter: sepia(0.55) saturate(1.5) brightness(1.06); }
.nest { position: absolute; inset: 0; width: 100%; height: 100%; }
.order-a { fill: var(--ink); }
.order-b { fill: none; stroke: var(--ink); stroke-width: 10; }
.order-c { fill: var(--muted); }
.labels { opacity: 0; transition: opacity 1.2s ease; }
.labels rect { fill: var(--bg); }
.labels path { fill: var(--ink); }
.stage[data-mode="labels"] .labels { opacity: 1; }
.cap-labels { display: none; }
.stage[data-mode="labels"] .cap-nest { display: none; }
.stage[data-mode="labels"] .cap-labels { display: inline; }

.exploded {
  position: absolute; left: 50%; top: 46%;
  height: 74%; width: auto; max-width: 84%;
  transform: translate(-50%, -50%);
  fill: var(--ink);
}
.exploded .dots { fill: var(--muted); }

/* ════════ the reading column ════════ */
.read > * { padding: clamp(72px, 16cqi, 132px) var(--pad); }
.read > * > * + * { margin-top: 1.25em; }
.field { background: var(--ink); color: var(--accent-ink); }
.field ::selection { background: var(--bg); color: var(--ink); }

/* hero: a printed card */
.hero {
  padding: 0 !important;
  min-height: calc(100svh - 2 * var(--gap));
  display: flex; flex-direction: column;
}
.hero > * + * { margin-top: 0 !important; }
.hero-body { padding: clamp(28px, 7cqi, 56px) var(--pad) 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.hero-body > * + * { margin-top: 1.4rem; }
.wordmark {
  font-family: "Rokkitt", "Rockwell", Georgia, serif;
  font-weight: 800;
  font-size: var(--step-display);
  line-height: 0.85;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin-left: -0.03em;
  white-space: nowrap;
}
.wordmark span { display: block; }
.lead { font-size: var(--step-lead); line-height: 1.4; max-width: 30ch; }
.hero-links { padding: 28px var(--pad); display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: var(--step-body); }
.hero-links a { text-decoration: none; font-weight: 600; padding: 6px 0; transition: transform 0.18s var(--ease); }
.hero-links a:hover { transform: translateY(-2px); text-decoration: underline; text-decoration-thickness: 3px; }

/* intro: a narrow column and untouched ground */
.intro { padding-top: clamp(48px, 10cqi, 72px) !important; }
.intro p { max-width: 21.5rem; }
.intro .first { font-weight: 600; font-size: var(--step-lead); line-height: 1.35; }
.intro a { color: var(--ink); }

/* the cell: an itinerary on a slip */
.slip {
  position: relative;
  background: var(--bg); color: var(--ink);
  max-width: 30rem;
  padding: 28px 26px 34px;
  margin-top: 2.4em !important; margin-bottom: 2.6em;
  font-variant-numeric: tabular-nums lining-nums;
}
.slip-title { font-weight: 600; font-size: var(--step-lead); line-height: 1.2; }
.slip-note { color: var(--muted); font-size: var(--step-small); margin-top: 2px; }
.slip h3 { font-size: var(--step-body); font-weight: 600; margin-top: 28px; }
.rows li { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.rows span { flex: none; max-width: 72%; }
.rows i {
  flex: 1; height: 0; min-width: 16px; align-self: center;
  border-bottom: 4px dotted currentColor;
}
.rows b { font-weight: 400; flex: none; }
.slip-total {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--ink); color: var(--accent-ink);
  min-height: 44px; padding: 8px 14px; margin: 28px -10px 0;
  font-weight: 600;
}
.zigzag { position: absolute; left: 0; top: 100%; width: 100%; height: 12px; fill: var(--bg); }

/* the plans: a heading that holds while the rows pass */
.plans { display: grid; grid-template-columns: 1fr; gap: 0; }
.blocks { margin-top: 2.2em !important; }
.blocks article + article { margin-top: clamp(72px, 14cqi, 112px); }
.blocks article > * + * { margin-top: 1em; }
.blocks p, .blocks ul { max-width: 38ch; }
.plain li + li { margin-top: 0.55em; }
.blocks figure { max-width: 26rem; }
.blocks article:nth-child(odd) figure { margin-left: auto; }
.blocks figure img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface); }
figcaption { font-size: var(--step-small); line-height: 1.45; color: var(--muted); margin-top: 8px; }

/* four checks: one tall printed sheet */
.checks { padding-top: clamp(56px, 12cqi, 96px) !important; padding-bottom: clamp(56px, 12cqi, 96px) !important; }
.menu { position: relative; background: var(--bg); color: var(--ink); margin: 14px 0; }
.menu-body { padding: clamp(28px, 7cqi, 56px) clamp(20px, 6cqi, 48px); }
.scallop { position: absolute; left: 0; width: 100%; height: 14px; fill: var(--bg); }
.scallop.top { bottom: 100%; }
.scallop.bottom { top: 100%; }
.menu-note { font-size: var(--step-small); color: var(--muted); max-width: 36ch; margin-top: 10px; }
.menu h3 { margin-top: 48px; }
.menu dl > div, .prices > div {
  display: grid; grid-template-columns: 1fr auto; column-gap: 20px; align-items: baseline;
  margin-top: 16px;
}
.menu dt, .prices dt { font-weight: 400; }
.menu dd, .prices dd { text-align: right; font-variant-numeric: tabular-nums lining-nums; }
.menu dd { font-style: italic; }
dd.desc {
  grid-column: 1 / -1; text-align: left; font-style: normal;
  font-size: var(--step-small); color: var(--muted); max-width: 36ch; line-height: 1.45;
}

/* costs: set like a menu */
.costs h3 { margin-top: 0; }
.costs h3 small { font-size: var(--step-small); font-weight: 400; color: var(--muted); margin-left: 0.6em; }
.price-group { margin-top: 48px !important; }
.prices dt { font-weight: 600; }
.total {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 20px;
  background: var(--surface);
  padding: 18px 20px; margin: 56px calc(var(--pad) * -0.33) 0 !important;
  font-size: var(--step-lead); line-height: 1.2;
}
.total b { font-weight: 600; }

/* ════════ the calculator: full width, the one break in the split ════════ */
.numbers { padding: clamp(72px, 9vw, 150px) clamp(20px, 5vw, 80px); container-type: inline-size; }
.numbers-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px); align-items: start;
  max-width: 1320px; margin: 0 auto;
}
.numbers h2 { font-size: clamp(2rem, 1.2rem + 3vw, 2.9rem); }
.plate-col { position: sticky; top: 32px; }
.plate-col > * + * { margin-top: 1.2rem; }
.plate {
  background: var(--bg);
  aspect-ratio: 1 / 1; width: 100%; max-width: 34rem;
  padding: clamp(14px, 3%, 28px);
  display: flex; align-items: flex-start;
}
.tiles { display: grid; gap: 5px; width: 100%; grid-template-columns: repeat(8, 1fr); }
.tiles i {
  display: block; aspect-ratio: 1 / 2; background: var(--ink);
  animation: tile-in 0.35s var(--ease) both;
}
.tiles i:nth-child(3n) { background: var(--muted); }
@keyframes tile-in { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.plate-caption { font-size: var(--step-body); max-width: 34ch; }

.calc-col > * + * { margin-top: 2.2rem; }
.presets { display: flex; flex-wrap: wrap; gap: 4px 28px; }
.presets button {
  font: inherit; font-size: var(--step-lead); color: var(--accent-ink); opacity: 1;
  background: none; border: 0; padding: 8px 0; cursor: pointer;
  text-decoration: underline transparent 3px; text-underline-offset: 0.3em;
  transition: transform 0.18s var(--ease), text-decoration-color 0.18s;
}
.presets button:hover { transform: translateY(-2px); }
.presets button[aria-pressed="true"] { font-weight: 600; text-decoration-color: currentColor; }

.result-label { font-size: var(--step-lead); font-weight: 600; }
.figure {
  font-family: "Rokkitt", "Rockwell", Georgia, serif; font-weight: 800;
  font-size: clamp(3.4rem, 1.4rem + 8.4cqi, 8rem);
  line-height: 0.9; letter-spacing: -0.01em; white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
  margin-top: 6px;
}
.result-note { max-width: 36ch; margin-top: 12px; }

.controls { display: grid; gap: 22px; }
.controls label { display: grid; grid-template-columns: 1fr auto; column-gap: 16px; row-gap: 6px; align-items: baseline; }
.controls label output { font-weight: 600; font-variant-numeric: tabular-nums lining-nums; }
.controls input[type="range"] { grid-column: 1 / -1; }
.controls .check { grid-template-columns: auto 1fr; align-items: center; }
.controls .check input { width: 22px; height: 22px; accent-color: var(--bg); margin: 0; }
.controls details { margin-top: 6px; }
.controls summary { cursor: pointer; font-weight: 600; padding: 8px 0; width: fit-content; }
.controls summary:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.25em; }
.more { display: grid; gap: 22px; padding-top: 18px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 8px; background: var(--muted); }
input[type="range"]::-moz-range-track { height: 8px; background: var(--muted); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px;
  background: var(--bg); border: 0; border-radius: 0;
  transition: transform 0.15s var(--ease);
}
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; background: var(--bg); border: 0; border-radius: 0; }
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(0.94); }
input[type="range"]:disabled { cursor: default; }
input[type="range"]:disabled::-webkit-slider-thumb { background: var(--muted); }
input[type="range"]:disabled::-moz-range-thumb { background: var(--muted); }

.per-order { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums lining-nums; }
.per-order caption { text-align: left; font-weight: 600; font-size: var(--step-lead); padding-bottom: 10px; }
.per-order th { text-align: left; font-weight: 400; padding: 5px 0; }
.per-order td { text-align: right; padding: 5px 0; }
.per-order tr:first-child th, .per-order tr:first-child td { font-weight: 600; padding-bottom: 12px; }
.per-order .left-over th, .per-order .left-over td {
  background: var(--bg); color: var(--ink); font-weight: 600; padding: 12px 14px;
}
.per-order .left-over th { padding-right: 0; }
.per-order tr:nth-last-child(2) th, .per-order tr:nth-last-child(2) td { padding-bottom: 14px; }

.cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.cells p { background: var(--muted); padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 6px; min-height: 104px; justify-content: space-between; }
.cells span { font-size: var(--step-small); line-height: 1.3; }
.cells b { font-size: var(--step-lead); font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums lining-nums; }
.fine { font-size: var(--step-small); max-width: 52ch; line-height: 1.5; }

/* ════════ split B ════════ */
.parties > div + div { margin-top: 2em; }
.parties { margin-top: 2.6em !important; }
.parties dt { font-weight: 600; font-size: var(--step-lead); line-height: 1.25; }
.parties dd { max-width: 38ch; margin-top: 6px; }

.questions { background: var(--surface); }
.facts { margin-top: 1.8em !important; font-size: var(--step-lead); line-height: 1.35; }
.facts li + li { margin-top: 0.35em; }
.faq { margin-top: 3em !important; }
.faq details + details { margin-top: 28px; }
.faq summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  font-size: var(--step-lead); font-weight: 600; line-height: 1.25; min-height: 44px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 12px; height: 12px; margin-right: 4px;
  border-right: 3px solid currentColor; border-bottom: 3px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.25s var(--ease);
}
.faq details[open] summary::after { transform: translateY(3px) rotate(225deg); }
.faq summary:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.2em; }
.faq p { max-width: 40ch; margin-top: 10px; }
.after-faq { margin-top: 3em !important; }

.phone-figure { display: none; }

/* ════════ the close ════════ */
.close {
  position: relative; overflow: hidden;
  min-height: 90svh;
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(28px, 6vw, 96px); align-items: center;
  padding: clamp(64px, 8vw, 120px) clamp(20px, 5vw, 80px);
  container-type: inline-size;
}
.close-ground { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.close > :not(.close-ground) { position: relative; z-index: 1; }
.close-pic { align-self: center; }
.close-pic img { width: 100%; }
.close-pic figcaption { color: var(--ink); max-width: 46ch; }
.close-text > * + * { margin-top: 1.4rem; }
.close h2 { font-size: clamp(2rem, 1.2rem + 3vw, 2.9rem); max-width: 9em; }
.close-text p { max-width: 38ch; }

/* ════════ sources and the last line ════════ */
.sources {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px clamp(28px, 6vw, 96px);
  padding: clamp(64px, 8vw, 110px) clamp(20px, 5vw, 80px) 30svh;
  font-size: var(--step-small); line-height: 1.6;
}
.sources h2 { font-family: inherit; font-size: var(--step-body); font-weight: 600; letter-spacing: 0; line-height: 1.3; margin-bottom: 8px; }
.sources p { max-width: 58ch; color: var(--muted); }
.sources a { color: var(--ink); text-decoration-thickness: 1.5px; }
.foot {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 12px 24px;
  padding: 26px clamp(20px, 5vw, 80px) 30px;
  font-size: var(--step-small); color: var(--muted);
}
.foot nav { display: flex; gap: 24px; }
.foot a { color: var(--ink); text-decoration: none; font-weight: 600; }
.foot a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.foot-right { text-align: right; }

/* ════════ entrances ════════ */
.js [data-r] {
  opacity: 0; transform: translateY(26px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.js [data-r].is-in { opacity: 1; transform: none; }

/* ════════ phone and tablet: the stage leads, the card overlaps it ════════ */
@media (max-width: 999px) {
  .split { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
  .stage { position: relative; top: 0; order: -1; height: 44svh; min-height: 320px; }
  .split .read { position: relative; z-index: 1; margin-top: -24px; }
  .split-b .stage { height: 62svh; }
  .split-b .read { margin-top: 0; }
  .hero { min-height: 0; }
  .hero-body { padding-top: 34px; padding-bottom: 8px; }
  .ply { height: 40px; }
  .ply-foot { height: 8px; }
  .scene figcaption { max-width: 100%; right: 0; bottom: 24px; }
  .sheet { top: 4%; height: 66%; }
  .cap-more { display: none; }
  .split-b .scene figcaption { bottom: 0; }
  .stage[data-stage] .scene:not(:first-of-type) { display: none; }
  .stage .scene:first-of-type { opacity: 1; }
  .stage[data-mode] .labels { opacity: 0; }
  .stage[data-mode] .cap-nest { display: inline; }
  .stage[data-mode] .cap-labels { display: none; }
  .intro p { max-width: 78%; }
  .phone-figure { display: block; }
  .phone-figure img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
  .field .phone-figure figcaption { color: var(--accent-ink); }
  .blocks article:nth-child(odd) figure { margin-left: 0; }
  .blocks figure { max-width: none; }
  .total { margin-left: 0 !important; margin-right: 0 !important; }

  .numbers-grid { grid-template-columns: 1fr; }
  .plate-col { position: static; display: contents; }
  .numbers-grid > .calc-col { display: contents; }
  .numbers-grid h2 { order: 1; }
  .numbers-grid .plate-col > .narrow { order: 2; margin-top: -12px; }
  .presets { order: 3; }
  .result {
    order: 4; position: sticky; top: 0; z-index: 3;
    background: var(--ink); margin: 0 -20px; padding: 12px 20px 14px;
  }
  .result-note { display: none; }
  .controls { order: 5; }
  .plate { order: 6; max-width: none; }
  .plate-caption { order: 7; margin-top: -16px; }
  .per-order { order: 8; }
  .cells { order: 9; grid-template-columns: 1fr; }
  .cells p { min-height: 0; flex-direction: row; align-items: baseline; }
  .numbers-grid noscript { order: 10; }
  .fine { order: 11; }
  .numbers-grid { gap: 30px; }
  .figure { font-size: clamp(3rem, 15vw, 6rem); }
  .result-label { font-size: var(--step-body); }

  .close { grid-template-columns: 1fr; min-height: 0; align-items: start; }
  .sources { grid-template-columns: 1fr; padding-bottom: 20svh; }
  .foot { grid-template-columns: 1fr; gap: 8px; padding-bottom: 24px; }
  .foot nav { flex-wrap: wrap; gap: 6px 20px; }
  .foot-right { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scene, .labels { transition: none; }
  .scene.is-on .drift, .tiles i { animation: none; }
  .js [data-r] { opacity: 1; transform: none; transition: none; }
  .button, .hero-links a, .presets button { transition: none; }
}
