/* ==========================================================================
   CAS · Deep & Stacked Recurrent Networks — deep-recurrent-networks.css
   Deep-dive lecture visuals layered on top of the shared series styles.
   ========================================================================== */

/* ------------------------------------------------- sticky top nav */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 130;
  display: flex; align-items: center; gap: 1.4rem;
  padding: 0.55rem clamp(1rem, 3vw, 2rem);
  background: rgba(5, 8, 14, 0.82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topnav-brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text); flex: none; }
.topnav-brand:hover { text-decoration: none; }
.topnav-brand img { width: 2.1rem; height: 2.1rem; border-radius: 7px; }
.topnav-brand .tb-txt { display: flex; flex-direction: column; line-height: 1.1; }
.topnav-brand .tb-txt strong { font-family: var(--font-display); font-size: 0.85rem; letter-spacing: 0.05em; }
.topnav-brand .tb-txt small { font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.14em; color: var(--text-3); text-transform: uppercase; }
.topnav-links { display: flex; gap: 0.2rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-links a {
  font-size: 0.82rem; font-weight: 500; color: var(--text-2); text-decoration: none;
  padding: 0.35rem 0.65rem; border-radius: 7px; white-space: nowrap; transition: color 0.15s, background 0.15s;
}
.topnav-links a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.topnav-links a.active { color: var(--teal); }
.topnav-back {
  flex: none; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid var(--line-2); border-radius: 8px; padding: 0.4rem 0.8rem; color: var(--text);
  text-decoration: none; transition: border-color 0.2s, color 0.2s;
}
.topnav-back:hover { border-color: var(--teal); color: var(--teal); text-decoration: none; }
@media (max-width: 900px) { .topnav-links { display: none; } }

/* push content below fixed nav; progress bar sits under nav */
main { padding-top: 3.2rem; }
.scroll-progress { top: 3.2rem; }
.rail-toggle { top: 4.4rem; }
.rail { padding-top: 4.6rem; }

/* ------------------------------------------------- hero (YOLO standard) */
.sec-hero { text-align: center; padding-top: clamp(3rem, 8vh, 5.5rem); }
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.06em; color: var(--teal);
  border: 1px solid rgba(94, 234, 212, 0.35); border-radius: 999px; padding: 0.42rem 1.1rem;
  background: rgba(94, 234, 212, 0.06); margin-bottom: 1.6rem;
}
.sec-hero .hero-title { margin-inline: auto; }
.sec-hero .hero-sub { margin-inline: auto; text-align: center; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin: 1.8rem 0 2.4rem; }
.hero-chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em; color: var(--text-2);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 0.45rem 1rem;
  background: rgba(8, 13, 24, 0.55); transition: border-color 0.2s, color 0.2s;
}
.hero-chip:hover { border-color: rgba(94, 234, 212, 0.5); color: var(--teal); }
.hero-chip .hc-ico { color: var(--teal); font-size: 0.85rem; }

.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 1rem; max-width: 980px; margin: 0 auto 2.6rem; }
.hstat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1rem 0.95rem; text-align: center; transition: border-color 0.25s, transform 0.25s;
}
.hstat:hover { border-color: rgba(94, 234, 212, 0.45); transform: translateY(-3px); }
.hstat b { display: block; font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--teal); letter-spacing: -0.02em; }
.hstat span { display: block; font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2); margin-top: 0.3rem; }
.hstat small { display: block; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.08em; color: var(--text-3); margin-top: 0.15rem; }

.sec-hero .def-banner { text-align: left; margin-inline: auto; }
.sec-hero .hero-stage-grid { margin-inline: auto; text-align: left; }

/* ------------------------------------------------- hero layer strip */
.g-cell { height: 14px; flex: 1; border-radius: 3px; background: rgba(148, 163, 184, 0.12); transition: background 0.5s, box-shadow 0.5s; }

