/* LineBy daily-puzzle archive — /lineby/puzzles/
 *
 * Layered on /legal/legal.css (which imports tokens.css), so everything here
 * builds on the shared tokens: --accent comes from [data-theme="lineby"], and
 * --panel / --border / --text-dim / --heading are the global surface tokens.
 * Only the board itself needs bespoke colour, because it mirrors the iOS app's
 * tile palette rather than the site's.
 *
 * Generated pages come from scripts/build-lineby-puzzles.mjs. There is no JS in
 * this stylesheet's scope beyond /lineby/puzzle-engine.js, which renders the
 * board into #board; every rule here must therefore degrade gracefully when the
 * board is empty (no-JS crawlers see the quote in the <details> instead).
 */

.wrap {
  max-width: 860px;
}

/* ── page furniture ───────────────────────────────────────────────── */
.pz-page h1 {
  font-family: var(--brand-display, ui-serif, Georgia, serif);
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  line-height: 1.12;
  color: var(--heading);
  margin: 0.1em 0 0.35em;
}
.pz-page h2 {
  font-family: var(--brand-display, ui-serif, Georgia, serif);
  font-size: 1.25rem;
  color: var(--heading);
  margin: 2.4em 0 0.8em;
}
/* The site chrome ends in a "← LineBy" row immediately above this, and the two
   uppercase micro-labels ran together. Breathing room separates page content
   from navigation. The hub has no eyebrow, so its h1 carries the same gap —
   keep these two values in step or the pages start at different heights. */
.pz-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 2.2rem 0 0;
}
.pz-hub h1 {
  margin-top: 2.2rem;
}
.pz-eyebrow a {
  color: var(--accent);
  text-decoration: none;
}
.pz-eyebrow a:hover {
  text-decoration: underline;
}
.pz-genre {
  color: var(--text-dim);
}
.pz-lede {
  color: var(--text-mute);
  font-size: 1.02rem;
  line-height: 1.6;
  max-width: 58ch;
  margin: 0 0 2rem;
}

/* ── the board ────────────────────────────────────────────────────── */
/* Palette mirrors the app's TileView: an idle tile is a dark slab, a correct
   tile is the brand blue with a white "locked" dot in its corner. --t is the
   tile edge, set in px by puzzle-engine.js to fit the viewport. */
.pz-page {
  --t: 48px;
  --pz-idle: #1a1a22;
  --pz-edge: #2c2c3b;
  --pz-from: #1f4aa8;
  --pz-correct: #4e88e0;
}
.pz-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--heading);
  text-align: center;
}
.pz-hint {
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.5;
  max-width: 42ch;
  margin: 0.5rem auto 1.2rem;
  text-align: center;
}
/* Rows are ragged-LEFT, not centred — the same as the app's board. The wrap
   breaks lines at word boundaries, so rows differ in length; centring them
   makes the letters drift and the words much harder to read down the board.
   `width: fit-content` keeps the block itself centred on the page. */
