/* ============================================================
   CLD project page — interaction-first restyle
   ============================================================ */

:root{
  --bg:        #ffffff;
  --bg-2:      #ffffff;
  --ink:       #1d1d1f;
  --ink-2:     #424245;
  --muted:     #6e6e73;
  --line:      #e5e5e9;
  --line-2:    #d2d2d7;

  --accent:    #0071e3;
  --accent-2:  #007e91;
  --accent-3:  #e0484b;
  --accent-soft:#eaf3ff;

  /* light app surfaces shared by every demo panel */
  --panel:     #ffffff;
  --panel-2:   #f5f5f7;
  --panel-3:   #ededf0;
  --panel-line:#e5e5e9;
  --panel-ink: #1d1d1f;
  --panel-mut: #6e6e73;

  --r-s: 8px;
  --r-m: 14px;
  --r-l: 28px;
  --shadow-s: 0 1px 2px rgba(16,20,35,.06), 0 2px 8px rgba(16,20,35,.05);
  --shadow-m: 0 4px 14px rgba(16,20,35,.08), 0 18px 48px rgba(16,20,35,.09);
  --shadow-p: 0 12px 36px rgba(16,20,35,.07), 0 2px 8px rgba(16,20,35,.04);

  --maxw: 1260px;
  --display: 'Inter Tight','Inter',-apple-system,BlinkMacSystemFont,sans-serif;
  --checker:
    linear-gradient(45deg, rgba(107,115,137,.10) 25%, transparent 25%, transparent 75%, rgba(107,115,137,.10) 75%),
    linear-gradient(45deg, rgba(107,115,137,.10) 25%, transparent 25%, transparent 75%, rgba(107,115,137,.10) 75%);
}

*,*::before,*::after{ box-sizing:border-box; }

html{ scroll-behavior:smooth; scroll-padding-top:96px; color-scheme:light; }

body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif;
  font-size:16.5px;
  line-height:1.65;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

img{ max-width:100%; display:block; }
a{ color:var(--accent); text-decoration:none; }
a:hover{ text-decoration:underline; }
code,kbd{ font-family:ui-monospace,'SF Mono','JetBrains Mono',Menlo,Consolas,monospace; }

.wrap{ max-width:var(--maxw); margin:0 auto; padding:0 24px; }
.wrap-narrow{ max-width:820px; margin:0 auto; padding:0 24px; }

/* ---------- section scaffolding ---------- */
section{ padding:120px 0; }
section.tight{ padding:90px 0; }
.sec-head{ margin-bottom:52px; }
.sec-head.center{ text-align:center; }
.eyebrow{ display:block; margin:0 0 18px; color:var(--muted); font:600 17px/1.3 var(--display); letter-spacing:-.01em; }
h2.sec-title{ margin:0 auto 24px; max-width:23ch; font:600 clamp(36px,4.7vw,64px)/1.06 var(--display); letter-spacing:-.035em; text-wrap:balance; }
.sec-sub{ color:var(--muted); font-size:19px; line-height:1.5; max-width:65ch; margin:0; letter-spacing:-.015em; text-wrap:pretty; }
.sec-head.center .sec-sub{ margin-inline:auto; }

