/* Home page only (site/index.html, written by scripts/generate-placeholders.py). Shared tokens live in style.css.
   The layout and the components follow python.algoprep.com's and physics2.algoprep.com's front pages (owner,
   2026-12-04; ported from algoprep-pde-coursera 010be82): hero with a dark card beside the text, one wide price card,
   the tutor and the plan (a strip of numbers, two cards, three steps), the site's numbers, then the chapters. Sections are separated by spacing and
   type only. */
:root {
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --code-bg: #2a2522;
  --code-bar: #221e1b;
  --code-line: #3d3530;
  --code-ink: #ece4d9;
  --code-muted: #9a8d80;
  --code-accent: #ec9a78;
}
:root[data-theme='dark'] {
  --code-bg: #1c1917;
  --code-bar: #171413;
  --code-line: #3a322c;
}

.home main { overflow-x: clip; }
.home .section { padding-block: clamp(4rem, 10vh, 7rem); }
.home .section + .section { border-top: 0; }
.home h2 { font-size: clamp(2.1rem, 4.2vw, 3.4rem); letter-spacing: -.015em; }
.home ul, .home ol { margin: 0; padding: 0; list-style: none; }
.section-intro { max-width: 40rem; margin-bottom: clamp(2rem, 5vh, 3.25rem); }
.section-intro .muted { font-size: 1.2rem; margin: 0; }
.button-lg { padding: .95rem 1.7rem; font-size: 1.1rem; }
.hero .actions .button-lg { padding-inline: 1.45rem; } /* the three hero buttons on one row at 1300px */
.button.secondary { background: color-mix(in srgb, var(--card) 80%, transparent); }

/* Scroll-linked header hairline: not on the home page. */
.scroll-progress { display: none; }

/* Reveal on scroll (landing.js). Content stays visible without JS. */
.motion-ready [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); transition-delay: var(--rd, 0ms); }
.motion-ready [data-reveal].in { opacity: 1; transform: none; }

