/* ============================================================================
   NAVIER–STOKES PAGES  ·  shared stylesheet (ns-equations, ns-burgers,
   ns-flow2d, ns-flow3d, ns-wave, ns-vortex)
   ----------------------------------------------------------------------------
   Dark shell with one warm accent. Type comes from lib/sci.css, which each
   page loads after this file: STIX Two Text for titles and headings, Inter
   for text and controls, the system mono for numbers only. Labels are
   sentence case with no letter-spacing.

   Math colors: lib/sci.css gives .m1 to .m6. main.js sets the class map
   (grep -n 'NS_RULES' main.js). A slider label and a readout key use the
   same class as the symbol in the equations.

   GREP MAP
     grep -n 'TOKENS'       page colors and panel widths
     grep -n 'STAGE'        #stage, scrubber, overlay labels (.ov)
     grep -n 'TOPBAR'       title bar and #status
     grep -n 'PANEL'        #qp head, view buttons
     grep -n 'CONTROLS'     .ctl slider rows, buttons, toggles, readouts
     grep -n 'MATH PANEL'   #mp, prose, .eq equation boxes
     grep -n 'PHONE'        narrow layout
   ========================================================================== */
/* TOKENS */
:root{
  --bg:#0a0810; --bg2:#120e18; --surface:#1a1420;
  --border:rgba(252,180,120,0.08); --border-b:rgba(252,180,120,0.2);
  --blue:#f6a03f; --blue-dim:#a85f14; --blue-faint:rgba(249,142,9,0.07);
  --yellow:#fcf1a4; --yellow-dim:#b9a865; --yellow-faint:rgba(252,241,164,0.06);
  --green:#7ec27e; --red:#e34a6a;
  --text:#ddd5d8; --text-dim:#a2969f; --text-faint:#71666f; --text-bright:#f4eff0;
  --qp-w:0px; --mp-w:470px;
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html,body{width:100%;height:100%;overflow:hidden;background:var(--bg)}
body{font-family:var(--sci-sans);color:var(--text);-webkit-font-smoothing:antialiased;font-size:14px}
button,select,input{font-family:inherit}
.grid-bg{display:none}

/* STAGE */
#stage{position:fixed;top:48px;left:var(--qp-w);right:var(--mp-w);bottom:0;z-index:1;transition:left .22s,right .22s}
body.qp-collapsed #stage{left:0}
body.mp-collapsed #stage{right:44px}
#stage canvas{position:absolute;inset:0;width:100%;height:100%;display:none}
#stage canvas.active{display:block}
#stage-overlay{position:absolute;inset:0;pointer-events:none;z-index:3}
#stage-scrub{position:absolute;left:0;right:0;bottom:0;height:48px;z-index:5;display:flex;align-items:center;gap:14px;padding:0 22px;background:var(--bg);border-top:1px solid var(--border-b)}
#stage-scrub.off{display:none}
.ss-name{font-size:.78rem;color:var(--text-dim);white-space:nowrap}
.ss-val{font:.74rem var(--sci-mono);color:var(--blue);min-width:120px;text-align:right;font-variant-numeric:tabular-nums}
#stage-scrub input[type=range]{flex:1;height:20px;-webkit-appearance:none;background:transparent}
#stage-scrub input[type=range]::-webkit-slider-runnable-track{height:3px;background:var(--border-b)}
#stage-scrub input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;border-radius:50%;background:var(--blue);margin-top:-5.5px;border:0}
/* Overlay labels: plain text with inline MathJax SVG. The SVG takes its size
   from the font size, so .ov sets the size of the math too. Sizes are in em:
   stageDims() in main.js sets the #stage-overlay font size from the width. */
.ov{position:absolute;font-family:var(--sci-sans);font-size:.88em;color:var(--text-dim);line-height:1.55;white-space:normal}
.ov mjx-container{color:var(--text-bright)}
.ov svg{overflow:visible}
.ov.eq{font-size:1em}
.ov.small{font-size:.8em}
.ov.hdr{font-size:.86em}
.ov.hdr mjx-container{white-space:nowrap;font-size:1.08em}
#stage-caption{display:none}

/* TOPBAR */
.topbar{position:fixed;top:0;left:0;right:0;z-index:300;display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:0 1.4rem;height:48px;background:var(--bg);border-bottom:1px solid var(--border-b)}
.topbar-l{display:flex;align-items:baseline;gap:1.1rem;min-width:0}
.sys-name{color:var(--text-bright);font-family:var(--sci-serif);font-weight:400;font-size:1.2rem;white-space:nowrap}
.sys-status{font:.74rem var(--sci-mono);color:var(--green)}
.sys-status.paused{color:var(--yellow)}
.topbar-r{font-size:.74rem;color:var(--text-faint);text-align:right;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.topbar-r a{color:var(--blue);text-decoration:none}

/* PANEL. #qp stays hidden: setView() moves the active control section into
   the math panel. */
#qp{display:none!important;position:fixed;top:48px;left:0;bottom:0;width:var(--qp-w);background:var(--bg);border-right:1px solid var(--border-b);z-index:200;display:flex;flex-direction:column;overflow:hidden;transition:width .22s cubic-bezier(.4,0,.2,1)}
body.qp-collapsed #qp{width:54px}
body.qp-collapsed .qp-body,body.qp-collapsed .qp-title{display:none}
.qp-head{display:flex;align-items:flex-start;justify-content:space-between;padding:20px 20px 16px;border-bottom:1px solid var(--border)}
.qp-title{font-family:var(--sci-serif);font-weight:400;font-size:1.6rem;color:var(--text-bright);line-height:1.15}
.qp-title small{display:block;font-family:var(--sci-sans);font-size:.8rem;color:var(--text-dim);margin-top:6px}
.collapse-btn{flex-shrink:0;background:transparent;border:1px solid var(--border-b);border-radius:4px;color:var(--text-dim);width:28px;height:28px;cursor:pointer;font-size:.7rem;display:flex;align-items:center;justify-content:center;transition:border-color .2s,color .2s}
.collapse-btn:hover{border-color:var(--blue-dim);color:var(--blue)}
body.qp-collapsed #qp .collapse-btn{transform:rotate(180deg)}
.qp-body{flex:1;overflow-y:auto;padding:14px 20px 30px}
.qp-body::-webkit-scrollbar,.mp-body::-webkit-scrollbar{width:4px}
.qp-body::-webkit-scrollbar-thumb,.mp-body::-webkit-scrollbar-thumb{background:var(--border-b)}

.views{display:flex;flex-direction:column;gap:6px;margin-bottom:18px}
.view-btn{display:flex;align-items:center;gap:12px;background:transparent;border:1px solid var(--border);border-radius:5px;color:var(--text-dim);padding:10px 12px;cursor:pointer;text-align:left;font-family:inherit}
.view-btn .vn{font-family:var(--sci-serif);font-size:1.1rem;color:var(--text);min-width:88px}
.view-btn .vd{font-size:.74rem;line-height:1.4;color:var(--text-faint)}
.view-btn:hover{border-color:var(--border-b)}
.view-btn.on{border-color:var(--blue-dim)}
.view-btn.on .vn{color:var(--blue)}
.view-btn.on .vd{color:var(--text-dim)}

/* CONTROLS. One .ctl row: label (math symbol + word) and value on one line,
   the slider under them at full width. */
.sec{display:none}.sec.on{display:block}
.sec-lbl{font-size:.8rem;font-weight:600;color:var(--text);margin:18px 0 10px;padding-top:12px;border-top:1px solid var(--border)}
.ctl{display:grid;grid-template-columns:1fr auto;align-items:center;gap:4px 10px;margin-bottom:10px}
.ctl label{font-size:.8rem;color:var(--text)}
.ctl label .d{font-size:.74rem;color:var(--text-dim)}
.ctl label i{font-family:var(--sci-serif);font-size:.95rem}
.ctl label .sci-sym{font-size:.95rem;margin-right:6px}
.ctl .v{font:.76rem var(--sci-mono);color:var(--text);text-align:right;min-width:52px;font-variant-numeric:tabular-nums}
.ctl input[type=range]{grid-column:1/3;width:100%;height:16px;background:transparent;-webkit-appearance:none}
.ctl input[type=range]::-webkit-slider-runnable-track{height:2px;background:var(--border-b)}
.ctl input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:12px;height:12px;border-radius:50%;background:var(--blue);margin-top:-5px;border:0}
.ctl input[type=range]:focus-visible{outline:1px solid var(--blue)}
.btnrow{display:flex;gap:6px;margin:8px 0}
.btn{flex:1;background:var(--bg2);border:1px solid var(--border-b);border-radius:5px;color:var(--text);padding:8px 6px;font-size:.8rem;cursor:pointer;transition:border-color .18s,color .18s}
.btn:hover{border-color:var(--blue);color:var(--blue)}
.btn.primary{border-color:var(--yellow-dim);color:var(--yellow)}
.btn.primary:hover{border-color:var(--yellow)}
.btn:focus-visible{outline:1px solid var(--blue)}
.btn.on{border-color:var(--blue-dim);color:var(--blue);background:var(--blue-faint)}
.grp{font-size:.78rem;color:var(--text-faint);margin:8px 0 2px}
body.embed .views{display:none}
.btnrow.wrap{flex-wrap:wrap}.btnrow.wrap .btn{flex:1 1 30%}
.tog-row{display:flex;justify-content:space-between;align-items:center;padding:5px 0;cursor:pointer}
.tog-row span{font-size:.8rem;color:var(--text-dim)}
.tog{width:28px;height:14px;border:1px solid var(--border-b);border-radius:7px;position:relative;transition:all .18s}
.tog::after{content:'';position:absolute;top:2px;left:2px;width:8px;height:8px;border-radius:50%;background:var(--text-faint);transition:all .18s}
.tog.on{border-color:var(--blue-dim);background:var(--blue-faint)}.tog.on::after{left:16px;background:var(--blue)}

.phase{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;margin:6px 0 10px}
.phase div{font-size:.76rem;text-align:center;padding:6px 2px;border:1px solid var(--border);border-radius:4px;color:var(--text-faint)}
.phase div.on{border-color:var(--yellow-dim);color:var(--yellow)}
.phase div.done{color:var(--text-dim);border-color:var(--border-b)}
.ro{display:grid;grid-template-columns:1fr auto;gap:4px 10px;font-size:.78rem}
.ro .k{color:var(--text-dim)}.ro .k i{font-family:var(--sci-serif);font-size:.95rem;color:var(--text)}
.ro .k .m1{color:var(--m1)}.ro .k .m2{color:var(--m2)}.ro .k .m3{color:var(--m3)}
.ro .k .m4{color:var(--m4)}.ro .k .m5{color:var(--m5)}.ro .k .m6{color:var(--m6)}
.ro .n{font:.76rem var(--sci-mono);color:var(--text);text-align:right;font-variant-numeric:tabular-nums}
.ro .n.hot{color:var(--yellow)}
.ro .n.cold{color:var(--text-faint)}
.note{font-size:.78rem;line-height:1.6;color:var(--text-dim);margin-top:12px}
.note b{color:var(--text);font-weight:500}

/* MATH PANEL */
#mp{position:fixed;top:48px;right:0;bottom:0;width:var(--mp-w);background:var(--bg);border-left:1px solid var(--border-b);z-index:200;display:flex;flex-direction:column;overflow:hidden;transition:width .22s cubic-bezier(.4,0,.2,1)}
body.mp-collapsed #mp{width:44px}
body.mp-collapsed .mp-body,body.mp-collapsed .mp-head .t{display:none}
body.mp-collapsed #mp::after{content:'Mathematics';position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(90deg);white-space:nowrap;font-family:var(--sci-serif);font-size:1.05rem;color:var(--text);pointer-events:none}
#mp .collapse-btn{position:relative;z-index:2}
body.mp-collapsed #mp .collapse-btn{transform:rotate(180deg)}
.mp-head{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--border)}
.mp-head .t{font-size:.85rem;font-weight:600;color:var(--text)}
.mp-body{flex:1;overflow-y:auto;padding:6px 20px 40px}
.mp-body .mp-chap{margin:16px 0 10px}
.mp-body .sec{display:none;padding-bottom:16px;border-bottom:1px solid var(--border-b);margin-bottom:6px}.mp-body .sec.on{display:block}
#chapter-sel{background:var(--bg2);color:var(--text);border:1px solid var(--border-b);border-radius:4px;font-size:.78rem;padding:3px 6px;margin-left:12px}#chapter-sel.off{display:none}
.mp-body h3{font-family:var(--sci-serif);font-weight:500;font-size:1.15rem;color:var(--text-bright);margin:24px 0 8px}
.mp-body p{font-size:.84rem;line-height:1.65;color:var(--text);margin-bottom:10px}
.mp-body p sup,.mp-body p sub{line-height:0}
.mp-body p b{color:var(--yellow);font-weight:500}
.mp-body p code{font-family:var(--sci-mono);font-size:.76rem;color:var(--blue);background:var(--blue-faint);padding:1px 4px;border-radius:3px}
/* .eq is a .sci-eq box (lib/sci.css loads later, so these rules use the
   .mp-body prefix to win). font-size sets the formula size. */
.mp-body .eq{margin:8px 0 12px;padding:10px 12px;background:var(--bg2);border:1px solid var(--border);border-radius:5px;color:var(--text-bright);font-size:.98rem}
.mp-body .eq.long{font-size:.84rem}
.eq.live{border-color:var(--yellow-dim);background:var(--yellow-faint)}
.eq-cap{font-size:.74rem;line-height:1.5;color:var(--text-dim);margin:-6px 0 12px}
.src{font-size:.74rem;color:var(--text-dim);line-height:1.55;border-top:1px solid var(--border);padding-top:10px;margin-top:20px}
.src a{color:var(--blue);text-decoration:none}
.msec{display:none}.msec.on{display:block}
.live{margin:14px 0 4px}.livebox{border:1px solid var(--border);background:var(--bg2);margin-bottom:14px;line-height:0}.livebox canvas{display:block}

@media (max-width:1400px){:root{--mp-w:420px}}
@media (max-width:1100px){:root{--mp-w:380px}}
/* PHONE. The math panel is hidden; the stage fills the width. The source
   line in the topbar is hidden, so the title and status keep one line. */
@media (max-width:860px){
  #mp{display:none}#stage{right:0!important}
  .topbar{padding:0 16px}
  .topbar-r{display:none}
}
