/*
 * Atlas genre guides (/atlas/<family>/<slug>) — layered over /legal/legal.css
 * (which imports /tokens.css, so .cta-btn and the type scale come free) AND
 * over /lineby/puzzles.css.
 *
 * puzzles.css is the SINGLE HOME of the tile look: `.pz-page` declares the
 * palette (--t, --pz-idle, --pz-edge, --pz-correct, --pz-from) and
 * `.pz-board .tile` draws a LineBy tile, locked-dot and all. Every demo on a
 * guide page wraps itself in `.pz-page` and renders `.tile`s, so the guide and
 * the real board can never drift apart. Nothing here redefines a tile — the
 * rules below only add the per-format variants (small, wide, blank, blocked)
 * and the layout around them.
 *
 * Loaded via renderHead({ extraCss }) from scripts/build-atlas.mjs.
 */

.wrap {
  max-width: 820px;
}

.lead {
  max-width: 62ch;
}

/* ── format cards ──────────────────────────────────────────────────── */
.fmt {
  background: var(--panel, #16161d);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 16px;
  padding: 24px;
  margin: 16px 0 2.5rem;
}

.fmt > p:last-child {
  margin-bottom: 0;
}

.fmt-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.fmt-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.tag {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent, #8ea2ff);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.demo {
  background: var(--panel2, #1c1c25);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  padding: 20px;
  margin: 14px 0;
  overflow-x: auto;
}

.demo-label {
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim, rgba(255, 255, 255, 0.5));
  margin: 0 0 14px;
}

/* Demos run a little smaller than the real board so a 40+ character line still
   fits a card, and they wrap rather than scroll. Rows stay ragged-LEFT, exactly
   like .pz-board — see the comment in puzzles.css for why centring hurts. */
.demo .pz-board {
  --t: 34px;
}
.demo .row {
  flex-wrap: wrap;
  row-gap: 6px;
}
.gd-small {
  --t: 26px;
}
.demo .gd-small.tile {
  font-size: 14px;
  border-radius: 6px;
}

/* A word gap inside a letter run: holds the rhythm without drawing a tile. */
.demo .tile.gap {
  background: none;
  border-color: transparent;
  cursor: default;
  width: calc(var(--t) * 0.5);
  pointer-events: none;
}

/* A whole word on one tile (word scramble). */
.demo .tile.wide {
  width: auto;
  min-width: var(--t);
  padding: 0 12px;
  font-size: 15px;
  letter-spacing: 0.04em;
}

/* Drop-quote: a blocked square (word break) and a still-empty slot. */
.demo .tile.blk {
  background: rgba(255, 255, 255, 0.07);
  border-color: transparent;
  cursor: default;
  pointer-events: none;
}
.demo .tile.gd-empty {
  background: #0e0e14;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.22);
}

/* An unguessed cryptogram tile shows the cipher letter, held back so a filled-in
   guess reads as clearly yours. Monospace, because it's cipher text, not prose. */
.demo .tile.gd-unset {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px;
  color: var(--text-dim, rgba(255, 255, 255, 0.5));
}

/* The cipher letter, printed under its tile like the key line on a worksheet. */
.gd-cap {
  position: absolute;
  bottom: -15px;
  left: 0;
  right: 0;
  font-style: normal;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 9px;
  text-align: center;
  color: var(--text-dim, rgba(255, 255, 255, 0.5));
}
[data-demo='cryptogram'] .row {
  row-gap: 22px; /* leave room for .gd-cap under each tile */
}

/* Letters grouped into words (letter scramble) — tight within a word, a clear
   gap between words, so it reads as several small anagrams. */
.gd-word {
  display: flex;
  gap: 3px;
  margin-right: 14px;
}

/* The pile sits above the grid, separated by the fall line. */
.gd-pile {
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent, #8ea2ff);
  margin-bottom: 12px;
}

.gd-done {
  display: none;
  text-align: center;
  margin-top: 14px;
  font-family: ui-serif, Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--heading, #fff);
}

/* ── comparison table ──────────────────────────────────────────────── */
.tblwrap {
  overflow-x: auto;
  margin: 1rem 0 2rem;
}
.tblwrap table {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
  font-size: 0.9rem;
}
.tblwrap th,
.tblwrap td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  vertical-align: top;
}
.tblwrap th {
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim, rgba(255, 255, 255, 0.5));
  font-weight: 600;
}
.tblwrap td strong {
  color: var(--heading, #fff);
  font-weight: 600;
}
/* These carry real table content ("Poor" / "Good"), not decoration, so the
   word says it too — colour is never the only channel (WCAG 1.4.1) — and .no
   uses --text-mute rather than the dimmer --text-dim so it stays readable. */
.yes {
  color: #5fd08a;
}
.no {
  color: var(--text-mute, rgba(255, 255, 255, 0.55));
}

/* ── closing CTA ───────────────────────────────────────────────────── */
.cta {
  background: var(--panel, #16161d);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 16px;
  padding: 28px;
  margin-top: 2.5rem;
  text-align: center;
}
.cta h3 {
  margin: 0 0 0.4em;
}
.cta p {
  margin: 0 auto;
}
.cta .foot {
  color: var(--text-dim, rgba(255, 255, 255, 0.5));
  font-size: 0.8rem;
  margin-top: 10px;
}

/* ── back-link to the Atlas ────────────────────────────────────────── */
.guide-back {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  font-size: 0.9rem;
}
