/* RingNav project page; extends the Nerfies/CodedVO template (bulma + index.css).
   Light and dark themes: OS preference by default, overridden by the toggle (data-theme on <html>). */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --band: #f7f7f5;
  --surface: #ffffff;
  --ink: #1d1d1b;
  --ink-2: #52514e;
  --muted: #7a7974;
  --line: #e4e3df;
  --track: #f0efec;
  --dim: rgba(255, 255, 255, .5);
  --btn-bg: #363636;
  --btn-fg: #ffffff;
  --code-bg: #f5f5f4;
  --ours: #eef4fc;
  --rn-blue: #2a78d6;
  --vg-orange: #eb6834;
  --gif-rn: #4f9cf2;
  --gif-vg: #d9862a;
  --learned: #5a0052;
  --learned-wash: rgba(90, 0, 82, .16);
  --computed: #a67808;
  --shadow: 0 6px 18px rgba(0, 0, 0, .07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --band: #191918; --surface: #1f1f1e; --ink: #edede9; --ink-2: #c3c2b9; --muted: #9a9990;
    --line: #34332f; --track: #2a2a27; --dim: rgba(18, 18, 17, .55); --btn-bg: #e8e7e3; --btn-fg: #121211;
    --code-bg: #1a1a19; --ours: #1a2a3e; --rn-blue: #3987e5; --vg-orange: #d95926;
    --learned: #c07ab6; --learned-wash: rgba(192, 122, 182, .22); --computed: #cf9f2f; --shadow: 0 6px 18px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --band: #191918; --surface: #1f1f1e; --ink: #edede9; --ink-2: #c3c2b9; --muted: #9a9990;
  --line: #34332f; --track: #2a2a27; --dim: rgba(18, 18, 17, .55); --btn-bg: #e8e7e3; --btn-fg: #121211;
  --code-bg: #1a1a19; --ours: #1a2a3e; --rn-blue: #3987e5; --vg-orange: #d95926;
  --learned: #c07ab6; --learned-wash: rgba(192, 122, 182, .22); --computed: #cf9f2f; --shadow: 0 6px 18px rgba(0, 0, 0, .4);
}

/* ---------- Template surfaces follow the theme ---------- */
html { scroll-behavior: smooth; background: var(--bg); }
body, .navbar, .footer, .hero, .section { background-color: var(--bg); color: var(--ink-2); }
.title, .content h1, .content h2, .content h3, .content strong, strong, .content b, b { color: var(--ink); }
.subtitle, .content { color: var(--ink-2); }
.navbar-item, .navbar-link { color: var(--ink-2); }
.navbar-dropdown { background: var(--surface); border-color: var(--line); }
a.navbar-item:hover, .navbar-link:hover, .navbar-item.has-dropdown:hover .navbar-link { background: var(--band) !important; color: var(--ink) !important; }
.navbar-burger { color: var(--ink); }
.navbar-menu { background: var(--bg); }
.content pre, pre { background: var(--code-bg); color: var(--ink); }
.button.is-dark { background: var(--btn-bg); color: var(--btn-fg); }
.button.is-dark:hover { background: var(--ink); color: var(--bg); }
.section.rn-band, .rn-band { background: var(--band); }
.navbar { position: relative; }