.pz-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  width: fit-content;
  margin: 0 auto;
}
.pz-board .row {
  display: flex;
  gap: 6px;
}
.pz-board .tile {
  position: relative;
  width: var(--t);
  height: var(--t);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-serif, Georgia, 'Times New Roman', serif;
  font-weight: 600;
  font-size: calc(var(--t) * 0.48);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: linear-gradient(180deg, var(--pz-edge), var(--pz-idle));
  color: var(--text);
  border: 1px solid var(--pz-edge);
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.pz-board .tile.correct {
  background: linear-gradient(180deg, var(--pz-correct), var(--pz-from));
  border-color: #5a90e6;
  color: #fff;
}
/* "locked correct" dot, top-right — mirrors the game (TileView.correctIndicator). */
.pz-board .tile.correct::after {
  content: '';
  position: absolute;
  top: 13%;
  right: 13%;
  width: 8%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
}
.pz-board .tile.sel {
  outline: 3px solid #fff;
  outline-offset: -1px;
  transform: scale(1.06);
  z-index: 1;
}
.pz-board .tile:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.pz-progress {
  font-family: ui-monospace, Menlo, monospace;
  color: var(--text-dim);
  font-size: 0.76rem;
  text-align: center;
  margin-top: 0.9rem;
}
@media (prefers-reduced-motion: reduce) {
  .pz-board .tile {
    transition: none;
  }
}

/* ── solved reveal ────────────────────────────────────────────────── */
.pz-reveal {
  display: none; /* puzzle-engine.js flips this to flex on solve */
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 20px;
  max-width: 420px;
  margin: 1.6rem auto 0;
  text-align: center;
}
.pz-q {
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.4;
  color: var(--heading);
}
.pz-by {
  font-size: 0.82rem;
  color: var(--text-dim);
}
.pz-cta {
  display: inline-block;
  margin-top: 4px;
  line-height: 0;
}
.pz-cta img {
  height: 50px;
  width: auto;
}
.pz-foot {
  color: var(--text-dim);
  font-size: 0.76rem;
}

/* ── the crawlable answer ─────────────────────────────────────────── */
/* Real, visible page content — not hidden text. It sits below the board so it
   can't spoil the puzzle at a glance, and opens automatically once solved. */
.pz-spoiler {
  margin: 2rem auto 0;
  max-width: 46ch;
}
.pz-spoiler > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--accent);
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.pz-spoiler > summary::-webkit-details-marker {
  display: none;
}
.pz-spoiler > summary::after {
  content: '▾';
  font-size: 0.68rem;
  opacity: 0.8;
}
.pz-spoiler[open] > summary {
  background: rgba(255, 255, 255, 0.06);
}
.pz-quote {
  margin: 1rem 0 0;
}
.pz-quote blockquote {
  margin: 0;
  font-family: ui-serif, Georgia, serif;
  font-size: 1.22rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--heading);
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
}
.pz-quote figcaption {
  margin-top: 0.7rem;
  padding-left: 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ── facts strip ──────────────────────────────────────────────────── */
.pz-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  margin: 2.4rem 0 0;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.pz-facts > div {
  background: var(--panel);
  padding: 14px 16px;
}
.pz-facts dt {
  font-size: 0.66rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.pz-facts dd {
  margin: 4px 0 0;
  font-size: 0.98rem;
  color: var(--heading);
}

/* ── prev / next ──────────────────────────────────────────────────── */
.pz-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2rem;
}
.pz-nav a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 0;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  text-decoration: none;
}
.pz-nav a:hover {
  border-color: var(--accent);
}
.pz-nav .pz-next {
  text-align: right;
}
.pz-nav span {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.pz-nav b {
  font-weight: 500;
  color: var(--text);
  font-size: 0.94rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── related ──────────────────────────────────────────────────────── */
.pz-rel-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 2px;
}
.pz-rel-list a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  text-decoration: none;
  background: var(--panel);
}
.pz-rel-list a:hover {
  background: rgba(255, 255, 255, 0.06);
}
.pz-rel-who {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  font-size: 0.94rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pz-rel-date {
  flex: 0 0 auto;
  color: var(--text-mute);
  font-size: 0.8rem;
}

.pz-outro p {
  color: var(--text-mute);
  line-height: 1.65;
  max-width: 62ch;
}

/* ── hub ──────────────────────────────────────────────────────────── */
.pz-today {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  padding: 26px 20px 30px;
  margin-bottom: 1rem;
}
.pz-today h2 {
  margin-top: 0;
  text-align: center;
}
/* The hub's board is seeded at build time with the newest archived day, and
   puzzle-engine.js rewrites this label if /api/daily has a fresher one. */
.pz-daylabel {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  margin: -0.4rem 0 1.4rem;
}
/* The two apps, shown under the daily board. Two SEPARATE listings — see the
   comment on storeCardsHtml() in build-lineby-puzzles.mjs. */
/* Two contained rows: icon · (name / blurb / price) · badge. One line of copy
   each and no cards — the full pitch lives on /lineby/ and /lineby/inside; this
   only has to say which app is which and what it costs.
   Bounded width so it stays a footnote to the puzzle, not a second hero. */
.pz-apps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 520px;
  margin: 1.8rem auto 0;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}
.pz-app {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}
.pz-app[hidden] {
  display: none;
}
.pz-app-icon {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 22%;
}
/* iMessage icons are 4:3, not square — don't squash it into the app-icon box. */
.pz-app-icon-wide {
  width: 61px;
  height: 46px;
  border-radius: 14%;
}
.pz-app-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pz-app-name {
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--heading);
}
.pz-app-blurb {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-mute);
}
.pz-app-note {
  font-size: 0.7rem;
  color: var(--text-dim);
}
.pz-app-cta {
  flex: none;
  display: inline-block;
  line-height: 0;
}
.pz-app-cta img {
  height: 40px;
  width: auto;
}
/* Narrow: let the badge drop under the text rather than crushing the blurb. */
@media (max-width: 460px) {
  .pz-app {
    flex-wrap: wrap;
  }
  .pz-app-cta {
    margin-left: 60px;
  }
}

.pz-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.pz-card a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  text-decoration: none;
}
.pz-card a:hover {
  border-color: var(--accent);
}
.pz-card-genre {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.pz-card-who {
  color: var(--heading);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.3;
}
.pz-card-date {
  color: var(--text-mute);
  font-size: 0.8rem;
}
.pz-card-meta {
  color: var(--text-dim);
  font-size: 0.72rem;
  margin-top: auto;
  padding-top: 6px;
}
