/* ══════════════════════════════════════════════════════════════════
   challenge.css — December Challenge page (challenge.html)

   Only variables already defined in style.css, so dark and light both work.
   Mobile first, checked at 360px. No external fonts, no images.
   The page wrapper is .wrap from style.css, so --cg-foot-gap applies.
   ══════════════════════════════════════════════════════════════════ */

/* ── Bicolor hero title ── */
/* Three words, each split in two, painted with the same two variables as the
   header logo: .nav-logo uses --logo-a, .nav-logo span uses --logo-b
   (style.css). Both are theme scoped, so the title follows the logo in dark
   and in light without a second rule.

   Everything here has to outrank .tp-hero h1 span { color:var(--cg-accent) }
   in style.css, which matches EVERY span inside the hero h1, specificity
   (0,1,2). style.css must not change, so each selector below carries enough
   classes to win on specificity alone, whatever the load order:

     .tp-hero h1 .ch-hw                  (0,2,1) > (0,1,2)
     .tp-hero h1 .ch-hw > .ch-hw-a       (0,3,1) > (0,1,2)
     .tp-hero h1 .ch-hw > .ch-hw-b       (0,3,1) > (0,1,2)
     .tp-hero h1 .ch-hw > span           (0,2,2) > (0,1,2)

   The last one is the fallback for a word written as plain text plus one
   unclassed span, the markup challenge-transparency.html still uses. It also
   matches .ch-hw-a, so the per-part rules keep a third class to stay above it
   (b=3 against b=2) and the first part cannot turn lime.

   white-space:nowrap keeps a word whole, so the h1 still wraps between words
   only, exactly like a plain h1. */
.tp-hero h1 .ch-hw { color: var(--logo-a); white-space: nowrap; }
.tp-hero h1 .ch-hw > .ch-hw-a { color: var(--logo-a); }
.tp-hero h1 .ch-hw > .ch-hw-b { color: var(--logo-b); }
.tp-hero h1 .ch-hw > span { color: var(--logo-b); }

/* ── Link line at the end of an info card ── */
.ch-card-link { margin: 12px 0 0; font-size: 13px; }
.ch-card-link a { color: var(--link); text-decoration: none; }
.ch-card-link a:hover { text-decoration: underline; }
.ch-card-link a:focus-visible { outline: 2px solid var(--cg-accent); outline-offset: 2px; }

/* ── Test mode banner ── */
#ch-testmode {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  justify-content: center; margin: 0 0 18px;
  font-family: var(--font-main); font-size: 12px;
}
.ch-test-badge {
  padding: 3px 10px; border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  color: var(--danger); font-weight: 700; letter-spacing: .6px;
}
.ch-test-label { color: var(--text-muted); font-family: var(--font-mono); }

/* ── Status strip: countdown + cards collected ── */
.ch-strip {
  display: grid; grid-template-columns: 1fr; gap: 10px;
  margin: 0 0 24px;
}
.ch-strip > div {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  font-family: var(--font-main);
}
.ch-cd-label { font-size: 12px; color: var(--text-muted); }
.ch-cd-value { font-family: var(--font-mono); font-size: 20px; font-weight: 700; color: var(--text); }
.ch-next {
  align-self: flex-start; margin-top: 2px; padding: 0;
  background: none; border: none; cursor: pointer;
  font-family: var(--font-main); font-size: 12px; color: var(--link);
  text-decoration: underline; text-underline-offset: 2px; text-align: left;
}
.ch-ended { font-family: var(--font-main); font-size: 12.5px; line-height: 1.5; color: var(--text); }
.ch-next:hover { color: var(--text); }
.ch-next:focus-visible { outline: 2px solid var(--cg-accent); outline-offset: 2px; }

/* ── Connect prompt ── */
#ch-connect { margin: 0 0 24px; display: flex; flex-direction: column; gap: 10px; }

/* ── Shared blocks ── */
.ch-note {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px;
  font-family: var(--font-main); font-size: 13px; line-height: 1.5; color: var(--text);
}
.ch-hint { font-family: var(--font-main); font-size: 12px; line-height: 1.5; color: var(--text-muted); }