/* ---------- floating navigation ---------- */
.skip-link{ position:absolute; top:-80px; left:20px; z-index:100; padding:12px 18px; background:var(--ink); color:#fff; border-radius:12px; }
.skip-link:focus{ top:12px; }
.site-nav{ position:fixed; z-index:90; top:12px; left:50%; transform:translateX(-50%); width:min(1000px,calc(100% - 32px)); min-height:58px; display:flex; align-items:center; gap:28px; padding:9px 12px 9px 22px; border-radius:20px; background:rgba(255,255,255,.82); backdrop-filter:saturate(180%) blur(22px); -webkit-backdrop-filter:saturate(180%) blur(22px); box-shadow:0 0 0 1px rgba(0,0,0,.06),0 6px 28px rgba(0,0,0,.04); }
.nav-brand{ display:flex; align-items:center; gap:9px; margin-right:auto; color:var(--ink); font:600 18px/1.2 var(--display); letter-spacing:-.025em; }
.nav-brand svg{ width:26px; height:26px; flex:none; }
.nav-links{ display:flex; gap:25px; }
.nav-links a{ color:var(--ink-2); font-size:12px; font-weight:500; }
.nav-links a:hover{ color:var(--accent); }
.nav-cta{ flex:none; display:flex; align-items:center; gap:12px; background:var(--accent); color:#fff; border-radius:999px; padding:9px 17px; font-size:12px; }
.site-nav a:hover{ text-decoration:none; }
.nav-cta:hover{ background:#0077ed; }

/* ---------- hero ---------- */
.hero{ overflow:hidden; padding:145px 0 0; text-align:center; background:#fff; }
.hero-kicker{ max-width:65ch; margin:0 auto 22px; text-wrap:balance; font:600 20px/1.25 var(--display); letter-spacing:-.02em; }
h1.title{ margin:0 auto; font:600 clamp(64px,8.7vw,112px)/.99 var(--display); letter-spacing:-.055em; }
h1.title span{ color:#86868b; }
.subtitle{ margin:28px auto 0; max-width:52ch; color:var(--muted); font-size:21px; line-height:1.45; letter-spacing:-.02em; text-wrap:balance; }
.btn-row{ display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:28px; margin-top:28px; }
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:18px; border:0; border-radius:999px; padding:14px 24px; color:#fff; background:var(--accent); font-size:15px; font-weight:500; transition:background .2s,transform .2s; }
.btn:hover{ background:#0077ed; color:#fff; text-decoration:none; transform:translateY(-1px); }
.text-link{ display:inline-flex; align-items:center; gap:9px; font-size:16px; }
.text-link span{ font-size:25px; line-height:1; }
.hero-visual{ position:relative; display:flex; align-items:center; justify-content:center; gap:72px; width:min(100%,1000px); height:440px; margin:35px auto 0; isolation:isolate; }
.hero-visual::before{ content:''; position:absolute; inset:10% 0 0; z-index:-1; background:radial-gradient(ellipse at 53% 65%,#f1f1f4,transparent 69%); }
.hero-input{ position:relative; width:245px; flex:none; transform:rotate(-5deg); }
.hero-input>img{ width:100%; height:auto; border-radius:18px; box-shadow:0 18px 40px rgba(29,29,31,.12),0 0 0 1px rgba(29,29,31,.05); }
.visual-label{ display:block; margin-top:22px; color:var(--muted); font-size:12px; font-weight:500; letter-spacing:.01em; }
.visual-arrow{ color:#b5b5bb; font-size:30px; font-weight:400; }
.hero-layers{ position:relative; width:260px; height:260px; margin-right:70px; transform:rotateX(48deg) rotateZ(-33deg); transform-style:preserve-3d; }
.hero-plate{ position:absolute; inset:0; transform:translateZ(calc(var(--depth)*16px)); border-radius:13px; background:transparent; border:1px solid rgba(140,140,150,.22); box-shadow:0 12px 26px rgba(29,29,31,.10); overflow:hidden; transition:transform .7s cubic-bezier(.2,.7,.3,1); }
.hero-plate img{ width:100%; height:100%; }
.hero-visual:hover .hero-plate{ transform:translateZ(calc(var(--depth)*20px)); }
.layers-label{ position:absolute; bottom:35px; left:62%; }
.paper-title{ margin:12px auto 35px; max-width:65ch; color:var(--muted); font-size:13px; line-height:1.6; }
.stat-strip{ display:grid; grid-template-columns:repeat(4,1fr); padding:42px 0; border-top:1px solid var(--line); }
.stat{ text-align:center; padding:0 20px; border-right:1px solid var(--line); }
.stat:last-child{ border:0; }
.stat b{ display:block; font:600 46px/1.1 var(--display); letter-spacing:-.04em; }
.stat b .stat-unit{ font-size:22px; color:var(--ink); font-weight:500; }
.stat>span{ display:block; margin-top:10px; font-size:12px; color:var(--muted); }

/* ---------- generic light app panel ---------- */
.app{
  background:var(--panel);
  border:1px solid var(--panel-line);
  border-radius:var(--r-l);
  box-shadow:var(--shadow-p);
  overflow:hidden;
  color:var(--panel-ink);
}
.app-bar{
  display:flex; align-items:center; gap:12px;
  padding:18px 24px;
  background:var(--panel);
  border-bottom:1px solid var(--panel-line);
}
.dots{ display:flex; align-items:center; gap:7px; flex:none; }
.dots i{ width:11px; height:11px; border-radius:50%; display:block; }
.dots i:nth-child(1){ background:#ff5f57; }
.dots i:nth-child(2){ background:#febc2e; }
.dots i:nth-child(3){ background:#28c840; }
.app-title{
  font-size:12.5px; font-weight:600; color:var(--panel-mut);
  font-family:inherit; letter-spacing:-.01em;
}
.app-bar .spacer{ flex:1; }

.app-body{ padding:24px; }

/* case tabs */
.tabs{ display:flex; gap:7px; flex-wrap:wrap; }
.tab{
  border:1px solid var(--panel-line); background:var(--panel-2);
  color:var(--panel-mut); padding:5px 13px; border-radius:999px;
  font-size:12.5px; font-weight:600; cursor:pointer;
  transition:all .14s ease; font-family:inherit;
}
.tab:hover{ color:var(--panel-ink); border-color:var(--line-2); }
.tab[aria-selected="true"]{
  background:var(--accent); border-color:var(--accent); color:#fff;
}

/* segmented control */
.seg{ display:inline-flex; background:var(--panel-2); border:1px solid var(--panel-line); border-radius:999px; padding:3px; }
.seg button{
  border:0; background:transparent; color:var(--panel-mut); cursor:pointer;
  padding:6px 16px; border-radius:999px; font-size:13px; font-weight:650; font-family:inherit;
  transition:all .14s ease;
}
.seg button[aria-pressed="true"]{ background:var(--accent); color:#fff; }

/* checkerboard behind RGBA */
.checker{
  background-color:#ffffff;
  background-image:var(--checker);
  background-size:18px 18px;
  background-position:0 0, 9px 9px;
}
.checker.lite{ background-size:12px 12px; background-position:0 0,6px 6px; }

/* range input */
input[type=range].rng{
  -webkit-appearance:none; appearance:none; height:4px; border-radius:4px;
  background:var(--panel-line); outline:none; cursor:pointer; width:100%;
}
input[type=range].rng::-webkit-slider-thumb{
  -webkit-appearance:none; width:17px; height:17px; border-radius:50%;
  background:#fff; border:4px solid var(--accent); cursor:grab;
  box-shadow:0 2px 6px rgba(16,20,35,.15);
}
input[type=range].rng::-moz-range-thumb{
  width:17px; height:17px; border-radius:50%; background:#fff;
  border:4px solid var(--accent); cursor:grab;
}

/* ============================================================
   1. Decomposition explorer
   ============================================================ */
.explorer{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.08fr) 212px; gap:18px; }
@media (max-width:1040px){ .explorer{ grid-template-columns:1fr; } }

.pane{ background:var(--panel-2); border:1px solid var(--panel-line); border-radius:var(--r-m); overflow:hidden; }
.pane-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:9px 13px; border-bottom:1px solid var(--panel-line);
  font-size:11.5px; font-weight:700; letter-spacing:.1em; text-transform:uppercase;
  color:var(--panel-mut);
}
.pane-body{ padding:13px; }

/* input image + svg boxes */
.canvas-holder{ position:relative; aspect-ratio:1; border-radius:var(--r-s); overflow:hidden; }
.canvas-holder img{ width:100%; height:100%; object-fit:cover; }
.box-svg{ position:absolute; inset:0; width:100%; height:100%; }
.box-svg rect{
  fill:transparent; stroke-width:2; vector-effect:non-scaling-stroke;
  cursor:pointer; transition:fill .15s ease, stroke-width .15s ease;
}
.box-svg rect.on{ fill:rgba(0,113,227,.15); stroke-width:3; }
.box-svg .lbl{
  font:600 11px ui-monospace,Menlo,monospace; fill:#fff; paint-order:stroke;
  stroke:rgba(0,0,0,.65); stroke-width:3px; pointer-events:none; opacity:0;
  transition:opacity .15s ease;
}
.box-svg .lbl.on{ opacity:1; }

/* 3-D exploded stack */
.stage{
  position:relative; aspect-ratio:1; display:grid; place-items:center;
  perspective:1500px; overflow:hidden; border-radius:var(--r-s);
  background:radial-gradient(60% 55% at 50% 42%, #ffffff 0%, #f0f0f3 100%);
}
.stack{ position:relative; width:63%; aspect-ratio:1; transform-style:preserve-3d;
        transform:rotateX(56deg) rotateZ(-41deg); transition:transform .5s cubic-bezier(.2,.7,.3,1); }
.ply{
  position:absolute; inset:0; transform-style:preserve-3d;
  transform:translateZ(calc(var(--i) * var(--spread,0px)));
  transition:transform .42s cubic-bezier(.2,.7,.3,1), opacity .2s ease, filter .2s ease;
  cursor:pointer;
}
.ply img{ width:100%; height:100%; display:block; }
.ply::after{
  content:''; position:absolute; inset:0; pointer-events:none;
  border:1px solid rgba(107,115,137,.18);
  box-shadow:0 8px 22px rgba(16,20,35,.13);
}
.ply.base::after{ border-color:var(--line-2); }
.ply.hot{ filter:drop-shadow(0 0 0 transparent) brightness(1.1); }
.ply.hot::after{ border:2px solid var(--accent-2); box-shadow:0 0 0 1px var(--accent-2), 0 14px 34px rgba(16,20,35,.18); }
.ply.hidden{ opacity:.06; }
.ply.dim{ opacity:.22; }

.stage-ctl{ display:flex; align-items:center; gap:12px; padding:0 13px 13px; }
.stage-ctl label{ font-size:11.5px; color:var(--panel-mut); font-weight:650; white-space:nowrap; }

/* layer rail */
.rail{ max-height:430px; overflow-y:auto; padding:9px; display:flex; flex-direction:column; gap:6px; }
.rail::-webkit-scrollbar{ width:8px; }
.rail::-webkit-scrollbar-thumb{ background:var(--line-2); border-radius:8px; }
.chip{
  display:flex; align-items:center; gap:9px; padding:6px;
  border:1px solid transparent; border-radius:9px; cursor:pointer;
  transition:background .13s ease, border-color .13s ease;
}
.chip:hover{ background:var(--panel-3); }
.chip.on{ background:var(--accent-soft); border-color:var(--accent); }
.chip .tn{ width:42px; height:42px; border-radius:6px; flex:none; overflow:hidden; }
.chip .tn img{ width:100%; height:100%; object-fit:cover; }
.chip .meta{ min-width:0; }
.chip .nm{ font-size:12.5px; font-weight:650; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chip .sz{ font-size:10.5px; color:var(--panel-mut); font-family:ui-monospace,Menlo,monospace; }

/* ============================================================
   2. Mode A / Mode B
   ============================================================ */
.mode-grid{ display:grid; grid-template-columns:1fr 1fr; gap:18px; }
#modes .strip{ display:flex; flex-wrap:wrap; justify-content:center; align-content:flex-start; gap:7px; }
#modes .strip .cell{ flex:0 0 76px; width:76px; max-width:100%; }
@media (max-width:860px){ .mode-grid{ grid-template-columns:1fr; } }
.mode-note{
  display:flex; flex-wrap:wrap; gap:12px 24px; align-items:center;
  margin:16px 0 0; padding:16px 18px; border-radius:var(--r-s);
  background:var(--panel-2); border:1px solid var(--panel-line);
  font-size:13px; color:var(--panel-mut); line-height:1.5;
}
.mode-summary{ display:inline-flex; align-items:center; gap:8px; white-space:nowrap; }
.mode-note b{ color:var(--panel-ink); font-weight:650; }
.mode-caption{ flex:1 1 280px; }

/* ============================================================
   3. Robustness
   ============================================================ */
.rb{ display:grid; grid-template-columns:minmax(0,420px) minmax(0,1fr); gap:20px; align-items:stretch; }
.rb-input,.rb-output{ display:flex; flex-direction:column; min-width:0; }
.rb-input>.pane-body{ flex:1; }
.rb-controls{ padding:16px 14px; border-top:1px solid var(--panel-line); }
.rb-output>.pane-body{ flex:1; min-height:0; position:relative; }
#rb-strip{ position:absolute; inset:14px; display:flex; flex-wrap:wrap; justify-content:center; align-content:center; align-items:flex-start; gap:12px; }
#rb-strip .cell{ flex:0 0 var(--rb-tile,calc((100% - 24px)/3)); width:var(--rb-tile,calc((100% - 24px)/3)); aspect-ratio:1; border-radius:12px; }
#rb-strip .cell img{ height:auto; object-fit:contain; }
@media (max-width:900px){
  .rb{ grid-template-columns:1fr; }
  #rb-strip{ position:static; }
}
.ticks{ display:flex; justify-content:space-between; margin-top:7px; }
.ticks span{ font-size:11px; color:var(--panel-mut); font-family:ui-monospace,Menlo,monospace; }
.ticks span.on{ color:var(--accent-2); font-weight:700; }
.metric-row{ display:flex; gap:9px; flex-wrap:wrap; margin-top:16px; }
.metric{
  flex:1 1 92px; background:var(--panel-2); border:1px solid var(--panel-line);
  border-radius:10px; padding:11px 13px;
}
.metric b{ display:block; font-size:19px; font-weight:730; letter-spacing:-.02em; font-variant-numeric:tabular-nums; }
.metric span{ font-size:10.5px; color:var(--panel-mut); text-transform:uppercase; letter-spacing:.09em; font-weight:650; }
.metric em{ font-style:normal; font-size:11px; color:var(--accent-2); font-variant-numeric:tabular-nums; }

.strip{ display:grid; grid-template-columns:repeat(auto-fill,minmax(104px,1fr)); gap:9px; }
.strip .cell{ border-radius:8px; overflow:hidden; border:1px solid var(--panel-line); position:relative; }
.strip .cell img{ width:100%; aspect-ratio:1; object-fit:cover; }
.strip .cell em{
  position:absolute; left:5px; top:5px; font-style:normal;
  font:600 10px ui-monospace,Menlo,monospace; color:#fff;
  background:rgba(0,0,0,.6); padding:1px 6px; border-radius:5px;
}

/* ============================================================
   4. Design studio
   ============================================================ */
.studio{
  display:grid; grid-template-columns:minmax(0,1fr) 260px; gap:0;
  user-select:none; -webkit-user-select:none; -webkit-touch-callout:none;
}
@media (max-width:900px){ .studio{ grid-template-columns:1fr; } }

.studio-main{ border-right:1px solid var(--panel-line); display:flex; flex-direction:column; }
@media (max-width:900px){ .studio-main{ border-right:0; border-bottom:1px solid var(--panel-line); } }

.toolbar{
  display:flex; align-items:center; gap:6px; flex-wrap:wrap;
  padding:9px 13px; border-bottom:1px solid var(--panel-line); background:var(--panel-2);
}
.tbtn{
  display:inline-flex; align-items:center; gap:6px;
  background:var(--panel-3); border:1px solid var(--panel-line); color:var(--panel-ink);
  padding:6px 11px; border-radius:8px; font-size:12.5px; font-weight:600;
  cursor:pointer; font-family:inherit; transition:all .13s ease; white-space:nowrap;
}
.tbtn:hover:not(:disabled){ border-color:var(--accent); background:rgba(0,113,227,.08); }
.tbtn:disabled{ opacity:.35; cursor:not-allowed; }
.tbtn.danger:hover:not(:disabled){ border-color:var(--accent-3); background:rgba(224,72,75,.18); }
.tbtn svg{ width:14px; height:14px; }
.tb-sep{ width:1px; height:20px; background:var(--panel-line); margin:0 3px; }

.board-wrap{ padding:22px; display:grid; place-items:center; background:
  radial-gradient(70% 60% at 50% 40%, #ffffff 0%, #f0f0f3 100%); flex:1; }
.board{
  position:relative; width:min(100%,472px); aspect-ratio:1;
  border-radius:10px; overflow:hidden; touch-action:none;
  -webkit-tap-highlight-color:transparent;
  box-shadow:0 16px 40px rgba(16,20,35,.14);
  outline:1px solid var(--panel-line);
}
.ob{ position:absolute; inset:0; transform-origin:center; will-change:transform; }
.ob img{ width:100%; height:100%; display:block; pointer-events:none; -webkit-user-drag:none; }
.ob.gone{ display:none; }
.ob.pick{ cursor:grab; }
.ob.pick:active{ cursor:grabbing; }

.marq{ position:absolute; inset:0; pointer-events:none; display:none; z-index:60; }
.marq.on{ display:block; }
.marq-svg{ position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.marq-svg polygon{
  fill:none; stroke:var(--accent-2); stroke-width:1.5;
  vector-effect:non-scaling-stroke;
  filter:drop-shadow(0 0 1px rgba(0,0,0,.55));
}
.marq .h{
  position:absolute; width:11px; height:11px; margin:-5.5px 0 0 -5.5px;
  background:#fff; border:2px solid var(--accent-2); border-radius:2px;
  pointer-events:auto; touch-action:none;
  box-shadow:0 1px 3px rgba(0,0,0,.45);
}
.marq .h.rot{
  width:14px; height:14px; margin:-7px 0 0 -7px; border-radius:50%;
  background:var(--accent-2); border-color:#fff; cursor:grab;
}
.marq .h.rot:active{ cursor:grabbing; }
.marq .tag{
  position:absolute; transform:translate(-2px,-25px);
  font:600 10.5px ui-monospace,Menlo,monospace;
  background:var(--accent-2); color:#04232a; padding:1px 7px; border-radius:5px;
  white-space:nowrap; pointer-events:none;
}

/* layer panel */
.lpanel{ display:flex; flex-direction:column; min-height:0; background:var(--panel); }
.lpanel-head{
  padding:11px 13px; border-bottom:1px solid var(--panel-line);
  font-size:11.5px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--panel-mut);
  display:flex; justify-content:space-between; align-items:center;
}
.llist{ overflow-y:auto; max-height:470px; padding:7px; display:flex; flex-direction:column; gap:4px; }
.llist::-webkit-scrollbar{ width:8px; }
.llist::-webkit-scrollbar-thumb{ background:var(--line-2); border-radius:8px; }
.li{
  display:flex; align-items:center; gap:8px; padding:5px 7px;
  border:1px solid transparent; border-radius:8px; cursor:pointer;
  background:var(--panel-2); transition:background .12s ease, border-color .12s ease;
  user-select:none;
}
.li:hover{ background:var(--panel-3); }
.li.on{ border-color:var(--accent-2); background:rgba(0,126,145,.08); }
.li.drag{ opacity:.4; }
.li.over{ border-top:2px solid var(--accent-2); }
.li .grip{ color:#4b5368; font-size:13px; cursor:grab; line-height:1; letter-spacing:-1px; }
.li .tn{ width:34px; height:34px; border-radius:5px; overflow:hidden; flex:none; }
.li .tn img{ width:100%; height:100%; object-fit:cover; }
.li .nm{ flex:1; min-width:0; font-size:12px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.li .eye{
  border:0; background:transparent; color:var(--panel-mut); cursor:pointer;
  padding:3px; border-radius:5px; line-height:0;
}
.li .eye:hover{ color:var(--panel-ink); background:var(--panel-3); }
.li.off .nm,.li.off .tn{ opacity:.33; }
.li .eye svg{ width:15px; height:15px; }

.hint{
  padding:10px 13px; border-top:1px solid var(--panel-line);
  font-size:11.5px; color:var(--panel-mut); line-height:1.6;
}
.hint kbd{
  background:var(--panel-3); border:1px solid var(--panel-line); border-bottom-width:2px;
  border-radius:4px; padding:0 5px; font-size:10.5px; color:var(--panel-ink);
}

/* preset chips in toolbar */
.preset{
  background:transparent; border:1px dashed var(--panel-line); color:var(--panel-mut);
  padding:5px 10px; border-radius:8px; font-size:12px; font-weight:600; cursor:pointer; font-family:inherit;
  transition:all .13s ease;
}
.preset:hover{ border-style:solid; border-color:var(--accent-2); color:var(--panel-ink); }

/* ============================================================
   5. Efficiency chart
   ============================================================ */
.eff{ display:grid; grid-template-columns:minmax(0,1.35fr) minmax(0,1fr); gap:24px; align-items:center; }
@media (max-width:860px){ .eff{ grid-template-columns:1fr; } }
.chart{ width:100%; }
.chart text{ font-family:'Inter',sans-serif; }
.legend{ display:flex; gap:16px; flex-wrap:wrap; margin-top:10px; }
.legend i{ width:11px; height:11px; border-radius:3px; display:inline-block; margin-right:6px; }
.legend span{ font-size:12.5px; color:var(--panel-mut); font-weight:600; display:inline-flex; align-items:center; }

/* ============================================================
   tables / results
   ============================================================ */
.tbl-scroll{ overflow-x:auto; border:1px solid var(--line); border-radius:var(--r-m); background:#fff; box-shadow:var(--shadow-s); }
table.res{ width:100%; border-collapse:collapse; font-size:14px; min-width:720px; }
table.res th,table.res td{ padding:10px 14px; text-align:center; border-bottom:1px solid var(--line); }
table.res thead th{
  background:#f1f3f8; font-size:11.5px; text-transform:uppercase; letter-spacing:.07em;
  color:var(--muted); font-weight:700; border-bottom:1px solid var(--line-2);
}
table.res tbody tr:last-child td{ border-bottom:0; }
table.res tbody tr.ours{ background:var(--accent-soft); }
table.res tbody tr.ours td{ font-weight:650; }
table.res td.best{ font-weight:750; }
table.res td:first-child,table.res th:first-child{ text-align:left; }
.fnote{ font-size:12.5px; color:var(--muted); margin-top:10px; }

/* ---------- video placeholder ---------- */
.vid-grid{ display:grid; grid-template-columns:1fr 1fr; gap:20px; }
@media (max-width:860px){ .vid-grid{ grid-template-columns:1fr; } }
.vid-card{ background:#fff; border:1px solid var(--line); border-radius:var(--r-m); overflow:hidden; box-shadow:var(--shadow-s); }
.vid-slot{
  position:relative; aspect-ratio:16/10; display:grid; place-items:center; gap:10px;
  background:
    repeating-linear-gradient(45deg,#f3f4f9 0 12px,#eceef6 12px 24px);
  border-bottom:1px solid var(--line); text-align:center; padding:22px;
}
.vid-slot .ic{
  width:48px; height:48px; border-radius:50%; display:grid; place-items:center;
  background:#fff; border:1px solid var(--line-2); box-shadow:var(--shadow-s); color:var(--accent);
}
.vid-slot .ic svg{ width:21px; height:21px; }
.vid-slot b{ font-size:14.5px; font-weight:680; }
.vid-slot p{ margin:4px 0 0; font-size:12.5px; color:var(--muted); max-width:42ch; }
.vid-slot code{
  font-size:11.5px; background:#fff; border:1px solid var(--line-2);
  padding:2px 7px; border-radius:5px; color:var(--ink-2); display:inline-block; margin-top:8px;
}
.vid-card .cap{ padding:14px 16px; font-size:13.5px; color:var(--ink-2); }
.vid-card .cap b{ display:block; margin-bottom:3px; color:var(--ink); font-weight:680; }

/* ---------- gallery ---------- */
.gal{ display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:16px; }
.gcard{
  background:#fff; border:1px solid var(--line); border-radius:var(--r-m);
  overflow:hidden; box-shadow:var(--shadow-s); transition:transform .16s ease, box-shadow .16s ease;
}
.gcard:hover{ transform:translateY(-3px); box-shadow:var(--shadow-m); }
.gcard .shot{ position:relative; aspect-ratio:1; }
.gcard .shot img{ width:100%; height:100%; object-fit:cover; }
.gcard .bar{ padding:10px 13px; display:flex; justify-content:space-between; align-items:center; font-size:12.5px; }
.gcard .bar b{ font-weight:650; }
.gcard .bar span{ color:var(--muted); font-family:ui-monospace,Menlo,monospace; font-size:11.5px; }

/* ---------- abstract / method ---------- */
.prose{ font-size:16.5px; color:var(--ink-2); }
.prose p{ margin:0 0 16px; }
.figure{ background:#fff; border:1px solid var(--line); border-radius:var(--r-m); padding:20px; box-shadow:var(--shadow-s); }
.figure figcaption{ margin-top:14px; font-size:13.5px; color:var(--muted); line-height:1.6; }
.figure figcaption b{ color:var(--ink-2); font-weight:650; }

.cards3{ display:grid; grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); gap:16px; margin-top:26px; }
.card{
  background:#fff; border:1px solid var(--line); border-radius:var(--r-m);
  padding:20px; box-shadow:var(--shadow-s);
}
.card .n{
  width:30px; height:30px; border-radius:9px; display:grid; place-items:center;
  background:var(--accent-soft); color:var(--accent); font-weight:760; font-size:14px; margin-bottom:12px;
}
.card h3{ margin:0 0 7px; font-size:16.5px; font-weight:700; letter-spacing:-.012em; }
.card p{ margin:0; font-size:14px; color:var(--muted); line-height:1.6; }

/* bibtex */
pre.bib{
  background:var(--panel); color:var(--panel-ink); border-radius:var(--r-m);
  padding:20px; overflow-x:auto; font-size:13px; line-height:1.6;
  border:1px solid var(--panel-line); margin:0;
}
pre.bib .k{ color:var(--accent); }
pre.bib .s{ color:#087f72; }

footer.ft{ border-top:1px solid var(--line); padding:34px 0; color:var(--muted); font-size:13.5px; text-align:center; background:#fff; }
footer.ft a{ color:var(--ink-2); text-decoration:underline; }

.alt{ background:#f5f5f7; }

/* ---------- opening video showcase ---------- */
.video-section{
  position:relative;
  padding:76px 0 96px;
  overflow:hidden;
  background:linear-gradient(180deg,#fff 0%,#fbfbfd 58%,#f5f5f7 100%);
}
.video-section::before{
  content:'';
  position:absolute;
  top:8%; left:50%;
  width:min(900px,90vw); height:420px;
  transform:translateX(-50%);
  pointer-events:none;
  background:radial-gradient(ellipse at center,rgba(0,113,227,.09),transparent 68%);
  filter:blur(8px);
}
.video-feature{ position:relative; max-width:920px; margin:0 auto; }
.video-intro{ max-width:650px; margin:0 auto; text-align:center; }
.video-intro .eyebrow{ margin-bottom:12px; color:var(--accent); font-size:14px; letter-spacing:.04em; text-transform:uppercase; }
.video-intro h2{ margin:0; font:600 clamp(32px,4vw,50px)/1.08 var(--display); letter-spacing:-.04em; text-wrap:balance; }
.video-intro p{ margin:16px auto 0; max-width:54ch; color:var(--muted); font-size:17px; line-height:1.5; }
.video-frame{
  position:relative;
  margin-top:34px;
  padding:9px;
  border:1px solid rgba(255,255,255,.9);
  border-radius:28px;
  background:linear-gradient(135deg,rgba(255,255,255,.94),rgba(226,233,244,.88));
  box-shadow:0 24px 70px rgba(29,45,75,.14),0 2px 10px rgba(29,45,75,.08);
}
.video-frame::after{
  content:'';
  position:absolute; inset:0;
  border:1px solid rgba(29,45,75,.08);
  border-radius:inherit;
  pointer-events:none;
}
.video-frame video{
  display:block;
  width:100%;
  aspect-ratio:16/9;
  object-fit:cover;
  border-radius:20px;
  background:#12151c;
  box-shadow:0 8px 24px rgba(0,0,0,.16);
}
.video-meta{
  display:flex; align-items:center; justify-content:center; gap:10px;
  margin-top:16px; color:var(--muted); font-size:12px; letter-spacing:.01em;
}
.video-meta-dot{ width:4px; height:4px; border-radius:50%; background:var(--line-2); }

@media (prefers-reduced-motion:reduce){
  *{ animation-duration:.001ms !important; transition-duration:.001ms !important; }
  html{ scroll-behavior:auto; }
}

/* ---------- gallery (manifest-driven, real RGBA layers) ---------- */
.gal{ grid-template-columns:repeat(auto-fill,minmax(282px,1fr)); }
.gcard{ display:flex; flex-direction:column; }
.gcard .shot{ background-color:#eceef4; }
.gcard .shot img{ transition:opacity .12s ease; }

.grail{
  display:flex; gap:5px; padding:9px 11px 11px; overflow-x:auto;
  border-top:1px solid var(--line); background:#fbfbfd;
}
.grail::-webkit-scrollbar{ height:6px; }
.grail::-webkit-scrollbar-thumb{ background:var(--line-2); border-radius:6px; }
.gth{
  flex:0 0 40px; width:40px; height:40px; padding:0; cursor:pointer;
  border:1px solid var(--line-2); border-radius:6px; overflow:hidden;
  background-color:#eceef4; transition:border-color .13s ease, transform .13s ease;
}
.gth img{ width:100%; height:100%; object-fit:cover; }
.gth:hover,.gth:focus-visible{ border-color:var(--accent); outline:none; transform:translateY(-2px); }
.gth.on{ border-color:var(--accent); border-width:2px; }
.gcard .bar{ border-top:1px solid var(--line); }
.gcard .bar b{ font-variant-numeric:tabular-nums; }

/* ---------- numbered bbox badges (Mode A/B + Robustness) ---------- */
.bnum{
  position:absolute; z-index:4; pointer-events:none;
  transform:translate(1px,1px);
  min-width:16px; height:16px; padding:0 4px;
  display:flex; align-items:center; justify-content:center;
  font:700 10.5px/1 ui-monospace,'SF Mono',Menlo,monospace;
  color:#fff; border-radius:4px;
  box-shadow:0 1px 3px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.22);
  font-variant-numeric:tabular-nums;
}

/* ---------- clickable layer tiles ---------- */
.strip .cell{
  padding:0; border:1px solid var(--panel-line); background:none; cursor:zoom-in;
  font:inherit; color:inherit; display:block; width:100%;
  transition:border-color .13s ease, transform .13s ease;
}
.strip .cell:hover,
.strip .cell:focus-visible{ border-color:var(--accent-2); transform:translateY(-2px); outline:none; }
.strip .cell .zoom{
  position:absolute; right:5px; bottom:5px; width:21px; height:21px;
  display:grid; place-items:center; border-radius:6px;
  background:rgba(255,255,255,.94); color:var(--panel-ink); opacity:0; transition:opacity .13s ease;
}
.strip .cell .zoom svg{ width:13px; height:13px; }
.strip .cell:hover .zoom,
.strip .cell:focus-visible .zoom{ opacity:1; }

/* ---------- lightbox ---------- */
.lb{ position:fixed; inset:0; z-index:200; display:none; }
.lb.on{ display:block; }
.lb-back{
  position:absolute; inset:0; background:rgba(60,67,86,.28);
  backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px);
}
.lb-panel{
  position:absolute; inset:0; margin:auto; width:min(94vw,780px); height:fit-content;
  max-height:94vh; display:flex; flex-direction:column;
  background:var(--panel); border:1px solid var(--panel-line); border-radius:var(--r-m);
  box-shadow:0 24px 72px rgba(16,20,35,.18); overflow:hidden;
}
.lb-top{
  display:flex; align-items:center; gap:12px; padding:10px 12px 10px 16px;
  border-bottom:1px solid var(--panel-line); background:var(--panel-2);
}
.lb-cap{ flex:1; min-width:0; font-size:13.5px; font-weight:650; color:var(--panel-ink);
         white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lb-idx{ font:600 11.5px ui-monospace,Menlo,monospace; color:var(--panel-mut);
         font-variant-numeric:tabular-nums; }
.lb-x{
  border:1px solid var(--panel-line); background:var(--panel-3); color:var(--panel-ink);
  width:28px; height:28px; border-radius:7px; cursor:pointer; font-size:13px; line-height:1;
  display:grid; place-items:center; flex:none;
}
.lb-x:hover{ border-color:var(--accent-3); background:rgba(224,72,75,.2); }
.lb-stage{ display:grid; place-items:center; padding:16px; min-height:0; }
.lb-stage img{ max-width:100%; max-height:calc(94vh - 110px); width:auto; height:auto;
               border-radius:6px; }
.lb-nav{
  position:absolute; top:50%; transform:translateY(-50%);
  width:38px; height:38px; border-radius:50%; cursor:pointer;
  border:1px solid var(--panel-line); background:var(--panel); color:var(--panel-ink);
  font-size:21px; line-height:1; display:grid; place-items:center;
}
.lb-nav:hover{ border-color:var(--accent-2); color:var(--accent-2); }
.lb-prev{ left:10px; }
.lb-next{ right:10px; }
.lb-nav[hidden]{ display:none; }

@media (max-width:560px){
  .lb-panel{ width:100vw; max-height:100vh; border-radius:0; border:0; }
  .lb-stage img{ max-height:calc(100vh - 110px); }
}

/* ---------- editorial cards and responsive controls ---------- */
.app{ box-shadow:0 2px 8px rgba(0,0,0,.02),0 18px 48px rgba(0,0,0,.045); }
.app-title{ color:var(--ink-2); font-size:13px; }
.pane{ background:#fff; border-radius:16px; }
.pane-head,.lpanel-head{ text-transform:none; letter-spacing:0; font-size:12px; color:var(--ink-2); }
.pane-head{ padding:12px 14px; }
.tab{ min-height:34px; padding:6px 15px; border-color:transparent; font-weight:500; }
.tab[aria-selected="true"]{ background:var(--ink); border-color:var(--ink); }
.toolbar{ padding:12px 16px; background:#fafafa; }
.tbtn{ background:#fff; min-height:34px; font-weight:500; }
.tbtn:disabled{ opacity:.5; }
.chip.on{ background:var(--accent-soft); }
.chip .nm,.li .nm{ color:var(--ink); }
.stage-ctl{ padding-top:12px; }
.metric{ background:var(--panel-2); border-color:transparent; padding:16px; border-radius:14px; }
.metric b{ font-family:var(--display); font-size:25px; }
.metric span{ text-transform:none; letter-spacing:0; font-size:12px; }
.prose{ font-size:18px; line-height:1.8; }
.figure{ border:0; padding:30px; border-radius:24px; box-shadow:none; background:#f5f5f7; }
.figure figcaption{ max-width:90ch; margin:24px auto 0; }
.card{ background:#f5f5f7; border:0; box-shadow:none; border-radius:24px; padding:30px; }
.card .n{ background:#fff; color:var(--muted); border-radius:50%; }
.card h3{ font:600 23px/1.2 var(--display); letter-spacing:-.02em; margin-bottom:14px; }
.card p{ font-size:15px; line-height:1.65; }
.cards3{ gap:20px; margin-top:32px; }
.gal{ gap:24px; }
.gcard{ border:0; border-radius:22px; box-shadow:0 4px 18px rgba(0,0,0,.035); }
.gcard .bar{ padding:15px 16px; }
.grail{ padding:12px 14px; background:#fff; }
.tbl-scroll{ box-shadow:none; border-radius:20px; }
table.res th,table.res td{ padding:15px 16px; }
table.res thead th{ background:#f5f5f7; }
footer.ft{ padding:40px 0; background:#f5f5f7; font-size:12px; }
:focus-visible{ outline:2px solid var(--accent); outline-offset:4px; }
@media(min-width:735px){ .wrap{ padding-inline:40px; } }
@media(max-width:1040px){ .explorer{ grid-template-columns:1fr 1fr; } .explorer>.pane:last-child{ grid-column:1/-1; } .rail{ flex-direction:row; max-height:none; overflow-x:auto; } .rail .chip{ min-width:135px; } }
@media(max-width:734px){
  section{ padding:76px 0; } section.tight{ padding:64px 0; }
  .video-section{ padding:54px 0 70px; }
  .video-intro h2{ font-size:36px; }
  .video-intro p{ font-size:15px; }
  .video-frame{ margin-top:26px; padding:6px; border-radius:20px; }
  .video-frame video{ border-radius:15px; }
  .video-meta{ margin-top:12px; font-size:11px; }
  .site-nav{ top:8px; min-height:54px; padding-left:16px; gap:12px; border-radius:17px; }
  .nav-links{ display:none; } .nav-cta{ padding:9px 14px; }
  .nav-brand{ font-size:14px; max-width:210px; }
  .nav-brand svg{ width:22px; height:22px; }
  .nav-brand span{ text-wrap:balance; }
  .hero{ padding-top:116px; } .hero-kicker{ font-size:15px; margin-bottom:20px; }
  h1.title{ font-size:clamp(56px,12vw,82px); } .subtitle{ font-size:17px; margin-top:22px; }
  .btn-row{ gap:18px; margin-top:24px; } .btn{ font-size:13px; padding:13px 18px; } .text-link{ font-size:13px; gap:6px; }
  .hero-visual{ height:310px; gap:28px; margin-top:24px; }
  .hero-input{ width:32%; } .visual-arrow{ display:none; }
  .hero-layers{ width:34%; height:auto; aspect-ratio:1; margin:0 12px 0 0; }
  .hero-plate{ transform:translateZ(calc(var(--depth)*9px)); border-radius:8px; }
  .hero-visual:hover .hero-plate{ transform:translateZ(calc(var(--depth)*9px)); }
  .visual-label{ font-size:10px; margin-top:15px; } .layers-label{ left:auto; right:0; bottom:32px; width:52%; }
  .paper-title{ font-size:11px; margin:0 auto 28px; }
  .stat-strip{ grid-template-columns:1fr 1fr; padding:8px 0 20px; row-gap:28px; }
  .stat{ padding:16px 8px 0; } .stat:nth-child(2){ border:0; }
  .stat b{ font-size:34px; } .stat b .stat-unit{ font-size:17px; } .stat>span{ font-size:10px; }
  .sec-head{ margin-bottom:32px; } .eyebrow{ font-size:14px; margin-bottom:14px; }
  h2.sec-title{ font-size:37px; margin-bottom:20px; } .sec-sub{ font-size:16px; }
  .app{ border-radius:20px; } .app-bar{ flex-wrap:wrap; gap:10px; padding:15px; }
  .app-title{ font-size:11px; } .app-body{ padding:14px; }
  .explorer{ grid-template-columns:minmax(0,1fr); gap:14px; }
  .studio{ grid-template-columns:minmax(0,1fr); } .board-wrap{ padding:18px; }
  .app-bar .tabs{ width:100%; } .tab{ min-height:36px; font-size:11px; padding-inline:12px; }
  .toolbar{ gap:7px; padding:12px; } .preset{ min-height:34px; }
  .prose{ font-size:16px; } .figure{ padding:16px; } .card{ padding:24px; }
}

/* Keep the opening composition wide; give the demos more room at the edges. */
@media(min-width:901px){
  main .wrap{ width:calc(100% - 48px); max-width:1080px; }
  main .wrap-narrow{ max-width:740px; }
  main h2.sec-title{ font-size:clamp(36px,4vw,54px); }
  main .sec-sub{ font-size:17px; max-width:60ch; }
  main .app-body{ padding:20px; }
  main .app-bar{ padding:15px 20px; }
  .explorer{ grid-template-columns:minmax(0,1fr) minmax(0,1.08fr) 180px; gap:14px; }
  .rail{ max-height:360px; }
  .rb{ grid-template-columns:minmax(0,360px) minmax(0,1fr); gap:16px; }
  .studio{ grid-template-columns:minmax(0,1fr) 232px; }
  .board{ width:min(100%,420px); }
  .llist{ max-height:420px; }
  .gal{ grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:20px; }
}
@media(min-width:901px) and (max-width:1040px){
  .explorer{ grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
}
@media(max-width:480px){
  #rb-strip{ --rb-tile:calc((100% - 12px)/2); }
}
