/* X-ray Biology. Design: radiograph film. See DESIGN.md. */
:root {
  --film: #050607;      /* the unexposed film */
  --plate: #0e0f10;     /* raised surface */
  --bone: #f1ece0;      /* text and the primary button */
  --dim: #98948a;
  --line: #2a2925;
  --lamp: #ffb02e;      /* the one accent: selection, progress, warnings */
  --ok: #7fe0a3;
  --display: "Anek Bangla", "Hind Siliguri", sans-serif;
  --body: "Hind Siliguri", "Anek Bangla", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--film); color: var(--bone);
  font: 17px/1.65 var(--body); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; }

/* ---------- buttons ---------- */
.btn { display: inline-block; text-decoration: none; font: 600 18px/1.2 var(--display); padding: 16px 26px; border-radius: 4px; }
.btn.primary { background: var(--bone); color: var(--film); }
.btn.primary:active { background: #fff; }
.btn.ghost { color: var(--bone); padding: 16px 4px; border-bottom: 1px solid transparent; }
.btn.line { border: 1px solid var(--line); color: var(--bone); }
.btn:disabled { opacity: .5; }

/* ---------- 3D stage (always behind everything) ---------- */
#viewer { position: fixed; inset: 0; background: var(--film); overflow: hidden; }
.stage { position: absolute; inset: 0; overflow: hidden; }
.layer { position: absolute; left: 0; top: 0; }
.layer video, .layer canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.layer video { object-fit: fill; }
.mirrored video, .mirrored #gl, .mirrored #shade { transform: scaleX(-1); }
.explore video, .explore #shade { display: none; }
#gl, #shade { pointer-events: none; }
#gl { opacity: 0; transition: opacity .5s ease; }
.live #gl { opacity: 1; }
body.viewing { overflow: hidden; }
body.viewing #viewer { touch-action: none; z-index: 5; }

/* ---------- home ---------- */
#home { position: relative; z-index: 1; }
.hero { min-height: 100svh; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(to bottom, #05060700 0%, #05060700 44%, #050607d9 68%, var(--film) 92%); }
.bar { display: flex; justify-content: space-between; align-items: center; padding: calc(16px + env(safe-area-inset-top)) 20px 0;
  font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.bar a { text-decoration: none; color: var(--dim); padding: 8px 0; }
.bar a:last-child { font: 500 14px/1 var(--body); letter-spacing: 0; text-transform: none; }
.bar .mark { color: var(--bone); }
.hero-in { padding: 0 20px calc(28px + env(safe-area-inset-bottom)); max-width: 720px; }
h1 { margin: 0; font: 800 clamp(52px, min(15.5vw, 17vh), 112px)/1.08 var(--display); font-stretch: 82%; letter-spacing: -.01em; }
.lead { margin: 14px 0 26px; font-size: 18px; line-height: 1.6; max-width: 30em; color: #d9d4c8; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; }
.status { margin: 14px 0 0; min-height: 0; color: var(--lamp); font-weight: 500; }
.status:empty { display: none; }
.note { margin: 22px 0 0; font-size: 13px; color: var(--dim); }

.band { background: var(--film); padding: 56px 20px 8px; }
.band > * { max-width: 720px; }
h2 { margin: 0 0 18px; font: 700 26px/1.25 var(--display); }
.index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.index a { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 14px; padding: 16px 0; text-decoration: none;
  border-bottom: 1px solid var(--line); }
.index b { font: 700 clamp(26px, 7.4vw, 40px)/1.2 var(--display); font-stretch: 88%; }
.index i { font: 500 14px/1 var(--body); color: var(--dim); font-style: normal; grid-row: span 2; align-self: center; }
.index span { font: 400 12px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.prose { margin: 24px 0 0; color: #d9d4c8; max-width: 32em; }

.rows { border-top: 1px solid var(--line); }
.promo { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: center; padding: 18px 0; text-decoration: none;
  border-bottom: 1px solid var(--line); }
.promo b { font: 600 19px/1.3 var(--display); }
.promo span { grid-column: 1; color: var(--dim); font-size: 15px; line-height: 1.5; }
.promo em { grid-column: 2; grid-row: 1 / span 2; font: 500 14px/1 var(--body); font-style: normal; color: var(--lamp); white-space: nowrap; }

.foot { background: var(--film); padding: 48px 20px calc(40px + env(safe-area-inset-bottom)); color: var(--dim); font-size: 13px; }
.foot p { max-width: 720px; margin: 0 0 10px; }
.mono { font: 400 11px/1.6 var(--mono); }

/* ---------- viewer controls ---------- */
.top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 14px;
  padding: calc(12px + env(safe-area-inset-top)) 14px 30px; background: linear-gradient(#050607f2, #050607b3 55%, #05060700); }
.back { width: 44px; height: 44px; font-size: 20px; flex: none; color: var(--bone); }
.seg { display: flex; gap: 18px; }
.seg button { font: 600 17px/1 var(--display); padding: 12px 0 8px; color: var(--dim); border-bottom: 2px solid transparent; }
.seg button.on { color: var(--bone); border-color: var(--bone); }
.seg.right { margin-left: auto; padding-right: 6px; }
.hint { position: absolute; left: 20px; right: 20px; top: calc(70px + env(safe-area-inset-top)); margin: 0; font-size: 15px; color: var(--lamp);
  text-shadow: 0 1px 6px #000; pointer-events: none; }
.hint:empty { display: none; }

.quizbar { position: absolute; left: 0; right: 0; top: calc(62px + env(safe-area-inset-top)); display: flex; align-items: center;
  justify-content: space-between; gap: 10px; padding: 12px 6px 14px 20px; background: var(--film); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.quizbar span { display: block; font-size: 13px; color: var(--dim); }
.quizbar strong { font: 700 24px/1.25 var(--display); }

.bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 14px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(#05060700, #050607d9 26%, #050607f7 60%); }
.chips { display: grid; gap: 6px; padding: 0 0 12px; }
.lrow { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.lname { width: 34px; flex: none; font: 600 12px/1 var(--display); color: var(--dim); }
.chip { flex: none; display: flex; align-items: center; gap: 6px; font: 600 13px/1 var(--display); padding: 7px 8px;
  border: 1px solid var(--line); border-radius: 4px; color: var(--dim); background: #050607b3; }
.chip i { width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 0 1px #0009; }
.chip.on { background: var(--bone); border-color: var(--bone); color: var(--film); }
.chip.all { border-color: transparent; background: none; color: var(--lamp); }
.chip:disabled { opacity: .3; }
@media (max-width: 480px) { .lname { display: none; } }
.tools { display: grid; grid-template-columns: 1fr 1fr 1.25fr 1.5fr; gap: 8px; }
.tool { font: 600 16px/1 var(--display); padding: 16px 4px; border: 1px solid var(--line); border-radius: 4px; background: #0e0f10cc; }
.tool.on { border-color: var(--bone); }
.tool.go { background: var(--bone); color: var(--film); border-color: var(--bone); }

.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 64dvh; overflow-y: auto; background: var(--film);
  border-top: 1px solid var(--bone); padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); }
.sheet .close { position: absolute; right: 8px; top: 10px; }
.sheet .en, .read .en { margin: 0 0 4px; font: 500 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--lamp); }
.sheet h3 { margin: 0 0 10px; font: 800 36px/1.15 var(--display); font-stretch: 86%; padding-right: 44px; }
.sheet p { margin: 8px 0; }
.sheet ul, .facts { list-style: none; margin: 16px 0; padding: 0; border-top: 1px solid var(--line); }
.sheet li, .facts li { padding: 11px 0; border-bottom: 1px solid var(--line); }
.word { font: 400 13px/1.6 var(--mono); color: var(--dim); }
.sheet .row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.sheet .btn { font-size: 16px; padding: 13px 20px; }
.sheet .promo { margin-top: 20px; border-top: 1px solid var(--line); border-bottom: 0; }
.score { font: 800 84px/1 var(--display); margin: 0; }

@media (min-width: 820px) {
  .hero-in, .bar { padding-left: 6vw; padding-right: 6vw; }
  .band, .foot { padding-left: 6vw; padding-right: 6vw; }
  .hero { background: linear-gradient(to right, var(--film) 0%, #050607cc 38%, #05060700 68%); justify-content: space-between; }
  .hero-in { padding-bottom: 9vh; }
  .bottom { left: 50%; right: auto; transform: translateX(-50%); width: 560px; background: none; }
  .sheet { left: auto; right: 0; top: 0; bottom: 0; width: 420px; max-height: none; border-top: 0; border-left: 1px solid var(--line); padding-top: 80px; }
}

/* ---------- reading pages ---------- */
.read main { max-width: 680px; margin: 0 auto; padding: 22px 20px 72px; }
.read nav { font: 500 12px/1.6 var(--mono); letter-spacing: .06em; color: var(--dim); margin-bottom: 44px; }
.read nav a { text-decoration: none; }
.read h1 { font-size: clamp(44px, 12vw, 80px); margin-bottom: 12px; }
.read .lead { margin-bottom: 24px; }
.read h2 { margin-top: 48px; }
.read .list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.read .list a { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 0; text-decoration: none;
  border-bottom: 1px solid var(--line); font: 600 20px/1.3 var(--display); }
.read .list small { font: 400 11px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); text-align: right; }
.read .ad:empty, .read .ad { margin: 28px 0; }
.read .fine { font-size: 13px; color: var(--dim); margin: 10px 0 0; }
.read .rows { margin-top: 48px; }

/* ---------- shared menu and footer ---------- */
.sitetop { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 680px; margin: 0 auto 28px; padding: 16px 20px 0; }
.sitetop .brand { font: 800 18px/1 var(--display); text-decoration: none; }
.menu { display: flex; gap: 16px; font: 500 12px/1.6 var(--mono); letter-spacing: .06em; }
.menu a { text-decoration: none; color: var(--dim); }
.sitefoot { max-width: 680px; margin: 0 auto; padding: 24px 20px 48px; border-top: 1px solid var(--line); font-size: 13px; color: var(--dim); }
.sitefoot p { margin: 6px 0; }
.read .ad { min-height: 280px; }