/* ── Buttons ── */
.ch-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 9px 14px; width: 100%;
  border-radius: var(--radius-sm); font-family: var(--font-main); font-size: 14px;
  line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer;
}
.ch-btn-pri {
  background: var(--cg-accent); color: var(--cg-accent-text);
  border: 1px solid var(--cg-accent); font-weight: 700;
}
.ch-btn-pri:hover:not(:disabled) { filter: brightness(1.08); }
.ch-btn-sec {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); font-weight: 500;
}
.ch-btn-sec:hover:not(:disabled) { border-color: var(--cg-accent); }
.ch-btn:disabled { opacity: .55; cursor: default; }
.ch-btn-inline { width: auto; flex: none; min-height: 40px; }

/* ── Constellation map ── */
.ch-map { margin: 0 0 28px; }
.ch-map-svg {
  display: block; width: 100%; max-width: 760px; height: auto; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: visible;
}
.ch-star { fill: var(--text-muted); }
.ch-seg { stroke: var(--border); stroke-width: 1.5; }
.ch-seg.on { stroke: var(--cg-accent); stroke-width: 2.5; }

.ch-node { cursor: default; }
.ch-node[data-k] { cursor: pointer; }
.ch-node[data-k]:focus { outline: none; }
.ch-node[data-k]:focus-visible .ch-ring,
.ch-node[data-k]:focus-visible .ch-disc { stroke: var(--cg-accent); stroke-width: 3; }
.ch-node[data-k]:hover .ch-ring { stroke-width: 3; }

.ch-ring { fill: none; stroke: var(--border); stroke-width: 2; }
.ch-node-open .ch-ring { stroke: var(--cg-accent); }
.ch-node-cracked .ch-ring { stroke: var(--cg-accent); stroke-width: 2.5; }
.ch-node-collected .ch-ring { stroke: var(--success); stroke-width: 2.5; }
.ch-glow { fill: var(--cg-accent); opacity: .18; }
.ch-disc { fill: var(--surface-2); stroke: var(--border); stroke-width: 2; }
.ch-dot { fill: var(--text-muted); opacity: .55; }
.ch-lockmark { fill: none; stroke: var(--text-muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ch-q { fill: var(--text-muted); font-family: var(--font-mono); font-size: 16px; }
.ch-chk circle { fill: var(--success); }
.ch-chk-mark { fill: none; stroke: var(--cg-accent-text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ch-node-label { fill: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.ch-node-collected .ch-node-label { fill: var(--success); }
.ch-node-open .ch-node-label, .ch-node-cracked .ch-node-label { fill: var(--text); }

@keyframes ch-node-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.09); opacity: .78; }
}
.ch-pulse .ch-ring {
  transform-box: fill-box; transform-origin: center;
  animation: ch-node-pulse 2.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .ch-pulse .ch-ring { animation: none; }
  .ch-map-svg * { transition: none !important; }
}

/* ── Step list ── */
.ch-section-title {
  font-family: var(--font-display); font-size: 17px; font-weight: 800;
  color: var(--text); margin: 0 0 12px;
}
.ch-steps { display: flex; flex-direction: column; gap: 8px; margin: 0 0 32px; }
.ch-row {
  display: grid; grid-template-columns: 26px 24px 1fr auto;
  align-items: center; gap: 10px;
  width: 100%; text-align: left; padding: 12px 13px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); font-family: var(--font-main); color: var(--text);
}
button.ch-row { cursor: pointer; }
button.ch-row:hover { border-color: var(--cg-accent); background: var(--card-hover); }
button.ch-row:focus-visible { outline: 2px solid var(--cg-accent); outline-offset: 2px; }
.ch-row-date-locked { opacity: .68; }

/* Date unlocked, previous card missing: visible but inert */
.ch-row.is-seq-locked { opacity: .72; }
button.ch-row.is-seq-locked:hover { border-color: var(--border); background: var(--surface); }
.ch-row.is-seq-locked .ch-row-name { color: var(--text-muted); }
.ch-row-logo-lock {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: var(--surface-2);
}
.ch-badge-seq-locked { display: inline-flex; align-items: center; gap: 4px; }
.ch-row-collected { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.ch-row-cracked { border-color: color-mix(in srgb, var(--cg-accent) 55%, var(--border)); }
.ch-num { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.ch-row-logo {
  width: 24px; height: 24px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--border); background: var(--surface-2); display: block;
}
.ch-row-logo-empty { opacity: .5; }
.ch-row-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ch-row-name { font-size: 14px; font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.ch-row-sub { font-size: 11.5px; color: var(--text-muted); overflow-wrap: anywhere; }
.ch-badge {
  justify-self: end; padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 500; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
}
.ch-badge-open {
  color: var(--cg-accent); border-color: color-mix(in srgb, var(--cg-accent) 45%, transparent);
  background: color-mix(in srgb, var(--cg-accent) 12%, transparent);
}
.ch-badge-cracked {
  color: var(--text); border-color: color-mix(in srgb, var(--cg-accent) 55%, transparent);
  background: color-mix(in srgb, var(--cg-accent) 18%, transparent);
}
.ch-badge-collected {
  color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, transparent);
  background: color-mix(in srgb, var(--success) 12%, transparent);
}

/* ── Info cards: how it works, rules and rewards ── */
.ch-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 16px; margin: 0 0 20px;
  font-family: var(--font-main);
}
.ch-card h2 {
  font-family: var(--font-display); font-size: 17px; font-weight: 800;
  color: var(--text); margin: 0 0 12px;
}
.ch-card ol, .ch-card ul { margin: 0; padding-left: 20px; }
.ch-card li { font-size: 13.5px; line-height: 1.6; color: var(--text); margin: 0 0 7px; }
.ch-card li:last-child { margin-bottom: 0; }
.ch-card p { font-size: 13px; line-height: 1.6; color: var(--text-muted); margin: 12px 0 0; }
.ch-card strong { color: var(--text); }

/* ── Step panel (.ov + .smod from style.css) ── */
.ch-panel { max-width: 440px; padding: 18px 16px 12px; gap: 10px; }
.ch-panel-body { display: flex; flex-direction: column; gap: 10px; }
.ch-panel-logo {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--border); background: var(--surface-2);
}
.ch-panel .smod-title { font-size: 17px; }
.ch-panel .smod-sub { font-size: 12px; }

