/* main.css — global styles. Vanilla, token-driven, no framework. */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--ff-base);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3, h4 { font-family: var(--ff-heading); line-height: var(--lh-tight); font-weight: 700; letter-spacing: -0.01em; }
.brand { font-family: var(--ff-heading); }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }

/* Layout */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-4); }
/* One content width everywhere. .wide/.read are aliases for back-compat. */
.container.wide,
.container.read { max-width: var(--maxw); }
.container.narrow { max-width: 560px; }
main { flex: 1 0 auto; padding-block: var(--sp-6); }
.section { padding-block: clamp(var(--sp-6), 6vw, calc(var(--sp-8) * 1.6)); }
.display { font-family: var(--ff-heading); font-size: var(--fs-display); line-height: var(--lh-tight); letter-spacing: -0.025em; font-weight: 800; }

/* Skip link (a11y) */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1000;
  background: var(--c-primary); color: #fff; padding: var(--sp-2) var(--sp-4); border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* Header */
/* Sticky must be on the flex-child wrapper, not the nested header. */
#site-header { position: sticky; top: 0; z-index: 100; }
.site-header {
  height: var(--header-h);
  background: color-mix(in srgb, var(--c-bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.brand { display: flex; align-items: center; gap: var(--sp-2); font-weight: 800; font-size: var(--fs-lg); color: var(--c-text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--c-primary); color: #fff; display: grid; place-items: center; font-size: var(--fs-sm); font-weight: 800; }
.brand-logo { width: 60px; height: 60px; border-radius: var(--radius-sm); object-fit: contain; }
.brand { font-size: var(--fs-xl); }

/* Adaptive Na.Su label: full when room, short on cramped desktop, full in mobile menu */
.lbl-short { display: none; }
@media (max-width: 1040px) and (min-width: 761px) {
  .lbl-full { display: none; }
  .lbl-short { display: inline; }
}

/* Profile dropdown */
.profile { position: relative; }
.profile-btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--c-border); border-radius: 50%; background: var(--c-surface); cursor: pointer; overflow: hidden; }
.profile-btn img { width: 100%; height: 100%; object-fit: cover; }
.profile-fallback { font-weight: 700; color: var(--c-text); }
.profile-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 180px; background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: var(--sp-2); display: grid; gap: 2px; z-index: 200; }
.profile-menu[hidden] { display: none; }
.profile-name { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); color: var(--c-text-muted); border-bottom: 1px solid var(--c-border); margin-bottom: var(--sp-1); }
.profile-menu a, .profile-menu button { display: block; width: 100%; text-align: left; padding: var(--sp-2) var(--sp-3); border: 0; background: none; font: inherit; color: var(--c-text); border-radius: var(--radius-sm); cursor: pointer; }
.profile-menu a:hover, .profile-menu button:hover { background: var(--c-surface-2); text-decoration: none; }

.nav { display: flex; align-items: center; gap: var(--sp-5); }
.nav a { color: var(--c-text-muted); font-size: var(--fs-sm); font-weight: 600; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--c-text); text-decoration: none; }
/* Buttons inside the nav keep their own colors (don't inherit muted nav link color) */
.nav a.btn-primary { color: #fff; }
.nav a.btn-outline { color: var(--c-text); }

.nav-toggle { display: none; background: none; border: 0; padding: var(--sp-2); cursor: pointer; color: var(--c-text); }

#auth-slot { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); }

.theme-toggle { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-surface); color: var(--c-text); cursor: pointer; transition: border-color .15s ease, color .15s ease; }
.theme-toggle:hover { border-color: var(--c-primary); color: var(--c-primary); }

/* Utilities (use instead of inline styles — see DESIGN.md) */
.eyebrow { color: var(--c-primary); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: var(--fs-sm); }
.actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.actions.center { justify-content: center; }
.mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); } .mb-5 { margin-bottom: var(--sp-5); }
.score-val { font-size: var(--fs-2xl); font-weight: 700; }
.my-3 { margin-block: var(--sp-3); } .my-4 { margin-block: var(--sp-4); }
.text-success { color: var(--c-success); } .text-danger { color: var(--c-danger); }
.score-ring.pass { border: 8px solid var(--c-success); color: var(--c-success); }
.score-ring.fail { border: 8px solid var(--c-danger); color: var(--c-danger); }
.list { padding-left: var(--sp-5); display: grid; gap: var(--sp-2); margin-top: var(--sp-3); }
.pad-lg { padding: var(--sp-8); }
.price { font-size: var(--fs-2xl); font-weight: 800; margin-top: var(--sp-4); }
.fineprint { font-size: var(--fs-xs); color: var(--c-text-muted); }
.lead-narrow { max-width: 55ch; margin-inline: auto; }
.full { width: 100%; }
.tagline { max-width: 40ch; }
.form-narrow { max-width: 600px; }
.ml-2 { margin-left: var(--sp-2); }

