/* ============================================================
   LessonSlate — site styles
   "Thinking Canvas" whiteboard aesthetic
   ============================================================ */

:root {
  --ink: #1B2430;
  --ink-soft: #48566490;
  --slate: #22303E;
  --slate-2: #2B3B4B;
  --paper: #FAF9F5;
  --paper-2: #F2F0E9;
  --white: #FFFFFF;

  --blue: #2F6BEC;
  --blue-dark: #1E4FB8;
  --blue-tint: #EAF1FE;
  --orange: #F5952B;
  --orange-tint: #FDEFDD;
  --green: #22A366;
  --green-tint: #E4F5EC;
  --red: #E4572E;
  --red-tint: #FBE9E2;

  --text: #1B2430;
  --text-muted: #556472;
  --text-faint: #8895A2;
  --border: #E5E2D9;
  --border-strong: #D4D0C4;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(27,36,48,.05);
  --shadow: 0 6px 24px rgba(27,36,48,.08);
  --shadow-lg: 0 18px 50px rgba(27,36,48,.12);
  --maxw: 1120px;
  --font: "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--paper);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* subtle grid-paper texture on the page background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(34,48,62,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,48,62,.028) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
}

img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.18; margin: 0 0 .5em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.3rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 76px 0; }
.section-sm { padding: 48px 0; }
.center { text-align: center; }
.muted { color: var(--text-muted); }
.eyebrow {
  display: inline-block;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: .8rem;
}
.lead { font-size: 1.18rem; color: var(--text-muted); max-width: 640px; }
.center .lead { margin-left: auto; margin-right: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font: inherit; font-weight: 600; font-size: 1rem;
  padding: .72rem 1.35rem; border-radius: 999px;
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(47,107,236,.28); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--blue); color: var(--blue); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { color: var(--blue); }
.btn-light { background: #fff; color: var(--slate); }
.btn-outline-light { background: transparent; color: #fff; border-color: #ffffff55; }
.btn-outline-light:hover { border-color: #fff; }
.btn .arrow { transition: transform .15s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250,249,245,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 82px; }
.nav-logo { display: inline-flex; align-items: center; }
.nav-logo img { height: 46px; width: auto; transition: transform .15s ease; }
.nav-logo:hover img { transform: scale(1.03); }
.nav-links { display: flex; align-items: center; gap: 1.4rem; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--text); font-size: .96rem; font-weight: 500; }
.nav-links a:hover { color: var(--blue); text-decoration: none; }
.nav-links a.active { color: var(--blue); }
.nav-cta { display: flex; align-items: center; gap: .6rem; }
.nav-toggle {
  display: none; background: none; border: 0; cursor: pointer;
  padding: 8px; color: var(--ink);
}
.nav-toggle svg { width: 26px; height: 26px; }

@media (max-width: 900px) {
  .nav-links, .nav-cta .btn-ghost { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav.open .nav-links {
    display: flex; position: absolute; top: 82px; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--border);
    padding: 8px 24px 20px;
  }
  .nav.open .nav-links li { width: 100%; }
  .nav.open .nav-links a { display: block; padding: 12px 0; border-bottom: 1px solid var(--border); }
}

/* ---------- Hero ---------- */
.hero { padding: 72px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero h1 { margin-bottom: .35em; }
.hero .lead { font-size: 1.25rem; }
.hero-cta { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.8rem; }
.hero-note { margin-top: 1.2rem; font-size: .9rem; color: var(--text-faint); }
@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
}

/* ---------- Canvas card (hero visual) ---------- */
.canvas-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 22px; position: relative;
}
.canvas-card .board {
  background:
    linear-gradient(rgba(34,48,62,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,48,62,.04) 1px, transparent 1px);
  background-size: 22px 22px; background-color: #FCFCFA;
  border: 1px solid var(--border); border-radius: 12px; padding: 18px; min-height: 250px;
}
.board-title { font-size: .82rem; font-weight: 700; color: var(--text-faint); letter-spacing:.04em; margin-bottom: 14px; text-transform: uppercase; }
.eqn { font-size: 1.15rem; font-weight: 600; letter-spacing: .01em; margin: 6px 0 16px; color: var(--ink); }
.eqn .g { color: var(--blue); } .eqn .u { color: var(--orange); } .eqn .r { color: var(--green); }
.bubble-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.persona { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; color:#fff; font-weight:700; font-size:.8rem; }
.persona.student { background: var(--blue); border-radius: 50%; }
.persona.teacher { background: var(--slate); border-radius: 7px; }
.bubble { background: var(--paper-2); border-radius: 10px; padding: 8px 12px; font-size: .92rem; color: var(--ink); }
.bubble.correct { background: var(--green-tint); }
.bubble.wrong { background: var(--red-tint); }
.canvas-badge {
  position: absolute; top: -14px; right: 20px; background: var(--slate); color:#fff;
  font-size: .78rem; font-weight: 600; padding: 6px 12px; border-radius: 999px;
}

/* ---------- Trust strip ---------- */
.trust { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--white); }
.trust-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; padding: 26px 0; text-align: center; }
.trust-grid .num { font-size: 1.7rem; font-weight: 700; color: var(--ink); }
.trust-grid .lbl { font-size: .9rem; color: var(--text-muted); }
@media (max-width: 700px){ .trust-grid { grid-template-columns: repeat(2,1fr); gap: 22px; } }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2,1fr); }
.grid-3 { grid-template-columns: repeat(3,1fr); }
.grid-4 { grid-template-columns: repeat(4,1fr); }
@media (max-width: 900px){ .grid-3, .grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 620px){ .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card h3 { margin-bottom: .4rem; }
.card p { color: var(--text-muted); margin-bottom: 0; }
.card-accent { border-top: 4px solid var(--blue); }
.card-accent.orange { border-top-color: var(--orange); }
.card-accent.green { border-top-color: var(--green); }
.card-accent.red { border-top-color: var(--red); }

.icon-badge {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  margin-bottom: 16px; font-size: 1.3rem;
}
.icon-badge.blue { background: var(--blue-tint); color: var(--blue); }
.icon-badge.orange { background: var(--orange-tint); color: #C06A0E; }
.icon-badge.green { background: var(--green-tint); color: var(--green); }
.icon-badge.red { background: var(--red-tint); color: var(--red); }
.icon-badge.slate { background: #E7EBEF; color: var(--slate); }

/* ---------- Section heading ---------- */
.sec-head { max-width: 680px; margin: 0 auto 44px; text-align: center; }
.sec-head.left { margin-left: 0; text-align: left; }

/* ---------- Steps / pipeline ---------- */
.pipeline { display: grid; grid-template-columns: repeat(5,1fr); gap: 14px; }
@media (max-width: 900px){ .pipeline { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 520px){ .pipeline { grid-template-columns: 1fr; } }
.pstep { background:#fff; border:1px solid var(--border); border-radius: var(--radius); padding: 20px; position: relative; }
.pstep .n { width: 30px; height: 30px; border-radius: 50%; background: var(--slate); color:#fff; display:grid; place-items:center; font-weight:700; font-size:.9rem; margin-bottom: 12px; }
.pstep h4 { margin: 0 0 .3rem; font-size: 1.02rem; }
.pstep p { margin: 0; font-size: .9rem; color: var(--text-muted); }

.step-block { display: grid; grid-template-columns: 60px 1fr; gap: 22px; padding: 26px 0; border-bottom: 1px solid var(--border); }
.step-block:last-child { border-bottom: 0; }
.step-block .n { width: 46px; height: 46px; border-radius: 50%; background: var(--blue); color:#fff; display:grid; place-items:center; font-weight:700; font-size:1.15rem; }
.step-block h3 { margin-bottom: .3rem; }
.under-hood { margin-top: .7rem; font-size: .88rem; color: var(--text-faint); background: var(--paper-2); border-left: 3px solid var(--border-strong); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.under-hood b { color: var(--text-muted); }

/* ---------- Color legend ---------- */
.legend { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
@media (max-width: 700px){ .legend { grid-template-columns: repeat(2,1fr); } }
.legend-item { background:#fff; border:1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.swatch { width: 100%; height: 8px; border-radius: 999px; margin-bottom: 14px; }
.swatch.blue { background: var(--blue); } .swatch.orange { background: var(--orange); }
.swatch.green { background: var(--green); } .swatch.red { background: var(--red); }
.legend-item h4 { margin: 0 0 .2rem; }
.legend-item p { margin: 0; font-size: .9rem; color: var(--text-muted); }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { font-size: .82rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: var(--paper-2); color: var(--text-muted); border: 1px solid var(--border); }
.chip.blue { background: var(--blue-tint); color: var(--blue-dark); border-color: transparent; }
.chip.orange { background: var(--orange-tint); color: #B4640B; border-color: transparent; }
.chip.soon { background: transparent; color: var(--text-faint); border: 1px dashed var(--border-strong); }

/* ---------- Subject tiles ---------- */
.subject { background:#fff; border:1px solid var(--border); border-radius: var(--radius-lg); padding: 30px; box-shadow: var(--shadow-sm); }
.subject .kicker { font-size:.8rem; font-weight:700; letter-spacing:.1em; text-transform:uppercase; }
.subject.chem .kicker { color: var(--blue); }
.subject.alg .kicker { color: var(--orange); }
.subject .personas { font-size:.92rem; color: var(--text-muted); margin: 4px 0 14px; }

/* ---------- Split / feature rows ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.split.reverse .split-media { order: 2; }
@media (max-width: 860px){ .split { grid-template-columns: 1fr; gap: 28px; } .split.reverse .split-media{ order:0; } }

.callout {
  background: var(--blue-tint); border: 1px solid #cfe0fc; border-radius: var(--radius);
  padding: 24px 26px;
}
.callout.orange { background: var(--orange-tint); border-color: #f3ddba; }
.callout.green { background: var(--green-tint); border-color: #c7ead6; }
.callout h3 { margin-top: 0; }
.callout ul { margin: 0; padding-left: 1.1rem; color: var(--text-muted); }
.callout li { margin-bottom: .4rem; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background:#fff; }
table.data { width: 100%; border-collapse: collapse; min-width: 560px; }
table.data th, table.data td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .95rem; }
table.data th { background: var(--paper-2); font-weight: 700; color: var(--ink); }
table.data tr:last-child td { border-bottom: 0; }
table.data td .chip { font-size: .78rem; }

/* ---------- Bullet list ---------- */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { position: relative; padding-left: 30px; margin-bottom: .8rem; color: var(--text-muted); }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 6px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--green-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2322A366' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/12px no-repeat;
}

/* ---------- Pricing ---------- */
.price-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; align-items: stretch; }
@media (max-width: 860px){ .price-grid { grid-template-columns: 1fr; } }
.price {
  background:#fff; border:1px solid var(--border); border-radius: var(--radius-lg); padding: 30px; display: flex; flex-direction: column;
}
.price.featured { border: 2px solid var(--blue); box-shadow: var(--shadow); position: relative; }
.price .tag { position:absolute; top:-13px; left:50%; transform:translateX(-50%); background:var(--blue); color:#fff; font-size:.78rem; font-weight:700; padding:4px 14px; border-radius:999px; }
.price .plan { font-size: 1.15rem; font-weight: 700; }
.price .amount { font-size: 2.4rem; font-weight: 700; color: var(--ink); margin: 8px 0 2px; }
.price .amount span { font-size: .95rem; font-weight: 500; color: var(--text-faint); }
.price .who { color: var(--text-muted); margin-bottom: 18px; font-size: .95rem; }
.price ul { list-style: none; padding: 0; margin: 0 0 24px; flex: 1; }
.price li { padding: 8px 0 8px 26px; position: relative; font-size: .95rem; color: var(--text-muted); border-top: 1px solid var(--border); }
.price li:first-child { border-top: 0; }
.price li::before { content:"✓"; position:absolute; left:0; color: var(--green); font-weight:700; }

/* ---------- FAQ ---------- */
.faq { max-width: 780px; margin: 0 auto; }
.faq details { background:#fff; border:1px solid var(--border); border-radius: var(--radius); padding: 4px 20px; margin-bottom: 12px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 16px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; color: var(--ink); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--blue); font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--text-muted); margin: 0 0 16px; }

/* ---------- CTA band ---------- */
.cta-band { background: var(--slate); color: #fff; border-radius: var(--radius-lg); padding: 56px 40px; text-align: center; position: relative; overflow: hidden; }
.cta-band::before {
  content:""; position:absolute; inset:0;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 26px 26px;
}
.cta-band > * { position: relative; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #C6D0DA; max-width: 560px; margin: 0 auto 26px; }

/* ---------- Page hero (interior) ---------- */
.page-hero { padding: 60px 0 20px; }
.page-hero .eyebrow { color: var(--blue); }
.page-hero h1 { max-width: 800px; }
.page-hero .lead { font-size: 1.2rem; }

/* ---------- Pedagogy quote ---------- */
.pull {
  border-left: 4px solid var(--blue); padding: 6px 0 6px 22px; margin: 24px 0;
  font-size: 1.25rem; color: var(--ink); font-weight: 600; line-height: 1.4;
}

/* ---------- Footer ---------- */
.site-footer { background: var(--slate); color: #C6D0DA; padding: 56px 0 30px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
@media (max-width: 760px){ .footer-grid { grid-template-columns: 1fr 1fr; gap: 26px; } }
.site-footer img { height: 32px; margin-bottom: 14px; }
.site-footer .tagline { font-size: .92rem; color: #9BA9B6; max-width: 260px; }
.footer-col h4 { color: #fff; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 14px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: #C6D0DA; font-size: .95rem; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #ffffff1a; margin-top: 40px; padding-top: 20px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: .86rem; color: #8595A2; }

/* ---------- Contact form ---------- */
.contact-grid { display: grid; grid-template-columns: 1.25fr .9fr; gap: 34px; align-items: start; }
@media (max-width: 860px){ .contact-grid { grid-template-columns: 1fr; gap: 26px; } }
.form-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 32px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px){ .form-row { grid-template-columns: 1fr; } }
.form-field { margin-bottom: 18px; }
.form-field label { display: block; font-size: .9rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--border); border-radius: 10px; padding: 11px 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint);
}
.form-field textarea { min-height: 150px; resize: vertical; }
.form-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-note { font-size: .85rem; color: var(--text-faint); margin: 4px 0 0; }

.contact-info .info-item { display: flex; gap: 14px; align-items: flex-start; padding: 18px 0; border-bottom: 1px solid var(--border); }
.contact-info .info-item:first-child { padding-top: 0; }
.contact-info .info-item:last-child { border-bottom: 0; }
.contact-info .info-item .icon-badge { margin-bottom: 0; flex: 0 0 auto; }
.contact-info .info-item h4 { margin: 0 0 2px; font-size: 1rem; }
.contact-info .info-item p { margin: 0; color: var(--text-muted); font-size: .93rem; }
.contact-info .info-item a { font-weight: 600; }

/* ---------- Utilities ---------- */
.mt-1 { margin-top: 1rem; } .mt-2 { margin-top: 2rem; } .mb-0 { margin-bottom: 0; }
.badge-soft { display:inline-block; background: var(--paper-2); border:1px solid var(--border); color: var(--text-muted); font-size:.8rem; font-weight:600; padding:4px 12px; border-radius:999px; }

/* ---------- Hero video player ---------- */
.player-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 14px; position: relative;
}
.player-tabs { display: inline-flex; gap: 4px; background: var(--paper-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px; margin-bottom: 12px; }
.ptab {
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  border: 0; background: transparent; color: var(--text-muted);
  padding: 7px 18px; border-radius: 999px; transition: background .15s ease, color .15s ease;
}
.ptab:hover { color: var(--ink); }
.ptab.active { background: #fff; color: var(--blue); box-shadow: var(--shadow-sm); }
.player-frame {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); background: #0d1620; aspect-ratio: 16 / 9;
}
.player-frame video { width: 100%; height: 100%; display: block; object-fit: cover; background: #0d1620; }
.player-caption { margin: 12px 4px 4px; font-size: .88rem; color: var(--text-faint); }
.player-caption span { color: var(--text-muted); font-weight: 600; }

/* ---------- Count-up: no layout shift ---------- */
.num[data-count] { font-variant-numeric: tabular-nums; }

/* ---------- Animated pipeline flow ---------- */
.pipeline-flow .pstep { position: relative; overflow: hidden; }
.pipeline-flow .pstep::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--blue), var(--orange), var(--green));
  transform: scaleX(0); transform-origin: left; opacity: .0;
}
.pipeline-flow.run .pstep::after { animation: flowbar 5s ease-in-out infinite; }
.pipeline-flow.run .pstep:nth-child(1)::after { animation-delay: 0s; }
.pipeline-flow.run .pstep:nth-child(2)::after { animation-delay: .5s; }
.pipeline-flow.run .pstep:nth-child(3)::after { animation-delay: 1s; }
.pipeline-flow.run .pstep:nth-child(4)::after { animation-delay: 1.5s; }
.pipeline-flow.run .pstep:nth-child(5)::after { animation-delay: 2s; }
.pipeline-flow.run .pstep .n { transition: background .3s ease, transform .3s ease; }
@keyframes flowbar {
  0% { transform: scaleX(0); opacity: 0; }
  8% { transform: scaleX(1); opacity: 1; }
  40% { opacity: 1; }
  55% { transform: scaleX(1); opacity: 0; }
  100% { transform: scaleX(1); opacity: 0; }
}

/* ---------- Canvas demo shell ---------- */
.canvas-demo {
  background: #FCFCFA;
  background-image:
    linear-gradient(rgba(34,48,62,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,48,62,.04) 1px, transparent 1px);
  background-size: 26px 26px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 34px 28px; position: relative;
}
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.demo-head .board-title { margin: 0; }
.demo-replay {
  font: inherit; font-size: .82rem; font-weight: 600; color: var(--text-muted);
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.demo-replay:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- Units-cancel (dimensional analysis) ---------- */
.dim-chain {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 12px 14px; padding: 26px 4px 10px; font-size: 1.08rem;
}
.dim-chain .term, .dim-chain .op, .dim-chain .frac, .dim-chain .dim-result {
  opacity: 0; transform: translateY(8px);
  transition: opacity .45s ease, transform .45s ease;
}
.dim-chain .in { opacity: 1; transform: none; }
.term { font-weight: 600; padding: 6px 12px; border-radius: 9px; white-space: nowrap; }
.term.given { color: var(--blue-dark); background: var(--blue-tint); }
.op { color: var(--text-faint); font-weight: 600; font-size: 1.1rem; }
.frac { display: inline-flex; flex-direction: column; align-items: center; text-align: center; }
.fnum, .fden { padding: 3px 8px; white-space: nowrap; font-weight: 500; }
.fbar { width: 100%; height: 2px; background: var(--ink); margin: 2px 0; border-radius: 2px; }
.unit { position: relative; padding: 0 1px; }
.unit::after {
  content: ""; position: absolute; left: -2px; right: -2px; top: 50%; height: 2.5px;
  background: var(--red); border-radius: 2px; transform: scaleX(0); transform-origin: left;
  transition: transform .4s ease;
}
.unit.cut { color: var(--text-faint); }
.unit.cut::after { transform: scaleX(1); }
.unit.surv { color: var(--green); font-weight: 700; }
.dim-result {
  font-weight: 700; font-size: 1.25rem; color: var(--green);
  background: var(--green-tint); padding: 8px 16px; border-radius: 10px; white-space: nowrap;
}
.dim-caption { text-align: center; color: var(--text-faint); font-size: .9rem; margin: 8px 0 0; }
@media (max-width: 560px){ .dim-chain { font-size: .96rem; } }

/* ---------- Looping live session ---------- */
.live-demo .bubble-row { opacity: 0; transform: translateY(10px); transition: opacity .5s ease, transform .5s ease; }
.live-demo .bubble-row.show { opacity: 1; transform: none; }
.val { font-weight: 700; padding: 0 3px; border-radius: 5px; }
.val.wrong-v { color: var(--red); }
.val.right-v { color: var(--green); }
.bubble-row.show .val.wrong-v { animation: pulseRed 1.1s ease; }
.bubble-row.show .val.right-v { animation: pulseGreen 1.1s ease; }
@keyframes pulseRed { 0%,100% { background: transparent; } 30% { background: var(--red-tint); } }
@keyframes pulseGreen { 0%,100% { background: transparent; } 30% { background: var(--green-tint); } }

/* ---------- YouTube / free library ---------- */
.btn-youtube { background: #FF0000; color: #fff; }
.btn-youtube:hover { background: #d90000; }
.btn .yt-glyph { width: 20px; height: 15px; display: inline-block; }
.nav-links a.yt-link { display: inline-flex; align-items: center; gap: 6px; }
.nav-links a.yt-link .yt-glyph { fill: #FF0000; }

.lesson-card { padding: 0; overflow: hidden; display: block; color: inherit; }
.lesson-card:hover { text-decoration: none; }
.lesson-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 1px solid var(--border); background: #0d1620; }
.lesson-card .lc-body { padding: 18px 22px; }
.lesson-card .lc-body h3 { margin-bottom: .25rem; }
.lesson-card .lc-body p { color: var(--text-muted); margin: 0; }
.lc-tag { display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
.lc-tag.chem { color: var(--blue); } .lc-tag.alg { color: #B4640B; } .lc-tag.more { color: var(--green); }
.yt-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* Click-to-play YouTube facade */
.yt-facade .yt-play {
  position: relative; display: block; width: 100%; padding: 0; border: 0;
  background: #0d1620; cursor: pointer; aspect-ratio: 16 / 9; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.yt-facade .yt-play img { width: 100%; height: 100%; object-fit: cover; display: block; border: 0; transition: transform .35s ease; }
.yt-facade:hover .yt-play img { transform: scale(1.04); }
.yt-badge { position: absolute; inset: 0; display: grid; place-items: center; }
.yt-badge svg { width: 62px; height: 44px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.35)); transition: transform .2s ease; }
.yt-facade:hover .yt-badge svg { transform: scale(1.08); }
.yt-facade iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; border-bottom: 1px solid var(--border); }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  .pipeline-flow .pstep::after { display: none; }
  .dim-chain .term, .dim-chain .op, .dim-chain .frac, .dim-chain .dim-result,
  .live-demo .bubble-row { opacity: 1 !important; transform: none !important; }
  .unit.cut::after { transform: scaleX(1) !important; }
}
