/* work.css -- the project pages: same palette and type as the home page. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.katex, .katex * { box-sizing: content-box !important; }
:root {
  --bg: #0a0a0b;
  --surface: #111114;
  --surface2: #16161b;
  --border: rgba(255,255,255,0.08);
  --accent: #00e5a0;
  --accent2: #7b61ff;
  --text: #e8e6e3;
  --muted: #9a9997;
  --tag-bg: rgba(0,229,160,0.08);
  --radius: 6px;
}
html { scroll-behavior: smooth; }
html.lb-lock { overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden;
}
a { color: var(--accent); }
img { max-width: 100%; }

/* nav */
.wnav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 56px);
  background: rgba(10,10,11,0.86);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.wnav a { color: var(--muted); text-decoration: none; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.wnav a:hover { color: var(--accent); }
.wnav .logo { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 15px; letter-spacing: .04em; color: var(--text); text-transform: none; }
.wnav .logo span { color: var(--accent); }
.wnav .links { display: flex; gap: 22px; flex-wrap: wrap; justify-content: flex-end; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); position: relative; z-index: 1; }

/* hero */
.whero { padding: clamp(48px, 9vw, 110px) 0 40px; position: relative; }
.whero::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(0,229,160,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,160,0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 30%, black, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 70% at 50% 30%, black, transparent 75%);
}
.kicker { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }
.whero h1 {
  font-family: 'Cormorant Garamond', serif; font-weight: 300;
  font-size: clamp(34px, 5.6vw, 64px); line-height: 1.05; margin: 14px 0 18px;
}
.whero h1 em { color: var(--accent); font-style: italic; }
.lede { max-width: 820px; color: #cfcdca; font-size: 15.5px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.tag { font-size: 11px; letter-spacing: .06em; padding: 5px 11px; border: 1px solid rgba(0,229,160,.25); border-radius: 999px; background: var(--tag-bg); color: var(--accent); }
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; text-decoration: none; border: 1px solid var(--border); color: var(--text);
  transition: border-color .2s, color .2s, background .2s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: #04140e; border-color: var(--accent); }
.btn.primary:hover { background: transparent; color: var(--accent); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 2px; margin: 34px 0 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); padding: 22px 22px 18px; }
.stat b { display: block; font-family: 'Syne', sans-serif; font-size: clamp(26px, 3.4vw, 36px); color: var(--accent); line-height: 1.1; }
.stat span { font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }

