/* ============================================================
   The NVC Crossword — /games/nvc-crossword
   Scoped under .gxw. Built on the main site token set
   (css/tokens.css): warm paper, plum ink, watercolor accents.
   Nothing leaks out of .gxw.
   ============================================================ */

/* the hidden attribute always wins over display classes */
.gxw [hidden] { display: none !important; }

.gxw {
  background: var(--paper);
  padding: clamp(96px, 13vw, 150px) 20px clamp(72px, 9vw, 120px);
}
.gxw-inner {
  max-width: 980px;
  margin: 0 auto;
}

/* ---- header -------------------------------------------------------------- */
.gxw-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brand-ink);
  margin: 0 0 12px;
}
.gxw-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.04;
  color: var(--ink);
  margin: 0 0 14px;
  text-wrap: balance;
}
.gxw-title em {
  font-style: italic;
  background: var(--gradient-spectrum);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gxw-lede {
  font-size: clamp(17px, 2vw, 20px);
  color: var(--ink-soft);
  max-width: 560px;
  margin: 0 0 14px;
}
.gxw-howto {
  color: var(--ink-soft);
  font-size: 15px;
  max-width: 560px;
  margin: 0 0 10px;
}
.gxw-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 34px;
}

/* ---- variant switcher ---------------------------------------------------- */
.gxw-variants {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
}
.gxw-vbtn {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 9px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.gxw-vbtn:hover { border-color: var(--ink-faint); }
.gxw-vbtn.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--white);
}
.gxw-vbtn-num {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.7;
  margin-right: 4px;
}
.gxw-tagline {
  font-size: 15px;
  color: var(--ink-soft);
  font-style: italic;
  margin: 0 0 18px;
}

/* ---- grid ---------------------------------------------------------------- */
.gxw-board {
  position: relative;
  margin-bottom: 40px;
}
.gxw-grid {
  display: grid;
  grid-template-columns: repeat(var(--gxw-cols), minmax(0, 1fr));
  gap: 2px;
  background: var(--line-strong);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 620px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.gxw-block {
  background: var(--paper-3);
  aspect-ratio: 1;
}
.gxw-cell {
  position: relative;
  background: var(--white);
  aspect-ratio: 1;
  cursor: pointer;
}
.gxw-cell.is-word { background: var(--accent-blue-soft); }
.gxw-cell.is-focus {
  background: var(--accent-gold-soft);
  box-shadow: inset 0 0 0 2px var(--accent-gold);
}
.gxw-cell.is-wrong .gxw-letter { color: var(--error); opacity: 0.45; }
.gxw-cell.is-revealed .gxw-letter { color: var(--accent-blue); }
.gxw-num {
  position: absolute;
  top: 1px;
  left: 3px;
  font-family: var(--font-mono);
  font-size: clamp(7px, 1.1vw, 10px);
  color: var(--ink-faint);
  pointer-events: none;
}
.gxw-letter {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: clamp(13px, 2.4vw, 22px);
  color: var(--ink);
  pointer-events: none;
}

.gxw-active-clue {
  min-height: 1.5em;
  margin: 14px 0 0;
  font-size: 15px;
  color: var(--ink-soft);
  max-width: 620px;
}
.gxw-active-clue strong {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-ink);
  margin-right: 8px;
}

/* ---- controls ------------------------------------------------------------ */
.gxw-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.gxw-btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  padding: 12px 22px;
  min-height: 44px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.gxw-btn-primary {
  background: var(--brand);
  color: var(--white);
  border-color: var(--brand);
}
.gxw-btn-primary:hover { transform: translateY(-2px); color: var(--white); }
.gxw-btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.gxw-btn-ghost:hover { border-color: var(--ink-faint); color: var(--ink); }
.gxw-check-note {
  font-size: 13px;
  color: var(--ink-faint);
  margin: 10px 0 0;
}

/* offscreen input that carries the keyboard focus */
.gxw-ghost-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  border: 0;
  padding: 0;
  top: 0;
  left: 0;
}

/* ---- clues --------------------------------------------------------------- */
.gxw-clues {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 26px;
  margin-bottom: 40px;
}
.gxw-clue-col h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  color: var(--ink);
  margin: 0 0 12px;
}
.gxw-clue-col ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.gxw-clue-col li {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.5;
  cursor: pointer;
}
.gxw-clue-col li:hover { background: var(--paper-2); }
.gxw-clue-col li.is-active { background: var(--accent-gold-soft); color: var(--ink); }
.gxw-clue-col li.is-done { color: var(--ink-ghost); }
.gxw-clue-col li.is-done .gxw-clue-num { color: var(--ok); }
.gxw-clue-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--brand-ink);
  margin-right: 6px;
}

/* ---- done ---------------------------------------------------------------- */
.gxw-done {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-md, 0 10px 30px rgba(42, 34, 51, 0.08));
  padding: 34px 30px;
  max-width: 640px;
}
.gxw-done h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 40px);
  color: var(--ink);
  margin: 0 0 12px;
}
.gxw-done p { color: var(--ink-soft); margin: 0 0 20px; }
.gxw-done-row { display: flex; flex-wrap: wrap; gap: 10px; }

@media (prefers-reduced-motion: reduce) {
  .gxw-btn, .gxw-btn:hover { transition: none; transform: none; }
}
