/* Sei Gradi: the investigator's corkboard of the app, as a web page.
   Colours and fonts mirror the app (lib/core/theme/app_colors.dart, app_text.dart) and its design
   notes (design/sei_gradi/DESIGN.md): a single palette, no dark theme, like the app.
   Mobile first: written for 360px, widened at 780px and 1080px. */

/* ── 1. Fonts (the app's own files, subset to Latin; licences next to them) ── */
@font-face {
  font-family: "Special Elite";
  src: url("/assets/fonts/special-elite.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("/assets/fonts/literata.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("/assets/fonts/courier-prime-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* ── 2. Tokens (names follow AppColors) ── */
:root {
  color-scheme: light;
  --cork: #B4895C;
  --cork-deep: #6E4E2C;
  --board-dark: #231A12;
  --parchment: #F2DFD2;
  --poster: #FEEADD;
  --scrap: #E9D7CA;
  --notebook: #FFF8F5;
  --ruled: #E8DCB9;
  --ink: #231A12;
  --ink-soft: #58413E;
  --ink-light: #FFF8F5;
  --red: #912217;
  --red-string: #B23A2C;
  --ink-blue: #2B5782;
  --gold: #835D00;
  --outline: #8C716D;
  --outline-soft: #DFBFBA;
  --stamp-dark: #2A2018;

  --stamp: "Special Elite", "Courier New", monospace;
  --reading: "Literata", Georgia, "Times New Roman", serif;
  --mono: "Courier Prime", "Courier New", ui-monospace, monospace;

  --paper-shadow: 0 1px 1px rgba(35, 26, 18, .18), 0 4px 8px rgba(35, 26, 18, .16), 0 14px 28px rgba(35, 26, 18, .14);
  --container: min(100% - 32px, 620px);
  --header-h: 56px;
}

/* ── 3. Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--reading);
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--cork);
  background-image: url("/assets/cork.svg");
  overflow-wrap: break-word;
}
main { flex: 1; }
/* Vignette of the board, fixed to the window: the recessed frame of the app's CorkboardBackground. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 50%, rgba(46, 28, 10, .36) 100%);
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--ink-blue); text-underline-offset: 3px; }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--ink-blue); outline-offset: 3px; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0 0 .9em; }
p:last-child { margin-bottom: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
.container { width: var(--container); margin-inline: auto; }
.mono { font-family: var(--mono); font-weight: 700; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  padding: 10px 14px; background: var(--poster); color: var(--ink);
  font-family: var(--mono); font-weight: 700; box-shadow: var(--paper-shadow);
}
.skip-link:focus { top: 12px; }

/* ── 4. Materials: paper, pins, tilt, stamps ── */
.paper {
  position: relative;
  background: var(--poster);
  box-shadow: var(--paper-shadow);
  padding: 22px 18px 18px;
}
.ruled {
  background-color: var(--notebook);
  background-image: repeating-linear-gradient(to bottom, transparent 0 25px, var(--ruled) 25px 26px);
  background-position: 0 18px;
}
.pin {
  position: absolute; top: -8px; left: 50%; z-index: 2;
  width: 16px; height: 16px; margin-left: -8px; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #FAFAFA 0 12%, #A8A8A8 38%, #4A4A4A 100%);
  box-shadow: 1px 3px 3px rgba(0, 0, 0, .45);
}
.pin--red { background: radial-gradient(circle at 35% 32%, #FFB3A8 0 12%, var(--red-string) 42%, #4F0E08 100%); }
.tilt-l { rotate: -1deg; }
.tilt-r { rotate: .8deg; }
.stamp {
  display: inline-block;
  padding: 6px 10px 4px;
  border: 3px solid var(--red-string);
  color: var(--red);
  font-family: var(--stamp);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1.05;
  rotate: -7deg;
}
.kicker, .case-label, .facts, .label-strip, .step-num, .store-state, .fine-mono {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ── 5. Header ── */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--board-dark);
  color: var(--ink-light);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.header-inner {
  min-height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0 12px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  color: inherit; text-decoration: none;
  font-family: var(--stamp); font-weight: 700; font-size: 20px; text-transform: uppercase; letter-spacing: .02em;
}
.brand img { border-radius: 7px; }
.brand:hover { color: inherit; }
.menu-toggle {
  display: none;
  min-height: 44px; padding: 0 14px;
  border: 1px solid rgba(255, 248, 245, .45); background: transparent; color: inherit;
  font-family: var(--mono); font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer;
}
.site-nav { width: 100%; }
.nav-list { display: flex; flex-wrap: wrap; gap: 0 16px; padding-bottom: 8px; }
.nav-list a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  color: var(--ink-light); text-decoration: none; font-family: var(--mono); font-weight: 700; font-size: 14px;
}
.nav-list a:hover { text-decoration: underline; }
.nav-list .mono { color: var(--outline-soft); }
.js .menu-toggle { display: inline-block; }
.js .site-nav { display: none; }
.js .site-nav.is-open { display: block; }
.js .site-nav.is-open .nav-list { flex-direction: column; padding: 4px 0 12px; border-top: 1px solid rgba(255, 248, 245, .2); }

/* ── 6. Hero ── */
.hero { padding: 34px 0 48px; }
.hero-grid { display: grid; gap: 40px; }
.hero-copy { display: grid; gap: 26px; }
.title-card { padding: 26px 18px 20px; text-align: center; }
.stamp-title {
  display: block;
  color: var(--red-string);
  font-family: var(--stamp); font-weight: 700;
  font-size: clamp(46px, 15vw, 64px); line-height: 1; letter-spacing: -.02em; text-transform: uppercase;
}
.tagline {
  display: block; margin-top: 14px;
  color: var(--ink);
  font-family: var(--mono); font-weight: 700; font-size: 15px; line-height: 1.4; letter-spacing: .02em;
}
.lede { font-size: 17px; line-height: 26px; }
.ruled p { line-height: 26px; margin-bottom: 26px; }
.ruled p:last-child { margin-bottom: 0; }
.facts { color: var(--red); font-size: 13px; }
.stores { display: flex; flex-wrap: wrap; gap: 14px; }
.store {
  display: inline-flex; flex-direction: column; gap: 2px;
  min-width: 128px; padding: 10px 14px;
  background: var(--scrap); box-shadow: var(--paper-shadow);
  border: 1px dashed var(--outline);
}
.store-name { font-family: var(--stamp); font-weight: 700; font-size: 18px; line-height: 1.2; }
.store-state { color: var(--red); font-size: 12px; }

/* The real case: three cards on the board, joined by the red string. Positions are percentages
   of the board, so the strings in the SVG (same coordinates) always meet the pins. */
.case { position: relative; margin: 0; }
.case-board { position: relative; aspect-ratio: 1 / 1.2; }
.case-strings, .case-path { position: absolute; inset: 0; width: 100%; height: 100%; }
.case-strings { overflow: visible; }
.string {
  fill: none; stroke: var(--red-string); stroke-width: 2.5px; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .35));
}
.case-card {
  position: absolute;
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px 12px;
  background: var(--poster); box-shadow: var(--paper-shadow);
}
.case-card--start { left: 4%; top: 5%; width: 60%; rotate: -1.5deg; }
.case-card--hop { left: 36%; top: 38%; width: 60%; rotate: 1.2deg; }
.case-card--target { left: 6%; top: 72%; width: 56%; rotate: -.8deg; background: var(--parchment); }
.case-label { color: var(--ink-soft); font-size: 11px; line-height: 1.3; }
.case-title { font-family: var(--stamp); font-size: clamp(17px, 5vw, 22px); line-height: 1.15; }
.case-card--target .case-title { color: var(--red); font-weight: 700; }
.case-stamp {
  position: absolute; right: 2%; top: 86%;
  font-size: 15px; text-align: center; background: rgba(254, 234, 221, .85);
}
.case-stamp span { display: block; font-size: 13px; }
.case-caption {
  margin-top: 18px; padding: 12px 14px;
  background: var(--board-dark); color: var(--ink-light);
  font-size: 14px; line-height: 1.5;
}

/* String drawing: only when scripts run and the visitor accepts motion. */
@media (prefers-reduced-motion: no-preference) {
  .js .case .string { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.1s ease-out; }
  .js .case .string--late { transition-delay: 1s; }
  .js .case .case-stamp { opacity: 0; scale: 1.5; transition: opacity .25s ease-in 2.1s, scale .25s ease-in 2.1s; }
  .js .case.is-drawn .string { stroke-dashoffset: 0; }
  .js .case.is-drawn .case-stamp { opacity: 1; scale: 1; }
}

/* ── 7. Chapters ── */
.chapter { padding: 44px 0 52px; }
.chapter-head { display: grid; justify-items: start; gap: 0; margin-bottom: 30px; }
.label-strip {
  margin: 0; padding: 6px 12px;
  background: var(--board-dark); color: var(--ink-light); font-size: 12px;
}
.chapter-title {
  padding: 12px 16px 10px;
  background: var(--parchment); box-shadow: var(--paper-shadow);
  font-family: var(--stamp); font-weight: 700; font-size: clamp(28px, 8vw, 40px); line-height: 1.1;
}
.chapter-grid { display: grid; gap: 34px; justify-items: center; }
.chapter-grid > * { width: 100%; }
.chapter-grid > .photo { width: min(100%, 240px); }
.steps, .files, .notes { display: grid; gap: 26px; }
.step h3, .file h3 { font-family: var(--stamp); font-weight: 700; font-size: 22px; line-height: 1.2; margin-bottom: 6px; }
.step-num { display: inline-block; margin-bottom: 6px; padding: 2px 8px; border: 2px solid var(--red); color: var(--red); font-size: 13px; }
.file--daily { background: var(--parchment); }
.file--daily h3 { color: var(--red); }

.photo {
  position: relative; margin: 0;
  padding: 10px 10px 12px;
  background: var(--notebook); box-shadow: var(--paper-shadow);
}
.photo img { width: 100%; background: var(--board-dark); }
.photo figcaption { margin-top: 8px; font-family: var(--stamp); font-size: 15px; line-height: 1.3; text-align: center; }
.photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.dossier { padding: 26px 20px 22px; background: var(--parchment); }
.checklist { display: grid; gap: 12px; }
.checklist li { position: relative; padding-left: 30px; }
.checklist li::before {
  content: "✓"; position: absolute; left: 0; top: 1px;
  width: 20px; height: 20px; border: 2px solid var(--red); color: var(--red);
  font-family: var(--mono); font-weight: 700; font-size: 13px; line-height: 16px; text-align: center;
}
.dossier-links { display: flex; flex-wrap: wrap; gap: 0 22px; margin-top: 18px; font-family: var(--mono); font-weight: 700; font-size: 14px; }
.dossier-links a { display: inline-block; padding: 10px 0; }

.faq { padding: 22px 18px 14px; }
.faq details { border-bottom: 1px solid var(--outline-soft); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 8px 0; cursor: pointer; list-style: none;
  font-family: var(--stamp); font-weight: 700; font-size: 19px; line-height: 1.25;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; color: var(--red); font-family: var(--mono); font-size: 22px; }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding-bottom: 14px; line-height: 26px; }

.closing { padding: 30px 0 64px; }
.closing-card { padding: 30px 20px 24px; text-align: center; background: var(--parchment); }
.closing-card h2 { font-family: var(--stamp); font-weight: 700; font-size: clamp(26px, 7vw, 36px); line-height: 1.15; color: var(--red); }
.closing-card > p { margin: 12px 0 20px; }
.closing-card .stores { justify-content: center; }

/* ── 8. Document pages (terms, privacy, support, deletion) and 404 ── */
.board--doc { padding: 36px 0 64px; }
.doc { width: min(100% - 24px, 760px); margin-inline: auto; padding: 30px 20px 30px; background: var(--notebook); }
.doc-head { margin-bottom: 24px; padding-bottom: 18px; border-bottom: 2px solid var(--ink); }
.doc-head .kicker { color: var(--red); font-size: 12px; margin-bottom: 8px; }
.doc-title { font-family: var(--stamp); font-weight: 700; font-size: clamp(30px, 8vw, 44px); line-height: 1.1; }
.doc-body h2 { margin: 1.6em 0 .5em; font-family: var(--stamp); font-weight: 700; font-size: 22px; line-height: 1.25; }
.doc-body h3 { margin: 1.4em 0 .4em; font-family: var(--mono); font-weight: 700; font-size: 16px; }
.doc-body ul, .doc-body ol { margin: 0 0 1em; padding-left: 1.4em; }
.doc-body ul { list-style: disc; }
.doc-body ol { list-style: decimal; }
.doc-body li { margin-bottom: .35em; }
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; }
.doc-body table { border-collapse: collapse; min-width: 560px; font-size: 15px; line-height: 1.45; }
.doc-body th, .doc-body td { padding: 8px 10px; border: 1px solid var(--outline-soft); text-align: left; vertical-align: top; }
.doc-body th { background: var(--parchment); font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: .04em; }
.doc-back { margin-top: 28px; font-family: var(--mono); font-weight: 700; font-size: 14px; }
.doc-back a { display: inline-block; padding: 10px 0; }