.rn-banner { width: 100%; height: auto; border-radius: 10px; display: block; }
.rn-video { width: 100%; border-radius: 10px; background: #000; display: block; }
.rn-lede { text-align: center; color: var(--ink-2); font-size: 1.05rem; max-width: 42rem; margin: -.75rem auto 1.75rem; }
.rn-sublede { color: var(--ink-2); margin: 0 0 1rem; text-align: center; }
.rn-caption { color: var(--muted); font-size: .85rem; margin: .4rem 0 1.25rem; }
.rn-subhead { margin-top: 3rem; margin-bottom: .75rem !important; font-family: 'Google Sans', sans-serif; text-align: center; }
.button.is-soon { opacity: .5; cursor: not-allowed; }

/* ---------- Theme toggle and sticky link bar ---------- */
.rn-theme-btn {
  display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: .9rem;
}
.rn-theme-btn:hover { background: var(--band); }
.rn-theme-top { position: absolute; right: 1rem; top: .7rem; z-index: 31; }
.rn-sticky {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40; background: var(--bg);
  border-bottom: 1px solid var(--line); transform: translateY(-100%); transition: transform .2s ease;
}
.rn-sticky.is-on { transform: none; box-shadow: var(--shadow); }
.rn-sticky-inner { max-width: 1000px; margin: 0 auto; padding: .45rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.rn-sticky-title { font-family: 'Google Sans', sans-serif; font-weight: 600; color: var(--ink); font-size: 1.05rem; }
.rn-sticky-title:hover { color: var(--ink); }
.rn-sticky-links { display: flex; gap: .35rem; align-items: center; }
.rn-sticky-links a {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--btn-fg); background: var(--btn-bg);
  border-radius: 999px; padding: .28rem .7rem; white-space: nowrap;
}
.rn-sticky-links a:hover { color: var(--btn-fg); opacity: .85; }
.rn-sticky-links a.is-soon { opacity: .4; cursor: not-allowed; }
.rn-sticky-links .rn-theme-btn { width: 1.9rem; height: 1.9rem; margin-left: .2rem; }
@media (max-width: 640px) {
  .rn-sticky-links span { display: none; }
  .rn-sticky-links a { padding: .4rem .55rem; }
}

/* ---------- Task-shaped memory ---------- */
.rn-compare { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.25fr); gap: 1rem; align-items: center; }
.rn-mem { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; height: 100%; }
.rn-mem.is-this { border: 2px solid var(--computed); box-shadow: var(--shadow); }
.rn-mem-title { font-family: 'Google Sans', sans-serif; font-weight: 600; color: var(--ink); }
.rn-mem-title span { font-size: .7rem; color: #fff; background: var(--computed); border-radius: 999px; padding: .08rem .5rem; margin-left: .4rem; vertical-align: .15em; }
.rn-mem-fig { display: block; width: 110px; height: 110px; margin: .6rem auto; }
.rn-mem-fig .cells rect { fill: var(--track); stroke: var(--muted); stroke-width: .8; }
.rn-mem-fig .ring { fill: none; stroke: var(--computed); stroke-width: 4; }
.rn-mem-fig .wedge { fill: var(--learned-wash); }
.rn-mem-fig .needle { stroke: var(--ink); stroke-width: 1.5; }
.rn-mem-fig .dot { fill: var(--computed); stroke: var(--surface); stroke-width: 2; }
.rn-mem-state { text-align: center; color: var(--ink-2); font-size: .95rem; }
.rn-mem-list { list-style: none; margin: .7rem 0 0; padding: 0; font-size: .85rem; color: var(--ink-2); }
.rn-mem-list li { margin: .2rem 0; }
.rn-mem-list i { width: 1.2rem; color: var(--muted); }
.rn-mem.is-this .rn-mem-list i { color: var(--computed); }
.rn-mem-arrow { color: var(--muted); font-size: 1.3rem; }
@media (max-width: 760px) {
  .rn-compare { grid-template-columns: 1fr; }
  .rn-mem-arrow { transform: rotate(90deg); justify-self: center; }
}

/* ---------- Method ---------- */
.rn-pipeline { border-radius: 10px; overflow: hidden; margin: 0; background: #000; }
.rn-pipeline video { width: 100%; height: auto; display: block; aspect-ratio: 16 / 9; }
.rn-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; margin-top: 1rem; }
@media (max-width: 900px) { .rn-steps { grid-template-columns: 1fr; } }
.rn-step { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--computed); border-radius: 10px; padding: .9rem 1rem .6rem; text-align: center; }
.rn-step.is-learned { border-top-color: var(--learned); }
.rn-step-head { font-family: 'Google Sans', sans-serif; font-weight: 600; color: var(--ink); text-align: left; }
.rn-step-head .badge {
  display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; margin-right: .5rem;
  background: var(--computed); color: #fff; font-size: .75rem;
}
.rn-step.is-learned .rn-step-head .badge { background: var(--learned); }
.rn-eq { overflow-x: auto; overflow-y: hidden; font-size: .95rem; color: var(--ink); }
.rn-step p { font-size: .82rem; color: var(--muted); margin-top: -.4rem; }