/* Admin dashboard */
.admin-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.admin-tabs { display: flex; gap: var(--sp-2); }
#post-form,
#pdf-form,
#quiz-form { max-width: 1040px; margin-inline: auto; }
#post-form textarea,
#quiz-form input:not([type="radio"]) { width: 100%; }
#admin-app .card {
  border-color: color-mix(in srgb, var(--c-border) 78%, transparent);
  box-shadow: none;
}
#admin-app input,
#admin-app textarea,
#admin-app .rte {
  border-color: color-mix(in srgb, var(--c-border) 86%, transparent);
}
#admin-app input:focus,
#admin-app textarea:focus,
#admin-app .rte:focus {
  border-color: var(--c-primary);
  outline: 3px solid color-mix(in srgb, var(--c-primary) 16%, transparent);
  outline-offset: 0;
}
.q-row {
  margin-block: var(--sp-4);
  padding: var(--sp-5);
  background: color-mix(in srgb, var(--c-surface) 54%, var(--c-bg));
}
.q-row .field { margin-bottom: var(--sp-3); }
.q-row .q-opt {
  display: grid;
  grid-template-columns: 18px 34px minmax(0, 1fr);
  align-items: center;
  gap: var(--sp-2);
  margin-block: var(--sp-2);
  padding: var(--sp-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--c-bg);
}
.q-row .q-opt:has(input[type="radio"]:checked) {
  border-color: color-mix(in srgb, var(--c-primary) 38%, var(--c-border));
  background: var(--c-primary-soft);
}
.q-row .q-opt input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  justify-self: center;
  accent-color: var(--c-primary);
}
.q-row .q-key {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  font-size: var(--fs-xs);
  font-weight: 800;
}
.q-row .q-opt:has(input[type="radio"]:checked) .q-key {
  background: var(--c-primary);
  color: #fff;
}
.q-row .q-option {
  min-width: 0;
  font: inherit;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-bg);
  color: var(--c-text);
}
.q-row .q-del { margin-top: var(--sp-2); }

/* Rich-text editor */
.rte-toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-1); padding: var(--sp-2); border: 1px solid var(--c-border); border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--c-surface-2); }
.rte-toolbar button { font: inherit; font-size: var(--fs-sm); padding: var(--sp-1) var(--sp-2); border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-bg); color: var(--c-text); cursor: pointer; }
.rte-toolbar button:hover { border-color: var(--c-primary); color: var(--c-primary); }
.rte { min-height: 280px; max-height: 60vh; overflow-y: auto; padding: var(--sp-4); border: 1px solid var(--c-border); border-radius: 0 0 var(--radius-sm) var(--radius-sm); background: var(--c-bg); font-size: var(--fs-base); }
.rte:focus { outline: 2px solid var(--c-focus); outline-offset: -2px; }
.rte img { max-width: 100%; height: auto; }

.seo-box { border: 1px solid var(--c-border); border-radius: var(--radius); padding: var(--sp-4); }
.seo-box legend { font-weight: 700; padding-inline: var(--sp-2); }
.check { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.btn-danger-outline { background: transparent; border-color: var(--c-danger); color: var(--c-danger); }
.btn-danger-outline:hover { background: var(--c-danger); color: #fff; }

/* Form textarea (matches .field input) */
.field textarea { font: inherit; padding: var(--sp-3); border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-bg); color: var(--c-text); resize: vertical; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font: inherit; font-weight: 600; font-size: var(--fs-sm);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  background: var(--c-surface-2); color: var(--c-text);
  transition: background .15s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-hover); }