/* Hero */
.hero { display: block; position: relative; padding-block: clamp(3rem, 9vh, 6.5rem) clamp(3rem, 8vh, 5.5rem); isolation: isolate; }
.hero::before { content: ''; position: absolute; inset: 0; z-index: -2; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 36px 36px; opacity: .45; -webkit-mask-image: radial-gradient(ellipse 70% 75% at 30% 45%, #000 10%, transparent 72%); mask-image: radial-gradient(ellipse 70% 75% at 30% 45%, #000 10%, transparent 72%); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(2.5rem, 5vw, 4.5rem); align-items: center; }
/* The first line is a little smaller than python's, as on PDE, so it keeps to one line. */
.hero h1 { font-size: clamp(2.5rem, 4.6vw, 4rem); line-height: 1.04; letter-spacing: -.03em; margin-bottom: 1.6rem; }
.hero h1 span, .hero h1 em { display: block; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lead { font-size: clamp(1.15rem, 1.6vw, 1.35rem); color: var(--muted); max-width: 31rem; margin-bottom: 0; }
.hero .actions { margin-block: 2.2rem 0; }
.hero-note { margin: 1.1rem 0 0; padding: 0; border: 0; color: var(--muted); font-size: .98rem; }
.hero-note:empty, .hero-note span:empty { display: none; }
.rise { animation: rise 1s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 110ms + 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(20px); filter: blur(6px); } }

/* The hero's card: a normal curve and the course's formulas on a dark sheet, the counterpart of python's code window.
   Math is LTR; each formula's name sits at the line's end. Lines keep their height before KaTeX arrives, so nothing
   moves. */
.formula-window { margin: 0; direction: ltr; text-align: left; background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--code-line); border-radius: 14px; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 34px 60px -34px rgba(48, 43, 39, .6); }
.window-header { display: flex; align-items: center; gap: .45rem; padding: .7rem .95rem; background: var(--code-bar); border-bottom: 1px solid var(--code-line); }
.dot { width: 11px; height: 11px; border-radius: 50%; background: #5a4f47; }
.file-name { margin-inline-start: .7rem; font: 500 .8rem var(--mono); color: var(--code-muted); }
.nc-wrap { padding: .9rem 1.4rem .2rem; border-bottom: 1px solid var(--code-line); }
.nc { display: block; width: 100%; height: auto; max-height: 8.6rem; }
.nc-curve { fill: none; stroke: var(--code-ink); stroke-width: 2; stroke-linejoin: round; }
.nc-tail { fill: var(--code-accent); opacity: .4; }
.nc-axis { stroke: var(--code-muted); stroke-width: 1; opacity: .6; }
.nc-cut { stroke: var(--code-accent); stroke-width: 1.5; stroke-dasharray: 3 3; }
.nc-label { fill: var(--code-muted); font: italic 13px Georgia, 'Times New Roman', serif; }
.nc-alpha { fill: var(--code-accent); font-size: 15px; }
.home .tex-lines { padding: .5rem 1.4rem; }
.tex-lines li, .formula-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.4rem; }
.tex-lines li + li { border-top: 1px solid var(--code-line); }
.formula-window .eq { font-size: 1.2rem; white-space: nowrap; }
.formula-window .eq:not(:has(.katex)) { visibility: hidden; } /* the raw TeX, until KaTeX has drawn it */
.formula-window .katex { color: inherit; }
.formula-window .law { direction: rtl; flex-shrink: 0; font-size: .92rem; color: var(--code-muted); }
.formula-foot { flex-wrap: wrap; row-gap: .1rem; padding: .55rem 1.3rem; min-height: 4.4rem; background: var(--code-bar); border-top: 1px solid var(--code-line); }
.formula-foot .eq { color: var(--code-accent); font-size: 1rem; }
.formula-foot .law { margin-left: auto; } /* where the formula takes the whole line, its name goes under it, at the right */
@media (max-width: 1199px) { .formula-foot .eq { font-size: .9rem; } }

/* The 3D ASCII backdrop (driven by /assets/ascii.js). Desktop: the canvas sits in the page and scrolls with the text,
   beside the section intros. Mobile (.is-fixed): fixed to the viewport. The fade layer paints soft paper edges. */
.home { position: relative; }
.ascii-backdrop { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; opacity: .9; contain: layout paint; }
/* The decorative backdrop is never the browser's scroll anchor. As one, it moved the page 40px on every refresh
   (header-sticky widths), and that stopped the browser from putting the reader back where they were. */
.ascii-backdrop { overflow-anchor: none; }
.ascii-backdrop.is-fixed { position: fixed; }
.ascii-backdrop canvas { position: absolute; top: 0; left: 0; display: block; will-change: transform; }
.ascii-fade { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  --head: -1000px; --pa: color-mix(in srgb, var(--paper) 84%, transparent); --pb: color-mix(in srgb, var(--paper) 50%, transparent); --pc: color-mix(in srgb, var(--paper) 16%, transparent);
  background: linear-gradient(to bottom, var(--paper) calc(var(--head) - 10px), var(--pa) calc(var(--head) + 15px), var(--pb) calc(var(--head) + 40px), var(--pc) calc(var(--head) + 65px), transparent calc(var(--head) + 90px)),
    linear-gradient(to bottom, var(--paper) 0, transparent 18%, transparent 78%, var(--paper) 100%), linear-gradient(to right, var(--paper) 0, transparent 8%, transparent 92%, var(--paper) 100%); }
:root[data-theme='dark'] .ascii-backdrop { opacity: .72; }
.home .site-header { border-bottom: 0; background: linear-gradient(to bottom, var(--paper) 45%, color-mix(in srgb, var(--paper) 0%, transparent)); background-origin: border-box; background-repeat: no-repeat; -webkit-backdrop-filter: none; backdrop-filter: none; }
.home .site-footer { border-top: 0; background: linear-gradient(to bottom, transparent, var(--paper) 45%); }
/* A paper-coloured glow under each text block the art passes, so a stray tail of it can never cross a letter. */
.hero-copy, .section-intro { position: relative; }
.hero-copy::before, .section-intro::before { content: ''; position: absolute; z-index: -1; inset: -3.5rem -4rem; pointer-events: none; background: radial-gradient(closest-side, var(--paper) 55%, color-mix(in srgb, var(--paper) 0%, transparent)); }

/* Pricing: the full course in one wide card between the hero and the study section. Three parts side by side: the
   name and the price, what is inside, the button. Under 900px they stack, centred. */
.price-band { padding-block: 0 clamp(2.5rem, 7vh, 4.5rem); }
.price-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(1.5rem, 3.5vw, 3rem); padding: clamp(1.5rem, 2.8vw, 2.1rem) clamp(1.5rem, 3.4vw, 2.8rem); background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.price-card h2 { font-size: clamp(1.5rem, 2.2vw, 1.9rem); font-weight: 600; margin-bottom: .3rem; }
.price { display: flex; align-items: baseline; gap: .7rem; margin: 0; }
.price strong { font: 600 clamp(3rem, 5.4vw, 4rem)/1 var(--serif); color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.price span { font-size: 1.15rem; font-weight: 700; }
.price-what { text-align: center; }
.price-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; max-width: 24rem; } /* two rows of two */
.home .price-chips { margin: 0 auto; }
.price-chips li { padding: .3rem .9rem; border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-size: .93rem; font-weight: 600; line-height: 1.5; }
.price-free { margin: .9rem 0 0; font-size: 1rem; font-weight: 600; }
.price-free b { color: var(--accent); }
.price-buy { text-align: center; }
.price-note { margin: .7rem 0 0; color: var(--muted); font-size: .93rem; }
@media (max-width: 900px) {
  .price-card { grid-template-columns: minmax(0, 1fr); max-width: 34rem; margin-inline: auto; text-align: center; gap: 1.4rem; }
  .price { justify-content: center; }
}

/* Numbers: one strip, split by hairlines. */
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: color-mix(in srgb, var(--card) 88%, transparent); border: 1px solid var(--line); border-radius: 20px; padding-block: 1.6rem; box-shadow: var(--shadow); }
.study-facts { grid-template-columns: repeat(4, 1fr); margin-block: 1.6rem 2rem; }
.fact { padding-inline: 1.5rem; border-inline-end: 1px solid var(--line); text-align: center; }
.fact:last-child { border: 0; }
.fact strong { display: block; font: 600 clamp(1.9rem, 3.2vw, 2.5rem)/1.15 var(--serif); letter-spacing: -.02em; color: var(--accent); font-variant-numeric: tabular-nums; }
.fact > span { display: block; color: var(--ink); font-weight: 600; font-size: 1.05rem; }
.fact > span a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: .25em; }
.fact > span a:hover { color: var(--accent); text-decoration-color: currentColor; }
.fact small { display: block; color: var(--muted); font-size: .86rem; }
.site-facts { padding-block: 0 clamp(1rem, 3vh, 2rem); }

