/*
  The page's chrome — one stylesheet for every route in every language (ARCHITECTURE.md §1.2·§3.2).

  A game never imports this file and this file never reaches inside the game's box: the game owns its own
  `styles.css` and every rule there is scoped under its root (§1.6). What lives here is what a page owns —
  the bar, the size of the box, the prose around it, the list of other games.

  Two readers shaped it. Someone arriving from a search should see cards, not a banner, so the box takes the
  first screen and the words start below it (§4, DIRECTION.md §2 "바로 하기"). And the type is set for readers
  in their forties and up: one column, generous line height, no thin greys on white (§2 "편안함").
*/

:root {
  --bar-height: 3.25rem;
  --measure: 68ch;

  --paper: #f7f4ed;
  --paper-raised: #fffdf8;
  --ink: #1b1917;
  --ink-soft: #4c463d;
  --line: #ded6c7;
  --accent: #1f5c3d;
  --felt: #0e3a27;

  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Malgun Gothic', sans-serif;
  --font-prose: Georgia, 'Iowan Old Style', 'Nanum Myeongjo', serif;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* A first tab stop for people who do not want the bar — it skips straight to the game. */
.skip {
  position: absolute;
  left: 0;
  top: -3rem;
  padding: 0.75rem 1rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 0 0 0.5rem 0;
  transition: top 0.15s ease-out;
}

.skip:focus {
  top: 0;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
  min-height: var(--bar-height);
  padding: 0.375rem clamp(0.75rem, 3vw, 1.75rem);
  background: var(--paper-raised);
  border-bottom: 1px solid var(--line);
}

.bar__brand {
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

.bar__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
  font-size: 0.9375rem;
}

.bar__link,
.bar__group a {
  display: inline-block;
  padding: 0.5rem 0.25rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.bar__group a + a {
  margin-left: 0.75rem;
}

.bar__link:hover,
.bar__group a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.bar__group {
  color: var(--ink-soft);
}

.bar__group [aria-current='page'] {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
}

/*
  The box the page hands the game. Size only — the game positions its own layers inside it (§4), and the
  felt colour is a flash of the table rather than chrome: the first paint should be a table, not a white gap.
  `min-height` keeps the box usable when the window is short; `overflow: hidden` keeps a canvas from spilling
  over the words below it.
*/
.game-box {
  height: calc(100svh - var(--bar-height));
  min-height: 26rem;
  background: var(--felt);
  overflow: hidden;
}

.prose {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 4vw, 1.5rem) 0;
  font-family: var(--font-prose);
  font-size: 1.125rem;
  line-height: 1.75;
}

.prose h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  line-height: 1.15;
  text-wrap: balance;
}

.prose h2 {
  margin: 2.25rem 0 0.75rem;
  font-family: var(--font-ui);
  font-size: 1.3125rem;
  line-height: 1.3;
}

.prose h3 {
  margin: 1.5rem 0 0.5rem;
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

.prose p {
  margin: 0.9em 0;
}

.prose ul,
.prose ol {
  margin: 0.9em 0;
  padding-left: 1.35em;
}

.prose li {
  margin: 0.4em 0;
}

.prose li::marker {
  color: var(--ink-soft);
}

.prose code {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.9375em;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  padding: 0.05em 0.3em;
}

/* The one line under the H1 — the game's own pitch, still part of the introduction (§4 "한 문단 소개"). */
.prose .lede {
  margin: 0.75rem 0 0;
  font-family: var(--font-ui);
  font-size: 1.125rem;
  color: var(--ink-soft);
}

.more {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3rem) clamp(1rem, 4vw, 1.5rem) 0;
}

.more h2 {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.more ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.more a {
  display: block;
  min-height: 3rem;
  padding: 0.9rem 1rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  font-size: 1.0625rem;
  text-decoration: none;
}

.more a:hover {
  border-color: var(--accent);
}

.footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem clamp(1rem, 4vw, 1.5rem) 3rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

/* Phone in portrait: the bar wraps to two rows, and the box takes what is left of the screen. */
@media (max-width: 34rem) {
  :root {
    --bar-height: 5.5rem;
  }

  .bar {
    align-items: flex-start;
    padding-block: 0.5rem;
  }

  .bar__nav {
    gap: 0.125rem 1rem;
  }

  .game-box {
    min-height: 24rem;
  }

  .prose {
    font-size: 1.0625rem;
  }
}
