/* Home page styles (spec 4.1) and the skill map (spec 4.3). Owned by the home page builder.
   See docs/frontend-contract.md. Page-only classes use the home-, how-, warm-, hf-, welcome-, hub-, map- and ml- prefixes. */

/* ---------- slots + page rhythm ---------- */
.home-top:empty, .home-band:empty { display: none; }
.home-top .event-band { margin-top: 0; }
.home-tail { height: var(--section); }
/* Signed in, the event band is the last section: the dark band sits on the footer, no white gap. */
.home-band:not(:empty) + .home-tail { display: none; }

/* ---------- signed-in banners ---------- */
.home-banners { display: grid; gap: 12px; margin-top: 32px; }
.home-banners[hidden] { display: none; }
.home-banners .notice p { margin: 0; }
.home-goal { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.hh-form { justify-content: flex-start; }
.hh-form > input { flex: none; width: 220px; height: 40px; font-size: 15px; }
.hh-form > .btn { height: 40px; }
.home-handle .field-err { margin-top: 8px; }

/* ---------- signed-in welcome hero ---------- */
.home-welcome { padding-top: 48px; padding-bottom: 40px; }
.welcome-hi { margin: 0 0 10px; font-size: 15px; color: var(--ink-3); }
.welcome-handle { overflow-wrap: anywhere; }
.home-welcome h1 { margin: 0; max-width: 900px; overflow-wrap: anywhere; }
.home-welcome h1:focus { outline: none; }
.home-welcome h1:focus-visible { outline: 2px solid var(--blue-ink); outline-offset: 4px; }
.welcome-meta { margin: 12px 0 0; }
.welcome-line { margin: 12px 0 0; font-size: 17px; color: var(--ink-2); }
.home-welcome .cta { margin-top: 28px; }

/* ---------- map card ---------- */
.home-map { margin-top: 24px; }
.map-card { position: relative; }
.map-head { background: var(--bg-3); border-bottom: 1px solid var(--line-2); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 18px 22px; }
.map-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.map-head-l { min-width: 0; }
.map-head .eyebrow { margin-bottom: 6px; }
.map-title { margin: 0; font: 700 22px/1.25 var(--font); letter-spacing: -.015em; }
.map-count { margin: 0; font: 700 26px/1.2 var(--font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.map-count .caption { font-weight: 400; letter-spacing: 0; margin-left: 4px; }
.map-pill { display: inline-block; padding: 6px 10px; font: 500 11px/1.3 var(--mono); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-pill); }

/* path strip (signed in) */
.map-strip { display: flex; gap: 3px; margin-top: 14px; }
.map-strip i { flex: 1; max-width: 40px; height: 6px; border-radius: 3px; background: #E3E3E8; }
.map-strip i.s-solved { background: var(--grad-ink); }
.map-strip i.s-next { background: var(--ink); }
.map-strip i.s-optional { background: #FFF; border: 1px dashed #C7C7CC; }
.map-strip i.s-classified { background: repeating-linear-gradient(45deg, #D2D2D7 0 3px, #F5F5F7 3px 6px); }

/* body */
.map-body { display: grid; grid-template-columns: 232px 1fr; gap: 0; padding: 24px 22px; transition: opacity 125ms var(--ease); }
.map-body.is-fading { opacity: 0; }
.map-canvas { min-width: 0; display: flex; align-items: center; background: radial-gradient(#E3E3E8 1px, transparent 1.2px) 0 0 / 24px 24px; }
.map-svgwrap { position: relative; width: 100%; }
.map-svg { display: block; width: 100%; height: auto; overflow: visible; }

/* hub */
.map-hub { position: relative; z-index: 1; align-self: center; width: 232px; padding: 18px; background: var(--bg-2); border-radius: 16px; }
.map-ringbox { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; }
.map-ringbox svg { position: absolute; inset: 0; }
.map-mono { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ink); color: #FFF; font: 700 18px/1 var(--font); }
.map-you { font: 700 12px/1 var(--mono); color: var(--ink); letter-spacing: .04em; }
.hub-handle { margin: 12px 0 0; font: 600 15px/1.3 var(--font); overflow-wrap: anywhere; }
.hub-rank { margin: 3px 0 0; font: 700 11px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--teal-ink); }
.hub-to { margin: 4px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--ink-3); }
.hub-stats { list-style: none; margin: 12px 0 0; padding: 0; font: 400 12px/1.7 var(--mono); color: var(--ink-2); }
.hub-div { border: 0; border-top: 1px solid var(--line-2); margin: 14px 0 12px; }
.hub-for { color: var(--ink-3); }
.hub-goal { margin: 4px 0 6px; font: 600 13.5px/1.35 var(--font); }
.hub-pitch { margin: 12px 0 14px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }

/* rails */
.map-rail { fill: none; stroke: var(--line); stroke-width: 2; stroke-linecap: round; }
.map-rail.lit-under { stroke-width: 10; opacity: .28; }
.map-rail.lit { stroke-width: 3; }
.map-rail.into-next { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 2 6; animation: map-march 1.2s linear infinite; }
.map-rail.into-opt { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 4 4; }
.map-tail { fill: none; stroke: var(--line); stroke-width: 2; }
@keyframes map-march { to { stroke-dashoffset: -16; } }

/* track badges */
.map-badge rect { fill: var(--bg-2); stroke: var(--line); stroke-width: 1; }
.map-badge.done rect { stroke: none; }
.map-badge text { font: 700 10.5px var(--mono); letter-spacing: .14em; fill: var(--ink); }
.map-badge.done text { fill: #FFF; }

/* nodes */
.map-node { cursor: pointer; }
.map-svg a:hover { text-decoration: none; }
.map-node[aria-disabled="true"] { cursor: default; }
.map-svg a:focus { outline: none; }
.map-svg a:focus-visible .map-ring { opacity: 1; }
.map-node.hl .map-ring { opacity: .45; }
.map-label { font: 500 13px var(--font); fill: var(--ink); }
.s-solved .map-label, .s-next .map-label { font-weight: 600; }
.s-optional .map-label { fill: var(--ink-3); }
.map-node .map-tier { font: 500 10.5px var(--mono); letter-spacing: .08em; fill: var(--ink-3); }
.map-redact { fill: var(--ink); }
.map-pulse { fill: none; stroke: var(--ink); stroke-width: 2; opacity: .45; transform-box: fill-box; transform-origin: center; vector-effect: non-scaling-stroke; animation: map-pulse 2.4s ease-out infinite; }
@keyframes map-pulse { from { transform: scale(1); opacity: .45; } to { transform: scale(1.7); opacity: 0; } }
.map-upnext-pill rect { fill: var(--ink); }
.map-upnext-pill text { font: 700 9.5px var(--mono); letter-spacing: .12em; fill: #FFF; }
.map-glyph { transform-box: fill-box; transform-origin: center; }

/* next-node intro dot (offset-path set inline by JS) */
.map-intro { position: absolute; left: 0; top: 0; z-index: 2; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); border: 2px solid #FFF; box-shadow: 0 1px 3px rgba(0,0,0,.2); pointer-events: none; offset-rotate: 0deg; offset-distance: 0%; animation: map-intro 1.4s var(--ease) forwards; }
@keyframes map-intro { 0% { offset-distance: 0%; opacity: 1; } 85% { offset-distance: 100%; opacity: 1; } 100% { offset-distance: 100%; opacity: 0; } }

/* popover (spec 3.16): positioned by JS relative to .map-card */
.map-pop .label { color: var(--ink-3); }
.map-pop p { margin: 0; }
.map-pop-t { margin-top: 4px !important; font: 600 15px/1.35 var(--font); color: var(--ink); }
.map-pop-s { margin-top: 4px !important; font-size: 14px; color: var(--ink-2); }
.map-pop-s.ok { color: var(--ok-ink); }
.map-pop-go { display: block; margin-top: 8px; font-weight: 600; color: var(--blue-ink); }

/* foot */
.map-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 14px 22px; background: var(--bg-3); border-top: 1px solid var(--line-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.map-foot-msg { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; flex: 1 1 420px; min-width: 0; }
.mf-text { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink); }
.mf-text.mf-out { font-size: 14px; color: var(--ink-3); }
.mf-next { margin: 0; font-size: 15px; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
.mf-next .label { display: inline; margin-right: 6px; }
.mf-meta { color: var(--ink-3); }
.mf-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.map-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; font: 400 11px/1 var(--mono); color: var(--ink-3); }
.map-legend li { display: inline-flex; align-items: center; gap: 6px; }
.map-litnote { display: flex; align-items: center; gap: 8px; flex-basis: 100%; margin: 0; font-size: 13.5px; color: var(--ink); }
.map-litnote::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }

/* ---------- mobile map (<=640px): hub strip, up next card, disclosure list ---------- */
.map-body.is-mobile { display: block; padding: 16px; }
.map-hubstrip { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 14px; background: var(--bg-2); border-radius: var(--r); }
.map-mono.sm { flex: none; width: 36px; height: 36px; font-size: 14px; }
.map-you.sm { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1.5px dashed #C7C7CC; border-radius: 50%; font-size: 9px; }
.map-hubstrip .btn { flex: 1; }
.mhs-id { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.mhs-handle { font: 600 15px/1.3 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mhs-rank { font: 700 11px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--teal-ink); }
.mhs-bar { flex: none; width: 64px; height: 4px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.mhs-bar i, .ml-bar i { display: block; height: 100%; background: var(--grad-ink); border-radius: 2px; }
.map-upnext { margin-top: 12px; padding: 16px 18px; box-shadow: inset 3px 0 0 var(--ink); }
.map-upnext p { margin: 0; }
.map-upnext-t { margin: 6px 0 2px !important; font: 600 17px/1.35 var(--font); overflow-wrap: anywhere; }
.map-upnext .btn { margin-top: 14px; }
.map-lines { list-style: none; margin: 12px 0 0; padding: 0; }
.ml-track + .ml-track { border-top: 1px solid var(--line-2); }
.ml-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 4px; background: none; border: 0; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ml-btn-in { display: inline-flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.ml-count { font: 500 12px/1 var(--mono); color: var(--ink); }
.ml-bar { flex: none; width: 60px; height: 4px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.ml-chev { flex: none; transition: transform var(--t-1) var(--ease); }
.ml-btn[aria-expanded="true"] .ml-chev { transform: rotate(180deg); }
.ml-nodes { list-style: none; margin: 0 0 8px; padding: 0; }
.ml-row { position: relative; }
.ml-row::before { content: ""; position: absolute; left: 26px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.ml-row:last-child::before { bottom: 50%; }
.ml-row.lit::after { content: ""; position: absolute; left: 25.5px; top: 0; bottom: 50%; width: 3px; border-radius: 2px; background: var(--grad-ink); box-shadow: 0 0 0 2.5px var(--halo); }
.ml-link { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 6px 8px 16px; color: var(--ink); border-radius: var(--r-sm); }
a.ml-link:hover { background: rgba(251,251,253,.6); text-decoration: none; }
a.ml-link:focus-visible { outline-offset: -2px; }
.ml-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ml-title { font: 400 15px/1.35 var(--font); overflow-wrap: anywhere; }
.s-solved .ml-title, .s-next .ml-title { font-weight: 600; }
.s-optional .ml-title { color: var(--ink-3); }
.ml-tier { margin-top: 2px; font: 500 11px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.ml-redact { display: block; width: 150px; max-width: 100%; }
.ml-redact .redact-bar { display: block; height: 10px; }

/* ---------- how it works + warm-up case (signed out) ---------- */
.home-how { margin-top: var(--section); }
.how-grid { display: grid; grid-template-columns: 1fr 420px; gap: 64px; align-items: start; }
.how-copy { min-width: 0; }
.how-copy .t-section { margin: 0; }
.how-rail { position: relative; list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin: 40px 0 0; padding: 0; }
.how-rail::before { content: ""; position: absolute; left: 16px; right: 0; top: 15px; height: 2px; background: var(--line); }
.how-rail li { position: relative; }
.how-n { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: #FFF; border: 1.5px solid var(--ink); font: 700 12px/1 var(--mono); color: var(--ink); }
.how-rail h3 { margin: 16px 0 6px; }
.how-rail p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); }

.warm { min-width: 0; }
.warm .dossier { padding: 24px; }
.warm-head { min-height: 30px; padding-right: 112px; }
.warm .stamp { top: 22px; right: 22px; }
.warm-brief { margin: 16px 0 20px; font: 400 16px/1.7 var(--font); color: var(--ink-2); }
.warm-ev-l { margin-bottom: 8px; }
.evidence-str { display: block; padding: 8px 10px; font: 400 14px/1.5 var(--mono); word-break: break-all; }
.warm-hint { margin: 10px 0 16px; font-size: 14px; color: var(--ink-3); }
.warm-form > input { height: 40px; }
.warm-form > .btn { height: 40px; }
.warm-form > input[readonly] { background: var(--bg-2); }

/* ---------- what's free (signed out) ---------- */
.home-free { margin-top: var(--section); }
.home-free .t-section { margin: 0; }
.hf-cols { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 48px; margin-top: 40px; }
.hf-rule { background: var(--line); }
.hf-h { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font: 700 18px/1.3 var(--font); }
.hf-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.hf-yes { color: var(--teal-ink); }
.hf-yes .hf-dot { background: var(--teal); }
.hf-soon { color: var(--ink-2); }
.hf-soon .hf-dot { border: 1.5px solid var(--ink-3); }
.hf-list { list-style: none; margin: 0; padding: 0; }
.hf-list li { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0; font-size: 16px; line-height: 1.4; color: var(--ink); }
.hf-list li + li { border-top: 1px solid var(--line-2); }
.hf-check { flex: none; }
.hf-list.plus li { color: var(--ink-2); }
.hf-plus { flex: none; width: 16px; text-align: center; font-weight: 600; }
.hf-foot { margin: 24px 0 0; font-size: 14px; color: var(--ink-3); }

/* ---------- tablet ---------- */
@media (max-width: 900px) {
  /* Stack the hub above the map so the SVG gets the full card width and is not scaled down below legible sizes. */
  .map-body { grid-template-columns: 1fr; gap: 16px; }
  .map-hub { width: auto; }
  .how-grid { grid-template-columns: 1fr; gap: 48px; }
  .warm { max-width: 560px; }
  .how-rail { grid-template-columns: 1fr; gap: 28px; }
  .how-rail::before { left: 15px; right: auto; top: 16px; bottom: 16px; width: 2px; height: auto; }
  .how-rail li { padding-left: 52px; min-height: 32px; }
  .how-n { position: absolute; left: 0; top: 0; }
  .how-rail h3 { margin-top: 4px; }
  .hf-cols { grid-template-columns: 1fr; gap: 32px; }
  .hf-rule { height: 1px; }
}

/* ---------- phone ---------- */
@media (max-width: 640px) {
  .map-head { padding: 16px; }
  .map-head-row { gap: 12px; }
  .map-goals { display: flex; width: 100%; }
  .map-goals > [role="radio"] { flex: 1; min-width: 0; padding: 0 4px; font-size: 12px; white-space: normal; line-height: 1.15; height: auto; min-height: 34px; }
  .map-count { font-size: 22px; }
  .map-foot { padding: 14px 16px; }
  .map-foot-msg { flex-basis: 100%; }
  .mf-btns { width: 100%; }
  .mf-btns .btn { flex: 1; }
  /* arena.css gives inputs flex: 1 (basis 0), which collapses them once .inline-form stacks into a column. */
  .hh-form > input, .warm-form > input { flex: none; width: 100%; }
  .home-goal { align-items: flex-start; flex-direction: column; }
  .home-welcome { padding-top: 32px; padding-bottom: 32px; }
  .home-welcome .cta .btn { flex: 1 1 100%; }
  .warm-head { padding-right: 0; }
}

/* ---------- reduced motion: resting states are final (kill switch in arena.css stops the animations) ---------- */
@media (prefers-reduced-motion: reduce) {
  .map-intro { display: none; }
  .map-body.is-fading { opacity: 1; }
}
