/* Home page only. Shared tokens live in style.css. */
.home main { overflow-x: clip; }
.home .section { padding-block: clamp(4.5rem, 11vh, 8rem); }
.home .section + .section { border-top: 0; }
.home h2 { font-size: clamp(2.1rem, 4.2vw, 3.4rem); letter-spacing: -.015em; }
.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; }
/* Scroll-linked header hairline (progressive enhancement). */
.scroll-progress { position: absolute; inset: auto 0 -1px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: right; display: none; }
@supports (animation-timeline: scroll()) {
  .scroll-progress { display: block; animation: scroll-progress linear both; animation-timeline: scroll(root); }
  @keyframes scroll-progress { to { transform: scaleX(1); } }
}
/* Reveal on scroll. 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(3.5rem, 11vh, 7.5rem) clamp(3.5rem, 9vh, 6rem); 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-curve { position: absolute; z-index: -1; inset: auto 0 -4% 0; width: 100%; height: 48%; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; opacity: .26; }
.hero-curve path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.8s var(--ease-out) .5s forwards; vector-effect: non-scaling-stroke; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 5.5rem); align-items: center; }
.hero h1 { font-size: clamp(2.9rem, 5.4vw, 4.6rem); line-height: 1.02; 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; }
.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); } }
.calc-cta { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-top: clamp(2rem, 5vh, 3rem); padding: 1.5rem clamp(1.4rem, 3vw, 2.2rem); border-radius: 18px; background: var(--ink); color: var(--paper); text-decoration: none; transition: transform .3s var(--ease-out), box-shadow .3s; }
.calc-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -14px rgba(48, 43, 39, .55); }
.calc-cta strong { display: block; font: 500 clamp(1.5rem, 2.6vw, 2rem) var(--serif); line-height: 1.2; }
.calc-cta span span { display: block; opacity: .75; font-size: 1rem; margin-top: .2rem; }
.calc-cta svg { flex-shrink: 0; width: 2.8rem; height: 2.8rem; padding: .7rem; border-radius: 50%; background: var(--accent); stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease-out); }
.calc-cta:hover svg { transform: translate(-3px, -3px); }
.link-arrow { display: inline-flex; gap: .45rem; font-weight: 700; text-decoration: none; margin-top: .6rem; }
.link-arrow span { transition: transform .25s var(--ease-out); }
.link-arrow:hover span { transform: translateX(-4px); }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-grid { gap: 2.5rem; }
}
@media (max-width: 700px) {
  .home .section { padding-block: 3.75rem; }
  .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%); }
  .hero-curve { display: none; }
  .button-lg { width: 100%; }
  .calc-cta { padding: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .rise, .hero-curve path { animation: none; }
  .hero-curve path { stroke-dashoffset: 0; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
}
/* ---- One continuous page (the design of pde.algoprep.com). A single fixed 3D ASCII backdrop (driven by /assets/ascii.js) flows behind
   every section; sections are separated only by spacing and type, with no borders or background bands. ---- */
.home { position: relative; } /* the backdrop below is sized to the whole page */
/* Desktop: the canvas sits in the page and is moved only by whole character rows, so it scrolls natively with the
   text. Mobile (.is-fixed): fixed to the viewport and nudged by the sub-row part of its parallax drift. */
.ascii-backdrop { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; opacity: .9; contain: layout paint; }
.ascii-backdrop.is-fixed { position: fixed; }
.ascii-backdrop canvas { position: absolute; top: 0; left: 0; display: block; will-change: transform; }
/* Soft edges at the viewport (paper painted over the art, the same result as masking it), kept off the canvas so
   they stay put while the art moves. */
.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 .scroll-progress { display: none; }
.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%); }
@media (max-width: 700px) {
  .ascii-backdrop { opacity: .75; }
}
/* ---- Option A: the art sits beside the text. A borderless paper-coloured glow under each text block is a backup,
   so a stray wave tail can never cross a letter. ---- */