/* ── 9. Invite bridge page ── */
.board--invite { display: grid; place-items: center; align-content: center; gap: 22px; min-height: 100vh; padding: 40px 16px; }
.invite-card { width: min(100%, 420px); padding: 34px 22px 24px; text-align: center; }
.invite-card .kicker { color: var(--ink-soft); font-size: 12px; margin-bottom: 10px; }
.invite-card .stamp-title { font-size: clamp(40px, 13vw, 54px); }
.invite-card .invite-text { margin: 16px 0 22px; font-size: 17px; line-height: 1.5; }
.invite-actions { display: grid; gap: 12px; }
.tab-button {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 18px;
  background: var(--red); color: var(--ink-light); box-shadow: 0 2px 4px rgba(35, 26, 18, .3);
  font-family: var(--mono); font-weight: 700; font-size: 16px; letter-spacing: .06em; text-decoration: none;
}
.tab-button:hover { color: var(--ink-light); background: #7A1C13; }
.tab-button:active { box-shadow: none; translate: 0 1px; }
.tab-button--ghost { background: var(--scrap); color: var(--red); border: 1px solid var(--outline); box-shadow: none; }
.tab-button--ghost:hover { background: var(--parchment); color: var(--red); }
.invite-card .fine { margin-top: 16px; color: var(--ink-soft); font-size: 14px; }
.invite-foot a { color: var(--ink); font-family: var(--mono); font-weight: 700; font-size: 14px; background: var(--poster); padding: 10px 14px; display: inline-block; box-shadow: var(--paper-shadow); }

/* ── 10. Footer ── */
.site-footer { background: var(--board-dark); color: var(--ink-light); padding: 34px 0 40px; }
.footer-grid { display: grid; gap: 16px; }
.footer-brand p { margin: 4px 0 0; font-family: var(--mono); font-weight: 700; font-size: 14px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 20px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-light); font-family: var(--mono); font-weight: 700; font-size: 14px; }
.site-footer a:hover { color: var(--outline-soft); }
.fine { display: block; font-size: 13px; line-height: 1.5; color: #D9C9BE; }
.site-footer .fine a { color: inherit; display: inline-block; padding: 4px 0; }

/* ── 11. Wider screens ── */
@media (min-width: 780px) {
  :root { --container: min(100% - 48px, 1120px); }
  .hero { padding: 56px 0 72px; }
  .hero-grid { gap: 56px; }
  .hero-copy, .case { width: min(100%, 620px); margin-inline: auto; }
  .case-board { aspect-ratio: 1 / .8; }
  .chapter { padding: 64px 0 72px; }
  .chapter-grid { grid-template-columns: minmax(0, 1fr) 240px; align-items: start; justify-items: stretch; gap: 48px; }
  .chapter-grid--photo-first { grid-template-columns: 240px minmax(0, 1fr); }
  .chapter-grid > .photo { width: 100%; }
  .chapter-grid:has(.photos) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .notes { max-width: 640px; }
  .notes > :nth-child(2) { margin-left: 8%; }
  .chapter-pair { display: grid; gap: 0 48px; }
  .closing-card { width: min(100%, 720px); margin-inline: auto; padding: 40px 32px 32px; }
  .doc { padding: 40px 44px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; }
  .footer-grid .fine { grid-column: 1 / -1; }
}
@media (min-width: 1080px) {
  .js .menu-toggle { display: none; }
  .js .site-nav, .site-nav { display: block; width: auto; }
  .nav-list { padding: 0; gap: 0 18px; }
  .stamp-title { font-size: 76px; }
  .tagline { font-size: 17px; }
  .steps { max-width: 640px; }
  .steps > :nth-child(2) { margin-left: 16%; }
  .steps > :nth-child(3) { margin-left: 6%; }
  .chapter-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; gap: 64px; }
  .hero-copy, .case { width: auto; }
  .case-board { aspect-ratio: 1 / .84; }
  .case-title { font-size: 26px; }
  .case-label { font-size: 12px; }
  .chapter-grid { grid-template-columns: minmax(0, 1fr) 260px; gap: 56px; }
  .chapter-grid--photo-first { grid-template-columns: 260px minmax(0, 1fr); }
  .files { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step, .file { padding: 26px 22px 22px; }
}
