/*
 * FAN TRIBUTES — page-scoped styles for /site/fun/, layered on site.css.
 *
 * Everything here is prefixed .fun-*. The diversions sit on the same gold-on
 * dark chrome as the rest of the site and reuse .btn / .card / .callout rather
 * than restating them, so a change to the site theme carries into this corner
 * for free. What is defined below is only the shapes site.css has no opinion
 * about: an option list, a bracket ladder, a heraldry picker, a share bar.
 */

.fun-wrap { max-width: 820px; }

.fun-head { text-align: center; margin-bottom: 30px; }
.fun-head h1 { font-family: var(--fancy); color: var(--gold); font-size: clamp(28px, 5vw, 44px); margin: 8px 0 14px; line-height: 1.15; }
.fun-sub { color: var(--muted); font-size: 16px; max-width: 640px; margin: 0 auto; }

/* The interactive root. A min-height keeps the page from jumping by several
   hundred pixels the moment the script swaps the placeholder for a question —
   layout shift after load is the single most irritating thing a page can do to
   somebody who has already started reading. */
.fun-app { min-height: 320px; margin: 0 0 40px; }
.fun-app-placeholder { color: var(--muted); text-align: center; padding: 40px 0; }

.fun-card {
  background: var(--glass, rgba(255,255,255,0.03)); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px;
}
.fun-prompt { font-family: var(--fancy); font-size: clamp(19px, 3.2vw, 25px); color: #fff; margin: 0 0 20px; line-height: 1.3; }

/* Progress */
.fun-progress-track { height: 6px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; margin: 0 0 10px; }
.fun-progress-bar { height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); transition: width .25s ease; }
.fun-progress-label { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 22px; letter-spacing: .5px; }

/* Option lists */
.fun-options { display: flex; flex-direction: column; gap: 10px; }
.fun-option {
  display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
  background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); padding: 14px 18px; transition: border-color .15s, background .15s, transform .1s;
}
.fun-option:hover { border-color: var(--gold); background: rgba(227,193,104,.06); transform: translateY(-1px); }
.fun-option:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.fun-option.picked { border-color: var(--gold); background: rgba(227,193,104,.12); }
.fun-option.right { border-color: #57a05a; background: rgba(87,160,90,.14); }
.fun-option.wrong { border-color: #b4553f; background: rgba(180,85,63,.14); }
.fun-option[disabled] { cursor: default; transform: none; }
.fun-option-mark { float: right; margin-left: 12px; color: var(--muted); font-size: 13px; }

.fun-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; }
.fun-nav .muted { font-size: 13px; }

/* Results */
.fun-result { text-align: center; }
.fun-band { width: 100%; max-width: 220px; height: 8px; border-radius: 999px; margin: 0 auto 20px; }
.fun-result h2 { font-family: var(--fancy); font-size: clamp(28px, 6vw, 44px); margin: 0 0 6px; color: var(--gold); }
.fun-result-words { font-style: italic; color: var(--text); font-size: 18px; margin: 0 0 6px; }
.fun-result-meta { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.fun-reading {
  text-align: left; background: rgba(255,255,255,.03); border-left: 3px solid var(--gold);
  border-radius: 4px; padding: 16px 20px; margin: 0 0 18px; font-size: 16px; line-height: 1.6;
}
.fun-traits { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 0 20px; list-style: none; padding: 0; }
.fun-traits li {
  font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-bright);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px;
}
.fun-runner { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.fun-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 6px; }

/* Share bar — the point of the whole directory, so it is not a footnote. */
.fun-share { margin: 22px 0 4px; padding: 18px; border: 1px dashed var(--line); border-radius: 14px; background: rgba(227,193,104,.04); }
.fun-share-lead { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.fun-share-row { display: flex; gap: 10px; flex-wrap: wrap; }
.fun-share-url {
  flex: 1 1 260px; min-width: 0; font: inherit; font-size: 14px; color: var(--text);
  background: rgba(0,0,0,.32); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
}
.fun-share-url:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* Shared-result banner: what somebody sees when they open a friend's link. */
.fun-visiting { margin: 0 0 18px; font-size: 14px; }

/* Hub index cards */
.fun-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 24px 0 8px; }
.fun-tile {
  display: block; border: 1px solid var(--line); border-radius: 16px; padding: 22px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2)); color: inherit; text-decoration: none;
  transition: border-color .2s, transform .2s;
}
.fun-tile:hover { border-color: var(--gold); transform: translateY(-2px); text-decoration: none; }
.fun-tile h3 { font-family: var(--fancy); color: var(--gold-bright); margin: 0 0 6px; font-size: 19px; }
.fun-tile p { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.fun-tile .fun-shape { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-dim); }

/* Trivia */
.fun-score { font-family: var(--fancy); font-size: clamp(34px, 8vw, 56px); color: var(--gold); margin: 0 0 4px; }
.fun-score-of { color: var(--muted); font-size: 15px; margin: 0 0 18px; }
.fun-review { text-align: left; list-style: none; padding: 0; margin: 0 0 20px; }
.fun-review li { border-top: 1px solid var(--line); padding: 12px 0; }
.fun-review li:first-child { border-top: 0; }
.fun-review .q { color: var(--text); margin: 0 0 4px; font-size: 15px; }
.fun-review .a { color: var(--muted); font-size: 13.5px; margin: 0; }
.fun-review .a b { color: var(--gold-bright); font-weight: 600; }