/* Numbered tasks */
.ch-tasks { display: flex; flex-direction: column; gap: 10px; }
.ch-task {
  display: flex; flex-direction: column; gap: 7px;
  padding: 10px 11px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.ch-task-done { opacity: .82; }
.ch-task-current { border-color: color-mix(in srgb, var(--cg-accent) 55%, var(--border)); }
.ch-task-todo { opacity: .72; }
.ch-step-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ch-step-ico { display: flex; align-items: center; flex: none; color: var(--text-muted); }
.ch-task-done .ch-step-ico { color: var(--success); }
.ch-task-current .ch-step-ico { color: var(--cg-accent); }
.ch-step-title {
  font-family: var(--font-main); font-size: 13px; font-weight: 700;
  color: var(--text); letter-spacing: .2px; min-width: 0;
}
.ch-task-todo .ch-step-title { color: var(--text-muted); font-weight: 500; }
.ch-opt {
  flex: none; padding: 1px 7px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border);
  font-family: var(--font-main); font-size: 10.5px; color: var(--text-muted);
}

/* Required tag: same pill, accent border so it reads as a blocker */
.ch-opt-req {
  border-color: color-mix(in srgb, var(--cg-accent) 55%, var(--border));
  color: var(--text);
}

/* Skipped optional step: muted, but its own button stays usable */
.ch-step.is-skipped { opacity: .62; }
.ch-step.is-skipped .ch-step-ico { color: var(--text-muted); }
.ch-step.is-skipped .ch-step-title { color: var(--text-muted); font-weight: 500; }
.ch-step.is-skipped:focus-within, .ch-step.is-skipped:hover { opacity: 1; }
.ch-opt-skipped { font-style: italic; }