/* The tutor and the study plan: two cards and how a lesson goes. */
.study-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.study-card { display: flex; flex-direction: column; gap: .5rem; padding: 1.5rem 1.6rem; border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: border-color .2s, transform .2s, opacity .5s var(--ease-out); }
.study-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.study-card .eyebrow { margin: 0; }
.study-card h3 { margin: 0; font: 700 1.5rem var(--serif); }
.study-card .button { align-self: flex-start; margin-top: auto; }
.home .study-points { margin: .2rem 0 1rem; padding-inline-start: 1.1rem; list-style: disc; color: var(--muted); display: grid; gap: .35rem; }
.home .study-steps { margin-top: 2rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.study-steps li { display: grid; gap: .25rem; align-content: start; padding: 1rem 1.1rem; border-radius: 14px; background: var(--paper-deep); }
.study-steps .idx { font: 600 .85rem var(--mono); color: var(--accent); }
.study-steps strong { font: 700 1.05rem var(--serif); }
.study-steps li > span:last-child { color: var(--muted); font-size: .95rem; }

/* What each chapter teaches: one card, two columns; a chapter is one line (number, name, lessons) and a short line
   under it. Its page holds the rest. */
.ch-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 3rem; padding: 1rem 2rem 1.2rem; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.ch-card:focus { outline: none; }
.ch-list li { padding-block: .65rem; }
.ch-list li + li { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.ch-list a { display: flex; align-items: baseline; gap: .7rem; color: var(--ink); text-decoration: none; }
.ch-list a:hover .toc-t { color: var(--accent); }
.toc-n { flex-shrink: 0; min-width: 1.4rem; font: 600 .85rem var(--mono); color: var(--accent); font-variant-numeric: tabular-nums; }
.toc-t { flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 1.05rem; line-height: 1.45; transition: color .2s; }
.toc-tag { flex-shrink: 0; color: var(--muted); font-size: .86rem; }
.ch-list p { margin: .1rem 0 0; padding-inline-start: 2.1rem; color: var(--muted); font-size: .93rem; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
  .hero-visual { max-width: 34rem; }
  .ch-card { grid-template-columns: 1fr; }
  .ch-list + .ch-list { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
}
@media (max-width: 760px) {
  .study-grid, .home .study-steps { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .home .section { padding-block: 3.5rem; }
  .hero { padding-block: 2.5rem 3rem; }
  .hero::before { -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 30%, #000 10%, transparent 75%); mask-image: radial-gradient(ellipse 90% 60% at 50% 30%, #000 10%, transparent 75%); }
  .button-lg { width: 100%; }
  .ascii-backdrop { opacity: .75; }
  .hero-copy::before, .section-intro::before { inset: -2rem -1.5rem; background: radial-gradient(closest-side, color-mix(in srgb, var(--paper) 85%, transparent) 60%, color-mix(in srgb, var(--paper) 0%, transparent)); }
  .home .tex-lines { padding: .4rem 1rem; }
  .nc-wrap { padding-inline: 1rem; }
  .formula-window .eq { font-size: 1rem; }
  .formula-foot .eq { font-size: .86rem; }
  .formula-window .law { font-size: .82rem; }
  .formula-foot { padding-inline: 1rem; }
  .facts { grid-template-columns: repeat(2, 1fr); gap: 1.5rem 0; padding-inline: .5rem; }
  .fact { padding-inline: 1rem; }
  .fact:nth-child(even) { border: 0; }
  .fact:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .ch-card { padding: .8rem 1.1rem 1rem; }
  .ch-list p { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; }
  .motion-ready [data-reveal] { opacity: 1; transform: none; transition: none; }
}
