/* ===== Homepage (K-8 Read & Learn) ===== */
/* Loaded after styles.css on index.html only. */

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 2000;
    background: var(--dark);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 8px;
}
.skip-link:focus { left: 8px; }

section[id] { scroll-margin-top: 80px; }

.eyebrow {
    display: block;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 12px;
}

.section-subtitle.left { text-align: left; margin-bottom: 32px; }
.container.narrow { max-width: 820px; }

.gradient-text {
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899, #f59e0b, #6366f1);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 8s linear infinite;
}

@keyframes gradient-shift {
    to { background-position: 300% 0; }
}

/* ----- Reveal on scroll ----- */
.js .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
    transition-delay: var(--reveal-delay, 0s);
}
.js .reveal.in {
    opacity: 1;
    transform: none;
}

/* ----- Hero ----- */
.hero h1 { font-size: 3.2rem; }
.hero-trust { flex-wrap: wrap; row-gap: 10px; }
.trust-text { white-space: nowrap; }

.hero-blobs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.45;
    animation: blob-drift 18s ease-in-out infinite alternate;
}
.blob-1 { width: 420px; height: 420px; background: #c7d2fe; top: -120px; left: -80px; }
.blob-2 { width: 360px; height: 360px; background: #fbcfe8; bottom: -100px; right: 20%; animation-delay: -6s; }
.blob-3 { width: 300px; height: 300px; background: #bbf7d0; top: 30%; right: -80px; animation-delay: -12s; }

@keyframes blob-drift {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -30px) scale(1.1); }
    100% { transform: translate(-30px, 40px) scale(0.95); }
}

.badge-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--secondary);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
    animation: ring 2s infinite;
}
@keyframes ring {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hero-usecase {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 18px;
}
.hero-usecase .typewriter-wrapper { min-width: 0; }

.hero-chips {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
}
.chip {
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9375rem;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    animation: chip-bob 4s ease-in-out infinite;
}
.chip:nth-child(2) { animation-delay: 0.3s; }
.chip:nth-child(3) { animation-delay: 0.6s; }
.chip:nth-child(4) { animation-delay: 0.9s; }
.chip-math { border-color: #c7d2fe; color: #4f46e5; }
.chip-science { border-color: #a7f3d0; color: #047857; }
.chip-reading { border-color: #fde68a; color: #b45309; }
.chip-games { border-color: #fbcfe8; color: #be185d; }
@keyframes chip-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.btn-shine { position: relative; overflow: hidden; }
.btn-shine::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: skewX(-20deg);
    animation: shine 3.5s ease-in-out infinite;
}
@keyframes shine {
    0%, 60% { left: -60%; }
    100% { left: 130%; }
}

.product-hunt-badge { margin-top: 1.5rem; }

.carousel-indicators .indicator {
    border: none;
    padding: 0;
    cursor: pointer;
}

.phone-frame { animation: phone-float 6s ease-in-out infinite; }
@keyframes phone-float {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-12px) rotate(1deg); }
}

/* ----- Stats strip ----- */
.stats-strip {
    background: var(--gradient);
    padding: 44px 24px;
    color: var(--white);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    text-align: center;
}
.stat-num {
    display: block;
    font-size: 2.75rem;
    font-weight: 900;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.stat-label {
    font-weight: 600;
    opacity: 0.9;
}

/* ----- Use cases ----- */
.usecases { padding: 100px 24px; }
.usecase-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.usecase-card {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    box-shadow: var(--shadow);
    border-top: 5px solid var(--accent-color);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.usecase-card::before {
    content: "";
    position: absolute;
    width: 160px;
    height: 160px;
    right: -60px;
    top: -60px;
    border-radius: 50%;
    background: var(--accent-color);
    opacity: 0.08;
    transition: transform 0.5s ease;
}
.usecase-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-xl); }
.usecase-card:hover::before { transform: scale(1.6); }
.usecase-icon {
    font-size: 2.5rem;
    margin-bottom: 14px;
    display: inline-block;
    transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.usecase-card:hover .usecase-icon { transform: scale(1.2) rotate(-8deg); }
.usecase-card h3 { margin-bottom: 10px; font-size: 1.3rem; }
.usecase-card p { font-size: 0.975rem; }

/* ----- Subjects ----- */
.subjects { padding: 100px 24px; background: var(--light); }
.subject-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}
.subject-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, box-shadow 0.3s ease;
    transform-style: preserve-3d;
    will-change: transform;
}
.subject-card:hover { box-shadow: var(--shadow-xl); }
.subject-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}
.subject-head > div { flex: 1; }
.subject-emoji {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
}
.subject-math .subject-emoji { background: #e0e7ff; }
.subject-science .subject-emoji { background: #d1fae5; }
.subject-reading .subject-emoji { background: #fef3c7; }
.subject-games .subject-emoji { background: #fce7f3; }
.subject-grades { font-size: 0.875rem; font-weight: 700; color: var(--gray); }
.live-pill {
    font-size: 0.75rem;
    font-weight: 800;
    color: #047857;
    background: #d1fae5;
    padding: 4px 10px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.live-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    animation: ring 2s infinite;
}
.subject-card > p { margin-bottom: 16px; }
.topic-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.topic-list li {
    font-size: 0.8125rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 50px;
    background: var(--light);
    color: var(--dark-light);
}

.coming-soon {
    margin-top: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 18px 24px;
    border: 2px dashed var(--gray-light);
    border-radius: var(--radius-lg);
}
.coming-label {
    font-weight: 800;
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gray);
}
.coming-items { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.coming-item {
    background: var(--white);
    padding: 6px 14px;
    border-radius: 50px;
    font-weight: 700;
    color: var(--gray);
}

/* ----- Topic marquee ----- */
.topic-marquee {
    padding: 36px 0;
    overflow: hidden;
    background: var(--white);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-row { overflow: hidden; padding: 6px 0; }
.marquee-track {
    display: flex;
    gap: 14px;
    width: max-content;
    animation: marquee 50s linear infinite;
}
.marquee-row.reverse .marquee-track { animation-direction: reverse; animation-duration: 58s; }
.topic-marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
    white-space: nowrap;
    padding: 10px 18px;
    border-radius: 50px;
    background: var(--light);
    font-weight: 700;
    color: var(--dark-light);
}
@keyframes marquee {
    to { transform: translateX(-50%); }
}

/* ----- Lesson flow + animated demo ----- */
.lesson-flow { padding: 100px 24px; }
.lesson-flow-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 60px;
    align-items: center;
}
.lesson-steps h2, .lesson-steps .eyebrow { text-align: left; }
.flow-list { list-style: none; display: grid; gap: 12px; }
.flow-step {
    display: flex;
    gap: 16px;
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 2px solid transparent;
    transition: background 0.4s ease, border-color 0.4s ease, transform 0.4s ease;
    cursor: pointer;
}
.flow-step h3 { font-size: 1.15rem; margin-bottom: 4px; }
.flow-step p { font-size: 0.95rem; }
.flow-num {
    flex: 0 0 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    background: var(--light);
    color: var(--gray);
    transition: background 0.4s ease, color 0.4s ease;
}
.flow-step.active {
    background: #eef2ff;
    border-color: #c7d2fe;
    transform: translateX(6px);
}
.flow-step.active .flow-num { background: var(--gradient); color: var(--white); }

.lesson-demo { display: flex; justify-content: center; }
.demo-device {
    position: relative;
    width: 340px;
    height: 460px;
    border-radius: 32px;
    background: #0f172a;
    padding: 18px;
    box-shadow: 0 30px 60px -20px rgba(79, 70, 229, 0.5);
    overflow: hidden;
    color: var(--white);
}
.demo-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #cbd5e1;
    margin-bottom: 14px;
}
.demo-dot { width: 8px; height: 8px; border-radius: 50%; background: #2dd4bf; }
.demo-crumb { flex: 1; font-weight: 700; }
.demo-progress { width: 70px; height: 6px; border-radius: 4px; background: #334155; overflow: hidden; }
.demo-progress-fill {
    display: block;
    height: 100%;
    width: 25%;
    background: #5eead4;
    transition: width 0.6s ease;
}
.demo-stage {
    position: absolute;
    inset: 56px 18px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
}
.demo-stage.active { opacity: 1; transform: none; }
.demo-illus { font-size: 5rem; margin-bottom: 18px; animation: chip-bob 3s ease-in-out infinite; }
.demo-narration { font-size: 1.3rem; font-weight: 700; line-height: 1.5; color: #f8fafc; }
.demo-narration span { transition: color 0.2s ease; }
.demo-narration span.lit { color: #fde047; }
.demo-audio {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: #94a3b8;
}
.eq { display: inline-flex; gap: 3px; align-items: flex-end; height: 16px; }
.eq i { width: 3px; background: #5eead4; border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: 0.15s; }
.eq i:nth-child(3) { animation-delay: 0.3s; }
.eq i:nth-child(4) { animation-delay: 0.45s; }
.eq i:nth-child(5) { animation-delay: 0.6s; }
@keyframes eq {
    0%, 100% { height: 4px; }
    50% { height: 16px; }
}

.demo-diagram {
    position: relative;
    width: 100%;
    height: 230px;
    background: #fef9ec;
    border-radius: 18px;
    color: #334155;
    margin-bottom: 16px;
}
.diag-sun { position: absolute; top: 12px; left: 16px; font-size: 2.6rem; animation: spin 12s linear infinite; }
.diag-plant { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); font-size: 4rem; }
.diag-arrow {
    position: absolute;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    opacity: 0;
}
.demo-stage.active .diag-arrow { animation: pop-in 0.4s ease forwards; }
.diag-arrow.a1 { top: 34px; left: 80px; background: #fef3c7; color: #b45309; animation-delay: 0.4s !important; }
.diag-arrow.a2 { bottom: 30px; left: 24px; background: #dbeafe; color: #1d4ed8; animation-delay: 0.9s !important; }
.diag-arrow.a3 { top: 90px; right: 18px; background: #e2e8f0; color: #334155; animation-delay: 1.4s !important; }
.diag-out {
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-size: 0.75rem;
    font-weight: 800;
    background: #d1fae5;
    color: #047857;
    padding: 3px 8px;
    border-radius: 6px;
    opacity: 0;
}
.demo-stage.active .diag-out { animation: pop-in 0.4s ease 1.9s forwards; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop-in {
    from { opacity: 0; transform: scale(0.6); }
    to { opacity: 1; transform: scale(1); }
}
.demo-caption { font-size: 0.95rem; color: #e2e8f0; }

.demo-question { font-size: 1.2rem; font-weight: 800; margin-bottom: 18px; }
.demo-options { display: grid; gap: 10px; width: 100%; }
.opt {
    padding: 12px;
    border-radius: 12px;
    border: 2px solid #475569;
    font-weight: 700;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}
.demo-stage.picked .opt-correct {
    background: #15803d;
    border-color: #4ade80;
    transform: scale(1.03);
}
.demo-feedback-pop {
    margin-top: 14px;
    font-weight: 800;
    color: #4ade80;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.demo-stage.picked .demo-feedback-pop { opacity: 1; transform: none; }

.demo-stars { font-size: 3rem; display: flex; gap: 8px; margin-bottom: 10px; }
.demo-stars span { opacity: 0; transform: scale(0.2) rotate(-90deg); }
.demo-stage.active .demo-stars span { animation: star-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) forwards; }
.demo-stage.active .demo-stars span:nth-child(2) { animation-delay: 0.25s; }
.demo-stage.active .demo-stars span:nth-child(3) { animation-delay: 0.5s; }
@keyframes star-pop { to { opacity: 1; transform: none; } }
.demo-done { font-size: 1.5rem; font-weight: 900; color: var(--white); }
.demo-xp {
    margin-top: 10px;
    font-weight: 800;
    color: #5eead4;
    background: rgba(94, 234, 212, 0.12);
    padding: 6px 16px;
    border-radius: 50px;
}
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i {
    position: absolute;
    top: -10px;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    opacity: 0;
}
.demo-stage.active .confetti i { animation: confetti-fall 1.8s ease-in forwards; }
.confetti i:nth-child(4n+1) { background: #f59e0b; }
.confetti i:nth-child(4n+2) { background: #6366f1; }
.confetti i:nth-child(4n+3) { background: #10b981; }
.confetti i:nth-child(4n+4) { background: #ec4899; }
.confetti i:nth-child(1) { left: 6%; animation-delay: 0.1s !important; }
.confetti i:nth-child(2) { left: 14%; animation-delay: 0.4s !important; }
.confetti i:nth-child(3) { left: 23%; animation-delay: 0.2s !important; }
.confetti i:nth-child(4) { left: 31%; animation-delay: 0.6s !important; }
.confetti i:nth-child(5) { left: 40%; animation-delay: 0.3s !important; }
.confetti i:nth-child(6) { left: 49%; animation-delay: 0.5s !important; }
.confetti i:nth-child(7) { left: 57%; animation-delay: 0.15s !important; }
.confetti i:nth-child(8) { left: 66%; animation-delay: 0.45s !important; }
.confetti i:nth-child(9) { left: 74%; animation-delay: 0.25s !important; }
.confetti i:nth-child(10) { left: 82%; animation-delay: 0.55s !important; }
.confetti i:nth-child(11) { left: 89%; animation-delay: 0.35s !important; }
.confetti i:nth-child(12) { left: 95%; animation-delay: 0.05s !important; }
@keyframes confetti-fall {
    0% { opacity: 1; transform: translateY(0) rotate(0); }
    100% { opacity: 0; transform: translateY(400px) rotate(540deg); }
}

/* ----- Screenshot showcase ----- */
.showcase { padding: 100px 0; background: linear-gradient(180deg, #f8fafc, #eef2ff); }
.showcase .container { padding: 0 24px; }
.showcase-scroller {
    display: flex;
    gap: 28px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 10px max(24px, calc((100vw - 1200px) / 2 + 24px)) 30px;
    scrollbar-width: thin;
    cursor: grab;
}
.showcase-scroller.dragging { cursor: grabbing; scroll-snap-type: none; }
.shot {
    flex: 0 0 220px;
    scroll-snap-align: start;
    text-align: center;
}
.shot img {
    width: 100%;
    height: auto;
    border-radius: 26px;
    border: 7px solid #111827;
    box-shadow: var(--shadow-xl);
    transition: transform 0.35s ease;
    user-select: none;
    -webkit-user-drag: none;
}
.shot:hover img { transform: translateY(-8px) rotate(-1deg); }
.shot figcaption { margin-top: 14px; font-weight: 700; color: var(--dark-light); }

/* ----- Reading coach ----- */
#reading { background: var(--white); }
.speech-content .eyebrow { text-align: left; }
.reading-points { list-style: none; display: grid; gap: 18px; }
.reading-points li { display: flex; gap: 14px; align-items: flex-start; color: var(--gray); }
.reading-points strong { color: var(--dark); }
.rp-icon {
    flex: 0 0 44px;
    height: 44px;
    border-radius: 12px;
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.pattern-chart .substitutions { margin-top: 22px; }

/* ----- Parents ----- */
.parents { padding: 100px 24px; background: var(--light); }
.parents h2 { margin-bottom: 48px; }

/* ----- FAQ ----- */
.home-faq { padding: 100px 24px; }
.faq-accordion { display: grid; gap: 12px; margin-top: 36px; }
.faq-accordion details {
    background: var(--white);
    border: 2px solid var(--light);
    border-radius: var(--radius);
    padding: 0 22px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.faq-accordion details[open] { border-color: #c7d2fe; box-shadow: var(--shadow); }
.faq-accordion summary {
    cursor: pointer;
    list-style: none;
    padding: 18px 30px 18px 0;
    font-weight: 800;
    font-size: 1.05rem;
    position: relative;
}
.faq-accordion summary::-webkit-details-marker { display: none; }
.faq-accordion summary::after {
    content: "+";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: var(--primary);
    transition: transform 0.3s ease;
}
.faq-accordion details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-accordion details p { padding-bottom: 18px; }
.faq-accordion a, .faq-more a { color: var(--primary); font-weight: 700; }
.faq-more { text-align: center; margin-top: 28px; }

/* ----- Download sparkles ----- */
.download { position: relative; overflow: hidden; }
.download-sparkles { position: absolute; inset: 0; pointer-events: none; }
.download-sparkles i {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
}
.download-sparkles i:nth-child(1) { top: 15%; left: 10%; }
.download-sparkles i:nth-child(2) { top: 70%; left: 18%; animation-delay: 0.6s; }
.download-sparkles i:nth-child(3) { top: 25%; left: 85%; animation-delay: 1.2s; }
.download-sparkles i:nth-child(4) { top: 80%; left: 78%; animation-delay: 1.8s; }
.download-sparkles i:nth-child(5) { top: 45%; left: 5%; animation-delay: 2.4s; }
.download-sparkles i:nth-child(6) { top: 50%; left: 94%; animation-delay: 0.9s; }
@keyframes twinkle {
    0%, 100% { opacity: 0; transform: scale(0.4); }
    50% { opacity: 1; transform: scale(1.3); }
}
.download .container { position: relative; }

/* ----- Responsive ----- */
@media (max-width: 1024px) {
    .hero h1 { font-size: 2.6rem; }
    .hero-chips { justify-content: center; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .usecase-grid { grid-template-columns: repeat(2, 1fr); }
    .lesson-flow-grid { grid-template-columns: 1fr; }
    .lesson-steps h2, .lesson-steps .eyebrow, .section-subtitle.left { text-align: center; }
}

@media (max-width: 768px) {
    .hero h1 { font-size: 2.1rem; }
    .hero-usecase { font-size: 1.3rem; min-height: 2.8em; }
    .hero-usecase .typewriter-wrapper { display: inline-block; margin-top: 0; }
    .stat-num { font-size: 2.1rem; }
    .usecase-grid, .subject-grid { grid-template-columns: 1fr; }
    .demo-device { width: 300px; height: 430px; }
    .shot { flex-basis: 180px; }
    .speech-content .eyebrow { text-align: center; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.85rem; }
    .stats-grid { gap: 16px; }
    .subject-card, .usecase-card { padding: 24px; }
    .demo-device { width: 100%; max-width: 300px; }
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .js .reveal { opacity: 1; transform: none; }
    .marquee-track { animation: none; flex-wrap: wrap; width: auto; justify-content: center; }
    .marquee-track span[aria-hidden="true"] { display: none; }
}

/* Links into the generated grade pages */
.grade-links { margin-top: 14px; font-size: 0.85rem; font-weight: 700; color: var(--gray); }
.grade-links a {
    display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center;
    border-radius: 8px; background: var(--light); color: var(--primary); margin: 2px 1px;
}
.grade-links a:hover { background: var(--primary); color: var(--white); }
.inline-link { color: var(--primary); font-weight: 700; }

/* Hero phone fits the screen: its height follows the viewport, with the
   screenshots' own proportions (720×1616), instead of a fixed 600px. */
.hero {
    min-height: 0;
    padding: 112px 24px 64px;
    gap: clamp(32px, 5vw, 80px);
}
.screenshot-carousel {
    height: clamp(360px, calc(100vh - 300px), 560px);
    width: auto;
    aspect-ratio: 720 / 1616;
}
.screenshot-slide img { object-fit: cover; object-position: top; }
.hero-image { width: auto; min-width: 300px; }

@media (max-width: 1024px) {
    .hero { padding-top: 104px; }
    .screenshot-carousel { height: clamp(340px, 56vh, 500px); }
}
@media (max-width: 480px) {
    .screenshot-carousel { height: clamp(320px, 52vh, 440px); }
    .hero-image { min-width: 0; }
}

/* Keep the menu on one line on mid-size screens. */
.nav-links li { white-space: nowrap; }
@media (max-width: 1240px) and (min-width: 769px) {
    .nav-links { gap: 20px; }
    .nav-links a { font-size: 0.9rem; }
}
@media (max-width: 1100px) and (min-width: 769px) {
    .nav-links li:has(a[href="#how-it-works"]),
    .nav-links li:has(a[href="#reading"]),
    .nav-links li:has(a[href="/#reading"]) { display: none; }
}

/* Showcase: phones sized to the screen, arrows on desktop, edges aligned with the page */
.showcase { padding: 72px 0; --edge: max(24px, calc((100vw - 1200px) / 2 + 24px)); }
.showcase .section-subtitle { margin-bottom: 28px; }
.showcase-wrap { position: relative; }
.showcase-scroller { padding: 10px var(--edge) 24px; scroll-padding-inline: var(--edge); gap: 24px; }
.shot { flex: 0 0 auto; }
.shot img {
    height: clamp(300px, calc(100vh - 360px), 440px);
    width: auto;
    aspect-ratio: 720 / 1616;
    border-width: 6px;
    border-radius: 24px;
}
.shot figcaption { margin-top: 10px; font-size: 0.9rem; max-width: 200px; margin-inline: auto; }
.sc-arrow {
    position: absolute;
    top: 42%;
    z-index: 2;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    font-size: 1.8rem;
    line-height: 1;
    color: var(--dark);
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.sc-arrow:hover { transform: scale(1.08); }
.sc-arrow[disabled] { opacity: 0; pointer-events: none; }
.sc-prev { left: max(8px, calc(var(--edge) - 64px)); }
.sc-next { right: max(8px, calc(var(--edge) - 64px)); }
@media (max-width: 768px) {
    .sc-arrow { display: none; }
    .shot img { height: clamp(280px, 50vh, 380px); }
}

/* Subject cards: one clear way in */
.subject-card { display: flex; flex-direction: column; }
.subject-card .topic-list { margin-bottom: 18px; }
.subject-cta {
    margin-top: auto;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 12px;
    background: var(--dark);
    color: var(--white);
    font-weight: 800;
    font-size: 0.95rem;
    transition: transform 0.2s ease, background 0.2s ease;
}
.subject-cta:hover { background: var(--primary); transform: translateX(3px); }
.subject-math .subject-cta { background: #4f46e5; }
.subject-science .subject-cta { background: #047857; }

/* Showcase v2: the row stays inside the page width, centered, with the
   arrows outside it, faded ends and no visible scrollbar. */
.showcase-wrap { max-width: 1248px; margin: 0 auto; padding: 0 64px; position: relative; }
.showcase-scroller {
    padding: 10px 4px 20px;
    scroll-padding-inline: 4px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}
.showcase-scroller::-webkit-scrollbar { display: none; }
.sc-arrow { top: calc(50% - 44px); }
.sc-prev { left: 4px; }
.sc-next { right: 4px; }
@media (max-width: 768px) {
    .showcase-wrap { padding: 0; }
    .showcase-scroller { padding: 10px 16px 20px; scroll-padding-inline: 16px; -webkit-mask-image: none; mask-image: none; }
}

/* Whole subject card is clickable: the button's link stretches over the card. */
.subject-card { position: relative; cursor: pointer; }
.subject-card .subject-cta::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.subject-card:hover { box-shadow: var(--shadow-xl); }
.subject-card:hover .subject-cta { background: var(--primary); transform: translateX(3px); }
.all-subjects { text-align: center; margin-top: 26px; }
.all-subjects a { color: var(--primary); font-weight: 800; }