/* ------------------------------------------------- layer lens (§02) */
.gate-lab-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.lens-tokens { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-bottom: 1rem; }
.lens-tok {
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.2rem;
  border: 1px solid var(--line-2); border-radius: 9px; padding: 0.5rem 0.8rem;
  background: rgba(8, 13, 24, 0.5); min-width: 4.2rem;
}
.lens-tok b { font-size: 0.95rem; color: var(--text); font-weight: 600; }
.lens-tag { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.08em; color: var(--teal); text-transform: uppercase; }
.span-tok { transition: border-color 0.25s, box-shadow 0.25s; }
.dim-tok { opacity: 0.45; }
.lens-legend { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.lens-span-chip {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.05em;
  border: 1px solid; border-radius: 999px; padding: 0.3rem 0.75rem; background: rgba(5, 8, 14, 0.5);
}

/* ------------------------------------------------- tab bar */
.tab-bar { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1.2rem; }
.tab {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.55rem 0.95rem; border: 1px solid var(--line); border-radius: 999px; color: var(--text-2);
  background: rgba(8, 13, 24, 0.45); transition: all 0.18s; cursor: pointer;
}
.tab:hover { border-color: var(--line-2); color: var(--text); }
.tab[aria-selected="true"] { border-color: var(--teal); background: var(--teal); color: #05231f; font-weight: 700; }

/* ------------------------------------------------- anatomy map (§03) */
.cell-map-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.cell-svg-wrap { background: rgba(5, 8, 14, 0.55); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.8rem; }
.cell-gate { transition: opacity 0.25s; outline: none; }
.cell-gate:focus .gate-ring { stroke-dasharray: 4 3; }
.cell-info { margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(8, 13, 24, 0.45); padding: 0.9rem 1.1rem; min-height: 4.6rem; }
.cell-info b { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.06em; }
.cell-info p { color: var(--text-2); font-size: 0.95rem; line-height: 1.6; }

.conveyor-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-top: 1.2rem; }

/* ------------------------------------------------- walkthrough (§04) */
.walk-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.walk-stage { background: rgba(5, 8, 14, 0.55); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.6rem 0.4rem; overflow-x: auto; }
.walk-svg { min-width: 880px; width: 100%; height: auto; display: block; }
.wk-flow { stroke: rgba(148, 163, 184, 0.45); stroke-width: 1.7; fill: none; transition: stroke 0.35s, opacity 0.35s; }
.wk-box { fill: #0b1526; stroke: rgba(148, 163, 184, 0.4); stroke-width: 1.3; transition: stroke 0.35s, opacity 0.35s; }
.wk-op { fill: #0d1830; stroke: rgba(148, 163, 184, 0.4); stroke-width: 1.3; transition: stroke 0.35s, opacity 0.35s; }
.wk-t { font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; fill: var(--text); }
.wk-s { font-family: var(--font-mono); font-size: 8.5px; fill: var(--text-3); letter-spacing: 0.08em; }
.wk-var { font-family: var(--font-mono); font-size: 12.5px; fill: var(--teal); }
.wk-var.h { fill: var(--amber); }
.wk-cap { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; fill: var(--text-3); }
.wk-dim { opacity: 0.16; }
.wk-dot { stroke: var(--bg0); stroke-width: 2; }
.walk-legend { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: 0.9rem; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.05em; color: var(--text-2); }
.walk-legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
.wl-box { width: 14px; height: 14px; border-radius: 4px; background: #0b1526; border: 1.3px solid rgba(148, 163, 184, 0.4); }
.wl-line { width: 20px; height: 2px; background: rgba(148, 163, 184, 0.45); border-radius: 2px; }
.wl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 8px rgba(94, 234, 212, 0.8); }
.walk-dialog { margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(8, 13, 24, 0.45); padding: 1.1rem 1.25rem; min-height: 12rem; }
.walk-dialog .wd-head { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; }
.walk-dialog .wd-head b { font-family: var(--font-mono); font-size: 0.92rem; letter-spacing: 0.05em; }
.walk-dialog p { color: var(--text-2); font-size: 0.95rem; line-height: 1.7; margin: 0.55rem 0 0; }
.walk-dialog p b { color: var(--text); }
.walk-dialog .formula { margin: 0.8rem 0 0; white-space: normal; }
.walk-specs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.walk-spec { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.05em; color: var(--text-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.75rem; background: rgba(5, 8, 14, 0.5); }
.walk-nav { display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.walk-count { margin-left: auto; }
html.static .wk-flow, html.static .wk-box, html.static .wk-op { transition: none; }

/* ------------------------------------------------- parameter meter (§05) */
.pm-bars { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.1rem; }
.pm-row { display: grid; grid-template-columns: 8.5rem 1fr 5.5rem; gap: 0.9rem; align-items: center; }
.pm-lab { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
.pm-lab small { display: block; color: var(--text-3); font-size: 0.6rem; letter-spacing: 0.06em; margin-top: 0.15rem; }
.pm-track { height: 18px; border-radius: 6px; background: rgba(148, 163, 184, 0.1); overflow: hidden; }
.pm-fill { display: block; height: 100%; border-radius: 6px; transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.pm-fill.rnn { background: rgba(148, 163, 184, 0.55); }
.pm-fill.gru { background: linear-gradient(90deg, rgba(94, 234, 212, 0.45), rgba(94, 234, 212, 0.85)); }
.pm-fill.lstm { background: linear-gradient(90deg, rgba(251, 113, 133, 0.4), rgba(251, 113, 133, 0.8)); }
.pm-val { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700; color: var(--text); text-align: right; }
@media (max-width: 560px) { .pm-row { grid-template-columns: 6.5rem 1fr 4.5rem; } }

/* ------------------------------------------------- sequence lab (§06) */
.seq-card { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, rgba(8, 13, 24, 0.6), rgba(8, 13, 24, 0.25)); overflow: hidden; }
.seq-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; padding: 1rem 1.4rem; border-bottom: 1px solid var(--line); background: rgba(8, 13, 24, 0.5); }
#seqSelect { background: #09101d; color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 0.45rem 0.7rem; font-family: var(--font-mono); font-size: 0.8rem; max-width: 100%; }
.seq-ctl { display: flex; gap: 0.4rem; margin-left: auto; flex-wrap: wrap; }
.seq-tokenbar { padding: 0.9rem 1.4rem 0.4rem; background: rgba(8, 13, 24, 0.35); }
.seq-stage { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr); gap: 1.1rem; padding: 1.2rem 1.4rem; }
@media (max-width: 920px) { .seq-stage { grid-template-columns: 1fr; } }

.chan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
@media (max-width: 480px) { .chan-grid { grid-template-columns: repeat(2, 1fr); } }
.chan { display: flex; flex-direction: column; gap: 0.3rem; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.55rem 0.6rem; background: rgba(8, 13, 24, 0.45); }
.chan-lbl { font-size: 0.62rem; letter-spacing: 0.12em; color: var(--text-3); }
.chan-box { height: 2.6rem; border-radius: 6px; background: rgba(148, 163, 184, 0.1); transition: background 0.5s, box-shadow 0.5s; }
.chan-val { font-size: 0.72rem; color: var(--text-2); }

.act-row { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.7rem; }
.act-row .mono { font-size: 0.72rem; color: var(--text-2); }
.act-bar { flex: 1; height: 8px; border-radius: 4px; background: rgba(148, 163, 184, 0.12); overflow: hidden; }
.act-bar i { display: block; height: 100%; width: 0%; border-radius: 4px; background: linear-gradient(90deg, rgba(94, 234, 212, 0.4), rgba(94, 234, 212, 0.85)); transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }

.seq-narration { display: flex; gap: 0.9rem; align-items: flex-start; padding: 0.95rem 1.4rem 1.1rem; border-top: 1px solid var(--line); background: rgba(8, 13, 24, 0.5); }

/* ------------------------------------------------- numbers (§08) */
.num-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.num-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.1rem; }
.num-stage { border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(5, 8, 14, 0.5); padding: 1.2rem 1.3rem; min-height: 11rem; }
.num-body { margin: 0; font-size: 0.95rem; line-height: 1.8; color: var(--text-2); }
.num-body code { color: var(--teal); font-size: 0.86em; }
.num-body b { color: var(--amber); }
.num-nav { display: flex; gap: 0.5rem; margin-top: 1rem; }

/* ------------------------------------------------- gradient (§09) */
.grad-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.grad-lane { margin-top: 0.9rem; }
.grad-lane .mini { display: block; margin-bottom: 0.2rem; }
.cv-x-l::after { content: attr(data-mult); position: absolute; top: -1.05rem; left: 50%; transform: translateX(-50%); font-family: var(--font-mono); font-size: 0.58rem; color: var(--teal); }
.cv-x-d::after { content: attr(data-mult); position: absolute; top: -1.05rem; left: 50%; transform: translateX(-50%); font-family: var(--font-mono); font-size: 0.58rem; color: var(--sky); }
.cv-x-r::after { content: attr(data-mult); position: absolute; top: -1.05rem; left: 50%; transform: translateX(-50%); font-family: var(--font-mono); font-size: 0.58rem; color: var(--green); }
.res-toggle { display: flex; align-items: center; gap: 0.55rem; font-size: 0.85rem; color: var(--text-2); cursor: pointer; }
.res-toggle input { accent-color: var(--teal); width: 1rem; height: 1rem; cursor: pointer; }
.res-toggle code { color: var(--teal); font-size: 0.8em; }

/* ------------------------------------------------- compare (§10) */
.gru-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.formula { font-family: var(--font-mono); font-size: 0.86rem; line-height: 1.9; color: var(--text); background: rgba(5, 8, 14, 0.55); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.9rem 1.1rem; overflow-x: auto; white-space: nowrap; }
.formula code, .math-role code { color: var(--teal); font-size: 0.85em; }
.gru-vs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 1rem; margin-top: 1.3rem; }

.cmp-wrap { margin-top: 1.6rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.cmp-table th { text-align: left; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); padding: 0.85rem 1.1rem; background: rgba(148, 163, 184, 0.06); border-bottom: 1px solid var(--line-2); }
.cmp-table th.cmp-hl { color: var(--teal); }
.cmp-table td { padding: 0.75rem 1.1rem; border-bottom: 1px solid var(--line); color: var(--text-2); vertical-align: top; }
.cmp-table tr:last-child td { border-bottom: 0; }
.cmp-table td:first-child { color: var(--text-3); font-size: 0.82rem; }
.cmp-table td.cmp-hl { color: var(--text); background: rgba(94, 234, 212, 0.045); }
.cmp-table td.cmp-hl b { color: var(--teal); }
.cmp-table td .mono { font-size: 0.72rem; }

/* ------------------------------------------------- one-line summary callout */
.oneline {
  margin-top: 1.6rem; border: 1px solid rgba(94, 234, 212, 0.35); border-radius: var(--radius-s);
  background: linear-gradient(90deg, rgba(94, 234, 212, 0.08), rgba(94, 234, 212, 0.02));
  padding: 1rem 1.25rem; font-size: 0.98rem; line-height: 1.7; color: var(--text-2);
}
.oneline b { color: var(--teal); }

/* ------------------------------------------------- footer citation */
.cite-note { font-size: 0.8rem; color: var(--text-3); max-width: 70ch; line-height: 1.6; }

/* ------------------------------------ YOLO-standard section kickers */
.sec-head .kicker { gap: 0.4rem; letter-spacing: 0.22em; }
.sec-head .kicker .knum { display: inline; border: 0; background: none; padding: 0; min-width: 0; height: auto; border-radius: 0; white-space: nowrap; }
.sec-head .kicker .knum::before { content: "— SECTION "; }
.sec-head .kicker .knum::after { content: " ·"; }

/* ------------------------------------------------- static print mode */
html.static .g-cell, html.static .pm-fill, html.static .chan-box, html.static .act-bar i { transition: none; }