.hero-copy { position: relative; }
.hero-copy::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)); }
@media (max-width: 700px) {
  .hero-copy::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)); }
}
/* ---- Hero note, numbers, how a lesson goes, the free tutor, what's inside, the catalog, start. ---- */
.hero-free { margin: 1.1rem 0 0; color: var(--muted); font-size: .98rem; }
.app-facts { padding-block: 0 clamp(1rem, 3vh, 2rem); }
.app-facts .facts { 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); }
.app-facts .fact { text-align: center; }
.app-facts .fact strong { font-size: clamp(2rem, 3.4vw, 2.7rem); line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; }
.app-facts .fact span { display: block; color: var(--ink); font-weight: 600; font-size: 1.05rem; }
.app-facts .fact small { display: block; color: var(--muted); font-size: .86rem; }
.how-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.steps { list-style: none; padding: 0; margin: 1.6rem 0 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-inline-start: 3.1rem; margin-bottom: 1.4rem; color: var(--muted); font-size: 1.08rem; }
.steps li b { display: block; color: var(--ink); font-size: 1.15rem; margin-bottom: .15rem; }
.steps li::before { content: counter(step); position: absolute; inset-inline-start: 0; top: .1rem; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font: 600 1rem var(--serif); }
.demo { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: clamp(1.2rem, 2.6vw, 1.8rem); box-shadow: var(--shadow); }
.demo-tag { display: inline-block; font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--paper-deep); border-radius: 999px; padding: .1rem .7rem; margin-bottom: .6rem; }
.demo-q p { margin-bottom: .5rem; font-size: 1.05rem; line-height: 1.75; }
.demo-ask { color: var(--accent); font-weight: 700; }
.demo-sheet { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-block: 1rem; padding: .7rem; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.demo-cell { position: relative; min-width: 0; padding: .55rem .7rem .4rem; border-radius: 10px; border: 1px solid transparent; }
.demo-cell > span { display: block; font-size: .78rem; font-weight: 700; color: var(--muted); }
.demo-cell .katex { font-size: .8em; }
.demo-cell .katex-display { margin: .2rem 0 0; text-align: left; }
.lasso { position: absolute; inset: -10px -8px; width: calc(100% + 16px); height: calc(100% + 20px); overflow: visible; fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; pointer-events: none; }
.lasso path { stroke-dasharray: 1; stroke-dashoffset: 0; vector-effect: non-scaling-stroke; }
.motion-ready .demo .lasso path { stroke-dashoffset: 1; transition: stroke-dashoffset 1.3s var(--ease-out) .55s; }
.motion-ready .demo.in .lasso path { stroke-dashoffset: 0; }
.demo-feedback { padding: .75rem 1rem; border-radius: 12px; border-inline-start: 3px solid var(--success); background: color-mix(in srgb, var(--success) 9%, var(--card)); font-size: .98rem; line-height: 1.7; }
.demo-feedback b { color: var(--success); }
.motion-ready .demo .demo-feedback { opacity: 0; transform: translateY(6px); transition: opacity .5s var(--ease-out) 1.8s, transform .5s var(--ease-out) 1.8s; }
.motion-ready .demo.in .demo-feedback { opacity: 1; transform: none; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.tool-card h3 a { color: inherit; text-decoration: none; }
.tool-card h3 a::after { content: " ←"; color: var(--accent); }
.tool-card h3 a:hover { color: var(--accent); }
.tool-card { padding: 1.5rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tool-card h3 { font-size: 1.35rem; font-weight: 600; margin-bottom: .5rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: 1rem; }
.topics-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.topic-bars { list-style: none; margin: 0; padding: 1.3rem 1.5rem; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.topic-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem 1rem; padding-block: .55rem; }
.topic-bars li + li { border-top: 1px dashed var(--line); }
.topic-name { grid-row: 1; grid-column: 1; font-weight: 600; font-size: 1rem; line-height: 1.4; }
.topic-count { grid-row: 1; grid-column: 2; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.topic-bar { grid-row: 2; grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--paper-deep); overflow: hidden; }
.topic-bar i { display: block; height: 100%; width: calc(var(--w) * 100%); border-radius: inherit; background: var(--accent); transform-origin: right; }
.motion-ready .topic-bars .topic-bar i { transform: scaleX(0); transition: transform .9s var(--ease-out); transition-delay: calc(var(--i) * 70ms + 200ms); }
.motion-ready .topic-bars.in .topic-bar i { transform: none; }
/* Open space above the drill card where the tangent scene plays (ascii.js centres it here), so the card never covers it. */
.hero-art { height: clamp(11rem, 28vh, 16rem); }
@media (max-width: 700px) {
  .hero-art { display: none; }
}
.start { padding-top: 0 !important; }
.start-cta { margin-top: 0; }
/* The art sits beside these text blocks too (see Option A above). */
.how-grid > [data-reveal]:first-child, .tutor-grid > [data-reveal]:first-child, .tools .section-intro, .exam-topics .section-intro { position: relative; }
.how-grid > [data-reveal]:first-child::before, .tutor-grid > [data-reveal]:first-child::before, .tools .section-intro::before, .exam-topics .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)); }
@media (max-width: 1000px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .how-grid, .topics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .tool-grid, .demo-sheet { grid-template-columns: 1fr; }
  .app-facts .facts { padding-inline: .5rem; }
  .topic-bars { padding: 1rem 1.1rem; }
  .how-grid > [data-reveal]:first-child::before, .tutor-grid > [data-reveal]:first-child::before, .tools .section-intro::before, .exam-topics .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)); }
}
@media (prefers-reduced-motion: reduce) {
  .motion-ready .demo .lasso path { stroke-dashoffset: 0; transition: none; }
  .motion-ready .demo .demo-feedback, .motion-ready .topic-bars .topic-bar i { opacity: 1; transform: none; transition: none; }
}
/* The band that sends to the study plan (/app#plan-special), or says it is coming, and to free practice. */
.plan-band { padding-block: clamp(2rem, 5vh, 3.5rem) !important; }
.plan-band-card { display: grid; grid-template-columns: minmax(0, 1.3fr) auto auto; align-items: center; gap: 1.5rem 2.5rem; padding: clamp(1.4rem, 3vw, 2.4rem); border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px); background: var(--card); box-shadow: var(--shadow); }
.plan-band-card h2 { margin-bottom: .5rem; font-size: clamp(1.6rem, 2.6vw, 2.2rem); }
.plan-band-card .muted { margin: 0; max-width: 32rem; }
.plan-band-card .eyebrow { margin-bottom: .5rem; }
.plan-band-facts { display: grid; gap: .7rem; margin: 0; padding: 0; list-style: none; }
.plan-band-actions { display: grid; gap: .8rem; justify-items: center; }
.plan-band-actions .link-arrow { font-size: .95rem; }
.plan-band-facts li { display: grid; line-height: 1.25; }
.plan-band-facts strong { font: 500 1.5rem/1.2 var(--serif); color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-band-facts span { color: var(--muted); font-size: .9rem; }
@media (max-width: 1000px) {
  .plan-band-card { grid-template-columns: 1fr; }
  .plan-band-facts { grid-template-columns: repeat(3, 1fr); }
  .plan-band-card .button { justify-self: start; }
  .plan-band-actions { justify-items: start; }
}
@media (max-width: 620px) {
  .plan-band-card .button { justify-self: stretch; }
}

/* ---- This course: an exercise-heavy page. ---- */
/* The hero's drill card: real booklet exercises, the done ones with their checked answers, the last one to solve. */
.hero-side { min-width: 0; }
.drill-card { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 1.1rem 1.2rem 1rem; box-shadow: var(--shadow); }
.drill-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .4rem; }
.drill-head .demo-tag { margin: 0; }
.drill-dots { display: inline-flex; gap: .3rem; }
.drill-dots i { width: .55rem; height: .55rem; border-radius: 50%; background: var(--line); }
.drill-dots i.is-done { background: var(--success); }
.drill-dots i.is-now { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.drill-list { list-style: none; margin: 0; padding: 0; }
.drill-list li { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr) auto; grid-template-areas: "mark topic ans" "mark ex ans"; align-items: center; gap: 0 .7rem; padding-block: .55rem; }
.drill-list li + li { border-top: 1px dashed var(--line); }
.drill-mark { grid-area: mark; width: 1.4rem; height: 1.4rem; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--success) 14%, var(--card)); }
.drill-mark::after { content: '✓'; color: var(--success); font-size: .8rem; font-weight: 700; }
.drill-list li.is-now .drill-mark { background: var(--accent); }
.drill-list li.is-now .drill-mark::after { content: ''; width: .4rem; height: .4rem; border-radius: 50%; background: #fff; }
.drill-topic { grid-area: topic; font-size: .78rem; font-weight: 700; color: var(--muted); line-height: 1.3; }
.drill-ex { grid-area: ex; min-width: 0; line-height: 1.5; }
.drill-ex .katex { font-size: .98em; }
.drill-ans { grid-area: ans; justify-self: end; max-width: 9rem; font-size: .9rem; color: var(--success); background: color-mix(in srgb, var(--success) 9%, var(--card)); border-radius: 999px; padding: .1rem .6rem; }
.drill-ans .katex { font-size: .95em; }
.drill-ans.is-open { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.drill-list li.is-now { margin-inline: -.5rem; padding-inline: .5rem; border-radius: 10px; background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.drill-foot { margin: .5rem 0 0; font-size: .86rem; color: var(--muted); }
.motion-ready .drill-list li { animation: drill-in .6s var(--ease-out) both; animation-delay: calc(var(--k, 0) * 220ms + 700ms); }
.drill-list li:nth-child(2) { --k: 1; } .drill-list li:nth-child(3) { --k: 2; } .drill-list li:nth-child(4) { --k: 3; } .drill-list li:nth-child(5) { --k: 4; }
@keyframes drill-in { from { opacity: 0; transform: translateY(8px); } }
.demo-answer { font-weight: 700; color: var(--accent); }

/* The plan band before the plan exists: the same card, with a "בקרוב" badge. */
.soon-badge { display: inline-block; margin-inline-start: .4rem; padding: .05rem .65rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .8rem; vertical-align: .1em; }
.plan-band-facts.is-four { grid-template-columns: repeat(2, auto); gap: .7rem 1.6rem; }

/* The free tutor: four short points beside an example conversation. */
.tutor-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.points { list-style: none; padding: 0; margin: 1.5rem 0 1.9rem; display: grid; gap: .75rem; }
.points li { position: relative; padding-inline-start: 1.5rem; color: var(--muted); font-size: 1.08rem; }
.points li::before { content: ''; position: absolute; inset-inline-start: 0; top: .68em; width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent); }
.points li b { color: var(--ink); }
.chat-demo { margin: 0; display: grid; gap: .7rem; padding: clamp(1.1rem, 2.4vw, 1.6rem); background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.bubble { margin: 0; max-width: 88%; padding: .6rem .9rem; border-radius: 16px; font-size: 1rem; line-height: 1.6; }
.bubble.is-me { justify-self: start; background: var(--paper-deep); border-start-start-radius: 4px; }
.bubble.is-tutor { justify-self: end; background: color-mix(in srgb, var(--accent-soft) 60%, var(--card)); border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line)); border-start-end-radius: 4px; }
.bubble.is-tutor b { color: var(--success); }
.bubble ol { margin: .4rem 0 0; padding-inline-start: 1.3rem; display: grid; gap: .2rem; }
.motion-ready .chat-demo .bubble { opacity: 0; transform: translateY(8px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); }
.motion-ready .chat-demo.in .bubble { opacity: 1; transform: none; }
.motion-ready .chat-demo.in .bubble:nth-child(2) { transition-delay: .5s; }
.motion-ready .chat-demo.in .bubble:nth-child(3) { transition-delay: 1.1s; }
.motion-ready .chat-demo.in .bubble:nth-child(4) { transition-delay: 1.6s; }

/* The catalog: open space above the bars where the parameter scene plays (ascii.js). */
.topics-side { min-width: 0; }
.topics-art { height: clamp(9rem, 22vh, 13rem); }

@media (max-width: 900px) {
  .tutor-grid { grid-template-columns: 1fr; }
  .topics-art { display: none; }
}
@media (max-width: 700px) {
  .drill-card { padding: 1rem; }
  .drill-ans { max-width: 7.5rem; }
  .bubble { max-width: 94%; }
  .plan-band-facts.is-four { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .motion-ready .drill-list li { animation: none; }
  .motion-ready .chat-demo .bubble { opacity: 1; transform: none; transition: none; }
}