.btn-outline { background: transparent; border-color: var(--c-border); color: var(--c-text); }
.btn-outline:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn-lg { padding: var(--sp-3) var(--sp-6); font-size: var(--fs-base); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Cards / grid */
.grid { display: grid; gap: var(--sp-4); }
/* auto-fit: a few items stretch to fill the row (no empty trailing columns) */
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: var(--sp-5);
  transition: transform var(--motion), border-color var(--motion), box-shadow var(--motion);
}
a .card, .card:has(a:hover), .grid-3 .card:hover { border-color: color-mix(in srgb, var(--c-primary) 40%, var(--c-border)); transform: translateY(-3px); box-shadow: var(--shadow-2); }
.card h3 { margin-bottom: var(--sp-2); }
.card .meta { color: var(--c-text-muted); font-size: var(--fs-sm); display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }

.badge { display: inline-block; font-size: var(--fs-xs); font-weight: 700; padding: 2px var(--sp-2); border-radius: 99px; background: var(--c-primary-soft); color: var(--c-primary); }
.badge-premium { background: #fff3d6; color: var(--c-warning); }
:root[data-theme="dark"] .badge-premium { background: #2e2510; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-premium { background: #2e2510; } }

/* Hero */
.hero { text-align: center; padding-block: var(--sp-8); }
.hero p.lead { color: var(--c-text-muted); font-size: var(--fs-lg); max-width: 60ch; margin: var(--sp-4) auto var(--sp-5); }
.hero .actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }

/* Quiz runner */
.quiz-shell { max-width: 760px; margin-inline: auto; }
.quiz-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-4); font-size: var(--fs-sm); color: var(--c-text-muted); }
.progress { height: 6px; background: var(--c-surface-2); border-radius: 99px; overflow: hidden; margin-bottom: var(--sp-5); }
.progress > span { display: block; height: 100%; background: var(--c-primary); width: 0; transition: width .25s ease; }
.q-text { font-size: var(--fs-xl); font-weight: 700; margin-bottom: var(--sp-5); }
.options { display: grid; gap: var(--sp-3); }
.option {
  display: flex; gap: var(--sp-3); align-items: center; text-align: left;
  padding: var(--sp-4); border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-surface); cursor: pointer; font: inherit; color: var(--c-text); width: 100%;
}
.option:hover { border-color: var(--c-primary); }
.option[aria-pressed="true"] { border-color: var(--c-primary); background: var(--c-primary-soft); }
.option .key { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--c-surface-2); font-weight: 700; font-size: var(--fs-sm); }
.option.correct { border-color: var(--c-success); background: rgba(26,138,74,.12); }
.option.wrong { border-color: var(--c-danger); background: rgba(200,51,31,.12); }
.quiz-nav { display: flex; justify-content: space-between; margin-top: var(--sp-6); }

/* States */
.notice { padding: var(--sp-4); border-radius: var(--radius); background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-text-muted); }
.notice.error { border-color: var(--c-danger); color: var(--c-danger); }
.center { text-align: center; }
.muted { color: var(--c-text-muted); }
.hidden { display: none !important; }

/* Spinner */
.spinner { width: 28px; height: 28px; border: 3px solid var(--c-surface-2); border-top-color: var(--c-primary); border-radius: 50%; animation: spin .7s linear infinite; margin: var(--sp-6) auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }

/* Forms */
.field { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.field label { font-size: var(--fs-sm); font-weight: 600; }
.field input { font: inherit; padding: var(--sp-3); border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-bg); color: var(--c-text); }
.auth-card { max-width: 400px; margin: var(--sp-8) auto; }

/* Footer */
.site-footer { flex-shrink: 0; border-top: 1px solid var(--c-border); background: var(--c-surface); padding-block: var(--sp-6); margin-top: var(--sp-8); }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--sp-6); }
.site-footer h4 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--c-text-muted); margin-bottom: var(--sp-3); }
.site-footer ul { list-style: none; padding: 0; display: grid; gap: var(--sp-2); }
.site-footer a { color: var(--c-text-muted); font-size: var(--fs-sm); }
.site-footer .social { display: flex; gap: var(--sp-3); margin-top: var(--sp-6); }
.site-footer .social a { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--c-surface-2); color: var(--c-text-muted); transition: background .15s ease, color .15s ease; }
.site-footer .social a:hover { background: var(--c-primary); color: #fff; }
.site-footer .copy { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--c-border); font-size: var(--fs-xs); color: var(--c-text-muted); }

