/*
  Tokens, reset, and the room the game happens in.

  §16 asks for a warm independent bookstore and rules out the alternatives by
  name: no corporate UI, no neon, no gradient soup, no darkness. So the palette
  is paper, wood, ink and brass, the light comes from one side like a shopfront
  window, and every surface that carries text is a light one.

  Nothing here is themed to the OS. A bookstore at 2am is still warm, and a
  dark-mode inversion of cream and oak is a different, worse room.
*/

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

:root {
  /* Paper and ink */
  --paper: #f7f0e4;
  --paper-warm: #fdf8ee;
  --paper-edge: #e6d9c4;
  --ink: #2c2118;
  --ink-soft: #5d4c3c;
  /* Darkened from the first pass: the metadata under a cover measured 3.1:1
     on --paper, which fails AA for the 12px it is set at. */
  --ink-faint: #6f5c4a;

  /* The fittings */
  --oak: #8a5f3b;
  --oak-dark: #67432a;
  --oak-deep: #4e3320;
  --oak-light: #a97c53;
  --brass: #b8873f;
  --brass-bright: #d8a860;

  /* Meaning */
  --good: #4f7c46;
  --warn: #c07a2c;
  --bad: #a8503f;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 2px rgba(51, 32, 18, .10), 0 3px 10px rgba(51, 32, 18, .07);
  --shadow-2: 0 10px 34px rgba(51, 32, 18, .22);
  --shadow-sign: 0 1px 0 rgba(255,255,255,.55), 0 2px 6px rgba(51, 32, 18, .22);

  /* One place to change how big a book is. The shelf model counts slots; these
     turn a slot into pixels, and the bookcase width follows from them. */
  --spine-w: 32px;
  --spine-gap: 2px;
  --shelf-rows: 4;
  --shelf-slots: 7;
  --shelf-h: 88px;
  --cover-w: 58px;
  --cover-h: 84px;

  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, ui-serif, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  font-size: 16px;
}

@media (min-width: 720px) {
  :root { --spine-w: 38px; --shelf-h: 104px; --cover-w: 70px; --cover-h: 100px; }
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/*
  Nothing in this game is a text document, and every gesture is either a drag or
  a tap. Selection and long-press callouts only ever fire by accident here (§19),
  so they are off globally and turned back on for the few places that are prose.
*/
body {
  position: relative;
  height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}

.selectable { user-select: text; -webkit-user-select: text; }

/* `hidden` has to beat any display a class sets — see the note in Skyword's
   base.css; the same specificity tie bites here. */
[hidden] { display: none !important; }

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

.icon { display: block; flex: none; }

/* ── The room ───────────────────────────────────────────────────────────── */

/*
  Light from the left, as if from a shopfront window, plus a warm ceiling wash.
  Two radial gradients and a linear one — cheap, and it stops the flat cream
  from reading as a form background.
*/
.room {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 6% 8%, rgba(255, 246, 224, .95), rgba(255, 246, 224, 0) 58%),
    radial-gradient(90% 60% at 88% 100%, rgba(120, 78, 44, .16), rgba(120, 78, 44, 0) 60%),
    linear-gradient(180deg, #f9f2e6 0%, #f2e7d5 46%, #ead9c0 100%);
}

/* ── Screens ────────────────────────────────────────────────────────────── */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}
.screen.is-active { display: flex; }

/* ── Typography ─────────────────────────────────────────────────────────── */

.wordmark {
  font-family: var(--serif);
  font-size: 2.1rem;
  letter-spacing: .012em;
  color: var(--ink);
}
.wordmark em {
  font-style: normal;
  color: var(--oak-dark);
}

.eyebrow {
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

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

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 48px;
  padding: 0 1.4rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .01em;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }

.btn--primary {
  background: linear-gradient(180deg, var(--oak-light), var(--oak));
  color: #fff6e6;
  box-shadow: 0 2px 0 var(--oak-deep), var(--shadow-1);
}
.btn--primary:hover { background: linear-gradient(180deg, #b4855c, #916540); }

.btn--quiet {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--paper-edge);
  min-height: 42px;
  font-weight: 500;
}
.btn--quiet:hover { background: rgba(255,255,255,.5); }

.btn--icon {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 999px;
  color: var(--ink-soft);
}
.btn--icon:hover { background: rgba(255,255,255,.55); }
.btn--icon[aria-pressed='false'] { color: var(--ink-faint); }

/* ── Reduced motion ─────────────────────────────────────────────────────── */

/*
  §19: respect the preference where practical. The shelf spread and the settle
  are *information* — they show where a book will land — so they shrink rather
  than vanish. Everything decorative stops.
*/
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .08s !important;
    scroll-behavior: auto !important;
  }
}
