/*
 * Field-note pages (/notes/<app>/). Hand-written, not generated: the pages
 * are built by scripts/build-stories.mjs, this file is their one stylesheet.
 *
 * The hall's paper and ink (#F5EDE0 / #1A1210, #0D0B08 / #F5E6D3) and its
 * wall-label ink for small print (#6B6459 / #A8A094). Every value is a copy of
 * src/lib/design/exhibit.ts; tests/design-tokens.test.mjs keeps them equal. Each page
 * sets --accent to its app's colour; the accent marks things (a dot, a rule,
 * a link underline) and never colours body text, the same rule as the
 * exhibit labels (src/lib/design/exhibit.ts).
 */

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

:root {
  --bg: #F5EDE0;
  --paper: #FBF6EE;
  --ink: #1A1210;
  --muted: #6B6459;
  --hair: rgba(15, 23, 42, 0.12);
  --accent: #C2410C;
  --measure: 40rem;
  --wide: 66rem;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0D0B08;
  --paper: #15120D;
  --ink: #F5E6D3;
  --muted: #A8A094;
  --hair: rgba(245, 232, 214, 0.16);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D0B08;
    --paper: #15120D;
    --ink: #F5E6D3;
    --muted: #A8A094;
    --hair: rgba(245, 232, 214, 0.16);
    color-scheme: dark;
  }
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Outfit', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic', Meiryo, system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.8;
}

:lang(ja) body, body:lang(ja) { line-height: 1.95; letter-spacing: 0.01em; }

a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; background: var(--paper); padding: 6px 10px; z-index: 2; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 18px 16px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.top a { text-decoration: none; color: var(--muted); padding: 10px 0; }
.top a:hover { color: var(--ink); }
.top .mark { color: var(--ink); font-weight: 500; letter-spacing: 0.24em; text-transform: none; }
.top nav { display: flex; gap: 20px; }

main { max-width: var(--measure); margin: 0 auto; padding: 24px 16px 40px; }

.kicker {
  margin: 24px 0 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }

h1 {
  font-family: 'Space Grotesk', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  font-weight: 700;
  font-size: clamp(1.9rem, 5.2vw, 2.9rem);
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
  text-wrap: balance;
}
:lang(ja) h1 { letter-spacing: 0; line-height: 1.35; }

.dek { font-size: 1.2rem; line-height: 1.6; color: var(--muted); margin: 0 0 20px; text-wrap: pretty; }

.byline {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-bottom: 24px;
  margin: 0 0 32px;
  border-bottom: 1px solid var(--hair);
}

.body h2 {
  font-family: 'Space Grotesk', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  font-size: 1.35rem;
  line-height: 1.35;
  margin: 2.6em 0 0.6em;
}
.body p, .body ul, .body ol { margin: 0 0 1.2em; text-wrap: pretty; }
.body ul, .body ol { padding-left: 1.3em; }
.body li { margin-bottom: 0.35em; }
.body li::marker { color: var(--accent); }
.body strong { font-weight: 600; }
.body code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.88em;
  background: var(--paper);
  border: 1px solid var(--hair);
  padding: 0.05em 0.35em;
  border-radius: 3px;
}
.body pre {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  background: var(--paper);
  border: 1px solid var(--hair);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 1.4em;
}
.body pre code { background: none; border: 0; padding: 0; }

.body blockquote {
  margin: 1.6em 0;
  padding: 0.2em 0 0.2em 1.1em;
  border-left: 3px solid var(--accent);
  font-size: 1.15rem;
  line-height: 1.65;
}
.body blockquote p { margin: 0; }

/* Screens: a row of phone captures that may run wider than the text. */
figure { margin: 2em 0; }
figure img { display: block; max-width: 100%; height: auto; }
figcaption {
  margin-top: 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  line-height: 1.6;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.shots {
  width: min(var(--wide), calc(100vw - 32px));
  margin-left: 50%;
  transform: translateX(-50%);
}
.shots .row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
}
.shots .row > * { scroll-snap-align: start; margin: 0; }
.shots .row img {
  width: 100%;
  border: 1px solid var(--hair);
  border-radius: 14px;
  background: var(--paper);
}
.shots .row figcaption { margin-top: 8px; }
@media (max-width: 640px) {
  .shots .row { grid-auto-columns: 62%; }
}

.wide img { width: 100%; border: 1px solid var(--hair); border-radius: 6px; }

.illustration img { border-radius: 6px; }
.illustration figcaption::before { content: "◇ "; color: var(--accent); }

/* Store badges and the text links beside them. */
.stores {
  margin: 2.4em 0;
  padding: 20px 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}
.stores .badges { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.stores .badge { display: inline-flex; line-height: 0; border-radius: 8px; }
.stores .badge-apple img { height: 40px; width: auto; }
/* Google's PNG carries its own clear space; this size matches Apple's 40px. */
.stores .badge-play img { height: 58px; width: auto; margin: -9px -8px; }
.stores .links { margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.textlink {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 8px 0;
  display: inline-block;
}

.exhibit {
  margin: 2.4em 0 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.exhibit a { display: inline-block; padding: 10px 0; }

.related { margin-top: 2.4em; }
.related h2 {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.related ul { list-style: none; padding: 0; margin: 0; }
.related li { border-top: 1px solid var(--hair); }
.related li:last-child { border-bottom: 1px solid var(--hair); }
.related a { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; text-decoration: none; }
.related a:hover .t { text-decoration: underline; text-decoration-color: var(--accent); }
.related .meta {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.related .t { font-size: 1rem; line-height: 1.5; }

.foot {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 24px 16px 48px;
  border-top: 1px solid var(--hair);
  font-size: 0.8rem;
  color: var(--muted);
}
.foot p { margin: 0 0 8px; }
.foot .legal { font-size: 0.7rem; line-height: 1.6; }
