/* The public lesson pages (web/pages.py): the same night sky as the welcome page, made for reading. */
:root { --ink: #fff; --quiet: #b9c0e6; --muted: #8e97c9; --line: rgba(255, 255, 255, .14); --glass: rgba(255, 255, 255, .07); --warm: linear-gradient(135deg, #ffb38a, #ff5f8f); --text: #d5d9f2; }
* { box-sizing: border-box; }
html { background: #090b19; scroll-behavior: smooth; scroll-padding-top: 16px; }
body { margin: 0; min-height: 100vh; color: var(--ink); font: 16px/1.65 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(70% 46% at 8% 0%, rgba(74, 47, 149, .75) 0%, transparent 62%),
    radial-gradient(60% 40% at 100% 4%, rgba(29, 47, 107, .9) 0%, transparent 62%),
    linear-gradient(160deg, #0d1230 0%, #0a0d1f 55%, #090b19 100%);
  background-attachment: fixed; }
.sky { position: fixed; inset: 0; pointer-events: none; opacity: .6; z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 28% 42%, #cfd6ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 41% 12%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 55% 30%, #cfd6ff 50%, transparent 51%),
    radial-gradient(1px 1px at 67% 8%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 78% 36%, #cfd6ff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 16%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 20% 66%, #cfd6ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 94% 58%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 48% 58%, #cfd6ff 50%, transparent 51%); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: clamp(20px, 4vw, 40px) 16px 72px; }
a { color: #ffb38a; text-underline-offset: 3px; }
a:hover { color: #ffd0b3; }
a:focus-visible, summary:focus-visible { outline: 2px solid #ffb38a; outline-offset: 3px; border-radius: 6px; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.brand:hover { color: #fff; }
.dot { width: 30px; height: 21px; border-radius: 50%; background: var(--warm); box-shadow: 0 4px 16px rgba(255, 95, 143, .5); }
.open, .go { display: inline-block; text-decoration: none; font-weight: 700; font-size: 14.5px; color: #2a0d1c; padding: 9px 18px; border-radius: 999px; background: var(--warm); box-shadow: 0 10px 26px rgba(255, 95, 143, .35), inset 0 1px 0 rgba(255, 255, 255, .5); transition: transform .2s; }
.open:hover, .go:hover { color: #2a0d1c; transform: translateY(-1px); }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 22px; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--quiet); text-decoration: none; }
.crumbs a:hover { color: #fff; }
.crumbs span:last-child { display: none; }
.crumbs a:last-of-type { color: #fff; }

.hero { padding: clamp(28px, 6vw, 64px) 0 clamp(16px, 3vw, 28px); }
.hero.small { padding: 18px 0 10px; }
.kicker { margin: 0 0 12px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #9aa3d6; }
h1 { margin: 0; font-size: clamp(34px, 6.4vw, 60px); line-height: 1.04; letter-spacing: -.03em; font-weight: 700; text-wrap: balance;
  background: linear-gradient(180deg, #fff 30%, #c7ccf5 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero.small h1 { font-size: clamp(30px, 5vw, 46px); }
.lede { margin: 16px 0 0; max-width: 560px; font-size: clamp(16px, 2vw, 18px); line-height: 1.55; color: #aab1d8; }

.card { margin: 14px 0; padding: clamp(18px, 3vw, 28px); border-radius: 22px; background: var(--glass); border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .12); -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%); }
.card h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; font-size: clamp(19px, 2.4vw, 23px); line-height: 1.25; letter-spacing: -.015em; text-wrap: balance; }
.card h2 i { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; font-style: normal; font-size: 14px; color: #2a0d1c; background: var(--warm); }
.cta { text-align: center; background: linear-gradient(135deg, rgba(255, 179, 138, .14), rgba(255, 95, 143, .1)); border-color: rgba(255, 154, 176, .34); }
.cta h2 { justify-content: center; }
.cta p { margin: 0 auto 16px; max-width: 460px; color: var(--text); }

/* Lists of courses and lessons */
.group h2 { margin: 28px 0 12px; font-size: 22px; letter-spacing: -.015em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tile { display: grid; gap: 2px; padding: 16px 18px; border-radius: 18px; text-decoration: none; background: var(--glass); border: 1px solid var(--line); transition: border-color .2s, transform .2s; }
.tile:hover { border-color: rgba(255, 154, 176, .5); transform: translateY(-2px); }
.tile b { color: #fff; font-size: 16px; }
.tile span { color: var(--muted); font-size: 13.5px; }
.list { margin: 0; padding-left: 22px; columns: 2 280px; column-gap: 28px; color: var(--muted); }
.list li { margin: 0 0 8px; break-inside: avoid; }
.list a { color: var(--text); text-decoration: none; }
.list a:hover { color: #ffb38a; text-decoration: underline; }

/* One lesson: contents at the side, the lesson beside it */
.guide { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; margin-top: 8px; }
.side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding: 18px 4px 18px 0; font-size: 14px; }
.toc summary { cursor: pointer; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #9aa3d6; list-style: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc ol { margin: 10px 0 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--quiet); text-decoration: none; line-height: 1.35; }
.toc a:hover, .toc a.on { color: #fff; border-left-color: #ff9ab0; }
.steps { display: grid; gap: 8px; margin-top: 18px; }
.steps.wide { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 14px; }
.step { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; text-decoration: none; background: var(--glass); border: 1px solid var(--line); }
.step:hover { border-color: rgba(255, 154, 176, .5); }
.step small { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: #9aa3d6; }
.step b { color: #fff; font-size: 14.5px; line-height: 1.3; }
.near h3 { margin: 22px 0 8px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #9aa3d6; font-weight: 600; }
.near ul { margin: 0; padding: 0; list-style: none; }
.near a { display: block; padding: 5px 0; color: var(--quiet); text-decoration: none; line-height: 1.35; }
.near a:hover { color: #ffb38a; }

/* The lesson's own words */
.text { color: var(--text); overflow-wrap: anywhere; }
.text p { margin: 10px 0; }
.text ul, .text ol { margin: 10px 0; padding-left: 22px; }
.text li { margin: 6px 0; }
.text li::marker { color: #ff9ab0; }
.text b { color: #fff; font-weight: 600; }
.text h3 { margin: 18px 0 6px; font-size: 17px; color: #fff; }
.text code { font: 14px/1.5 ui-monospace, "SF Mono", Menlo, monospace; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, .1); }
.text pre { margin: 12px 0; padding: 14px 16px; border-radius: 14px; overflow-x: auto; background: rgba(9, 11, 25, .6); border: 1px solid var(--line); }
.text pre code { padding: 0; background: none; }
.math { font-family: ui-serif, Georgia, serif; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.ex { display: flex; gap: 12px; margin: 12px 0; padding: 12px 16px; border-radius: 16px; background: rgba(47, 123, 240, .12); border: 1px solid rgba(110, 160, 255, .3); }
.ex > b { flex: none; color: #8db6ff; white-space: nowrap; }
.ex.worked { flex-direction: column; gap: 4px; background: rgba(122, 95, 224, .14); border-color: rgba(160, 140, 255, .34); }
.ex.worked > b { color: #b9a8ff; }
.ex p:first-child, .ex ol:first-child, .ex ul:first-child { margin-top: 0; }
.ex p:last-child, .ex ol:last-child, .ex ul:last-child { margin-bottom: 0; }
.dg { margin: 14px 0; }
.dg-wait { margin: 0; padding: 14px; border-radius: 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); }
.lr-fig { margin: 0 auto; max-width: 520px; padding: 14px 16px 10px; border-radius: 18px; background: rgba(9, 11, 25, .45); border: 1px solid var(--line); }
.lr-fig svg { display: block; width: 100%; height: auto; color: #eef1ff; font-size: 11px; font-family: inherit; overflow: visible; }
.lr-fig figcaption { margin-top: 6px; font-size: 13px; color: var(--quiet); text-align: center; }
.study { margin: 12px 0; padding: 14px 16px; border-radius: 16px; background: rgba(18, 165, 148, .12); border: 1px solid rgba(80, 210, 190, .3); }
.study summary { cursor: pointer; display: grid; gap: 2px; }
.study .k { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: #7fe0cf; }
.study summary p { margin: 4px 0 0; }
.study .row { display: grid; gap: 2px; margin-top: 12px; }
.study .sides { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 12px; }

.check { margin-top: 16px; padding: 12px 16px; border-radius: 16px; background: rgba(9, 11, 25, .4); border: 1px solid var(--line); }
.check > summary, .answer > summary { cursor: pointer; font-weight: 600; color: #ffb38a; }
.check .q { margin-top: 8px; color: #fff; font-weight: 600; }
.check .q p, .options p, .answer p { margin: 4px 0; }
.options { margin: 8px 0 10px; padding-left: 22px; color: var(--text); }
.answer div { margin-top: 8px; color: var(--text); }
.answer div > b p { display: inline; }
.answer div > b { color: #7fe0cf; }

footer { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 36px; color: var(--muted); font-size: 14px; }

@media (max-width: 860px) {
  .guide { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .side { position: static; max-height: none; padding: 0; margin-top: 10px; }
  .side .steps, .side .near { display: none; }
  .toc { padding: 12px 16px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); }
}

/* Tables inside lesson text (the same rules as the app's .md-table). */
.md-table { overflow-x: auto; margin: 4px 0 14px; border: 1px solid var(--line); border-radius: 12px; }
.md-table table { border-collapse: collapse; width: 100%; font-size: .93em; line-height: 1.45; }
.md-table th, .md-table td { padding: 7px 11px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.md-table th { font-weight: 700; color: var(--ink); background: var(--glass); }
.md-table tr:last-child td { border-bottom: none; }
.md-table td + td, .md-table th + th { border-left: 1px solid var(--line); }
