/* Homepage motion. Only movement, fading and soft light, so it stays smooth.
   Everything is switched off for visitors who ask for reduced motion (see the end of this file). */

/* 1. Entrance: items rise and fade in one after another */
@keyframes rise { from { opacity: 0; translate: 0 22px; } to { opacity: 1; translate: 0 0; } }
.rise { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 120ms + 120ms); }

/* A gold line draws itself under "step by step." */
.hero h1 .draw { position: relative; display: inline-block; }
.hero h1 .draw::after { content: ""; position: absolute; left: 0; right: 0; bottom: -.06em; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), transparent); transform-origin: left center; animation: draw 1.1s cubic-bezier(.3, .7, .2, 1) 1.15s both; }
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* 2. The learning path lights up step by step */
.path-wrap { position: relative; }
.path-card { transition: transform .35s ease-out; transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); will-change: transform; }
.path-wrap::after { content: ""; position: absolute; inset: 14px -14px -14px 14px; z-index: -1; border-radius: 22px; background: var(--brand); opacity: .9; }
.path-list::after { content: ""; position: absolute; left: 15px; top: 14px; bottom: 14px; width: 2px; background: var(--accent); transform-origin: top center; animation: grow 2.4s ease-in-out 1.3s both; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.path-list li > div { animation: soft .7s ease-out both; animation-delay: calc(var(--s, 0) * 600ms + 1.2s); }
@keyframes soft { from { opacity: .35; } to { opacity: 1; } }
.path-list li .dot { animation: light .6s ease-out both; animation-delay: calc(var(--s, 0) * 600ms + 1.2s); }
@keyframes light {
  0% { background: var(--surface-2); border-color: var(--line); color: var(--muted); box-shadow: 0 0 0 0 transparent; }
  60% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 28%, transparent); }
  100% { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 0 transparent; }
}

/* 3. Ambient glow: slow, soft light drifting behind the hero */
.hero-glow { position: absolute; inset: -80px calc(50% - 50vw) auto calc(50% - 50vw); height: 560px; z-index: -1; overflow: hidden; pointer-events: none; }
.hero-glow .blob { position: absolute; border-radius: 50%; will-change: transform; }
.blob-1 { width: 520px; height: 520px; right: 8%; top: 0; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent), transparent 68%); animation: drift-a 24s ease-in-out infinite alternate; }
.blob-2 { width: 460px; height: 460px; left: 4%; top: 60px; background: radial-gradient(circle, color-mix(in srgb, var(--ink) var(--glow-ink), transparent), transparent 68%); animation: drift-b 30s ease-in-out infinite alternate; }
.blob-3 { width: 340px; height: 340px; left: 42%; top: 220px; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 68%); animation: drift-c 36s ease-in-out infinite alternate; }
@keyframes drift-a { from { transform: translate(0, 0) scale(1); } to { transform: translate(-90px, 50px) scale(1.12); } }
@keyframes drift-b { from { transform: translate(0, 0) scale(1); } to { transform: translate(80px, -30px) scale(1.08); } }
@keyframes drift-c { from { transform: translate(0, 0) scale(1); } to { transform: translate(-60px, -40px) scale(1.15); } }

/* 5. Subject cards: lift, and a soft light follows the cursor */
.cards a { isolation: isolate; overflow: hidden; }
.cards a::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; opacity: 0; pointer-events: none; transition: opacity .25s; background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 30%), color-mix(in srgb, var(--accent) 17%, transparent), transparent 70%); }
.cards a:hover::before, .cards a:focus-visible::before { opacity: 1; }
.cards .badge { transition: transform .25s; }
.cards a:hover .badge { transform: scale(1.08) rotate(-3deg); }

@media (max-width: 860px) {
  .blob-1 { width: 360px; height: 360px; right: -60px; }
  .blob-2 { width: 320px; height: 320px; left: -80px; }
  .blob-3 { display: none; }
}