/* Post prev/next nav (high-level category series) */
.post-nav { display: flex; justify-content: space-between; gap: var(--sp-4); margin-block: var(--sp-6); }
.post-nav a { flex: 1; padding: var(--sp-4); border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); font-size: var(--fs-sm); }
.post-nav a:hover { border-color: var(--c-primary); text-decoration: none; }
.post-nav .pn-dir { display: block; color: var(--c-text-muted); font-size: var(--fs-xs); margin-bottom: var(--sp-1); }
.post-nav a.next { text-align: right; }
.post-nav a.disabled { visibility: hidden; }

/* Result summary */
.score-ring { width: 150px; height: 150px; margin: 0 auto var(--sp-5); display: grid; place-items: center; border-radius: 50%; font-size: 2.25rem; line-height: 1; font-weight: 800; }

/* Homepage */
.section-head { text-align: center; max-width: 60ch; margin: 0 auto var(--sp-6); }
.section-head .eyebrow { color: var(--c-primary); font-weight: 700; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .06em; }
.section-head h2 { margin-top: var(--sp-2); }
.section-head p { color: var(--c-text-muted); margin-top: var(--sp-3); }
.section-cta { text-align: center; margin-top: var(--sp-6); }

.hero-home { padding-block: var(--sp-8); }
.hero-home .eyebrow { color: var(--c-primary); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: var(--fs-sm); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-8); align-items: center; }
.split .portrait { aspect-ratio: 4/5; max-width: 400px; width: 100%; justify-self: center; background: linear-gradient(135deg, var(--c-primary-soft), var(--c-surface-2)); border-radius: var(--radius); display: grid; place-items: center; color: var(--c-text-muted); overflow: hidden; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait.square { aspect-ratio: 1 / 1; }
.portrait.tall { aspect-ratio: 3 / 4; }
.book-layout { display: grid; grid-template-columns: minmax(260px, 1fr) 1.4fr; gap: var(--sp-8); align-items: start; }
.cover-img { width: 100%; border-radius: var(--radius); }
@media (max-width: 760px) { .book-layout { grid-template-columns: 1fr; } }
.testimonials .card .who { display: flex; align-items: center; gap: var(--sp-3); }
.testimonials .who img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.post-hero { width: 100%; aspect-ratio: 1080/675; object-fit: cover; border-radius: var(--radius); margin-bottom: var(--sp-5); }
.card .thumb { display: block; width: 100%; aspect-ratio: 400/250; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: var(--sp-3); }
.stats { display: flex; gap: var(--sp-6); margin-top: var(--sp-5); flex-wrap: wrap; }
.stats .stat strong { display: block; font-size: var(--fs-2xl); color: var(--c-primary); }
.stats .stat span { font-size: var(--fs-sm); color: var(--c-text-muted); }

.band { background: var(--c-surface); border-block: 1px solid var(--c-border); }

.yt-facade { position: relative; cursor: pointer; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #000; max-width: 760px; margin-inline: auto; box-shadow: var(--shadow-2); }
.yt-facade img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.yt-facade .play { position: absolute; inset: 0; margin: auto; width: 72px; height: 72px; border-radius: 50%; background: rgba(0,0,0,.6); display: grid; place-items: center; }
.yt-facade .play::after { content: ""; border-style: solid; border-width: 14px 0 14px 24px; border-color: transparent transparent transparent #fff; margin-left: 5px; }
.yt-frame { width: 100%; height: 100%; border: 0; border-radius: var(--radius); display: block; }

.testimonials .card p { font-style: italic; }
.testimonials .card .who { font-style: normal; font-weight: 700; margin-top: var(--sp-3); }

.cta-band { text-align: center; padding-block: var(--sp-8); }
.cta-band h2 { margin-bottom: var(--sp-4); }

@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }

/* Na.Su landing hero */
.nasu-hero { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(var(--sp-6), 5vw, calc(var(--sp-8) * 1.6)); align-items: center; padding-block: clamp(var(--sp-6), 6vw, var(--sp-8)); }
.nasu-hero img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow-2); }
.nasu-hero-text h1 { font-family: var(--ff-heading); font-size: var(--fs-display); line-height: var(--lh-tight); letter-spacing: -0.025em; font-weight: 800; margin-block: var(--sp-3) var(--sp-4); }
.nasu-hero-text .lead { max-width: 46ch; margin-bottom: var(--sp-5); }
@media (max-width: 760px) { .nasu-hero { grid-template-columns: 1fr; gap: var(--sp-5); } }