/* sections */
.wsec { padding: 56px 0 20px; }
.wsec h2 { font-family: 'Cormorant Garamond', serif; font-weight: 300; font-size: clamp(28px, 4vw, 44px); line-height: 1.1; margin-bottom: 8px; }
.wsec .num { font-size: 11px; letter-spacing: .2em; color: var(--accent); text-transform: uppercase; }
.wsec > .wrap > p, .prose p { max-width: 860px; color: #cfcdca; margin: 12px 0; }
.rule { border: 0; border-top: 1px solid var(--border); margin: 18px 0 26px; }
.eq { margin: 18px 0; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-left: 2px solid var(--accent); border-radius: var(--radius); overflow-x: auto; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 20px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card h3 { font-family: 'Syne', sans-serif; font-size: 15px; letter-spacing: .02em; margin-bottom: 6px; color: var(--text); }
.card p { color: var(--muted); font-size: 13.5px; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 16px; margin: 22px 0; }
.gallery.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); }
.fig {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: zoom-in; display: flex; flex-direction: column;
  transition: border-color .25s, transform .25s;
}
.fig:hover, .fig:focus-visible { border-color: rgba(0,229,160,.45); transform: translateY(-2px); outline: none; }
.fig .ph { background: #fff; aspect-ratio: 16/10; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.fig .ph img { width: 100%; height: 100%; object-fit: contain; display: block; }
.fig.movie .ph { aspect-ratio: 16/11; }
.fig .ph .play { position: absolute; top: 10px; left: 10px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #04140e; background: var(--accent); padding: 3px 8px; border-radius: 3px; }
.fig .ph .zoomhint { position: absolute; right: 10px; bottom: 10px; font-size: 10px; color: #fff; background: rgba(0,0,0,.55); padding: 3px 8px; border-radius: 3px; opacity: 0; transition: opacity .2s; }
.fig:hover .zoomhint { opacity: 1; }
.fig figcaption { padding: 13px 16px 15px; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.fig figcaption b { color: var(--text); font-weight: 500; display: block; margin-bottom: 2px; font-size: 13px; }

/* demo */
.demo { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(14px, 2.4vw, 24px); margin: 22px 0; }
.demo-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; }
.demo canvas { width: 100%; height: auto; display: block; background: #07070a; border: 1px solid var(--border); border-radius: 4px; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 18px; margin: 16px 0 6px; }
.controls label { font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.controls label span.v { color: var(--accent); }
.controls input[type=range] { width: 100%; accent-color: var(--accent); }
.controls select { background: var(--surface2); color: var(--text); border: 1px solid var(--border); padding: 6px; border-radius: 4px; font-family: inherit; }
.dbtns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.dbtns button { font-family: inherit; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 9px 15px; border-radius: 4px; border: 1px solid var(--accent); background: var(--accent); color: #04140e; cursor: pointer; }
.dbtns button.ghost { background: transparent; color: var(--accent); }
.dnote { font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 18px; height: 3px; vertical-align: middle; margin-right: 6px; }
.readout { font-size: 12px; color: var(--text); margin-top: 8px; min-height: 1.4em; }

/* simulator app */
.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.stage { position: relative; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 12px 12px 10px; }
.stage.pre { border-color: rgba(0,229,160,.4); background: rgba(0,229,160,.06); }
.stage small { position: absolute; top: 8px; right: 10px; color: var(--muted); font-size: 10px; }
.stage b { display: block; font-family: 'Syne', sans-serif; font-size: 13px; color: var(--text); }
.stage span { display: block; font-size: 11px; color: var(--muted); line-height: 1.45; margin: 4px 0 8px; }
.stage em { font-style: normal; font-size: 10.5px; letter-spacing: .1em; padding: 2px 7px; border-radius: 3px; background: #2a2a31; color: #e8e6e3; }
.stage.pre em { background: var(--accent); color: #04140e; }
.sim-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; margin-bottom: 12px; }
.sim-stats div { background: var(--surface2); border: 1px solid var(--border); padding: 10px 10px 8px; }
.sim-stats b { display: block; font-family: 'Syne', sans-serif; font-size: 20px; color: var(--accent); }
.sim-stats span { font-size: 10.5px; color: var(--muted); }
.splitbar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: #222; margin: 4px 0 2px; }
.splitbar i { display: block; height: 100%; }
.split { margin-bottom: 12px; }
.cmp table, .rtable { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 14px 0 6px; }
.cmp th, .cmp td, .rtable th, .rtable td { border: 1px solid var(--border); padding: 7px 10px; text-align: right; }
.cmp th, .rtable th { background: var(--surface2); color: var(--accent); font-weight: 500; text-align: center; }
.cmp td:first-child, .rtable td:first-child, .rtable td:nth-child(2) { text-align: left; }
.rtable tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.rtable b { color: var(--accent); font-weight: 500; }
.tablewrap { overflow-x: auto; }
@media (max-width: 860px) { .pipeline { grid-template-columns: 1fr 1fr; } .sim-stats { grid-template-columns: repeat(3, 1fr); } }

.pipeline.six { grid-template-columns: repeat(6, 1fr); }
.stage.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: rgba(0,229,160,.10); }
.stage.done { border-color: rgba(0,229,160,.35); }
.stage.done b::after { content: "  \2713"; color: var(--accent); }
.progress { height: 4px; background: #222; border-radius: 2px; margin-top: 12px; overflow: hidden; }
.progress .prog { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.wlog { margin-top: 12px; height: 190px; overflow-y: auto; font-size: 12px; color: #cfcdca; background: #07070a;
        border: 1px solid var(--border); border-radius: 4px; padding: 10px 12px; line-height: 1.6; }
@media (max-width: 860px) { .pipeline.six { grid-template-columns: 1fr 1fr; } }

/* links / cite */
.cite { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; font-size: 12.5px; color: #cfcdca; overflow-x: auto; }
.next { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 20px 0 10px; }
.next a { display: block; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: border-color .2s; }
.next a:hover { border-color: var(--accent); }
.next a small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; }
footer.wfoot { border-top: 1px solid var(--border); margin-top: 60px; padding: 28px 0 40px; color: var(--muted); font-size: 12px; }
footer.wfoot .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 1000; background: rgba(6,6,8,.96); display: none; }
.lb.lb-on { display: block; }
.lb-stage { position: absolute; inset: 0 0 56px 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; cursor: zoom-out; }
.lb.lb-zoomed .lb-stage { cursor: grab; }
.lb-img { max-width: 94vw; max-height: calc(100vh - 90px); transform-origin: center center; transition: transform .06s linear; user-select: none; background: #fff; cursor: zoom-in; box-shadow: 0 10px 50px rgba(0,0,0,.6); }
.lb-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; border-top: 1px solid var(--border); background: rgba(10,10,11,.9); }
.lb-cap { color: #cfcdca; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-tools { display: flex; gap: 6px; flex-shrink: 0; }
.lb-tools button, .lb-tools a { font-family: inherit; min-width: 36px; height: 34px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.lb-tools button:hover, .lb-tools a:hover { border-color: var(--accent); color: var(--accent); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 64px; border: 1px solid var(--border); background: rgba(17,17,20,.8); color: var(--text); font-size: 30px; cursor: pointer; border-radius: 4px; }
.lb-nav:hover { color: var(--accent); border-color: var(--accent); }
.lb-prev { left: 12px; } .lb-next { right: 12px; }
.lb.lb-single .lb-nav { display: none; }

@media (max-width: 860px) {
  .demo-grid { grid-template-columns: 1fr; }
  .wnav .links { gap: 14px; }
  .wnav .links a.hide-sm { display: none; }
  .lb-nav { width: 38px; height: 52px; font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fig, .fig:hover { transition: none; transform: none; }
}

/* review additions: scope notes, presets, plain-language boxes */
.demo-scope { font-size: 12.5px; color: var(--text); border-left: 3px solid var(--accent); padding: 6px 10px; margin: 14px 0 4px; background: rgba(0,229,160,.06); }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; }
.presets-lab { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.presets button { font-family: inherit; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; padding: 7px 12px; border-radius: 4px; border: 1px solid var(--accent); background: var(--accent); color: #04140e; cursor: pointer; }
.presets button.ghost { background: transparent; color: var(--accent); }
.preset-note { flex-basis: 100%; font-size: 12.5px; color: var(--muted); margin: 4px 0 0; }
.plain { border: 1px solid rgba(255,255,255,.1); border-radius: 6px; padding: 14px 18px; margin: 0 0 18px; background: rgba(255,255,255,.02); }
.plain b:first-child { display: block; font-family: Syne, sans-serif; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.plain ul { margin: 0; padding-left: 18px; } .plain li { margin: 4px 0; font-size: 14px; line-height: 1.6; } .plain p { margin: 0; font-size: 14px; line-height: 1.65; }
