/* Physics Lab theme: tiltoootilt-inspired. Fonts: Bagel Fat One, DM Sans, DM Mono (all OFL). */
@import url("https://fonts.googleapis.com/css2?family=Bagel+Fat+One&family=DM+Sans:ital,opsz,wght@0,9..40,400..800;1,9..40,400..700&family=DM+Mono:wght@400;500&display=swap");
:root {
  --font-display: "Bagel Fat One", "DM Sans", system-ui, sans-serif;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, monospace;
  --void: #101233;
  --accent: #ffd23f;
  --lilac: #8fa2ff;
  --sun: #ffd23f; --ink: #141414; --cobalt: #2f4bff; --tomato: #ff4b33; --mint: #7be0b5; --paper: #fff8e6;
}
/* lesson pages: display face is chunky, keep it for titles only */
body:not(.hub) h1, body:not(.hub) h2 { letter-spacing: 0 !important; font-weight: 400 !important; }

/* ---------- hub ---------- */
body.hub { margin: 0; background: var(--sun); color: var(--ink); font-family: var(--font-sans); overflow-x: clip; }
.hub * { box-sizing: border-box; }
.hub .skip { position: absolute; left: -999px; } .hub .skip:focus { left: 12px; top: 12px; background: var(--ink); color: var(--sun); padding: 8px 12px; z-index: 9; }
.hub .top { display: flex; justify-content: space-between; align-items: baseline; padding: 18px clamp(16px, 4vw, 48px); font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; border-bottom: 2.5px solid var(--ink); }
.hub .brand { font-family: var(--font-display); font-size: 22px; letter-spacing: 0; text-transform: none; }
.hub .hero { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(260px, 1fr); min-height: min(78vh, 720px); border-bottom: 2.5px solid var(--ink); }
.hub .pile { position: relative; padding: clamp(18px, 3vw, 40px) clamp(16px, 4vw, 48px); border-right: 2.5px solid var(--ink); overflow: hidden; touch-action: pan-y; }
.hub .word { margin: 0; font-family: var(--font-display); font-weight: 400; line-height: .82; font-size: clamp(5.5rem, 19vw, 17rem); user-select: none; }
.hub .row { display: flex; flex-wrap: nowrap; }
.hub .r2 { padding-left: 9%; margin-top: -.04em; }
.hub .l { display: inline-block; font-weight: 400; color: var(--c, var(--ink)); transform: translate(var(--x, 0px), var(--y, 0px)) rotate(calc(var(--r) + var(--a, 0deg))); cursor: grab; will-change: transform; padding: 0 .01em; }
.hub .l:active { cursor: grabbing; }
.hub .l.lab { font-size: .38em; align-self: flex-end; margin: 0 0 .5em .25em; background: var(--ink); color: var(--sun); border-radius: 999px; padding: .32em .5em .22em; line-height: 1; }
.hub .grab { position: absolute; right: clamp(16px, 4vw, 48px); bottom: 16px; margin: 0; font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; transform: rotate(-3deg); }
.hub .side { display: flex; flex-direction: column; justify-content: flex-end; gap: 18px; padding: clamp(18px, 3vw, 40px); background: var(--paper); }
.hub .kicker { margin: 0; display: inline-block; align-self: flex-start; background: var(--tomato); color: #fff; font-weight: 700; padding: 6px 12px; border-radius: 999px; transform: rotate(-4deg); font-size: 15px; }
.hub .intro { margin: 0; font-size: clamp(1.15rem, 1.6vw, 1.45rem); line-height: 1.35; font-weight: 500; max-width: 30ch; }
.hub .facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hub .facts li { border: 2px solid var(--ink); border-radius: 999px; padding: 6px 12px; font-family: var(--font-mono); font-size: 13px; background: #fff; }
.hub .facts b { font-weight: 500; color: var(--cobalt); }
.hub .lessons { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: clamp(16px, 2.2vw, 28px); padding: clamp(28px, 5vw, 72px) clamp(16px, 4vw, 48px) clamp(40px, 6vw, 88px); align-items: stretch; }
.hub .slab { position: relative; display: flex; flex-direction: column; gap: 12px; min-height: 240px; padding: 22px 22px 20px; border: 2.5px solid var(--ink); border-radius: 28px; color: #fff; text-decoration: none; box-shadow: 8px 8px 0 var(--ink); transition: transform .35s cubic-bezier(.34,1.56,.64,1), box-shadow .2s; }
.hub .slab:nth-child(3n+1) { background: var(--cobalt); transform: rotate(-1.4deg); }
.hub .slab:nth-child(3n+2) { background: var(--tomato); transform: rotate(1.1deg); }
.hub .slab:nth-child(3n) { background: var(--ink); transform: rotate(-0.6deg); }
.hub .slab:nth-child(3n) .n { color: var(--tomato); }
.hub .slab:hover, .hub .slab:focus-visible { transform: rotate(0) translateY(-6px) scale(1.02); box-shadow: 12px 14px 0 var(--ink); outline: none; }
.hub .n { font-family: var(--font-display); font-size: clamp(2.8rem, 4vw, 3.6rem); line-height: .8; color: var(--sun); }
.hub .t { font-family: var(--font-display); font-size: clamp(1.45rem, 2vw, 1.9rem); line-height: .98; }
.hub .d { font-size: 1.02rem; line-height: 1.45; flex: 1; max-width: 34ch; }
.hub .go { align-self: flex-start; background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 8px 16px; font-weight: 700; }
.hub .soon { padding-top: 12px; }
.hub .soon-h { margin: 0 0 12px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.hub .soon ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.hub .soon li { border: 2px dashed var(--ink); border-radius: 14px; padding: 9px 13px; font-weight: 600; background: rgba(255,255,255,.35); transform: rotate(var(--r)); }
.hub .foot { display: flex; justify-content: space-between; padding: 16px clamp(16px, 4vw, 48px); border-top: 2.5px solid var(--ink); font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 860px) {
  .hub .hero { grid-template-columns: 1fr; min-height: 0; }
  .hub .pile { border-right: 0; border-bottom: 2.5px solid var(--ink); min-height: 62vw; padding-bottom: 44px; }
  .hub .word { font-size: 24vw; }
  .hub .lessons { grid-template-columns: 1fr; }
  .hub .slab, .hub .slab:hover, .hub .slab:focus-visible { transform: none; min-height: 0; }
  .hub .by { display: none; }
}
@media (prefers-reduced-motion: reduce) { .hub .slab { transition: none; } .hub .grab { display: none; } }
/* lesson chrome: a stripe of the hub palette */
body:not(.hub)::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: 5px; z-index: 999; pointer-events: none; background: linear-gradient(90deg, var(--cobalt) 0 33%, var(--sun) 33% 66%, var(--tomato) 66%); }

/* ================= lesson pages: sticker panels over a cobalt night ================= */
body:not(.hub) { --void: #161c5e; background: #161c5e !important; }
body:not(.hub) .vig { background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(8, 10, 40, .55)) !important; }
/* title block */
body:not(.hub) .label .tag { display: inline-block; align-self: flex-start; color: #fff !important; background: var(--tomato); border-radius: 999px; padding: 5px 11px; letter-spacing: .06em !important; font-size: 11px !important; transform: rotate(-3deg); }
body:not(.hub) .label h1 { color: var(--sun); font-size: clamp(2.3rem, 5.8vw, 5rem) !important; line-height: .9 !important; text-shadow: 4px 4px 0 var(--ink) !important; }
body:not(.hub) .label h1 em { color: #fff !important; font-weight: 400 !important; }
body:not(.hub) .label .sub { color: rgba(255, 248, 230, .82) !important; }
/* "answer first" + In the world block becomes a paper sticker */
body:not(.hub) .geo-lead { background: var(--paper); color: var(--ink) !important; border: 2.5px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink); padding: 14px 16px !important; transform: rotate(-.6deg); }
body:not(.hub) .geo-lead h2 { color: var(--cobalt) !important; font-size: 1.15rem !important; }
body:not(.hub) .geo-lead::-webkit-scrollbar-thumb { background: rgba(20, 20, 20, .3) !important; }
/* panels: lesson card, readouts, meters */
body:not(.hub) .lesson, body:not(.hub) .meters, body:not(.hub) .hud {
  --pearl: #141414; --mute: rgba(20, 20, 20, .68); --faint: rgba(20, 20, 20, .4); --line: rgba(20, 20, 20, .16);
  --accent: #ff4b33; --honey: #2f4bff; --lilac: #2f4bff; --fric: #138a63;
  color: var(--ink) !important;
}
body:not(.hub) .lesson { background: var(--paper) !important; border: 2.5px solid var(--ink) !important; border-radius: 24px !important; box-shadow: 8px 8px 0 var(--ink) !important; backdrop-filter: none !important; }
body:not(.hub) .lesson-head { border-bottom: 2px solid var(--ink) !important; background: var(--sun); }
body:not(.hub) .lesson-kicker, body:not(.hub) .lesson-kicker b { color: var(--ink) !important; }
body:not(.hub) .lesson-body h3 { font-family: var(--font-display) !important; font-weight: 400 !important; font-size: 1.5rem !important; color: var(--cobalt) !important; letter-spacing: 0 !important; }
body:not(.hub) .lesson-body .formula { background: var(--sun) !important; color: var(--ink) !important; border: 2px solid var(--ink) !important; border-radius: 12px !important; }
body:not(.hub) .lesson-body .watch { border-color: var(--ink) !important; background: #fff !important; color: var(--ink) !important; }
body:not(.hub) .lesson-body details { border-top: 1.5px dashed rgba(20, 20, 20, .35) !important; }
body:not(.hub) .lesson-body summary { color: var(--ink) !important; font-weight: 700; }
body:not(.hub) .lesson-nav { border-top: 2px solid var(--ink) !important; }
body:not(.hub) .lesson-nav .dots button::after { background: rgba(20, 20, 20, .25) !important; }
body:not(.hub) .lesson-nav .dots button[aria-current="step"]::after { background: var(--tomato) !important; transform: scale(1.4); }
body:not(.hub) .lesson button, body:not(.hub) .lesson-tabs button { color: var(--ink); }
body:not(.hub) .lesson-tabs { background: rgba(20, 20, 20, .08) !important; }
body:not(.hub) .lesson-tabs button[aria-selected="true"] { background: var(--ink) !important; color: var(--sun) !important; }
/* every button: chunky pill with an ink outline */
body:not(.hub) .chips button, body:not(.hub) .lesson-body .acts button, body:not(.hub) .lesson-nav > button, body:not(.hub) .lesson-toggle {
  background: #fff !important; color: var(--ink) !important; border: 2px solid var(--ink) !important; border-radius: 999px !important;
  box-shadow: 3px 3px 0 var(--ink) !important; font-weight: 700 !important; backdrop-filter: none !important;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, background .2s !important;
}
body:not(.hub) .chips button:hover, body:not(.hub) .lesson-body .acts button:hover, body:not(.hub) .lesson-nav > button:hover { transform: rotate(-2deg) translateY(-2px); box-shadow: 4px 5px 0 var(--ink) !important; }
body:not(.hub) .chips button[aria-pressed="true"], body:not(.hub) .lesson-body .acts button[aria-pressed="true"] { background: var(--sun) !important; }
body:not(.hub) .chips button small { color: rgba(20, 20, 20, .6) !important; }
/* live readouts become a paper ticket */
body:not(.hub) .hud, body:not(.hub) .meters { background: var(--paper) !important; border: 2.5px solid var(--ink) !important; border-radius: 18px !important; box-shadow: 6px 6px 0 var(--ink) !important; padding: 12px 14px !important; transform: rotate(.6deg); }
body:not(.hub) .hud h2, body:not(.hub) .meters h2 { color: var(--tomato) !important; }
body:not(.hub) .hud canvas { filter: invert(1) hue-rotate(180deg); opacity: .8 !important; }
body:not(.hub) .meter .track { background: rgba(20, 20, 20, .1) !important; border: 1.5px solid var(--ink); border-radius: 999px; }
/* 3D labels: small sun stickers */
body:not(.hub) .tags span { background: var(--sun) !important; color: var(--ink) !important; border: 2px solid var(--ink) !important; border-radius: 999px !important; font-weight: 500; }
body:not(.hub) .tags span b { color: var(--tomato) !important; }
body:not(.hub) .hint, body:not(.hub) .foot { color: rgba(255, 248, 230, .78) !important; }
body:not(.hub) .hint i { background: var(--sun) !important; }
@media (prefers-reduced-motion: reduce) { body:not(.hub) .geo-lead, body:not(.hub) .hud, body:not(.hub) .meters { transform: none; } }
body:not(.hub) .geo-lead { max-height: min(21vh, 180px) !important; }

/* ================= phones & portrait: scene on top, panels stacked below, page scrolls ================= */
@media (max-width: 720px), (max-aspect-ratio: 5/6) {
  html:has(body:not(.hub)), body:not(.hub) { height: auto !important; min-height: 100%; overflow-x: hidden !important; overflow-y: auto !important; touch-action: manipulation !important; }
  body:not(.hub) { display: flex; flex-direction: column; }
  body:not(.hub)::before { position: sticky !important; }
  body:not(.hub) .chrome, body:not(.hub) .label { display: contents !important; }
  body:not(.hub) .label .tag { order: 1; margin: 16px 16px 8px !important; }
  body:not(.hub) .label h1 { order: 2; margin: 0 16px 12px !important; font-size: clamp(2.1rem, 10vw, 3rem) !important; }
  body:not(.hub) #stage { order: 3; position: relative !important; inset: auto !important; flex: none; width: 100%; height: 58svh; min-height: 300px; touch-action: none; border-top: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); }
  body:not(.hub) .vig { display: none !important; }
  body:not(.hub) .tags { z-index: 2 !important; }
  body:not(.hub) .foot { order: 4; position: static !important; display: flex !important; flex-direction: column; gap: 14px !important; padding: 14px 16px 8px; pointer-events: auto; }
  body:not(.hub) .foot .chips { flex-wrap: wrap !important; }
  body:not(.hub) .foot .chips button { min-height: 44px !important; }
  body:not(.hub) .lesson { order: 0; width: auto !important; max-height: none !important; margin: 0 !important; transform: none; }
  body:not(.hub) .lesson-body { max-height: none !important; overflow: visible !important; -webkit-mask-image: none !important; mask-image: none !important; }
  body:not(.hub) .lesson-nav > button, body:not(.hub) .lesson-tabs button { min-height: 44px; min-width: 44px; }
  body:not(.hub) .lesson-nav .dots button { min-width: 28px; min-height: 28px; }
  body:not(.hub) .hud, body:not(.hub) .meters { position: static !important; transform: none; width: auto !important; max-width: none !important; }
  body:not(.hub) .hint { color: rgba(255, 248, 230, .85) !important; }
  body:not(.hub) .geo-lead { order: 5; margin: 6px 16px 28px !important; max-height: none !important; overflow: visible !important; transform: none; font-size: 15px !important; }
  body:not(.hub) #err { order: 6; }
}

/* ================= laptops: the lesson card keeps its reading room; the intro card scrolls instead ================= */
@media (min-width: 721px) and (min-aspect-ratio: 5/6) {
  body:not(.hub) .label > .lesson { flex: 0 0 auto; min-height: min(300px, 42vh); }
  body:not(.hub) .label > .lesson .lesson-body { min-height: 120px; }
  body.lesson-closed .label > .lesson { min-height: 0; }
  body:not(.hub) .label > .geo-lead { flex: 0 1 auto; min-height: 84px; overflow-y: auto; scrollbar-width: thin; }
  body:not(.hub) .label > .geo-lead::after { content: "scroll for more \2193"; position: sticky; bottom: -14px; display: block; margin: 4px -16px -14px; padding: 14px 16px 6px; background: linear-gradient(rgba(255, 248, 230, 0), var(--paper) 55%); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--cobalt); text-align: right; pointer-events: none; }
}

/* lesson card is paper: its text must be ink, not the old pale night colour */
body:not(.hub) .lesson-body, body:not(.hub) .lesson-body p, body:not(.hub) .lesson-body li { color: var(--ink) !important; }
body:not(.hub) .lesson-body details p, body:not(.hub) .lesson-body .live, body:not(.hub) .lesson-body .muted { color: rgba(20, 20, 20, .78) !important; }
body:not(.hub) .lesson-body .live span, body:not(.hub) .lesson-body .watch b, body:not(.hub) .lesson-body .live b { color: var(--cobalt) !important; }
body:not(.hub) .lesson-body .acts button { color: var(--ink) !important; border-color: var(--ink) !important; background: #fff !important; }
body:not(.hub) .lesson-body .acts button[aria-pressed="true"] { background: var(--sun) !important; }
body:not(.hub) .lesson-toggle, body:not(.hub) .lesson-tabs button { color: var(--ink) !important; }
/* numbers cards are paper too: labels in ink, the unfocused column only lightly dimmed */
body:not(.hub) .hud .row, body:not(.hub) .meters .row, body:not(.hub) .meters .lab, body:not(.hub) .meters .val { color: rgba(20, 20, 20, .82) !important; }
body:not(.hub)[data-focus="spring"] .hud .col:last-child, body:not(.hub)[data-focus="orbit"] .hud .col:first-child { opacity: .72; }
/* lesson step dots: a bigger hit area around the same small dot */
body:not(.hub) .lesson-nav .dots button { min-width: 26px; min-height: 32px; }