/* pdf-quiz-post layout */
.post-layout { max-width: var(--maxw); }
.post-head { margin-bottom: var(--sp-6); }
.post-head h1 { margin-block: var(--sp-3); }
.post-head .lead { color: var(--c-text-muted); font-size: var(--fs-lg); }

.pdf-reader {
  padding: var(--sp-4);
  scroll-margin-top: calc(var(--header-h) + var(--sp-4));
}
.pdf-stage {
  position: relative;
  background: var(--c-surface-2);
  border-radius: var(--radius-sm);
  overflow: auto;
  min-height: clamp(260px, 58svh, 760px);
  max-height: 78svh;
  display: grid;
  place-items: start center;
  padding: var(--sp-3);
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.pdf-stage canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 1px 8px rgba(16, 24, 40, 0.12);
}
.pdf-tap-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 25%;
  z-index: 2;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.pdf-tap-prev { left: 0; }
.pdf-tap-next { right: 0; }
.pdf-tap-zone:disabled { pointer-events: none; cursor: default; }
.pdf-tap-zone:focus-visible { outline: none; }
.pdf-bar {
  display: grid;
  grid-template-columns: minmax(92px, auto) minmax(56px, 1fr) minmax(92px, auto) minmax(118px, auto);
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.pdf-bar [data-pdf-pager] { text-align: center; font-weight: 700; }
.pdf-reader[data-rendering="true"] .pdf-stage { cursor: progress; }
.pdf-reader:fullscreen {
  width: 100vw;
  height: 100svh;
  padding: var(--sp-3);
  border: 0;
  border-radius: 0;
  background: var(--c-bg);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}
.pdf-reader:fullscreen .pdf-stage {
  min-height: 0;
  max-height: none;
  height: 100%;
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  place-items: center;
}
.pdf-reader:fullscreen .pdf-stage canvas { max-width: 100%; max-height: 100%; }
.pdf-reader:fullscreen .pdf-bar {
  position: sticky;
  bottom: 0;
  background: color-mix(in srgb, var(--c-bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding-top: var(--sp-2);
  transition: opacity .22s ease, transform .22s ease;
}
.pdf-reader:fullscreen.controls-hidden .pdf-bar {
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(100% + var(--sp-2)));
}

.notes-text { margin-block: var(--sp-5); border: 1px solid var(--c-border); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); background: var(--c-surface); }
.notes-text > summary { cursor: pointer; font-weight: 600; color: var(--c-primary); }
.notes-text .post-body { margin-top: var(--sp-4); font-size: var(--fs-base); }
.post-body p { margin-block: var(--sp-4); }
.post-body h2, .post-body h3, .post-body h4 { margin-block: var(--sp-6) var(--sp-3); }
.post-body ul, .post-body ol { padding-left: var(--sp-5); display: grid; gap: var(--sp-2); margin-block: var(--sp-4); }
.post-body img { max-width: 100%; height: auto; border-radius: var(--radius); margin-block: var(--sp-4); }
.post-body table { width: 100%; border-collapse: collapse; margin-block: var(--sp-4); }
.post-body td, .post-body th { border: 1px solid var(--c-border); padding: var(--sp-2); }

.quiz-section, .comments-section, .related { margin-block: var(--sp-8); padding-top: var(--sp-6); border-top: 1px solid var(--c-border); }
.quiz-section h2, .comments-section h2, .related h2 { margin-bottom: var(--sp-5); }
.comments-section [data-cm-list] { gap: var(--sp-3); }

/* Responsive */
@media (max-width: 760px) {
  .nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--c-bg);
    border-top: 1px solid var(--c-border);
    border-bottom: 1px solid var(--c-border);
    box-shadow: var(--shadow-2);
    padding: var(--sp-2) var(--sp-4) var(--sp-4);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a[data-nav] { padding: var(--sp-4) var(--sp-1); border-bottom: 1px solid var(--c-border); font-size: var(--fs-base); }
  #theme-toggle { margin-top: var(--sp-3); align-self: flex-start; }
  #auth-slot { margin-top: var(--sp-3); }
  #auth-slot .btn { width: 100%; }
  .profile { align-self: flex-start; }
  .nav-toggle { display: inline-flex; }
  .site-footer .cols { grid-template-columns: 1fr; }
  .pdf-reader { padding: var(--sp-2); }
  .pdf-stage {
    min-height: 58svh;
    max-height: 72svh;
    padding: var(--sp-2);
  }
  .pdf-bar {
    grid-template-columns: 1fr 72px 1fr;
    gap: var(--sp-2);
  }
  .pdf-bar [data-pdf-fullscreen] { grid-column: 1 / -1; order: 2; }
  .pdf-bar .btn { min-height: 44px; padding-inline: var(--sp-3); }
  .pdf-reader:fullscreen { padding: var(--sp-1); }
  .pdf-reader:fullscreen .pdf-stage {
    min-height: 0;
    max-height: none;
    padding: var(--sp-2);
    border-radius: var(--radius-sm);
  }
  .pdf-reader:fullscreen .pdf-bar {
    margin-top: var(--sp-2);
    padding: var(--sp-2) 0 0;
  }
  h1 { font-size: var(--fs-2xl); }
}

