/* Public lesson page (/v/:id): the StudyGraph notebook look on one paper page. Kept separate from
   styles.css so the page loads only what it needs (and so the app's stylesheet can change freely). */
:root {
  --ink: #141414; --ink-2: #3d3a35; --ink-3: #6f6a62;
  --paper: #f6f1e7; --paper-2: #ede6d8; --line: #d6cdbb; --line-2: #bfb4a0;
  --hl: #ffd93d; --hl-2: #ffe580; --ok: #2f7d4f; --bad: #c43d33; --dark: #0d0d0e;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper) radial-gradient(circle at 100% 0, rgba(255, 229, 128, .9), rgba(255, 229, 128, 0) 60%); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; min-height: 100vh; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
.serif { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; font-variation-settings: 'opsz' 48; }
.mono { font-family: var(--mono); }
mark { background: linear-gradient(transparent 28%, var(--hl) 28%, var(--hl) 88%, transparent 88%); color: inherit; padding: 0 .08em; }

.top { display: flex; align-items: center; padding: 18px 20px 0; max-width: 560px; width: 100%; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 20px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--ink); box-shadow: 2px 2px 0 var(--hl); position: relative; }
.brand-mark::after { content: ''; position: absolute; left: 10px; top: 7px; border-left: 9px solid var(--hl); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }

.watch { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 18px 20px 28px; }
.pills { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.unit-pill { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  padding: 5px 9px; border-radius: 5px; background: var(--hl); color: var(--ink); }
.unit-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); flex: none; }
.fmt-badge { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 5px 8px; border-radius: 5px; border: 1.5px solid var(--ink); color: var(--ink); }
.title { font-family: var(--serif); font-weight: 600; letter-spacing: -.015em; font-variation-settings: 'opsz' 72; font-size: clamp(26px, 6.5vw, 36px); line-height: 1.1; margin: 14px 0 8px; }
.hook { color: var(--ink-2); font-size: 16px; margin: 0 0 18px; }

/* The stage is a phone-shaped frame on paper; the player fills it. */
.stage { position: relative; aspect-ratio: 9 / 16; max-height: 78vh; margin: 0 auto; background: var(--dark); border-radius: 18px; overflow: hidden;
  border: 1.5px solid var(--ink); box-shadow: 6px 6px 0 var(--hl); }