/* ---------- Heading propagation example ---------- */
.rn-demo { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; }
.rn-pills { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.rn-pill {
  font: inherit; font-size: .85rem; color: var(--ink-2); background: transparent; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: .35rem .9rem;
}
.rn-pill.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.rn-demo-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .rn-demo-grid { grid-template-columns: 1fr; } }
.rn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.rn-pair figure { margin: 0; }
.rn-pair canvas { width: 100%; height: auto; display: block; border-radius: 6px; background: var(--track); }
.rn-pair figcaption { font-size: .85rem; color: var(--muted); margin-top: .25rem; text-align: center; }
.rn-filmstrip { width: 100%; height: auto; display: block; margin-top: .75rem; }
.rn-scrub { display: block; margin: .5rem 0 .6rem; }
.rn-scrub input { width: 100%; accent-color: var(--computed); height: 1.4rem; }
.rn-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.rn-controls { display: flex; flex-wrap: wrap; gap: .4rem; }
.rn-ctl {
  font: inherit; font-size: .85rem; display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  min-height: 2.25rem; padding: 0 .85rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.rn-ctl:hover { background: var(--band); }
.rn-ctl.is-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); min-width: 6rem; justify-content: center; }
.rn-ctl.is-on { background: var(--computed); border-color: var(--computed); color: #fff; }
.rn-ctl.is-text { border-color: transparent; color: var(--muted); }
.rn-demo-state svg { width: 100%; max-width: 300px; display: block; margin: 0 auto; }
.rn-demo-state .rg-track { fill: none; stroke: var(--computed); stroke-width: 3; }
.rn-demo-state .rg-tick { stroke: var(--line); stroke-width: 1; }
.rn-demo-state .rg-label { fill: var(--muted); font-size: 11px; }
.rn-demo-state .rg-sector { fill: var(--learned-wash); }
.rn-demo-state .rg-arc { fill: none; stroke: var(--learned); stroke-width: 4; stroke-linecap: round; }
.rn-demo-state .rg-needle { stroke: var(--ink); stroke-width: 1.5; }
.rn-demo-state .rg-hub { fill: var(--ink); }
.rn-demo-state .rg-gt { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.rn-demo-state .rg-dot { fill: var(--computed); stroke: var(--surface); stroke-width: 2; }
.rn-ring-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; justify-content: center; font-size: .8rem; color: var(--ink-2); margin: .25rem 0 .5rem; }
.rn-ring-legend i { display: inline-block; vertical-align: middle; margin-right: .3rem; }
.rn-ring-legend .k-state { width: 10px; height: 10px; border-radius: 50%; background: var(--computed); }
.rn-ring-legend .k-gt { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); }
.rn-ring-legend .k-inc { width: 14px; height: 4px; background: var(--learned); border-radius: 2px; }
.rn-frame { text-align: center; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rn-status { text-align: center; font-size: .88rem; color: var(--ink); margin-top: .5rem; min-height: 2.6em; }

/* ---------- Experiments: loops ---------- */
.rn-legend-note { font-size: .85rem; color: var(--ink-2); text-align: center; margin: 0 0 1rem; }
.k { display: inline-block; width: 20px; height: 0; vertical-align: middle; margin: 0 .35rem 0 .75rem; border-top: 3px solid; }
.k-gt { border-top: 3px dashed var(--ink); }
.k-rn { border-color: var(--gif-rn); }
.k-vg { border-color: var(--gif-vg); }
.rn-loops { display: grid; gap: 1.25rem; justify-content: center; margin: 0 auto 1.25rem; padding: 0 1rem; }
.rn-loops.is-2 { grid-template-columns: repeat(2, minmax(0, 420px)); }
.rn-loops.is-3 { grid-template-columns: repeat(3, minmax(0, 360px)); }
.rn-loops.is-4 { grid-template-columns: repeat(4, minmax(0, 280px)); }
@media (max-width: 1100px) { .rn-loops.is-3, .rn-loops.is-4 { grid-template-columns: repeat(2, minmax(0, 420px)); } }
@media (max-width: 560px) { .rn-loops.is-2, .rn-loops.is-3, .rn-loops.is-4 { grid-template-columns: minmax(0, 420px); } }
.rn-loops figure { margin: 0; }
.rn-loops video { width: 100%; height: auto; display: block; border-radius: 8px; background: #000; aspect-ratio: 480 / 492; }
.rn-loops figcaption { font-size: .88rem; color: var(--ink); margin-top: .4rem; text-align: center; }

/* ---------- Tables ---------- */
.table.rn-table { font-size: .9rem; font-variant-numeric: tabular-nums; background: transparent; color: var(--ink-2); }
.rn-table th { color: var(--ink) !important; font-weight: 600; }
.rn-table td, .rn-table th { border-color: var(--line) !important; white-space: nowrap; }
.rn-table tr.sep td { border-top: 2px solid var(--muted) !important; }
.rn-table tr.is-ours td { background: var(--ours); color: var(--ink); }
.rn-table tr.is-ours td:first-child { font-weight: 600; }
.table-container, .rn-eq { position: relative; }   /* keep KaTeX's MathML inside scroll containers */

/* ---------- Edge deployment ---------- */
.rn-edge { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 700px) { .rn-edge { grid-template-columns: 1fr; } }
.rn-edge-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem .9rem; }
.rn-edge-card.is-gap8 { border: 2px solid var(--computed); box-shadow: var(--shadow); }
.rn-edge-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.rn-edge-name { font-family: 'Google Sans', sans-serif; font-weight: 600; color: var(--ink); }
.rn-edge-badge { font-size: .75rem; font-weight: 600; color: #fff; background: var(--computed); border-radius: 999px; padding: .1rem .6rem; white-space: nowrap; }
.rn-edge-hz { font-family: 'Google Sans', sans-serif; color: var(--ink-2); margin: .35rem 0 .5rem; }
.rn-edge-hz b { font-size: 2.1rem; color: var(--ink); font-weight: 600; line-height: 1; }
.rn-edge-hz small { color: var(--muted); font-size: .85rem; margin-left: .4rem; }
.rn-edge-lanes { width: 100%; height: 64px; display: block; }
.rn-edge-mem { font-size: .82rem; color: var(--muted); margin-top: .45rem; font-variant-numeric: tabular-nums; }
.rn-edge-mem b { color: var(--ink); }

/* ---------- Paper pages ---------- */
.rn-pages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.rn-pages img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 3px; background: #fff; box-shadow: var(--shadow); transition: transform .2s ease; }
.rn-pages img:hover { transform: translateY(-4px); }
@media (max-width: 600px) { .rn-pages { grid-template-columns: repeat(2, 1fr); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rn-sticky, .rn-pages img { transition: none; }
}
