/* hub.css — the deck-guide hub (site/index.html). Loads after /css/styles.css and reuses its tokens, pill nav,
 * masthead, fan, foil, stats and footer. Each guide entry carries its own theme through [data-deck] (tokens.css);
 * the comparator draws every deck in its own accent for the same reason, plus a dash pattern and a marker shape
 * per slot so colour is never the only cue.
 * Hallmark · macrostructure: Masthead + Index cards + Workbench (comparator) · nav: N5 Floating pill · footer: Ft2 Inline
 * theme: site tokens (dark, Space Grotesk / IBM Plex, foil) · accent per deck · enrichment: fog + card art + radar
 * Motion: transform and opacity only; everything is static under prefers-reduced-motion.
 */

:root {
  /* the hub's fog is the three deck hues meeting in one place; a new deck needs no change here */
  --fog-a: oklch(62% 0.12 195 / 0.34);
  --fog-b: oklch(58% 0.13 320 / 0.26);
  --fog-c: oklch(70% 0.11 85 / 0.20);
}

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

main, .foot { position: relative; z-index: 1; }
main.hub { padding-top: calc(var(--space-3xl) + var(--space-md)); }
@media (max-width: 40rem) { main.hub { padding-top: calc(var(--space-2xl) + var(--space-xl)); } }

/* ───────── fog: three slow wide mists behind everything ───────── */
.fog { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.fog i {
  position: absolute;
  left: -40%;
  width: 180%;
  height: 52vh;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--fog-a), transparent);
  will-change: transform;
  animation: fog-drift 64s ease-in-out infinite alternate;
}
.fog i:nth-child(1) { top: -6%; }
.fog i:nth-child(2) { top: 38%; height: 58vh; background: radial-gradient(closest-side, var(--fog-b), transparent); animation-duration: 88s; animation-direction: alternate-reverse; }
.fog i:nth-child(3) { top: 72%; background: radial-gradient(closest-side, var(--fog-c), transparent); animation-duration: 76s; animation-delay: -30s; }
@keyframes fog-drift {
  from { transform: translate3d(-9%, 0, 0) scale(1); }
  to   { transform: translate3d(9%, -4vh, 0) scale(1.12); }
}

/* ───────── reveal on scroll ───────── */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 640ms var(--ease-out), transform 640ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}
html.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ───────── pill nav mark ───────── */
.pill__mark { display: inline-flex; align-items: center; gap: var(--space-xs); }
.pill__mark svg { width: 1.15rem; height: 1.15rem; flex: none; color: var(--color-accent); }

/* ───────── masthead (shares .masthead, .fan, .stats with the guides) ───────── */
.masthead { padding-top: var(--space-md); }
.masthead__title { flex-wrap: wrap; }
.masthead__proof { margin: var(--space-md) 0 0; font-size: var(--text-sm); color: var(--color-muted); }
.masthead .stats dd { font-size: var(--text-xl); }
.masthead .stats small { font-family: var(--font-body); }
@media (max-width: 40rem) { .masthead .stats dd { font-size: var(--text-lg); } }
/* device/pointer tilt set by hub.js on the .fan feeds every fan card */
.fan__card { --rx: var(--gx, 0deg); --ry: var(--gy, 0deg); }
/* three themes in one fan: each card keeps its own foil colours */
.fan__card[data-deck] { box-shadow: var(--shadow-card), 0 0 0 1px var(--color-rule), 0 0 36px -6px var(--color-glow); }

/* ───────── the guides ───────── */
.deck-grid {
  list-style: none;
  margin: var(--space-xl) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr));
  gap: var(--space-lg);
}
.deck-grid > li { min-width: 0; display: flex; }

.deck {
  --lift: 0px;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-rule);
  border-radius: 18px;
  background:
    linear-gradient(90deg, var(--color-accent), var(--foil-b), var(--color-accent-2)) top / 100% 3px no-repeat,
    linear-gradient(165deg, var(--color-paper-3) 0%, var(--color-paper-2) 40%, var(--color-paper) 100%);
  box-shadow: var(--shadow-card);
  transform: translateY(var(--lift));
  transition: transform var(--dur-long) var(--ease-out), border-color var(--dur-short) var(--ease-out), box-shadow var(--dur-long) var(--ease-out);
}
.deck::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(70% 55% at 80% 12%, var(--color-glow), transparent 72%);
  opacity: 0.7;
  transition: opacity var(--dur-long) var(--ease-out);
  pointer-events: none;
}
.deck:hover { --lift: -5px; border-color: oklch(from var(--color-accent) l c h / 0.7); box-shadow: var(--shadow-card), 0 18px 44px -18px var(--color-glow); }
.deck:hover::before { opacity: 1; }