/* Skip: small ghost text button, pushed to the right of the step header */
.ch-skip {
  margin-left: auto; flex: none; padding: 2px 3px;
  background: none; border: none; cursor: pointer;
  font-family: var(--font-main); font-size: 11.5px; color: var(--text-muted);
  text-decoration: underline; text-underline-offset: 2px;
}
.ch-skip:hover { color: var(--text); }

/* Visible ring on whatever the focus pass lands on */
.ch-task .ch-btn:focus-visible,
.ch-skip:focus-visible,
.ch-toggle:focus-visible {
  outline: 2px solid var(--cg-accent); outline-offset: 2px;
}

/* Redirect notice at the top of the panel */
.ch-info {
  border-radius: var(--radius-sm); padding: 9px 11px;
  background: color-mix(in srgb, var(--cg-accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--cg-accent) 40%, transparent);
  font-family: var(--font-main); font-size: 12.5px; line-height: 1.45; color: var(--text);
}

/* Fun line */
.ch-fun {
  font-family: var(--font-main); font-size: 12.5px; line-height: 1.45;
  color: var(--cg-accent); text-align: center;
}

/* Collected row */
.ch-collected { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.ch-col-img {
  flex: none; max-height: 112px; max-width: 112px; height: auto; width: auto;
  object-fit: contain; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
}
.ch-col-main { flex: 1 1 170px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ch-col-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  font-family: var(--font-main); font-size: 12px;
}
.ch-col-ok { display: inline-flex; align-items: center; gap: 5px; color: var(--success); }
.ch-col-links { display: inline-flex; flex-wrap: wrap; gap: 12px; }
.ch-col-links a { color: var(--link); }
.ch-toggle { min-height: 38px; }

.ch-manual { display: flex; flex-direction: column; gap: 6px; }
.ch-manual-row { display: flex; gap: 8px; align-items: stretch; }
.ch-input {
  flex: 1; min-width: 0; min-height: 40px; padding: 8px 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font-mono); font-size: 12px;
}
.ch-input:focus { outline: none; border-color: var(--cg-accent); }
.ch-status {
  border-radius: var(--radius-sm); padding: 9px 11px;
  font-family: var(--font-main); font-size: 12.5px; line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  overflow-wrap: anywhere;
}
.ch-status a { color: var(--link); font-family: var(--font-mono); }
.ch-status-ok {
  color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent);
  background: color-mix(in srgb, var(--success) 10%, transparent);
}
.ch-status-warn {
  border-color: color-mix(in srgb, var(--cg-accent) 45%, transparent);
  background: color-mix(in srgb, var(--cg-accent) 10%, transparent);
}
.ch-status-error {
  color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.ch-status-ok a, .ch-status-error a { color: inherit; }

/* ── Fortune quote, inside the collected row ── */
.ch-quote {
  margin: 0; padding: 9px 12px; width: 100%;
  border-left: 3px solid var(--cg-accent); border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--font-main); font-size: 13px; line-height: 1.5; color: var(--text);
}

/* ── Wider screens ── */
@media (min-width: 640px) {
  .ch-strip { grid-template-columns: 1fr 1fr; }
  #ch-connect { flex-direction: row; align-items: center; justify-content: space-between; }
  #ch-connect .ch-note { flex: 1; }
  #ch-connect .ch-btn { width: auto; flex: none; }
  .ch-row { grid-template-columns: 30px 28px 1fr auto; padding: 13px 16px; }
  .ch-card { padding: 22px 20px; }
}

/* ── Narrow phones ── */
@media (max-width: 380px) {
  .ch-row { grid-template-columns: 22px 1fr; gap: 8px; padding: 11px; }
  .ch-row-logo { display: none; }
  .ch-badge { grid-column: 2; justify-self: start; margin-top: 4px; }
  .ch-cd-value { font-size: 18px; }
  .ch-manual-row { flex-direction: column; }
  .ch-btn-inline { width: 100%; }
  .ch-collected { gap: 10px; }
  .ch-col-img { max-height: 92px; max-width: 92px; }
  .ch-col-main { flex-basis: 100%; }
  .ch-panel { padding: 16px 13px 10px; }
}

/* ═══════════════════════════════════════════════════════════════
   CAMPAIGN TRANSPARENCY (challenge-transparency.html)
   ══════════════════════════════════════════════════════════════ */