/* ============ Modern pass ============ */
/* Hero: image-led, larger */
.hero-home { padding-block: clamp(var(--sp-6), 5vw, var(--sp-8)); }
.hero-home .split { gap: clamp(var(--sp-5), 5vw, calc(var(--sp-8) * 1.4)); align-items: center; }
.hero-home .portrait { max-width: 540px; aspect-ratio: 4/5; }
.hero-home h1 { font-family: var(--ff-heading); font-size: var(--fs-display); line-height: var(--lh-tight); letter-spacing: -0.025em; font-weight: 800; margin-block: var(--sp-3) var(--sp-4); }

/* Testimonials: cardless quotes */
.testimonials .grid-3 { gap: clamp(var(--sp-5), 4vw, var(--sp-8)); }
.testimonials .card { background: none; border: 0; padding: 0; box-shadow: none; transform: none; }
.testimonials .card:hover { transform: none; box-shadow: none; border: 0; }
.testimonials .card p { font-size: var(--fs-lg); line-height: 1.5; }
.testimonials .card p::before { content: "\201C"; color: var(--c-primary); font-size: 2em; line-height: 0; vertical-align: -0.35em; margin-right: .08em; }

/* Scroll reveal (JS-gated: content visible if JS/CSS unsupported) */
html.reveal-on [data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform var(--motion); }
html.reveal-on [data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { html.reveal-on [data-reveal] { opacity: 1; transform: none; } }

/* Section heads a touch larger/airier */
.section-head { max-width: 64ch; }
.section-head h2 { font-size: var(--fs-2xl); letter-spacing: -0.02em; }

/* First Paper landing */
.fp-hero { text-align: center; padding-block: clamp(var(--sp-6), 6vw, var(--sp-8)); max-width: 60ch; margin-inline: auto; }
.fp-hero .actions { justify-content: center; margin-top: var(--sp-5); }
.fp-stats .card { text-align: center; }
.fp-num { display: block; font-family: var(--ff-heading); font-size: var(--fs-2xl); font-weight: 800; color: var(--c-primary); }
.fp-stats .card span { color: var(--c-text-muted); font-size: var(--fs-sm); }

/* Quiz timer */
.quiz-bar-right { display: inline-flex; align-items: center; gap: var(--sp-3); }
.quiz-timer { font-variant-numeric: tabular-nums; font-weight: 700; padding: 2px var(--sp-2); border-radius: 99px; background: var(--c-surface-2); color: var(--c-text); }
.quiz-timer.danger { background: color-mix(in srgb, var(--c-danger) 20%, transparent); color: var(--c-danger); }

/* Filter chips */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip { font: inherit; font-size: var(--fs-sm); font-weight: 600; padding: var(--sp-2) var(--sp-4); border: 1px solid var(--c-border); border-radius: 99px; background: var(--c-surface); color: var(--c-text-muted); cursor: pointer; transition: all .15s ease; }
.chip:hover { border-color: var(--c-primary); color: var(--c-primary); }
.chip[aria-pressed="true"] { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