.deck__stage {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1fr);
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-lg) var(--space-lg) var(--space-sm);
}
.deck__art {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
  position: relative;
  aspect-ratio: 63 / 88;
  border-radius: 9px;
  overflow: hidden;
  box-shadow: var(--shadow-card), 0 0 0 1px var(--color-rule);
  transform: perspective(700px) rotate(-3deg) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform var(--dur-long) var(--ease-out);
}
.deck__art img { width: 100%; height: 100%; object-fit: cover; }
.deck:hover .deck__art { transform: perspective(700px) rotate(-1deg) translateY(-3px) rotateX(var(--rx)) rotateY(var(--ry)); }
.deck__art.is-tilting { transition: transform 80ms linear; }
.deck__art.is-tilting .foil, .deck:hover .deck__art .foil { opacity: 0.6; }

.deck__radar { position: relative; min-width: 0; }
.mini { display: block; width: 100%; height: auto; overflow: visible; }
.mini__ring { fill: none; stroke: var(--color-rule); stroke-width: 1; }
.mini__ring--10 { stroke: var(--color-neutral); }
.mini__spoke { stroke: var(--color-rule); stroke-width: 1; }
.mini__a {
  fill: oklch(from var(--color-accent) l c h / 0.26);
  stroke: var(--color-accent);
  stroke-width: 2.4;
  stroke-linejoin: round;
  transform-origin: 100px 100px;
}
.mini__dot { fill: var(--color-accent); stroke: var(--color-paper-2); stroke-width: 1.5; }
html.js .mini__a { transform: scale(0.15); opacity: 0; transition: transform 1000ms var(--ease-out) 150ms, opacity 500ms var(--ease-out) 150ms; }
html.js .mini__dot { opacity: 0; transition: opacity 400ms var(--ease-out) 700ms; }
html.js li.is-in .mini__a { transform: none; opacity: 1; }
html.js li.is-in .mini__dot { opacity: 1; }
.deck__peaks { margin: var(--space-2xs) 0 0; font-family: var(--font-mono); font-size: var(--text-xs); line-height: 1.5; color: var(--color-ink-2); font-variant-numeric: tabular-nums; }
.deck__peaks b { font-weight: 500; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 0.4em; }
.deck__noprofile { margin: 0; font-size: var(--text-sm); color: var(--color-muted); border: 1px dashed var(--color-neutral); border-radius: 10px; padding: var(--space-md); }

.deck__body { display: flex; flex-direction: column; gap: var(--space-sm); flex: 1; padding: var(--space-sm) var(--space-lg) var(--space-lg); }
.deck__tag {
  align-self: flex-start;
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
  border: 1px solid oklch(from var(--color-accent) l c h / 0.5);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  white-space: nowrap;
}
.deck__name { margin: 0; font-family: var(--font-display); font-weight: 700; font-style: normal; font-size: var(--text-xl); line-height: 1.08; letter-spacing: -0.015em; color: var(--color-ink); overflow-wrap: anywhere; }
.deck__name .accent { color: var(--color-accent); }
.deck__link { color: inherit; text-decoration: none; }
/* the whole card is the link */
.deck__link::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; }
.deck__link:focus-visible { outline: none; }
.deck__link:focus-visible::after { outline: 2px solid var(--color-focus); outline-offset: -3px; border-radius: 18px; }
.deck__dek { margin: 0; font-size: var(--text-sm); color: var(--color-ink-2); max-width: 62ch; }

.deck__stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: var(--space-xs) 0 0; border-block: 1px solid var(--color-rule); }
.deck__stats > div { padding: var(--space-sm) var(--space-sm) var(--space-sm) 0; min-width: 0; }
.deck__stats > div + div { padding-left: var(--space-sm); border-left: 1px solid var(--color-rule); }
.deck__stats dt { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-muted); }
.deck__stats dd { margin: var(--space-2xs) 0 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--text-lg); line-height: 1.1; color: var(--color-ink); }
.deck__stats dd small { display: block; margin-top: var(--space-2xs); font-family: var(--font-body); font-size: var(--text-xs); line-height: 1.35; color: var(--color-ink-2); }
.deck__checked { margin: 0; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-muted); font-variant-numeric: tabular-nums; }

