/* ==========================================================================
   vault by thejojiz — experience layer  (r2026.10.01)
   Loaded last. Adds the pieces that make the site something you work
   through rather than scroll past:
     · split hero with a live question card
     · "start where you are" role chooser
     · step-by-step explainers on every topic
     · outline-style sections that open on demand
     · "what is moving" reform timeline
     · category colour as a quiet wayfinding cue
   Same tokens as the rest of the system; no inline styles; every motion is
   switched off by the global prefers-reduced-motion rule in main.css.
   ========================================================================== */

/* ---- Category colour ------------------------------------------------------ */

:root { --cat: var(--accent); }
.cat-law        { --cat: #8e7dff; }
.cat-rights     { --cat: #ff715b; }
.cat-practice   { --cat: #c7ff43; }
.cat-safety     { --cat: #ffbe5c; }
.cat-governance { --cat: #78d6ff; }
.cat-workforce  { --cat: #7ee2a8; }
html[data-theme='light'] .cat-law        { --cat: #5341c9; }
html[data-theme='light'] .cat-rights     { --cat: #bf3e2d; }
html[data-theme='light'] .cat-practice   { --cat: #55730a; }
html[data-theme='light'] .cat-safety     { --cat: #9a6400; }
html[data-theme='light'] .cat-governance { --cat: #0b6f99; }
html[data-theme='light'] .cat-workforce  { --cat: #1d7a4a; }

.topic-card .chip::before,
.topic-head .chip[class*='chip-']::before {
  content: '';
  width: 0.45rem; height: 0.45rem;
  border-radius: 50%;
  background: var(--cat);
  flex: none;
}
.topic-card article { border-top: 2px solid color-mix(in srgb, var(--cat) 60%, var(--line)); }
.topic-card article:hover {
  border-color: var(--cat);
  box-shadow: 0 0 0 1px var(--cat), 0 24px 60px -40px var(--cat);
}
.topic-card article:hover .card-idx { color: var(--cat); }

/* ---- Home rhythm: numbered section heads, more air -------------------------- */

.home { counter-reset: sec; }
.home .section-head {
  counter-increment: sec;
  margin-top: clamp(3.2rem, 8vw, 6rem);
  padding-top: 0;
}
.home .section-head::before {
  content: counter(sec, decimal-leading-zero) ' /';
  position: static;
  display: block;
  width: auto; height: auto;
  background: none;
  margin-bottom: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--accent);
}

/* ---- Hero: copy on the left, something to do on the right ------------------- */

.hero-split { text-align: left; padding-bottom: clamp(1.5rem, 4vw, 3rem); }
.hero-grid { display: grid; gap: clamp(2.2rem, 5vw, 4rem); align-items: center; }
@media (min-width: 62rem) {
  .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
}
.hero-split h1 { font-size: clamp(2.7rem, 1.3rem + 5.2vw, 5.6rem); }
.hero-split .lead { margin-inline: 0; max-width: 36rem; }
.hero-split .hero-actions { justify-content: flex-start; }

.hero-split .hero-stats {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: start;
  gap: 1rem clamp(1.2rem, 3vw, 2.4rem);
  margin-top: 2.2rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line);
}
.hero-split .hero-stats li { display: flex; flex-direction: column; gap: 0.35rem; margin: 0; max-width: 9rem; line-height: 1.3; }
.hero-split .hero-stats strong {
  font-size: clamp(1.7rem, 1.1rem + 1.6vw, 2.4rem);
  font-weight: 700;
  line-height: 1;
  margin: 0;
  color: var(--text);
}
@media (max-width: 40rem) { .hero-split .hero-stats { grid-template-columns: repeat(2, 1fr); } }

.hero-side { position: relative; }

/* the vault dial behind the card — three rings turning at different speeds */
.dial {
  position: absolute;
  left: 50%; top: 50%;
  width: min(135%, 36rem);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}
.dial i {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  aspect-ratio: 1;
  transition: border-color 0.5s ease, opacity 0.5s ease;
}
.dial i:nth-child(1) {
  width: 100%;
  background: repeating-conic-gradient(var(--line-strong) 0 0.6deg, transparent 0.6deg 6deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 11px), #000 calc(100% - 10px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 11px), #000 calc(100% - 10px));
  opacity: 0.7;
  animation: dial-spin 120s linear infinite;
}
.dial i:nth-child(2) {
  width: 78%;
  border: 1px dashed var(--line-strong);
  animation: dial-spin 80s linear infinite reverse;
}
.dial i:nth-child(3) {
  width: 56%;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: 0 0 90px -10px var(--glow-soft), inset 0 0 70px -20px var(--glow-soft);
}
@keyframes dial-spin { to { transform: rotate(360deg); } }
.hero-side:has(.tryit.is-right) .dial i:nth-child(3) { border-color: var(--accent); box-shadow: 0 0 110px -6px var(--glow-c), inset 0 0 80px -16px var(--glow-c); }
.hero-side:has(.tryit.is-wrong) .dial i:nth-child(3) { border-color: var(--danger); }

.tryit {
  position: relative;
  z-index: 1;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-top: 2px solid var(--accent);
  border-radius: 4px;
  padding: 1.2rem 1.4rem 1.4rem;
  box-shadow: var(--shadow-lg);
  transition: border-color 0.3s ease;
}
.tryit.is-wrong { border-top-color: var(--danger); }
.tryit-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.9rem; }
.tryit-tag {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.tryit-count { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }
.tryit-body { min-height: 13.5rem; }
.tryit .q-text { font-size: 1.14rem; line-height: 1.35; }
.tryit .q-why { margin-bottom: 0.9rem; }
.tryit-foot { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.tryit-fallback { color: var(--muted); font-size: 0.94rem; margin: 0; }

/* ---- Stepper: shared by the explainers and the role chooser ------------------ */

.stepper {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-solid);
  overflow: hidden;
}
/* grid and flex children default to min-width:auto, which lets a long tab row
   push the whole page sideways on a phone — let them shrink instead */
.reader > *, .topic, .hero-grid > * { min-width: 0; }
.stepper { min-width: 0; max-width: 100%; }

/* panels switch by class, so print and no-JS views can show every step */
html.js .stepper.is-live .st-panel:not(.is-on) { display: none; }
html:not(.js) .st-tabs,
html:not(.js) .st-nav,
html:not(.js) .st-bar { display: none; }
html:not(.js) .st-panel + .st-panel { border-top: 1px solid var(--line); }

.st-bar { height: 2px; background: var(--line); }
.st-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  transition: transform 0.45s var(--ease);
}

.st-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.st-tabs::-webkit-scrollbar { display: none; }
.st-tab {
  position: relative;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  font: inherit;
  text-align: left;
  padding: 0.75rem 1rem 0.8rem;
  background: none;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.st-tab:last-child { border-right: 0; }
.st-tab:hover { color: var(--text); background: var(--accent-soft); }
.st-tab:focus-visible { outline-offset: -3px; }
.st-n { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--dim); }
.st-l { font-size: 0.86rem; font-weight: 620; white-space: nowrap; }
.st-tab[aria-selected='true'] { color: var(--text); background: var(--surface-2); }
.st-tab[aria-selected='true'] .st-n { color: var(--accent); }
.st-tab[aria-selected='true']::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
}
.st-tab.is-seen .st-n::after { content: ' ✓'; color: var(--accent); }

.st-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem clamp(1rem, 3vw, 1.8rem);
  align-items: start;
  padding: clamp(1.2rem, 3vw, 2rem);
  min-height: 12rem;
}
html.js .stepper.is-live .st-panel.is-on { animation: st-in 0.38s var(--ease-out) both; }
@keyframes st-in { from { opacity: 0; transform: translateX(14px); } }
.st-big {
  font-family: var(--font-mono);
  font-size: clamp(2.6rem, 1.6rem + 4vw, 4.8rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1px var(--accent);
}
.st-copy h3 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.6rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.st-copy p { margin: 0 0 0.8rem; max-width: 40rem; }
.st-copy p:last-child { margin-bottom: 0; }
.st-tip {
  border-left: 2px solid var(--accent);
  padding-left: 0.85rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.st-tip span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 0.15rem;
}
.st-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.st-count { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.st-nav .btn:disabled { opacity: 0.35; cursor: default; transform: none; box-shadow: none; }
@media (max-width: 34rem) {
  .st-panel { grid-template-columns: 1fr; min-height: 0; }
  .st-big { font-size: 2.4rem; }
}

/* ---- Topic page: the explainer block -------------------------------------------- */

.explain { margin: 0 0 1.8rem; scroll-margin-top: 6rem; }
.explain-head { margin-bottom: 1rem; }
.explain-tag { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em; color: var(--accent); }
.explain h2 { margin: 0.3rem 0 0.35rem; font-size: clamp(1.45rem, 1.1rem + 1.4vw, 2.1rem); }
.explain-head p { margin: 0; color: var(--muted); max-width: 40rem; }
.qr-mode .explain { display: none; }

/* ---- Topic page: sections read as an outline you open up -------------------------- */

.s-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.s-teaser {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.section[open] .s-teaser { display: none; }
.section:not([open]):hover { border-color: var(--line-strong); }
.section:not([open]) .s-num { opacity: 0.75; }

/* smooth open/close where the browser can animate to auto height */
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  .section::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size 0.38s var(--ease), content-visibility 0.38s allow-discrete;
  }
  .section[open]::details-content { block-size: auto; }
}

/* ---- Home: role chooser -------------------------------------------------------------- */

.role-tabs { display: grid; grid-template-columns: repeat(4, 1fr); overflow: visible; }
.role-tab {
  flex-direction: row;
  align-items: center;
  font-size: 1rem;
  font-weight: 620;
  padding: 1.05rem 1.2rem;
  letter-spacing: -0.01em;
}
.role-tab[aria-selected='true']::after { bottom: auto; top: 0; }
@media (max-width: 52rem) {
  .role-tabs { grid-template-columns: 1fr 1fr; }
  .role-tab:nth-child(2n) { border-right: 0; }
  .role-tab:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
}

.role-panel { grid-template-columns: 1fr; gap: 1.6rem; min-height: 0; }
@media (min-width: 52rem) { .role-panel { grid-template-columns: 1.1fr 1fr; gap: 2.4rem; } }
.role-label { display: none; }
html:not(.js) .role-label {
  display: block;
  margin: 0 0 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.role-main h3 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.45rem, 1rem + 1.7vw, 2.2rem);
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-wrap: balance;
}
.role-main p { color: var(--muted); max-width: 32rem; }
.role-main .btn { margin-top: 0.3rem; }
.role-main .role-meta { margin: 0.9rem 0 0; font-family: var(--font-mono); font-size: 0.72rem; color: var(--dim); }

.role-picks {
  list-style: none;
  padding: 0;
  margin: 0;
  align-self: start;
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.role-picks li { margin: 0; }
.role-picks a {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  gap: 0.8rem;
  align-items: baseline;
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  transition: background-color 0.2s ease, padding-left 0.25s var(--ease);
}
.role-picks a:hover { background: var(--accent-soft); padding-left: 1.3rem; }
.role-picks a:hover strong { color: var(--accent); }
.pick-k { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.12em; color: var(--accent); }
.pick-m { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); white-space: nowrap; }
.role-picks strong { font-weight: 620; }

/* ---- Home: what is moving -------------------------------------------------------------- */

.radar {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
/* six entries: 1, 2 or 3 columns so a row is never left half empty */
@media (min-width: 40rem) { .radar { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .radar { grid-template-columns: repeat(3, 1fr); } }
.radar-item { margin: 0; background: var(--surface-solid); transition: background-color 0.25s ease; }
.radar-item:hover { background: var(--surface-2); }
.radar-item a {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  height: 100%;
  padding: 1.25rem 1.35rem 1.2rem;
  color: var(--text);
  text-decoration: none;
}
.radar-now  { --rc: var(--accent); }
.radar-soon { --rc: var(--signal); }
.radar-open { --rc: var(--muted); }
.radar-when {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--rc);
}
.radar-when i, .radar-key .k::before {
  width: 0.55rem; height: 0.55rem;
  border-radius: 50%;
  background: var(--rc);
  flex: none;
}
.radar-now .radar-when i { animation: pulse 2.4s ease-out infinite; }
.radar-open .radar-when i, .radar-key .k-open::before { background: none; border: 1px solid var(--rc); }
.radar-item strong { font-size: 1.14rem; letter-spacing: -0.015em; line-height: 1.2; }
.radar-item p { margin: 0; font-size: 0.9rem; color: var(--muted); }
.radar-item .go { margin-top: auto; padding-top: 0.4rem; font-family: var(--font-mono); font-size: 0.74rem; color: var(--accent); }

.radar-key { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; margin: 0.9rem 0 0; font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }
.radar-key .k { display: inline-flex; align-items: center; gap: 0.45rem; }
.radar-key .k::before { content: ''; }
.k-now  { --rc: var(--accent); }
.k-soon { --rc: var(--signal); }
.k-open { --rc: var(--muted); }

/* ---- Print: every step on paper, none of the controls ------------------------------------ */

@media print {
  .hero-side, .roles, .radar, .radar-key, .st-tabs, .st-nav, .st-bar { display: none !important; }
  .stepper .st-panel { display: grid !important; break-inside: avoid; border-top: 1px solid #999; min-height: 0; }
  .st-big { -webkit-text-stroke-color: #333; }
  .s-teaser { display: none; }
}
