/* ═══════════════════════════════════════════════════════════════════
   GUARDIANS · ACT II — THE TRAINING GROUNDS (training.css)
   Additive layer only. css/portal.css is LAW and is never modified.
   Theme law: MAGIC-FIRST twilight chrome; teal = tech thread only.
   Lesson CARDS are the artifact layer: PARCHMENT (paper stays paper).
   ═══════════════════════════════════════════════════════════════════ */

/* ── Lesson track (the hub's list of lessons) ───────────────────── */
.lesson-track { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.lesson-track li {
  display: flex; align-items: center; gap: 16px;
  border: 1px solid rgba(183, 154, 224, 0.24);
  background: rgba(16, 13, 30, 0.72);
  border-radius: 10px; padding: 14px 18px;
}
.lesson-track .rune-slot {
  flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--arc-line); border-radius: 50%;
  font-family: var(--f-arc); font-size: 1.15rem; color: var(--arc-hi);
}
.lesson-track li.live .rune-slot { border-color: var(--gold-soft); color: var(--gold); box-shadow: 0 0 14px rgba(255, 207, 136, 0.22); }
.lesson-track .l-txt { flex: 1 1 auto; min-width: 200px; }
.lesson-track .l-txt h3 { margin: 0 0 3px; font-size: 1.08rem; letter-spacing: 0.05em; color: #f0eaf8; }
.lesson-track .l-txt p { margin: 0; font-family: var(--f-arc); font-size: 0.9rem; color: #ab9fc4; }
.lesson-track .go { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--arc-hi); text-decoration: none; white-space: nowrap; }
.lesson-track li.live { border-color: rgba(255, 207, 136, 0.35); }
.lesson-track li.live:hover { box-shadow: 0 10px 26px rgba(0,0,0,.5), 0 0 18px rgba(255, 207, 136, 0.14); }
.lesson-track li.forged-next { opacity: 0.62; }
.lesson-track li.forged-next .go { color: #7d7396; letter-spacing: 0.14em; }
.lesson-track a.wrap { display: contents; color: inherit; text-decoration: none; }

/* ── Walkthrough engine ─────────────────────────────────────────── */
.wt-shell { max-width: 880px; margin: 0 auto; }

/* Progress runes: one cog per step */
.wt-runes { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 0 0 22px; padding: 0; list-style: none; }
.wt-runes button {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--arc-line); background: rgba(16, 13, 30, 0.8);
  color: #7d7396; font-family: var(--f-ui); font-weight: 700; font-size: 0.78rem;
  transition: color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.wt-runes button:hover { color: var(--arc-hi); border-color: var(--arc-soft); }
.wt-runes button[aria-current="step"] {
  color: var(--gold); border-color: var(--gold-soft);
  box-shadow: 0 0 12px rgba(255, 207, 136, 0.3);
}
.wt-runes button.done { color: var(--arc-hi); border-color: var(--arc-soft); background: rgba(183, 154, 224, 0.12); }

/* The lesson card: PARCHMENT. Paper things stay paper. */
.wt-card {
  background:
    radial-gradient(ellipse at 12% 8%, rgba(255,255,255,0.35), transparent 55%),
    linear-gradient(168deg, var(--parch), var(--parch-2));
  color: var(--ink);
  border-radius: 6px;
  padding: clamp(22px, 4vw, 40px);
  box-shadow: 0 4px 0 #9a8a64, 0 22px 48px rgba(0, 0, 0, 0.55);
  position: relative;
}
.wt-card .kicker {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.28em; text-transform: uppercase;
  color: #8a6d3b;
}
.wt-card h2 { font-family: var(--f-arc); font-weight: 400; font-size: clamp(1.5rem, 3vw, 2rem); margin: 6px 0 14px; color: var(--ink); }
.wt-card .body p { font-size: 1.02rem; line-height: 1.65; margin: 0 0 12px; color: var(--ink); }
.wt-card .body strong { color: #5d3f14; }
.wt-card .body ul { margin: 0 0 12px; padding-left: 20px; }
.wt-card .body li { margin: 4px 0; line-height: 1.55; }
.wt-card .body table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 0.95rem; }
.wt-card .body th, .wt-card .body td { border: 1px solid rgba(74, 61, 44, 0.35); padding: 6px 10px; text-align: left; }
.wt-card .body th { background: rgba(74, 61, 44, 0.1); font-weight: 700; }
.wt-card .formula {
  font-family: var(--f-ui); font-weight: 700; letter-spacing: 0.03em;
  background: rgba(74, 61, 44, 0.08); border: 1px dashed rgba(74, 61, 44, 0.4);
  border-radius: 4px; padding: 10px 14px; margin: 10px 0 14px; display: block;
}

/* Book citation: the page reference stamp */
.wt-cite {
  margin-top: 16px; font-family: var(--f-arc); font-style: italic;
  font-size: 0.85rem; color: var(--ink-soft);
  border-top: 1px solid rgba(74, 61, 44, 0.3); padding-top: 8px;
}

/* "Why this matters" — the margin note */
.wt-why {
  margin: 16px 0 0; padding: 12px 16px;
  border-left: 3px solid #8a6d3b; background: rgba(138, 109, 59, 0.09);
  border-radius: 0 4px 4px 0;
}
.wt-why .tag { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase; color: #8a6d3b; display: block; margin-bottom: 4px; }
.wt-why p { margin: 0; font-family: var(--f-arc); font-style: italic; line-height: 1.55; color: var(--ink-soft); }

/* Tela's whisper — the companion on the corner of the page */
.wt-tela { display: flex; align-items: flex-start; gap: 12px; margin-top: 18px; }
.wt-tela .tela-mini { flex: 0 0 auto; width: 52px; height: 40px; }
.wt-tela .tela-mini .eye { animation: tela-blink 6s infinite; transform-origin: center; }
.wt-tela p { margin: 4px 0 0; font-family: var(--f-arc); font-style: italic; font-size: 0.95rem; color: #4a5f6d; }
.wt-tela p b { font-style: normal; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: #3f7987; display: block; margin-bottom: 2px; }

/* Dice: the cog spins while fate decides */
.wt-roll { margin-top: 18px; padding: 14px 16px; border: 1px solid rgba(74, 61, 44, 0.35); border-radius: 6px; background: rgba(255, 255, 255, 0.25); }
.wt-roll .roll-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.wt-roll button {
  font-family: var(--f-ui); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  font-size: 0.8rem; cursor: pointer; color: #2a2118;
  background: linear-gradient(180deg, #f7eed6, #e0d2ae);
  border: 1px solid #9a8a64; border-radius: 6px; padding: 10px 18px;
  box-shadow: 0 2px 0 #9a8a64;
}
.wt-roll button:hover { transform: translateY(-1px); box-shadow: 0 3px 0 #9a8a64; }
.wt-roll button:disabled { opacity: 0.55; cursor: wait; transform: none; }
.wt-roll .cog { width: 34px; height: 34px; }
.wt-roll .cog.spinning { animation: cog-spin 0.9s cubic-bezier(0.3, 0.1, 0.3, 1); }
@keyframes cog-spin { from { transform: rotate(0); } to { transform: rotate(720deg); } }
.wt-roll .result { font-weight: 700; font-size: 1rem; color: var(--ink); min-height: 1.3em; }
.wt-roll .result .die { color: #8a6d3b; }
.wt-roll .verdict { margin: 10px 0 0; font-size: 0.95rem; line-height: 1.5; color: var(--ink); }

/* Choice branches */
.wt-choice { margin-top: 18px; }
.wt-choice .prompt { font-weight: 700; margin: 0 0 10px; color: var(--ink); }
.wt-choice .opts { display: flex; gap: 10px; flex-wrap: wrap; }
.wt-choice .opts button {
  font-family: var(--f-ui); font-weight: 600; font-size: 0.9rem; cursor: pointer;
  color: var(--ink); background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(74, 61, 44, 0.45); border-radius: 6px; padding: 10px 16px;
}
.wt-choice .opts button:hover { background: rgba(255, 255, 255, 0.65); }
.wt-choice .opts button[aria-pressed="true"] { background: #4a3d2c; color: var(--parch); border-color: #2a2118; }
.wt-choice .outcome { margin-top: 14px; padding: 12px 16px; background: rgba(255,255,255,0.3); border: 1px dashed rgba(74, 61, 44, 0.4); border-radius: 6px; }
.wt-choice .outcome p { margin: 0 0 8px; line-height: 1.55; }
.wt-choice .outcome p:last-child { margin-bottom: 0; }

/* Prev / next */
.wt-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; gap: 12px; }
.wt-nav .steps-said { font-family: var(--f-arc); font-style: italic; font-size: 0.85rem; color: #9d92b8; }
.wt-nav button {
  font-family: var(--f-ui); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  font-size: 0.78rem; cursor: pointer; padding: 12px 22px; border-radius: 8px;
  color: var(--arc-hi); background: transparent; border: 1px solid var(--arc-soft);
}
.wt-nav button:hover { border-color: var(--arc); box-shadow: 0 0 18px var(--arc-glow); }
.wt-nav button:disabled { opacity: 0.35; cursor: default; box-shadow: none; }
.wt-nav button.primary { color: #241c10; background: linear-gradient(180deg, #ffe3ae, var(--gold)); border-color: #9a8a64; }
.wt-nav button.primary:hover { box-shadow: 0 0 22px rgba(255, 207, 136, 0.35); }

/* No-JS fallback chain (also the print view of the lesson) */
.lesson-fallback details {
  background: linear-gradient(168deg, var(--parch), var(--parch-2));
  color: var(--ink); border-radius: 6px; margin: 0 0 14px;
  box-shadow: 0 3px 0 #9a8a64, 0 14px 30px rgba(0, 0, 0, 0.45);
}
.lesson-fallback summary {
  cursor: pointer; padding: 14px 20px; font-weight: 700; letter-spacing: 0.04em;
  font-size: 1.05rem; color: var(--ink);
}
.lesson-fallback summary .k { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase; color: #8a6d3b; margin-right: 10px; }
.lesson-fallback .fb-body { padding: 0 20px 18px; }
.lesson-fallback .fb-body p { line-height: 1.6; margin: 0 0 10px; }
.lesson-fallback .fb-body table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 0.93rem; }
.lesson-fallback .fb-body th, .lesson-fallback .fb-body td { border: 1px solid rgba(74, 61, 44, 0.35); padding: 5px 9px; text-align: left; }
.lesson-fallback .note-line { font-family: var(--f-arc); font-style: italic; font-size: 0.9rem; color: var(--ink-soft); }
html.js-on .lesson-fallback { display: none; }
html:not(.js-on) .wt-shell { display: none; }

/* ── AP Calculator ──────────────────────────────────────────────── */
.ap-calc {
  background:
    radial-gradient(ellipse at 12% 8%, rgba(255,255,255,0.35), transparent 55%),
    linear-gradient(168deg, var(--parch), var(--parch-2));
  color: var(--ink); border-radius: 6px;
  padding: clamp(20px, 3.5vw, 34px);
  box-shadow: 0 4px 0 #9a8a64, 0 22px 48px rgba(0, 0, 0, 0.55);
  max-width: 880px; margin: 0 auto;
}
.ap-calc h2 { font-family: var(--f-arc); font-weight: 400; margin: 0 0 4px; color: var(--ink); }
.ap-calc .sub { font-family: var(--f-arc); font-style: italic; color: var(--ink-soft); margin: 0 0 18px; font-size: 0.92rem; }
.ap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ap-field label { display: block; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: #8a6d3b; margin-bottom: 4px; }
.ap-field input[type="number"], .ap-field select {
  width: 100%; font-family: var(--f-ui); font-weight: 700; font-size: 1.05rem;
  color: var(--ink); background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(74, 61, 44, 0.45); border-radius: 5px; padding: 8px 10px;
}
.ap-readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 6px 0 16px; }
.ap-readout .stat {
  border: 1px solid rgba(74, 61, 44, 0.4); border-radius: 6px; padding: 12px 16px;
  background: rgba(255, 255, 255, 0.3);
}
.ap-readout .stat .n { font-size: 1.9rem; font-weight: 700; color: #5d3f14; line-height: 1.1; }
.ap-readout .stat .l { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: #8a6d3b; }
.ap-readout .stat .f { font-family: var(--f-arc); font-style: italic; font-size: 0.82rem; color: var(--ink-soft); margin-top: 3px; }
.ap-costs table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.ap-costs th, .ap-costs td { border: 1px solid rgba(74, 61, 44, 0.35); padding: 7px 11px; text-align: left; }
.ap-costs th { background: rgba(74, 61, 44, 0.1); }
.ap-costs .live-n { font-weight: 700; color: #5d3f14; }
.ap-card-link { margin-top: 16px; font-family: var(--f-arc); font-style: italic; font-size: 0.92rem; color: var(--ink-soft); }
.ap-card-link a { color: #5d3f14; font-style: normal; font-weight: 700; }

/* Static card mirror (no-JS truth) */
.card-mirror table { width: 100%; border-collapse: collapse; font-size: 0.93rem; margin: 0 0 16px; }
.card-mirror th, .card-mirror td { border: 1px solid rgba(74, 61, 44, 0.35); padding: 6px 10px; text-align: left; vertical-align: top; }
.card-mirror th { background: rgba(74, 61, 44, 0.1); width: 34%; }

/* ── Doors on the training hub (twilight side) ──────────────────── */
.rails { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.rail-card {
  border: 1px solid rgba(183, 154, 224, 0.28); border-radius: 12px;
  background: linear-gradient(180deg, rgba(183, 154, 224, 0.07), rgba(16, 13, 30, 0.6));
  padding: 24px; position: relative;
}
.rail-card h3 { font-weight: 700; letter-spacing: 0.05em; color: #f2fbfd; font-size: 1.3rem; margin: 0 0 10px; }
.rail-card ol { margin: 0 0 14px; padding-left: 20px; }
.rail-card ol li { margin: 7px 0; font-family: var(--f-arc); color: #ab9fc4; line-height: 1.5; }
.rail-card ol li b { color: #e9e0f4; font-family: var(--f-ui); font-weight: 600; letter-spacing: 0.03em; }
.rail-card .go { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--arc-hi); text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .wt-roll .cog.spinning { animation: none; }
  .wt-runes button, .wt-roll button, .wt-nav button { transition: none; }
}

@media print {
  .g-header, .g-footer, .wt-shell, .btn-ghost { display: none !important; }
  html:not(.js-on) .wt-shell { display: none !important; }
  .lesson-fallback { display: block !important; }
  .lesson-fallback details { box-shadow: none; border: 1px solid #999; }
  .lesson-fallback details { page-break-inside: avoid; }
}

/* Interior-page stage: full curtain, matching the Index hero.
   The old rule here set a shorter min-height — clamp(460px, 74vh, 780px) — which is
   why this hero sat lower than the others. Removed so .hero-stage governs the height
   everywhere and all heroes agree. The object-position stays: this image's focal point
   (the sigil wheel over the war table) sits slightly above centre. */
.hero-stage.grounds .stage-art { object-position: 50% 44%; }

/* Hero proof line carries the pitch now — keep a readable measure */
.hero-stage.grounds .proof { max-width: 62ch; margin-left: auto; margin-right: auto; line-height: 1.7; }

/* The five doors of the track deserve real hover feedback (they ARE links) */
.lesson-track li.live {
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.lesson-track li.live .rune-slot, .lesson-track li.live .go {
  transition: box-shadow 0.3s ease, color 0.3s ease, text-shadow 0.3s ease, transform 0.3s ease;
}
.lesson-track li.live:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55), 0 0 26px rgba(255, 207, 136, 0.3);
}
.lesson-track li.live:hover .rune-slot {
  color: #ffe3ae;
  box-shadow: 0 0 20px rgba(255, 207, 136, 0.45), inset 0 0 10px rgba(255, 207, 136, 0.15);
}
.lesson-track li.live:hover .go {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 207, 136, 0.6);
  transform: translateX(4px);
}
@media (prefers-reduced-motion: reduce) {
  .lesson-track li.live, .lesson-track li.live .rune-slot, .lesson-track li.live .go { transition: none; }
  .lesson-track li.live:hover { transform: none; }
  .lesson-track li.live:hover .go { transform: none; }
}