/* placeholders the owner fills in: dashed, muted, labelled "to confirm" */
.is-todo dd { color: var(--color-muted); }
.is-todo dd small { color: var(--color-warn); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.deck__checked.is-todo span { color: var(--color-warn); text-transform: uppercase; letter-spacing: 0.06em; }
.deck__stats .is-todo { background: repeating-linear-gradient(135deg, transparent 0 6px, oklch(from var(--color-warn) l c h / 0.07) 6px 7px); }

.deck__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); margin-top: auto; padding-top: var(--space-xs); }
.deck__diff { display: inline-flex; align-items: center; gap: var(--space-sm); font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); min-width: 0; }
.pips { display: inline-flex; gap: 5px; }
.pips i { width: 0.8rem; height: 0.8rem; border-radius: 50%; border: 2px dashed var(--color-accent-2); }
.pips i.on { background: var(--color-accent-2); border-style: solid; }
.deck__go { font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm); color: var(--color-accent); white-space: nowrap; }
.deck__go span { display: inline-block; transition: transform var(--dur-short) var(--ease-out); }
.deck:hover .deck__go span { transform: translateX(5px); }

/* ───────── the comparator ───────── */
.cmp {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: var(--space-lg) var(--space-2xl);
  align-items: start;
  margin-top: var(--space-xl);
  padding: var(--space-xl);
  border: 1px solid var(--color-rule);
  border-radius: 20px;
  background: linear-gradient(170deg, var(--color-paper-2), var(--color-paper) 70%);
  box-shadow: var(--shadow-card);
}
@media (max-width: 60rem) { .cmp { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); padding: var(--space-lg) var(--space-md); } }
.cmp__chart { position: relative; min-width: 0; }
@media (min-width: 60.01rem) { .cmp__chart { position: sticky; top: 5.5rem; } }
.cmp__chart::before {
  content: "";
  position: absolute;
  inset: 8% 4% 14%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--color-glow), transparent 75%);
  opacity: 0.45;
  pointer-events: none;
}
.cmp__panel { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }

.cmp__pick { grid-column: 1 / -1; margin: 0; padding: 0; border: 0; min-width: 0; }
.cmp__pick legend { padding: 0; margin: 0 0 var(--space-sm); font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-muted); }
.cmp__chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding: 0 var(--space-md) 0 var(--space-sm);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1.2;
  color: var(--color-ink-2);
  background: transparent;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: border-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}
.chip__dot { flex: none; width: 0.85rem; height: 0.85rem; border-radius: 50%; border: 2px solid var(--color-accent); background: transparent; transition: background-color var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out); }
.chip:hover { border-color: var(--color-accent); color: var(--color-ink); }
.chip[aria-pressed="true"] { color: var(--color-ink); border-color: var(--color-accent); background: oklch(from var(--color-accent) l c h / 0.14); }
.chip[aria-pressed="true"] .chip__dot { background: var(--color-accent); transform: scale(1.1); }
.chip[aria-disabled="true"] { cursor: default; }
.chip:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.cmp__status { margin: var(--space-sm) 0 0; min-height: 1.6em; font-size: var(--text-sm); color: var(--color-ink-2); }
.cmp__status.is-warn { color: var(--color-warn); }

