/* Sir Sarim's Math Room: site styles
   Direction: quiet, editorial, academic. Warm paper background, near-black ink, the logo's royal blue as the only accent.
   Type: Newsreader (headings), Instrument Sans (text), IBM Plex Mono (syllabus codes). */

:root {
  --bg: #fbfaf6;
  --paper: #ffffff;
  --tint: #f3f0e7;
  --ink: #0e1320;
  --ink-2: #2c3243;
  --muted: #626a7b;
  --line: #e2ded2;
  --line-2: #cbc6b6;
  --blue: #003080;
  --blue-d: #00225a;
  --navy: #07163a;
  --sky: #e8edf8;
  --wa: #1fa855;
  --r: 6px;
  --r-lg: 12px;
  --header-h: 72px;
  --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink-2); font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.65; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg { max-width: 100%; display: block; }
picture { display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-d); }
h1, h2, h3, h4 { color: var(--ink); margin: 0; line-height: 1.1; font-family: var(--font-display); font-weight: 500; letter-spacing: -.02em; }
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); letter-spacing: -.03em; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.9rem); }
h3 { font-size: 1.35rem; letter-spacing: -.01em; }
h1 em, h2 em { font-style: italic; color: var(--blue); }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; }
::selection { background: var(--blue); color: #fff; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 300; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r); transition: top .2s; }
.skip:focus { top: 12px; color: #fff; }
[hidden] { display: none !important; }

.container { width: min(1160px, 100% - 48px); margin-inline: auto; }
.section { padding: clamp(64px, 9vw, 112px) 0; }
.section.tint { background: var(--tint); }
.section.dark { background: var(--navy); color: #c9d2ea; }
.section.dark h2, .section.dark h3 { color: #fff; }
.section.dark h2 em { color: #9db6ee; }
.section.dark a { color: #fff; }
.kicker { font-size: .8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 18px; }
.sec-head { max-width: 640px; margin-bottom: clamp(32px, 5vw, 56px); }
.sec-head p { color: var(--muted); margin: 14px 0 0; }
.sec-head.row { max-width: none; display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.sec-head.row > div { max-width: 640px; }
.dark .sec-head p, .dark .kicker { color: #9fb0d6; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font: 600 .95rem/1 var(--font-body); padding: 15px 22px; border-radius: var(--r); border: 1px solid transparent; cursor: pointer; transition: background .2s, color .2s, border-color .2s; white-space: nowrap; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-white { background: #fff; color: var(--navy); }
.btn-white:hover { background: var(--sky); color: var(--navy); }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn-outline-light:hover { border-color: #fff; color: #fff; }
.btn-sm { padding: 11px 16px; font-size: .88rem; }
.btn-block { width: 100%; }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--blue); }
.link-arrow svg { width: 18px; height: 18px; transition: transform .2s; }
.link-arrow:hover svg { transform: translateX(4px); }
.dark .link-arrow { color: #fff; }

/* ---------- Header ---------- */
.site-header { position: fixed; inset: 0 0 auto 0; z-index: 100; height: var(--header-h); background: rgba(251, 250, 246, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-header.scrolled { border-bottom-color: var(--line); }
.header-in { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; line-height: 1.1; letter-spacing: -.01em; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 46px; height: 46px; flex: none; border-radius: 50%; background: #fff; }
.brand small { display: block; font-family: var(--font-body); font-size: .66rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.nav { display: flex; gap: 6px; }
.nav a { padding: 10px 14px; font-weight: 500; font-size: .96rem; color: var(--ink-2); border-bottom: 2px solid transparent; border-radius: 0; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--blue); }
.header-cta { display: flex; align-items: center; gap: 18px; }
.login-link { font-weight: 600; font-size: .95rem; color: var(--ink); }
.login-link:hover { color: var(--blue); }
.burger { display: none; width: 44px; height: 44px; border: 1px solid var(--line-2); border-radius: var(--r); background: transparent; cursor: pointer; padding: 0; position: relative; }
.burger span { position: absolute; left: 12px; right: 12px; height: 2px; background: var(--ink); transition: transform .25s, opacity .2s; }
.burger span:nth-child(1) { top: 15px; } .burger span:nth-child(2) { top: 21px; } .burger span:nth-child(3) { top: 27px; }
.menu-open .burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-open .burger span:nth-child(2) { opacity: 0; }
.menu-open .burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 100%; z-index: 140; background: var(--blue); transform-origin: left; transform: scaleX(0); }
.menu-backdrop { position: fixed; inset: 0; z-index: 110; background: rgba(14, 19, 32, .4); opacity: 0; visibility: hidden; transition: opacity .25s, visibility 0s .25s; }
.mobile-menu { position: fixed; z-index: 120; top: var(--header-h); left: 0; right: 0; background: var(--bg); padding: 12px 24px 24px; border-bottom: 1px solid var(--line); opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity .25s, transform .25s, visibility 0s .25s; }
.mobile-menu a:not(.btn) { display: block; padding: 15px 0; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 1.05rem; color: var(--ink); }
.mobile-menu a[aria-current="page"] { color: var(--blue); }
.mm-foot { margin-top: 18px; display: grid; gap: 10px; }
.menu-open .menu-backdrop { opacity: 1; visibility: visible; transition: opacity .25s; }
.menu-open .mobile-menu { opacity: 1; visibility: visible; transform: none; transition: opacity .25s, transform .25s; }
.menu-open { overflow: hidden; }

/* ---------- Hero ---------- */
.hero { padding: calc(var(--header-h) + clamp(32px, 6vw, 80px)) 0 clamp(56px, 8vw, 104px); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(32px, 6vw, 88px); align-items: center; }
.hero h1 { margin-bottom: 24px; }
.lead { font-size: clamp(1.05rem, 1.5vw, 1.2rem); color: var(--ink-2); max-width: 540px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 44px; }
.facts { display: flex; gap: clamp(24px, 5vw, 56px); margin: 0; padding-top: 28px; border-top: 1px solid var(--line-2); }
.facts div { display: block; }
.facts dt { font-family: var(--font-display); font-size: clamp(1.9rem, 3vw, 2.5rem); color: var(--ink); line-height: 1; font-weight: 500; }
.facts dd { margin: 6px 0 0; font-size: .86rem; color: var(--muted); }
.hero-art { position: relative; padding-bottom: 40px; padding-left: 40px; }
.hero-photo { margin: 0; aspect-ratio: 4/5; border-radius: var(--r-lg); overflow: hidden; background: var(--tint); }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 32%; }
.hero-note { position: absolute; left: 0; bottom: 0; width: 38%; max-width: 210px; background: #fff; padding: 8px 8px 12px; border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 18px 40px rgba(14, 19, 32, .16); color: var(--ink); }
.hero-note img { width: 100%; height: auto; border: 1px solid var(--line); }
.hero-note span { display: block; font-size: .72rem; font-weight: 600; margin-top: 8px; color: var(--ink); line-height: 1.3; }
.hero-note span small { display: block; color: var(--muted); font-weight: 500; }
.caption { margin-top: 12px; font-size: .84rem; color: var(--muted); }

/* ---------- Index list (courses on home) ---------- */
.index { list-style: none; border-top: 1px solid var(--ink); }
.index a { display: grid; grid-template-columns: 1.1fr 1.3fr 250px 24px; gap: 24px; align-items: baseline; padding: 26px 4px; border-bottom: 1px solid var(--line-2); color: inherit; transition: background .2s, padding .2s; }
.index a:hover { background: #fff; padding-inline: 16px; color: inherit; }
.index h3 { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.3rem, 2.2vw, 1.7rem); }
.index p { margin: 0; color: var(--muted); font-size: .98rem; }
.codes { font-family: var(--font-mono); font-size: .86rem; font-weight: 500; color: var(--blue); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.index svg { width: 20px; height: 20px; color: var(--ink); align-self: center; }
.code { display: inline-block; font-family: var(--font-mono); font-size: .82rem; font-weight: 500; color: var(--blue); background: var(--sky); padding: 3px 9px; border-radius: 4px; }

/* ---------- Notes band (home) ---------- */
.notes-band { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 88px); align-items: center; }
.notes-band h2 { margin-bottom: 18px; }
.paper-links { list-style: none; margin: 30px 0 0; border-top: 1px solid rgba(255, 255, 255, .22); }
.paper-links a { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 2px; border-bottom: 1px solid rgba(255, 255, 255, .22); color: #fff; }
.paper-links a:hover { color: #fff; padding-inline: 10px; }
.paper-links a { transition: padding .2s; }
.paper-links b { font-family: var(--font-display); font-weight: 500; font-size: 1.3rem; }
.paper-links span { color: #9fb0d6; font-size: .9rem; }
.spread { display: grid; grid-template-columns: 1fr 1fr; gap: 0; filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .4)); }
.spread img { width: 100%; height: auto; background: #fff; }
.spread img:first-child { border-radius: 4px 0 0 4px; }
.spread img:last-child { border-radius: 0 4px 4px 0; }

/* ---------- Principles ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 88px); align-items: center; }
.split.top { align-items: start; }
.photo { margin: 0; border-radius: var(--r-lg); overflow: hidden; background: var(--tint); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo.tall { aspect-ratio: 4/5; }
.principles { list-style: none; counter-reset: p; margin-top: 8px; }
.principles li { counter-increment: p; display: grid; grid-template-columns: 44px 1fr; gap: 6px 16px; padding: 22px 0; border-top: 1px solid var(--line-2); }
.principles li:last-child { border-bottom: 1px solid var(--line-2); }
.principles li::before { content: counter(p, decimal-leading-zero); font-family: var(--font-mono); font-size: .8rem; color: var(--muted); padding-top: 4px; grid-row: span 2; }
.principles h3 { font-size: 1.2rem; }
.principles p { margin: 0; color: var(--muted); font-size: .98rem; }

/* ---------- Reviews ---------- */
.tabs { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); padding: 3px; gap: 3px; background: var(--paper); }
.tab { border: 0; background: transparent; font: 600 .92rem var(--font-body); color: var(--muted); padding: 9px 18px; border-radius: 4px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; }
.quotes { columns: 3; column-gap: 24px; }
.quote { break-inside: avoid; margin: 0 0 24px; padding: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); }
.quote blockquote { margin: 0 0 20px; font-family: var(--font-display); font-size: 1.14rem; line-height: 1.5; color: var(--ink); }
.quote footer { font-size: .88rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.quote footer b { color: var(--ink); display: block; font-weight: 600; }

/* ---------- Credentials ---------- */
.certs { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--ink); }
.certs li { padding: 22px 20px 22px 0; border-bottom: 1px solid var(--line-2); }
.certs b { display: block; font-family: var(--font-display); font-weight: 500; font-size: 1.3rem; color: var(--ink); }
.certs span { font-size: .88rem; color: var(--muted); }

/* ---------- CTA ---------- */
.cta { background: var(--navy); color: #c9d2ea; border-radius: var(--r-lg); padding: clamp(36px, 6vw, 72px); display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; }
.cta h2 { color: #fff; }
.cta p { margin: 14px 0 0; max-width: 520px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.cta-wrap { padding: 0 0 clamp(64px, 9vw, 112px); }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #a9b6d8; padding: clamp(56px, 8vw, 88px) 0 28px; }
.foot-top { display: flex; justify-content: space-between; align-items: end; gap: 32px; flex-wrap: wrap; padding-bottom: 48px; border-bottom: 1px solid rgba(255, 255, 255, .16); }
.foot-top h2 { color: #fff; font-size: clamp(1.8rem, 3.6vw, 2.8rem); max-width: 560px; }
.foot-top h2 em { color: #9db6ee; }
.foot-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; padding: 48px 0; }
.site-footer .brand { color: #fff; }
.site-footer .brand small { color: #8fa0c8; }
.site-footer h4 { font: 600 .74rem var(--font-body); letter-spacing: .16em; text-transform: uppercase; color: #fff; margin-bottom: 16px; }
.site-footer ul { list-style: none; display: grid; gap: 9px; }
.site-footer a { color: #a9b6d8; }
.site-footer a:hover { color: #fff; }
.foot-blurb { margin: 16px 0 0; max-width: 300px; font-size: .95rem; }
.fcodes { display: flex; flex-wrap: wrap; gap: 8px; }
.fcode { font-family: var(--font-mono); font-size: .8rem; padding: 4px 10px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 4px; }
.fcode:hover { border-color: #fff; }
.foot-note { margin: 14px 0 0; font-size: .86rem; max-width: 280px; }
.foot-bottom { border-top: 1px solid rgba(255, 255, 255, .16); padding-top: 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; font-size: .86rem; }
.foot-bottom p { margin: 0; }
.foot-legal { display: flex; gap: 20px; }
.disclaimer { flex-basis: 100%; font-size: .78rem; color: #7f8fb8; }

/* ---------- WhatsApp button, toast ---------- */
.wa-fab { position: fixed; right: 20px; bottom: 20px; z-index: 90; }
.wa-btn { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--wa); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .22); transition: transform .2s; }
.wa-btn:hover { color: #fff; transform: scale(1.06); }
.wa-btn svg { width: 30px; height: 30px; }
.wa-tip { position: absolute; right: 68px; top: 50%; transform: translateY(-50%); background: var(--ink); color: #fff; font-size: .85rem; font-weight: 600; padding: 8px 14px; border-radius: var(--r); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .25s; }
.wa-tip.show, .wa-fab:hover .wa-tip { opacity: 1; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 200; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--r); font-weight: 600; font-size: .92rem; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: calc(100% - 40px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Page hero + breadcrumbs ---------- */
.page-hero { padding: calc(var(--header-h) + clamp(36px, 6vw, 72px)) 0 clamp(32px, 5vw, 56px); border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: clamp(2.3rem, 5vw, 3.8rem); max-width: 860px; }
.page-hero p { margin: 18px 0 0; max-width: 640px; color: var(--muted); font-size: 1.12rem; }
.crumbs { font-size: .86rem; color: var(--muted); margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--blue); }
.crumbs span[aria-hidden] { color: var(--line-2); }

/* ---------- About ---------- */
.prose h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); margin: 0 0 18px; }
.prose p { color: var(--ink-2); }
.ticks { list-style: none; margin: 24px 0 0; border-top: 1px solid var(--line-2); }
.ticks li { padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.ticks b { color: var(--ink); }
.statrow { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); margin-top: clamp(40px, 6vw, 72px); }
.statrow div { padding: 24px 0; border-bottom: 1px solid var(--line-2); }
.statrow b { display: block; font-family: var(--font-display); font-size: 3rem; font-weight: 500; color: var(--ink); line-height: 1; }
.statrow span { color: var(--muted); font-size: .92rem; }
.studio { margin: 0; }
.studio img { width: 100%; height: auto; border-radius: var(--r-lg); }

/* ---------- Courses ---------- */
.filter-bar { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: var(--header-h); z-index: 50; }
.filter-in { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 14px 0; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.fchip { font: 600 .86rem var(--font-body); padding: 9px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); cursor: pointer; }
.fchip:hover { border-color: var(--ink); }
.fchip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: var(--r); padding: 0 12px; background: #fff; }
.search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search input { border: 0; outline: 0; background: transparent; font: 500 .94rem var(--font-body); padding: 11px 0; width: 220px; color: var(--ink); }
.search:focus-within { border-color: var(--blue); }
.board { margin-bottom: clamp(40px, 6vw, 72px); }
.board-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--ink); padding-bottom: 14px; }
.board-head h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.board-head span { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.course { display: grid; grid-template-columns: 150px 1fr auto; gap: 24px; align-items: center; padding: 24px 0; border-bottom: 1px solid var(--line-2); scroll-margin-top: calc(var(--header-h) + 90px); }
.course:target { background: #fff; outline: 2px solid var(--blue); outline-offset: -2px; padding-inline: 16px; }
.course .big { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 500; color: var(--blue); }
.course h3 { font-size: 1.3rem; font-family: var(--font-display); font-weight: 500; }
.course p { margin: 4px 0 0; color: var(--muted); font-size: .95rem; }
.course .codes { margin-top: 10px; }
.course .btn { min-width: 190px; }
.empty { display: none; text-align: center; padding: 56px 20px; color: var(--muted); font-weight: 600; }
.empty.show { display: block; }
.note-card { margin-top: 24px; padding: clamp(28px, 4vw, 44px); background: var(--tint); border-radius: var(--r-lg); display: flex; gap: 28px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.note-card h3 { font-family: var(--font-display); font-size: 1.6rem; margin-bottom: 8px; }
.note-card p { margin: 0; max-width: 560px; }
.inline-link { margin: 10px 0 0; font-size: .92rem; }

/* ---------- Free resources + notes ---------- */
.paper-block { padding: clamp(32px, 5vw, 56px) 0; border-top: 1px solid var(--ink); }
.paper-block:first-of-type { border-top: 0; padding-top: 0; }
.paper-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.paper-head h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.paper-head p { margin: 8px 0 0; color: var(--muted); max-width: 560px; }
.paper-tag { font-family: var(--font-mono); font-size: .8rem; color: var(--blue); }
.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; }
.cover { display: block; color: var(--ink); }
.cover img { width: 100%; height: auto; aspect-ratio: 595/842; object-fit: cover; border: 1px solid var(--line-2); border-radius: 4px; background: #fff; transition: transform .25s, box-shadow .25s; }
.cover:hover img { transform: translateY(-4px); box-shadow: 0 16px 30px rgba(14, 19, 32, .14); }
.cover b { display: block; margin-top: 12px; font-weight: 600; font-size: .95rem; line-height: 1.3; color: var(--ink); }
.cover span { font-size: .82rem; color: var(--muted); }
.list-plain { list-style: none; border-top: 1px solid var(--ink); }
.list-plain li { border-bottom: 1px solid var(--line-2); }
.list-plain a { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px 4px; color: var(--ink); }
.list-plain a:hover { background: #fff; padding-inline: 14px; }
.list-plain a { transition: padding .2s, background .2s; }
.list-plain b { font-family: var(--font-display); font-weight: 500; font-size: 1.25rem; }
.list-plain span { color: var(--muted); font-size: .9rem; text-align: right; }
.res-links { display: flex; flex-wrap: wrap; gap: 10px; }
.src-note { margin-top: 12px; color: var(--muted); font-size: .94rem; max-width: 560px; }

/* chapter page */
.chapter { display: grid; grid-template-columns: 300px 1fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.chapter-cover { position: sticky; top: calc(var(--header-h) + 32px); margin: 0; }
.chapter-cover img { width: 100%; height: auto; border: 1px solid var(--line-2); border-radius: 4px; box-shadow: 0 24px 50px rgba(14, 19, 32, .14); background: #fff; }
.chapter-cover .btn { margin-top: 20px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 28px; padding: 0; list-style: none; font-size: .92rem; color: var(--muted); }
.meta b { color: var(--ink); }
.topic-list { list-style: none; margin: 0 0 8px; border-top: 1px solid var(--line-2); columns: 2; column-gap: 40px; }
.topic-list li { break-inside: avoid; padding: 12px 0 12px 28px; border-bottom: 1px solid var(--line-2); position: relative; font-weight: 500; color: var(--ink); }
.topic-list li::before { content: ""; position: absolute; left: 4px; top: 21px; width: 12px; height: 2px; background: var(--blue); }
.chapter h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); margin: 44px 0 16px; }
.chapter h2:first-of-type { margin-top: 0; }
.share-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 48px; }
.pager a { display: block; padding: 18px 20px; border: 1px solid var(--line-2); border-radius: var(--r); color: var(--ink); }
.pager a:hover { border-color: var(--ink); background: #fff; }
.pager small { display: block; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; margin-bottom: 4px; }
.pager b { font-family: var(--font-display); font-weight: 500; font-size: 1.15rem; }
.pager .next { text-align: right; }
.also { list-style: none; border-top: 1px solid var(--line-2); }
.also li { border-bottom: 1px solid var(--line-2); }
.also a { display: flex; justify-content: space-between; padding: 12px 2px; color: var(--ink); font-weight: 500; }
.also a:hover { color: var(--blue); }
.also a[aria-current] { color: var(--muted); pointer-events: none; }
.also span { color: var(--muted); font-size: .86rem; font-weight: 400; }

/* ---------- Blog + legal ---------- */
.legal { max-width: 760px; }
.legal h2 { font-size: 1.5rem; margin: 40px 0 12px; }
.legal ul { padding-left: 1.2em; }
.legal li { margin-bottom: 8px; }
.stamp { display: inline-block; font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.empty-state { max-width: 560px; margin: 0 auto; text-align: center; padding: 24px 0; }
.empty-state h1, .empty-state h2 { margin-bottom: 12px; }
.empty-state p { color: var(--muted); }
.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.post { display: block; color: var(--ink); border-top: 1px solid var(--ink); padding-top: 18px; }
.post:hover { color: var(--ink); }
.post img { width: 100%; max-width: 220px; border: 1px solid var(--line-2); border-radius: 4px; margin-bottom: 18px; background: #fff; }
.post small { display: block; color: var(--blue); font-family: var(--font-mono); font-size: .78rem; margin-bottom: 6px; }
.post h3 { font-size: 1.4rem; margin-bottom: 8px; }
.post p { color: var(--muted); font-size: .95rem; margin: 0; }

/* ---------- Scroll reveal (fade only) ---------- */
.js .reveal { opacity: 0; transition: opacity .6s ease; }
.js .reveal.seen { opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .nav, .header-cta .login-link, .header-cta .btn { display: none; }
  .burger { display: block; }
  .hero-grid, .split, .notes-band, .cta { grid-template-columns: 1fr; }
  .hero-art { max-width: 520px; }
  .cta-actions { justify-content: flex-start; }
  .quotes { columns: 2; }
  .certs { grid-template-columns: repeat(2, 1fr); }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-grid > :first-child { grid-column: 1 / -1; }
  .chapter { grid-template-columns: 220px 1fr; }
  .posts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 1rem; }
  .container { width: calc(100% - 32px); }
  .brand small { display: none; }
  .index a { grid-template-columns: 1fr 20px; gap: 6px 12px; }
  .index p, .index .codes { grid-column: 1; }
  .index svg { grid-row: 1; grid-column: 2; }
  .quotes { columns: 1; }
  .course { grid-template-columns: 1fr; gap: 10px; }
  .course .btn { min-width: 0; width: 100%; }
  .statrow { grid-template-columns: 1fr; }
  .facts { gap: 20px; }
  .chapter { grid-template-columns: 1fr; }
  .chapter-cover { position: static; max-width: 240px; }
  .topic-list { columns: 1; }
  .pager { grid-template-columns: 1fr; }
  .posts { grid-template-columns: 1fr 1fr; gap: 24px 16px; }
  .post img { max-width: 100%; }
  .post h3 { font-size: 1.1rem; }
  .post p { display: none; }
  .wa-tip { display: none; }
  .filter-bar { position: static; }
  .search, .search input { width: 100%; }
  .hero-art { padding-left: 24px; padding-bottom: 28px; }
  .actions .btn { flex: 1 1 100%; }
}
@media (max-width: 480px) {
  .certs { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-grid > :nth-child(3) { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .js .reveal { opacity: 1; }
}

/* ---------- Free notes menu, finder and level cards ---------- */
.nav-item { display: flex; align-items: center; }
.sub-toggle { border: 0; background: transparent; cursor: pointer; padding: 10px 8px 10px 0; margin-left: -10px; color: var(--ink-2); display: grid; place-items: center; }
.sub-toggle svg { width: 16px; height: 16px; transition: transform .2s; }
.sub-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.mega { position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 28px 40px rgba(14, 19, 32, .08); display: none; max-height: calc(100vh - var(--header-h) - 24px); overflow: auto; }
.mega.open { display: block; }
.mega-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 28px; padding: 28px 0 14px; }
.mega-col small { display: block; font: 600 .68rem var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.mega-set { display: block; font-family: var(--font-display); font-weight: 500; font-size: 1.12rem; line-height: 1.2; color: var(--ink); margin: 4px 0 12px; }
.mega-set:hover { color: var(--blue); }
.mega-col ul { list-style: none; display: grid; gap: 1px; }
.mega-col li a { display: block; padding: 5px 0; font-size: .92rem; color: var(--ink-2); line-height: 1.35; }
.mega-col li a:hover { color: var(--blue); }
.mega-all { display: inline-flex; align-items: center; gap: 8px; margin: 6px 0 22px; font-weight: 600; font-size: .95rem; }
.mega-all svg { width: 18px; height: 18px; }

.mobile-menu { max-height: calc(100dvh - var(--header-h)); overflow-y: auto; }
.mobile-menu details > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 1.05rem; color: var(--ink); }
.mobile-menu details > summary::-webkit-details-marker { display: none; }
.mobile-menu details > summary::after { content: "+"; font-size: 1.4rem; font-weight: 400; color: var(--muted); }
.mobile-menu details[open] > summary::after { content: "\2212"; }
.mm-sub.is-current > summary { color: var(--blue); }
.mm-sub-body { padding-left: 14px; }
.mm-sub-body a { display: block; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .98rem; color: var(--ink-2); font-weight: 500; }
.mm-set > summary { font-size: .98rem; font-weight: 600; padding: 12px 0; }
.mm-set > a { padding-left: 14px; font-size: .92rem; }

.finder { max-width: 760px; margin-bottom: clamp(48px, 7vw, 80px); }
.finder-label { display: block; font-family: var(--font-display); font-size: 1.6rem; color: var(--ink); margin-bottom: 14px; }
.finder-box { width: 100%; }
.finder-box input { width: 100%; font-size: 1.05rem; padding: 15px 0; }
.finder-results { margin-top: 8px; }
.finder-results a { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding: 14px 4px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
.finder-results a:hover { background: #fff; }
.finder-results b { font-family: var(--font-display); font-weight: 500; font-size: 1.2rem; }
.finder-results span { color: var(--muted); font-size: .86rem; text-align: right; }
.finder-results p { margin: 14px 4px 0; color: var(--muted); }
.set-group { margin-bottom: clamp(40px, 6vw, 64px); }
.set-group h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); padding-bottom: 14px; border-bottom: 1px solid var(--ink); margin-bottom: 24px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.set-card { display: flex; flex-direction: column; gap: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; color: var(--ink); transition: border-color .2s; }
.set-card:hover { border-color: var(--ink); color: var(--ink); }
.set-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; }
.set-card p { margin: 0; color: var(--muted); font-size: .96rem; }
.set-meta { font-size: .85rem; color: var(--muted); font-weight: 600; margin-top: auto; padding-top: 10px; }
.hub-filter { margin: 0 0 28px; max-width: 440px; }
.hub-filter input { width: 100%; }
.cover[hidden] { display: none; }
@media (max-width: 1020px) { .mega { display: none !important; } }
