/* Little Tokyo Story Wall: base layer.
   Reset · washi ground · typography · links · focus · selection · reduced motion.
   Intentionally leaves <video> and <canvas> untouched: MindAR sizes its camera video
   larger than the viewport on purpose and must not be clamped. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background-color: var(--c-cream);
  color: var(--c-ink);
  hanging-punctuation: first last;
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ol, ul {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

img,
picture {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  flex-shrink: 0;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  touch-action: manipulation;
}

textarea {
  resize: vertical;
}

[hidden] {
  display: none !important;
}

/* ── Washi ground ──────────────────────────────────────────────────────── */
body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: var(--lh-body);
  color: var(--c-ink);
  background-color: var(--c-cream);
  background-image: var(--paper-texture);
  background-size: var(--paper-tile) var(--paper-tile);
  background-repeat: repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  overflow-wrap: break-word;
}

/* While a sheet or reading card is open (set by js/lib/dialog.js). */
html.ltsw-locked,
html.ltsw-locked body {
  overflow: hidden;
  overscroll-behavior: none;
}

/* ── Typography ────────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: 0.005em;
  text-wrap: balance;
}

h1 { font-size: var(--fs-question); }
h2 { font-size: var(--fs-title); }
h3 { font-size: var(--fs-lead); }
h4 { font-size: var(--fs-body); }

p,
li,
dd {
  text-wrap: pretty;
}

small {
  font-size: var(--fs-small);
}

strong,
b {
  font-weight: 700;
}

/* Japanese text: proportional punctuation and strict line breaking. */
:lang(ja) {
  font-feature-settings: "palt" 1;
  line-break: strict;
  letter-spacing: 0.04em;
}

/* ── Links ─────────────────────────────────────────────────────────────── */
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--c-vermilion);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color var(--dur-fast) var(--ease-out), text-decoration-color var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--c-vermilion-ink);
}

/* ── Focus ─────────────────────────────────────────────────────────────── */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--c-vermilion-ink);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: rgba(192, 70, 47, 0.2);
  color: var(--c-ink);
}

/* ── Utilities ─────────────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--c-ink-2);
}

.rule {
  display: block;
  width: var(--rule-len);
  height: var(--rule-w);
  border: 0;
  margin: 0;
  background: var(--c-vermilion);
}

.rule--full {
  width: 100%;
  height: 1px;
  background: var(--c-line);
}

.vertical-jp {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-display);
  letter-spacing: 0.3em;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ── Reduced motion ────────────────────────────────────────────────────── */
/* Safety net for every page: no travel, no loops. The shared components (notes, sheet,
   reading card, toasts) opt out of the net because they define their own opacity-only
   versions in components.css. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  :not(.note, .sheet, .sheet__panel, .sheet__backdrop, .reading-card, .reading-card__panel,
    .reading-card__backdrop, .toast, .pill, .fab-add),
  :not(.note, .sheet__panel, .reading-card__panel, .toast, .pill)::before,
  :not(.note, .sheet__panel, .reading-card__panel, .toast, .pill)::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-delay: 0s !important;
    transition-duration: 1ms !important;
  }
}