.cmp__table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cmp__table caption { text-align: left; }
.cmp__table th, .cmp__table td { padding: var(--space-xs) var(--space-sm); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--color-rule-2); }
.cmp__table thead th { padding-top: 0; border-bottom: 1px solid var(--color-rule); font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm); line-height: 1.2; color: var(--color-ink); vertical-align: bottom; }
.cmp__table thead th:first-child, .cmp__table tbody th { padding-left: 0; }
.cmp__table tbody th { font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm); color: var(--color-ink); white-space: nowrap; }
.cmp__table td { width: 22%; font-family: var(--font-mono); font-size: var(--text-md); color: var(--color-ink-2); }
.cmp__table td .n { display: block; line-height: 1.1; }
.cmp__table td.is-top .n { color: var(--color-accent); font-weight: 600; }
.cmp__table td.is-top .n::after { content: ""; display: inline-block; width: 0.35em; height: 0.35em; margin-left: 0.4em; vertical-align: 0.15em; background: currentColor; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.bar { display: block; position: relative; height: 3px; margin-top: 5px; border-radius: 2px; background: var(--color-paper-3); }
.bar i { position: absolute; inset: 0; width: calc(var(--v) * 100%); border-radius: 2px; background: var(--color-accent); transform-origin: left; animation: bar-grow 700ms var(--ease-out) backwards; animation-delay: calc(var(--r, 0) * 45ms); }
@keyframes bar-grow { from { transform: scaleX(0); } }
.th-deck { display: inline-flex; align-items: center; gap: 0.4rem; }
.th-deck svg { flex: none; width: 1.3rem; height: 0.8rem; overflow: visible; }

/* markers: one per slot, drawn in the deck's own accent */
.mk { fill: var(--color-accent); stroke: var(--color-accent); }
.mk-line { stroke: var(--color-accent); stroke-width: 2.4; fill: none; }

.cmp__diff { margin: 0; padding: var(--space-md) 0 0; border-top: 1px solid var(--color-rule); }
.cmp__diff h3 { margin: 0 0 var(--space-sm); font-family: var(--font-display); font-weight: 600; font-size: var(--text-base); color: var(--color-ink); }
.cmp__diff ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-xs); }
.cmp__diff li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-md); font-size: var(--text-sm); color: var(--color-ink); }
.cmp__diff .n { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--color-ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp__diff p { margin: var(--space-sm) 0 0; font-size: var(--text-xs); color: var(--color-muted); }
/* results: a table beside the profile, never part of it; same rhythm as Difficulty above */
.cmp__results { margin: 0; padding: var(--space-md) 0 0; border-top: 1px solid var(--color-rule); min-width: 0; }
.cmp__results[hidden] { display: none; }
.cmp__results h3 { margin: 0 0 var(--space-sm); font-family: var(--font-display); font-weight: 600; font-size: var(--text-base); color: var(--color-ink); }
.cmp__results p { margin: var(--space-sm) 0 0; font-size: var(--text-xs); color: var(--color-muted); max-width: 64ch; }
.cmp__res tbody th { white-space: normal; }
.cmp__res td { width: auto; font-size: var(--text-sm); vertical-align: top; }
.cmp__res td .n { font-size: var(--text-md); color: var(--color-ink); }
.cmp__res td small { display: block; margin-top: 0.2rem; font-family: var(--font-body); font-size: var(--text-xs); line-height: 1.3; color: var(--color-muted); }
.cmp__res td .none { font-family: var(--font-body); font-size: var(--text-xs); font-style: italic; color: var(--color-muted); }
@media (max-width: 40rem) {
  .cmp__res th, .cmp__res td { padding-left: var(--space-2xs); padding-right: var(--space-2xs); }
  .cmp__res tbody th, .cmp__res thead th:first-child { padding-left: 0; font-size: var(--text-xs); }
  .cmp__res td .n { font-size: var(--text-sm); }
  .cmp__res thead th .th-deck svg { display: none; }
}
.cmp__how { margin: 0; font-size: var(--text-sm); color: var(--color-ink-2); max-width: 64ch; }
.cmp__how a { white-space: nowrap; }

.legend { list-style: none; position: relative; display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); margin: var(--space-sm) 0 0; padding: 0; font-size: var(--text-sm); color: var(--color-ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 0.55rem; min-width: 0; }
.legend svg { flex: none; width: 1.9rem; height: 0.9rem; overflow: visible; }
.legend small { color: var(--color-muted); }

.radar { position: relative; display: block; width: 100%; height: auto; overflow: visible; }
.radar__ring { fill: none; stroke: var(--color-rule-2); stroke-width: 1; }
.radar__ring--10 { stroke: var(--color-rule); }
.radar__spoke { stroke: var(--color-rule); stroke-width: 1; }
.radar__lbl { font: 600 15px var(--font-display); fill: var(--color-ink); }
.radar__tick { font: 500 11px var(--font-mono); fill: var(--color-muted); }
@media (max-width: 40rem) { .radar__lbl { font-size: 17px; } .radar__tick { font-size: 13px; } }
.cmp__s { opacity: 0; transition: opacity 350ms var(--ease-out); pointer-events: none; }
.cmp__s.is-on { opacity: 1; }
.cmp__poly { fill: oklch(from var(--color-accent) l c h / 0.16); stroke: var(--color-accent); stroke-width: 2.4; stroke-linejoin: round; }
.cmp__s[data-slot="1"] .cmp__poly { stroke-dasharray: 8 5; }
.cmp__s[data-slot="2"] .cmp__poly { stroke-dasharray: 2 5; stroke-linecap: round; stroke-width: 3; }
.cmp__dot { fill: var(--color-accent); stroke: var(--color-paper); stroke-width: 1.5; }

.cmp-error { margin: var(--space-md) 0 0; padding: var(--space-md); border: 1px dashed var(--color-neutral); border-radius: 12px; color: var(--color-warn); font-size: var(--text-sm); }

@media (prefers-reduced-motion: reduce) {
  .fog i { animation: none; }
  html.js [data-reveal] { opacity: 1; transform: none; transition: none; }
  html.js .mini__a, html.js .mini__dot { transform: none; opacity: 1; transition: none; }
  .deck, .deck__art, .deck__go span, .chip, .chip__dot, .cmp__s { transition: none; }
  .deck:hover { --lift: 0px; }
  .deck:hover .deck__art { transform: perspective(700px) rotate(-3deg); }
  .deck:hover .deck__go span { transform: none; }
  .bar i { animation: none; }
}