/* Bracket */
.fun-match { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; margin: 0 0 6px; }
.fun-match .vs { align-self: center; color: var(--gold-dim); font-family: var(--fancy); font-size: 15px; }
.fun-pick {
  font: inherit; cursor: pointer; text-align: left; color: var(--text);
  background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  transition: border-color .15s, background .15s, transform .1s;
}
.fun-pick:hover { border-color: var(--gold); background: rgba(227,193,104,.06); transform: translateY(-1px); }
.fun-pick:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.fun-pick b { display: block; font-family: var(--fancy); color: var(--gold-bright); font-size: 17px; font-weight: 400; margin-bottom: 4px; }
.fun-pick span { color: var(--muted); font-size: 13px; }
.fun-path { text-align: left; list-style: none; padding: 0; margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.fun-path li { padding: 5px 0; border-top: 1px solid var(--line); }
.fun-path b { color: var(--gold-bright); font-weight: 600; }

/* Heraldry picker + banner */
.fun-swatches { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 22px; }
.fun-swatch {
  cursor: pointer; font: inherit; font-size: 13.5px; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
  background: rgba(255,255,255,.03); display: inline-flex; align-items: center; gap: 9px;
  transition: border-color .15s, background .15s;
}
.fun-swatch:hover { border-color: var(--gold); }
.fun-swatch:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.fun-swatch.picked { border-color: var(--gold); background: rgba(227,193,104,.12); }
/* The swatch chip. Its border is LIGHT, not dark: sable is very nearly the
   page background, and a dark outline round a dark chip on a dark panel makes
   the first colour in the row look like an empty box rather than a choice. */
.fun-dot { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(255,255,255,.32); display: inline-block; }
.fun-fieldset { margin: 0 0 6px; }
.fun-fieldset h3 { margin: 0 0 10px; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-dim); font-family: var(--display); }
.fun-banner-svg { display: block; margin: 0 auto 18px; max-width: 260px; width: 100%; height: auto; filter: drop-shadow(0 10px 24px rgba(0,0,0,.5)); }

/* The name field on the words generator */
.fun-field { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.fun-input {
  flex: 1 1 220px; min-width: 0; font: inherit; font-size: 16px; color: var(--text);
  background: rgba(0,0,0,.32); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px;
}
.fun-input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.fun-hint { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

/* Static, always-rendered prose. This is what a crawler and a JS-off visitor
   read, so it is styled to be genuinely readable rather than hidden away. */
.fun-static { border-top: 1px solid var(--line); padding-top: 26px; margin-top: 10px; }
.fun-static h2 { font-size: 22px; margin-top: 28px; }
.fun-static h2:first-child { margin-top: 0; }
.fun-static ul { padding-left: 20px; }
.fun-static li { margin: 6px 0; }

/* ── TOUCH TARGETS ───────────────────────────────────────────────────────────
 *
 * Apple's minimum tappable area is 44x44pt, and the number is not arbitrary —
 * it is about the contact patch of an adult fingertip. Below it, the tap that
 * lands next to the button is not the user's mistake.
 *
 * KEYED TO THE INPUT, NOT THE VIEWPORT, exactly as the game's own stylesheet
 * does it (see the TOUCH TARGETS block at the end of src/styles.css). A
 * `max-width` query asks the wrong question in both directions: a 1024px tablet
 * is a finger, and a narrow desktop window is a mouse. `pointer: coarse` asks
 * the real one.
 *
 * Which is why this is NOT applied unconditionally. A mouse is precise, and the
 * heraldry picker on the sigil page shows eighteen swatches at once — grown to
 * 44px each on a desktop they wrap into a wall and the visitor loses the sense
 * of the palette as one set of choices. Small on desktop is a better control
 * there; big on a phone is a better control everywhere. Both are true, and this
 * query is how both are honoured.
 */
@media (pointer: coarse) {
  .fun-option,
  .fun-pick,
  .fun-swatch,
  .fun-tap,
  .fun-share-url,
  .fun-input,
  .fun-app .btn { min-height: 44px; }

  /* The swatch row is the one place the visual box genuinely wants to stay
     small: a colour chip reads as a chip. So the BOX keeps its own height and
     the TARGET grows underneath it — a transparent, centred pseudo-element that
     extends the hit area to the full 44px without moving one pixel of layout.
     Same technique, same reason, as the tier chips in the game's stylesheet. */
  .fun-swatches .fun-swatch { position: relative; }
  .fun-swatches .fun-swatch::after {
    content: "";
    position: absolute; top: 50%; left: 0; right: 0;
    height: 44px; transform: translateY(-50%);
    /* Purely a target: it must never paint, and never eat a tap meant for
       something stacked above it. */
    background: transparent;
  }

  /* Buttons that sit side by side get a little vertical room too, so a
     two-line wrap does not put two 44px targets flush against each other. */
  .fun-actions .btn, .fun-share-row .btn { margin-bottom: 2px; }
}