/* Intro line under the hero, and the note above the step table */
.ct-intro { margin: 0 0 24px; }
.ct-table-note { margin: 0 0 12px; }

/* One contract or parameter entry inside a .ch-card */
.ct-item { padding: 12px 0; border-top: 1px solid var(--border); }
.ct-item:first-child { padding-top: 0; border-top: 0; }
.ct-item:last-child { padding-bottom: 0; }
.ct-label {
  font-family: var(--font-main); font-size: 12px; font-weight: 700;
  color: var(--text-muted); letter-spacing: .3px; margin: 0 0 5px;
}
.ct-value {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text);
  overflow-wrap: anywhere; margin: 0 0 4px;
}
.ct-text { font-family: var(--font-main); font-size: 13px; line-height: 1.6; color: var(--text); margin: 0; }
.ct-note { font-family: var(--font-main); font-size: 12px; line-height: 1.55; color: var(--text-muted); margin: 4px 0 0; }
.ct-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.ct-link { font-family: var(--font-mono); font-size: 12px; color: var(--link); text-decoration: none; white-space: nowrap; }
.ct-link:hover { text-decoration: underline; }
.ct-link:focus-visible { outline: 2px solid var(--cg-accent); outline-offset: 2px; }

/* Can / cannot lists */
.ct-cols { display: flex; flex-direction: column; gap: 16px; }
.ct-col-head {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-main); font-size: 13px; font-weight: 700;
  color: var(--text); margin: 0 0 7px;
}
.ct-col-can .ct-col-head { color: var(--cg-accent); }
.ct-col-cannot .ct-col-head { color: var(--success); }

/* Cookies by step.
   Same row look as .ch-row in the step list on challenge.html: one bordered
   rounded row per cookie on --surface, 8px apart, a fixed .ch-num badge on
   the left (the same class, so the two pages cannot drift apart).
   Mobile first: three columns, and the two link cells drop onto their own
   lines with a label each. From 561px the row becomes five columns and the
   muted caption above it takes over the labelling. Colors are variables
   only, so dark and light both follow style.css. */
.ct-rows { display: flex; flex-direction: column; gap: 8px; }

/* Small muted caption, wide screens only (see the min-width block below) */
.ct-head {
  display: none;
  padding: 0 13px 2px; font-family: var(--font-main);
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px;
  color: var(--text-muted); text-transform: uppercase;
}

.ct-row {
  display: grid; grid-template-columns: 26px 24px 1fr;
  align-items: center; gap: 4px 10px;
  padding: 12px 13px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-main); color: var(--text);
}
.ct-row-sealed { opacity: .68; }

.ct-row-logo {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--border);
  background: var(--surface-2); display: block;
}
.ct-row-lock {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.ct-row-name { font-size: 14px; font-weight: 500; color: var(--text); overflow-wrap: anywhere; min-width: 0; }

/* The reveal line of a sealed row spans chain, contract and source */
.ct-sealed { grid-column: 3 / -1; font-size: 12.5px; color: var(--text-muted); overflow-wrap: anywhere; }

.ct-cell { min-width: 0; font-size: 12.5px; }
.ct-cell[data-label]::before {
  content: attr(data-label); display: block;
  font-size: 10px; font-weight: 700; letter-spacing: .4px;
  color: var(--text-muted); text-transform: uppercase; margin-bottom: 1px;
}
.ct-pending { color: var(--text-muted); font-size: 12.5px; }
.ct-only { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }

/* Narrow: the link cells sit under the name, lined up with the logo */
@media (max-width: 560px) {
  .ct-cell { grid-column: 2 / -1; }
}

/* Wide: one line per row, the caption carries the column names */
@media (min-width: 561px) {
  .ct-head, .ct-row { grid-template-columns: 26px 24px 1fr 112px 112px; }
  .ct-head { display: grid; align-items: end; gap: 10px; }
  .ct-cell[data-label]::before { display: none; }
}

@media (min-width: 640px) {
  .ct-cols { flex-direction: row; gap: 24px; }
  .ct-cols > div { flex: 1 1 0; min-width: 0; }
}
