/* Nibbles content pages - the article layout and the example boards shared
   by the guides and the about page. Rides theme.css: every colour is a
   token, so dark mode and the colour guard both come along for free.
   Game pages never load this file. */

/* Unlike the games, these pages are for reading. */
body.reading { -webkit-user-select: text; user-select: text; }

.page { display: flex; flex-direction: column; gap: 14px; }

/* A smaller hero: on a content page the heading is the content. */
.page .hero { padding-bottom: 4px; }
.page .mascot { font-size: 44px; }
.page .title { font-size: 27px; }

.page h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
}

.page p { margin: 0; line-height: 1.55; }
.page ul { margin: 0; padding-left: 20px; line-height: 1.55; }
.page li { margin-bottom: 6px; }
.page li:last-child { margin-bottom: 0; }

.page table { width: 100%; border-collapse: collapse; font-size: 14px; }
.page th {
  text-align: left;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--ink-soft);
  padding: 4px 8px 6px 0;
}
.page td { padding: 6px 8px 6px 0; border-top: 1px dashed var(--pink-soft); vertical-align: top; }
.page td b { white-space: nowrap; }

/* ------------------------------------------------------- example boards
   The game's board, remade as plain markup: a grid of tiles and an SVG
   trace that draws itself. Every letter is real text, so the examples
   are copy, not pictures. */

.ex-board { position: relative; margin-inline: auto; }
.ex-grid { display: grid; gap: 5px; }
.ex-grid.four { grid-template-columns: repeat(4, var(--ex-tile, 62px)); }
.ex-grid.three { grid-template-columns: repeat(3, var(--ex-tile, 56px)); }

.ex-tile {
  width: var(--ex-tile, 62px);
  height: var(--ex-tile, 62px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--ex-tile, 62px) * .42);
  font-weight: 800;
  color: var(--ink);
  background: var(--tile-face);
  border-radius: var(--r-md);
  box-shadow: 0 3px 0 var(--tile-edge);
}
.ex-tile.on {
  background: linear-gradient(160deg, var(--pink), var(--pink-deep));
  color: var(--on-accent);
  box-shadow: 0 3px 0 var(--pink-press);
}
.ex-tile.bad {
  color: var(--danger);
  box-shadow: 0 3px 0 var(--tile-edge), 0 0 0 2px var(--danger) inset;
}
.ex-tile.qu { --ex-tile: 76px; margin-inline: auto; }

.ex-trace { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.ex-trace polyline, .ex-trace line {
  fill: none;
  stroke: color-mix(in srgb, var(--on-accent) 85%, transparent);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 5px rgba(var(--pink-glow), .55));
}
.ex-trace .draw {
  stroke-dasharray: var(--len, 400);
  stroke-dashoffset: var(--len, 400);
  animation: ex-draw 3.2s ease-in-out infinite;
}
@keyframes ex-draw {
  0%   { stroke-dashoffset: var(--len, 400); opacity: 1; }
  55%  { stroke-dashoffset: 0; opacity: 1; }
  82%  { stroke-dashoffset: 0; opacity: 1; }
  96%  { opacity: 0; }
  100% { stroke-dashoffset: var(--len, 400); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ex-trace .draw { animation: none; stroke-dashoffset: 0; }
}
.ex-trace .refused {
  stroke: color-mix(in srgb, var(--danger) 80%, transparent);
  stroke-dasharray: 4 12;
  filter: none;
}

.ex-note { font-size: 13px; color: var(--ink-soft); text-align: center; }

/* Little word pills for the scoring examples. */
.ex-words { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ex-word {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .5px;
  background: var(--surface-3);
  border: 2px solid var(--pink-soft);
  border-radius: var(--r-sm);
  padding: 4px 10px;
}
.ex-word b { color: var(--mint-deep); }
.ex-word.gold { border-color: var(--gold); background: var(--tint-gold); }
.ex-word.gold b { color: var(--gold-press); }

/* The candy hint bubble, recreated. */
.ex-bubble {
  margin-inline: auto;
  background: linear-gradient(160deg, var(--lavender), var(--lavender-deep));
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: var(--r-md);
  box-shadow: 0 8px 18px rgba(var(--lavender-glow), .35);
}

/* ------------------------------------------------------ sudoku examples */

.ex-row { display: flex; gap: 3px; justify-content: center; }
.ex-cell {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  background: var(--surface-3);
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-xs);
}
.ex-cell.me { color: var(--mint-deep); }
.ex-cell.hint { background: var(--tint-lavender); color: var(--lavender-press); }
.ex-cell.hint span { opacity: .55; }
.ex-cell.ev { background: var(--tint-sky); }

/* A cell holding pencil marks: a tiny 3x3 grid. */
.ex-cell.marks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  font-size: 9px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 2px;
}
.ex-cell.marks span { display: flex; align-items: center; justify-content: center; }