.stage .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: opacity .4s var(--ease); }
.stage[data-loaded="true"] .poster { opacity: 0; }
.player-host, .player-host iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: transparent; }
.player-host iframe { pointer-events: none; }
.play { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(13, 13, 14, .35); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; cursor: pointer; }
.play-ring { width: 84px; height: 84px; border-radius: 50%; background: var(--hl); border: 2px solid var(--ink); display: grid; place-items: center; box-shadow: 4px 4px 0 var(--ink); transition: transform .15s var(--ease); }
.play:active .play-ring { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.play-tri { margin-left: 6px; border-left: 26px solid var(--ink); border-top: 16px solid transparent; border-bottom: 16px solid transparent; }
.play-label { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.stage[data-state="loading"] .play-label::after { content: '…'; }
.stage[data-state="playing"] .play { opacity: 0; pointer-events: none; }
.stage[data-state="paused"] .play, .stage[data-state="ended"] .play { opacity: 1; }
.stage[data-state="ended"] .play-tri { display: none; }
.stage[data-state="ended"] .play-ring::before { content: '↺'; font-size: 40px; font-weight: 700; color: var(--ink); line-height: 1; }
.note { position: absolute; left: 14px; right: 14px; bottom: 18px; margin: 0; text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--hl); transform-origin: left; transform: scaleX(0); }

/* Quick check: slides in over the bottom of the stage, holds the video until answered. */
.quiz { position: absolute; left: 10px; right: 10px; bottom: 14px; background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 14px; padding: 12px 12px 10px; box-shadow: 4px 4px 0 var(--hl); }
.quiz-label { margin: 0 0 8px; font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.quiz-hint { text-transform: none; letter-spacing: 0; font-weight: 500; }
.quiz[data-held="false"] .quiz-hint { visibility: hidden; }
.quiz-options { display: grid; gap: 6px; }
.quiz-opt { display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 10px; border-radius: 9px; border: 1.5px solid var(--line-2); background: #fff; cursor: pointer; font-size: 14px; line-height: 1.3; }
.quiz-opt b { font-family: var(--mono); font-size: 12px; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--paper-2); flex: none; }
.quiz-opt.right { border-color: var(--ok); background: #e8f3ec; }
.quiz-opt.wrong { border-color: var(--bad); background: #f8e6e4; }
.quiz-opt:disabled { cursor: default; }
.quiz-feedback { margin: 8px 0 0; font-size: 13.5px; min-height: 1.2em; }
.quiz-feedback:empty { display: none; }
.quiz-skip { background: none; border: 0; padding: 6px 0 0; color: var(--ink-3); font-size: 12.5px; text-decoration: underline; cursor: pointer; }

.notes { margin-top: 26px; padding: 20px; background: #fff; border: 1.5px solid var(--line-2); border-radius: 16px; }
.notes h2 { margin: 0 0 10px; font-size: 22px; }
.notes h3 { margin: 16px 0 6px; font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.notes p, .notes li, .notes dd { font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.notes ul, .notes ol { margin: 0; padding-left: 20px; }
.notes li + li { margin-top: 4px; }
.notes dl { margin: 0; }
.notes dt { font-weight: 600; color: var(--ink); margin-top: 8px; }
.notes dd { margin: 2px 0 0; }
.notes-objective { margin: 0; font-weight: 500; color: var(--ink) !important; }
.notes-myth, .notes-takeaway { margin: 14px 0 0; }
.notes-takeaway { padding: 10px 12px; background: var(--hl-2); border-radius: 10px; }
.notes-quiz { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.notes-quiz summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.notes-quiz ol { margin-top: 8px; }
.notes-quiz li.right { font-weight: 600; color: var(--ok); }
.notes-terms { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; }
.notes-terms span { font-family: var(--mono); font-size: 11.5px; padding: 4px 8px; border-radius: 6px; background: var(--paper-2); color: var(--ink-2); }
.shared-by { margin: 14px 0 0; color: var(--ink-3); font-size: 12px; text-align: center; }
.cta { margin-top: 30px; padding: 22px 20px; background: #fff; border: 1.5px solid var(--ink); border-radius: 16px; box-shadow: 6px 6px 0 var(--hl); }
.cta h2 { margin: 0 0 8px; font-size: 24px; line-height: 1.15; }
.cta p { margin: 0 0 16px; color: var(--ink-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 22px; border-radius: 10px; border: 1.5px solid var(--ink);
  background: var(--paper); color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: none; width: 100%; transition: transform .1s var(--ease), box-shadow .15s; }
.btn.primary { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 var(--hl); }
.btn:active { transform: translateY(1px); }

.foot { padding: 18px 20px calc(22px + env(safe-area-inset-bottom, 0px)); text-align: center; color: var(--ink-3); font-size: 12px; }
.stage:has(.quiz[data-held="true"]) .play { opacity: 0; pointer-events: none; }

/* ---- Course profile pages (/@handle, server/core/profile.js) ---- */
.profile { max-width: 720px; }
.p-head { text-align: center; padding-top: 8px; }
.p-avatar { width: 92px; height: 92px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 44px; background: var(--hl); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); overflow: hidden; }
.p-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-head .title { margin: 16px 0 2px; }
.p-handle { margin: 0; color: var(--ink-3); font-size: 14px; }
.p-kicker { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.p-stats { list-style: none; display: flex; justify-content: center; gap: 22px; margin: 16px 0; padding: 0; font-size: 13px; color: var(--ink-3); }
.p-stats strong { display: block; font-size: 20px; color: var(--ink); font-family: var(--serif); }
.p-head .hook { max-width: 520px; margin: 0 auto 10px; }
.p-by { margin: 0 0 12px; font-size: 13px; color: var(--ink-3); }
.p-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 22px; }
.p-share { background: #fff; color: var(--ink); }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tile { position: relative; display: block; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 6px; background: var(--dark); color: #fff; text-decoration: none; }
.tile img, .tile-blank { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-blank { background: linear-gradient(160deg, #2a2a2e, #0d0d0e); }
.tile-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 7px 7px; display: grid; gap: 3px; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); }
.tile-title { font-size: 12px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile-len { font-size: 10px; opacity: .85; }
.empty { text-align: center; color: var(--ink-3); padding: 24px 0; }
.syllabus { margin-top: 26px; padding: 20px; background: #fff; border: 1.5px solid var(--line-2); border-radius: 16px; }
.syllabus h2 { margin: 0 0 10px; font-size: 22px; }
.syllabus ol { margin: 0; padding-left: 22px; }
.syllabus li { margin: 6px 0; font-size: 15px; color: var(--ink-2); }
.syllabus li strong { color: var(--ink); }
.syllabus li span { display: block; font-size: 13.5px; }
@media (min-width: 640px) { .grid { gap: 8px; } .tile-title { font-size: 13px; } }