/* Reduced motion: show the finished page, nothing moves */
@media (prefers-reduced-motion: reduce) {
  .rise, .hero h1 .draw::after, .path-list::after, .path-list li > div, .path-list li .dot, .hero-glow .blob { animation: none !important; }
  .path-list::after { transform: none; }
  .path-list li .dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  .path-card { transform: none !important; transition: none; }
}

/* Subject chooser: expanding panels. The panel you point at or tab to widens and shows its details. */
.panels { --h: 400px; display: flex; gap: 12px; height: var(--h); list-style: none; margin: 0; padding: 0; }
.panel { --tint: var(--accent); position: relative; flex: 1 1 0; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); transition: flex-grow .65s cubic-bezier(.3, .7, .2, 1), border-color .3s, box-shadow .3s; }
.panel:nth-child(4n+2) { --tint: var(--tint-2); }
.panel:nth-child(4n+3) { --tint: var(--tint-3); }
.panel:nth-child(4n+4) { --tint: var(--tint-4); }
.panel.is-open { flex-grow: 4.2; border-color: color-mix(in srgb, var(--tint) 55%, var(--line)); box-shadow: var(--shadow-lg); }
.panel-link { position: relative; display: block; height: 100%; color: inherit; text-decoration: none; isolation: isolate; }
.panel-link::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(120% 90% at 85% 0%, color-mix(in srgb, var(--tint) 24%, transparent), transparent 62%), linear-gradient(180deg, transparent 40%, color-mix(in srgb, var(--tint) 8%, transparent)); transition: opacity .5s; opacity: .55; }
.panel.is-open .panel-link::before { opacity: 1; }
.panel-glyph { position: absolute; top: 14px; right: 18px; z-index: -1; font-family: var(--serif); font-size: 7.5rem; font-weight: 600; line-height: 1; letter-spacing: -.04em; white-space: nowrap; color: color-mix(in srgb, var(--tint) 30%, transparent); transform-origin: top right; transition: transform .65s cubic-bezier(.3, .7, .2, 1), color .5s; }
.panel.is-open .panel-glyph { transform: scale(1.22) rotate(-4deg); color: color-mix(in srgb, var(--tint) 42%, transparent); }
.panel-body { position: absolute; left: 0; bottom: 0; display: flex; flex-direction: column; gap: 6px; width: min(420px, 100%); min-width: 230px; padding: 0 26px 26px; }
.panel-count { color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.panel-title { font-family: var(--serif); font-size: clamp(1.4rem, 2.2vw, 2.1rem); line-height: 1.1; color: var(--ink); }
.panel-text, .panel-open { opacity: 0; transform: translateY(10px); transition: opacity .35s, transform .5s; }
.panel-text { max-width: 34ch; color: var(--text); font-size: .98rem; line-height: 1.5; }
.panel-open { margin-top: 6px; color: var(--accent-strong); font-weight: 700; font-size: .95rem; }
.panel.is-open .panel-text, .panel.is-open .panel-open { opacity: 1; transform: none; transition-delay: .22s; }
.panel-link:focus-visible { outline-offset: -4px; border-radius: 22px; }

/* Collapsed panels (desktop): the title runs sideways, so a long name is never cut off */
.panel:not(.is-open) .panel-title { writing-mode: vertical-rl; transform: rotate(180deg); max-height: calc(var(--h) - 150px); font-size: 1.25rem; }
.panel:not(.is-open) .panel-body { align-items: center; width: 100%; min-width: 0; padding: 0 0 22px; }
.panel:not(.is-open) .panel-count { display: none; }
.panel:not(.is-open) .panel-text, .panel:not(.is-open) .panel-open { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; overflow: hidden; }

/* Phones: panels stack, and the chosen one opens downwards */
@media (max-width: 760px) {
  .panels { flex-direction: column; height: auto; gap: 10px; }
  .panel { flex: none; height: 92px; transition: height .5s cubic-bezier(.3, .7, .2, 1), border-color .3s; }
  .panel.is-open { height: 270px; }
  .panel-glyph { font-size: 4.5rem; top: 10px; }
  .panel-body { width: 100%; padding: 0 20px 18px; }
  .panel:not(.is-open) .panel-title { writing-mode: horizontal-tb; transform: none; max-height: none; font-size: 1.4rem; }
  .panel:not(.is-open) .panel-body { align-items: stretch; width: 100%; padding: 0 20px 18px; }
  .panel:not(.is-open) .panel-count { display: block; }
}

/* Without JavaScript every panel stays open at an equal width */
.panels:not(.is-ready) .panel-text, .panels:not(.is-ready) .panel-open { opacity: 1; transform: none; }
.panels:not(.is-ready) .panel { flex-grow: 1; }

@media (prefers-reduced-motion: reduce) {
  .panel, .panel-glyph, .panel-link::before, .panel-text, .panel-open { transition: none !important; }
}

/* A subject that is announced but not open: no link, a quieter look */
.panel.is-soon { border-style: dashed; box-shadow: none; }
.panel.is-soon .panel-link { cursor: default; }
.panel.is-soon .panel-count { color: var(--accent-strong); }

/* Numbers strip under the hero */
.facts { list-style: none; margin: 8px 0 0; padding: 18px 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 44px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts li { display: flex; align-items: baseline; gap: 8px; }
.facts strong { font-size: 1.5rem; color: var(--ink); }
.facts span { color: var(--muted); font-size: .95rem; }

/* Start-here course cards */
.course-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.course-cards a { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 18px 20px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); transition: border-color .15s, transform .15s; }
.course-cards a:hover, .course-cards a:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.course-cards a.is-practice { border-left: 4px solid var(--accent); }
.course-cards strong { color: var(--ink); font-size: 1.08rem; }
.course-cards .card-text { color: var(--muted); font-size: .92rem; line-height: 1.5; }
.course-cards em { margin-top: auto; padding-top: 6px; font-style: normal; font-weight: 600; font-size: .9rem; color: var(--accent-strong); }

/* Practice preview */
.demo { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; }
.demo-copy ul { padding-left: 1.2em; }
.demo-copy li { margin: 6px 0; }
.demo-window { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); }
.demo-bar { display: flex; justify-content: space-between; padding: 8px 14px; font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.demo-code { margin: 0; padding: 16px 18px; overflow-x: auto; font-size: .9rem; line-height: 1.6; background: transparent; }
.demo-result { padding: 10px 18px; font-weight: 600; font-size: .92rem; background: #e3f4e8; color: #14502b; }
.demo-window figcaption { padding: 8px 18px; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); }
:root[data-theme="dark"] .demo-result { background: #1c3a27; color: #a8e6bd; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .demo-result { background: #1c3a27; color: #a8e6bd; } }
@media (max-width: 800px) { .demo { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .course-cards a { transition: none; } .course-cards a:hover { transform: none; } }

/* Practice slider (static/js/home-slider.js). Without the script every slide is shown, one under the other. */
.slider .slide + .slide { margin-top: 36px; }
.slider.is-js .slides { display: grid; }
.slider.is-js .slide { grid-area: 1 / 1; margin: 0; opacity: 0; visibility: hidden; transition: opacity .45s ease, visibility .45s; }
.slider.is-js .slide.is-active { opacity: 1; visibility: visible; }
.slider-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 22px; }
.slider:not(.is-js) .slider-controls { display: none; }
.slider-btn { min-width: 40px; padding: 8px 14px; font: inherit; font-size: .9rem; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.slider-btn:hover, .slider-btn:focus-visible { border-color: var(--accent); }
.slider-btn[hidden] { display: none; }
.slider-dots { display: flex; gap: 8px; }
.slider-dot { width: 11px; height: 11px; padding: 0; background: var(--line); border: 0; border-radius: 50%; cursor: pointer; }
.slider-dot.is-active { background: var(--accent); transform: scale(1.25); }
.slider-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.demo-copy .tag { display: inline-block; margin: 0 0 10px; }
.demo-more { margin-left: 12px; font-weight: 600; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .slider.is-js .slide { transition: none; } }