/* ------------------------------------------------------------ faq + cta */

.faq { gap: 0; padding-top: 8px; padding-bottom: 8px; }
.faq h2 { padding: 8px 0 10px; }
.faq details { border-top: 2px dashed var(--pink-soft); }
.faq summary {
  list-style: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  padding: 12px 0;
}
.faq summary::-webkit-details-marker { display: none; }
.faq details p { padding: 0 0 14px; }

a.play-cta {
  display: block;
  text-align: center;
  text-decoration: none;
}

.page .foot-link { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 0; }
.page .foot-link a { text-decoration: underline dotted; }

/* The hub's game cards, for the about page. */
.game-card {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
}
.game-mascot { font-size: 44px; line-height: 1; }
.game-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.game-name { font-size: 19px; font-weight: 800; color: var(--pink-deep); }
.game-blurb { font-size: 14px; color: var(--ink-soft); }
.game-go { margin-left: auto; font-size: 24px; }

/* --------------------------------------------------------------- desktop
   Phones keep the single column untouched; everything here sits behind a
   min-width query. Guides read as picture-book spreads (prose left, the
   example board right), the parallel pages spread into a bento grid, and
   the hub's game cards go side by side. The games never load this file. */

@media (min-width: 900px) {
  #app { max-width: 760px; }
  .page .card { padding: 22px 28px; }
  .page .title { font-size: 34px; }
  .page .mascot { font-size: 52px; }
  .page > a.play-cta { width: 100%; max-width: 520px; margin-inline: auto; }

  /* The hub: two portrait game cards under the hero and nav. */
  #app > .screen.is-active { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
  #app > .screen.is-active > .hero,
  #app > .screen.is-active > .site-nav,
  #app > .screen.is-active > .foot-link { grid-column: 1 / -1; }
  #app .game-card { flex-direction: column; text-align: center; gap: 10px; padding: 28px 20px; }
  #app .game-card .game-info { align-items: center; }
  #app .game-card .game-mascot { font-size: 64px; }
  #app .game-card .game-go { margin-left: 0; }

  /* Bento pages: cards flow into two columns; hero, nav, FAQ and the
     play button stay full width. */
  #app.page-bento { max-width: 1020px; }
  .page-bento { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
  .page-bento > .hero, .page-bento > .site-nav, .page-bento > a.play-cta,
  .page-bento > .card-wide, .page-bento > .card.faq { grid-column: 1 / -1; }
  .page-bento > .card.faq { width: 100%; max-width: 700px; justify-self: center; }

  /* Picture-book guides: inside a card that holds an example, prose sits
     left and the example right. Cards without one stay a single column. */
  #app.page-book { max-width: 900px; }
  .page-book .card:has(.ex-board, .ex-row, .ex-bubble, .ex-words, .ex-tile) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-auto-flow: dense;
    gap: 14px 30px;
    align-items: center;
  }
  .page-book .card > h2, .page-book .card > table { grid-column: 1 / -1; }
  .page-book .card > p { grid-column: 1; }
  .page-book .card > .ex-board, .page-book .card > .ex-bubble,
  .page-book .card > .ex-words, .page-book .card > .ex-row,
  .page-book .card > .ex-note, .page-book .card > .ex-tile { grid-column: 2; }
}
