/* ==========================================================
   AIM Math — main stylesheet
   ========================================================== */

:root {
    --navy:   #16215c;
    --blue:   #2f4bd8;
    --blue-2: #5a73f0;
    --orange: #ff7a1a;
    --yellow: #ffc93c;
    --teal:   #12b3a3;
    --pink:   #ff5d8f;
    --ink:    #1d2340;
    --muted:  #5b6280;
    --line:   #e4e7f2;
    --bg:     #fffdf8;
    --soft:   #f3f5ff;
    --cream:  #fff6e8;
    --white:  #ffffff;
    --radius: 18px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px rgba(22, 33, 92, .08);
    --shadow-lg: 0 20px 50px rgba(22, 33, 92, .14);
    --font-head: 'Baloo 2', 'Trebuchet MS', sans-serif;
    --font-body: 'Nunito', 'Segoe UI', Arial, sans-serif;
    --container: 1180px;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.7;
    color: var(--ink);
    background: var(--bg);
    overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration: none; transition: color .2s; }
a:hover { color: var(--orange); }
h1, h2, h3, h4 {
    font-family: var(--font-head);
    color: var(--navy);
    line-height: 1.2;
    margin: 0 0 .5em;
    font-weight: 700;
}
h1 { font-size: clamp(2rem, 4.5vw, 3.3rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.3em; }
.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.section { padding: 90px 0; }
.section-soft { background: var(--soft); }
.section-cream { background: var(--cream); }
.text-center { text-align: center; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--navy); color: #fff; padding: 10px 16px; z-index: 999; }
.skip-link:focus { left: 10px; top: 10px; }

.eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font-head); font-weight: 700; font-size: .95rem;
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--orange);
    background: rgba(255, 122, 26, .1);
    padding: 4px 14px; border-radius: 999px; margin-bottom: 14px;
}
.section-head { max-width: 720px; margin: 0 auto 50px; text-align: center; }
.section-head p { color: var(--muted); font-size: 1.08rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font-head); font-weight: 700; font-size: 1.05rem;
    padding: 12px 26px; border-radius: 999px; border: 2px solid transparent;
    cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s, color .2s;
    line-height: 1.3;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 8px 20px rgba(47, 75, 216, .3); }
.btn-primary:hover { background: var(--navy); color: #fff; }
.btn-accent { background: var(--orange); color: #fff; box-shadow: 0 8px 20px rgba(255, 122, 26, .3); }
.btn-accent:hover { background: #e9650a; color: #fff; }
.btn-outline { border-color: var(--navy); color: var(--navy); background: transparent; }
.btn-outline:hover { background: var(--navy); color: #fff; }
.btn-light { background: #fff; color: var(--navy); }
.btn-light:hover { background: var(--yellow); color: var(--navy); }
.btn-sm { padding: 8px 18px; font-size: .95rem; }

/* ---------- Top bar ---------- */
.topbar { background: var(--navy); color: #c9d0f5; font-size: .88rem; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 8px; padding-bottom: 8px; }
.topbar a { color: #fff; display: inline-flex; align-items: center; gap: 6px; margin-left: 18px; }
.topbar a:hover { color: var(--yellow); }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255, 253, 248, .94);
    backdrop-filter: saturate(160%) blur(10px);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    transition: box-shadow .25s;
}
.site-header.scrolled { box-shadow: 0 6px 24px rgba(22, 33, 92, .08); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 78px; }

.brand { display: flex; align-items: center; gap: 12px; color: var(--navy); }
.brand:hover { color: var(--navy); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text strong { font-family: var(--font-head); font-size: 1.75rem; font-weight: 800; letter-spacing: -.01em; }
.brand-text strong span { color: var(--orange); }
.brand-text small { font-size: .74rem; color: var(--muted); font-weight: 700; letter-spacing: .04em; margin-top: 4px; }

.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav ul { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.site-nav ul a {
    display: block; padding: 8px 16px; border-radius: 999px;
    font-family: var(--font-head); font-weight: 600; font-size: 1.08rem; color: var(--ink);
}
.site-nav ul a:hover { background: var(--soft); color: var(--blue); }
.site-nav ul a.active { background: var(--navy); color: #fff; }

.nav-toggle { display: none; width: 46px; height: 46px; border: 0; border-radius: 12px; background: var(--soft); cursor: pointer; padding: 12px 11px; flex-direction: column; justify-content: space-between; }
.nav-toggle span { display: block; height: 3px; border-radius: 3px; background: var(--navy); transition: transform .25s, opacity .25s; }
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

/* ---------- Home hero ---------- */
.hero {
    position: relative; overflow: hidden;
    padding: 70px 0 100px;
    background:
        radial-gradient(circle at 85% 20%, rgba(255, 201, 60, .35), transparent 40%),
        radial-gradient(circle at 10% 90%, rgba(18, 179, 163, .18), transparent 45%),
        linear-gradient(180deg, var(--bg), var(--soft));
}
.hero::before {
    content: ""; position: absolute; inset: 0;
    background-image: url('../images/math-pattern.svg');
    background-size: 420px; opacity: .55; pointer-events: none;
}
.hero-inner { position: relative; display: grid; grid-template-columns: 1.05fr 1fr; gap: 50px; align-items: center; }
.hero h1 span { color: var(--orange); position: relative; white-space: nowrap; }
.hero h1 span::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: .06em; height: .22em;
    background: var(--yellow); opacity: .55; z-index: -1; border-radius: 4px;
}
.hero-lead { font-size: 1.2rem; color: var(--muted); max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin: 28px 0 34px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 30px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-family: var(--font-head); font-size: 2.1rem; color: var(--navy); line-height: 1; }
.hero-stats span { color: var(--muted); font-size: .92rem; font-weight: 600; }
.hero-art { position: relative; }
.hero-art img { width: 100%; filter: drop-shadow(0 25px 40px rgba(22, 33, 92, .18)); }
.hero-badge {
    position: absolute; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
    padding: 12px 18px; font-family: var(--font-head); font-weight: 700; color: var(--navy);
    display: flex; align-items: center; gap: 10px; font-size: 1rem;
    animation: float 5s ease-in-out infinite;
}
.hero-badge .dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.hero-badge.b1 { top: 6%; left: -4%; }
.hero-badge.b1 .dot { background: var(--teal); }
.hero-badge.b2 { bottom: 8%; right: -2%; animation-delay: -2.5s; }
.hero-badge.b2 .dot { background: var(--pink); }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---------- Cards / features ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }

.card {
    background: #fff; border-radius: var(--radius); padding: 30px 28px;
    box-shadow: var(--shadow); border: 1px solid var(--line);
    transition: transform .25s, box-shadow .25s;
    position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.card p { color: var(--muted); margin-bottom: 0; }
.card-icon {
    width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center;
    color: #fff; margin-bottom: 18px; font-size: 1.6rem;
}
.card-icon .icon { width: 30px; height: 30px; }
.c-blue   { background: var(--blue); }
.c-orange { background: var(--orange); }
.c-teal   { background: var(--teal); }
.c-pink   { background: var(--pink); }
.c-yellow { background: var(--yellow); color: var(--navy); }
.c-navy   { background: var(--navy); }

.program-card { padding: 0; }
.program-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--soft); }
.program-card .card-body { padding: 24px 26px 28px; }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--blue); background: var(--soft); padding: 3px 10px; border-radius: 999px; margin-bottom: 10px; }

/* Lab tiles on home page */
.lab-tile {
    display: flex; align-items: center; gap: 16px;
    background: #fff; border-radius: var(--radius-sm); padding: 18px 20px;
    border: 1px solid var(--line); color: var(--navy);
    font-family: var(--font-head); font-weight: 700; font-size: 1.08rem; line-height: 1.25;
    transition: transform .2s, border-color .2s, box-shadow .2s;
}
.lab-tile:hover { transform: translateY(-3px); border-color: var(--orange); box-shadow: var(--shadow); color: var(--navy); }
.lab-tile .tile-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.lab-tile .tile-icon .icon { width: 24px; height: 24px; }

/* Equation / formula banner */
.formula {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 18px;
    font-family: var(--font-head); font-weight: 800; font-size: clamp(1.4rem, 3.5vw, 2.4rem); color: var(--navy);
}
.formula span { background: #fff; border-radius: 16px; padding: 10px 24px; box-shadow: var(--shadow); }
.formula .op { background: transparent; box-shadow: none; padding: 0; color: var(--orange); }
.formula .result { background: var(--navy); color: #fff; }

/* Checklist */
.checklist { list-style: none; padding: 0; }
.checklist li { position: relative; padding-left: 38px; margin-bottom: 14px; }
.checklist li::before {
    content: ""; position: absolute; left: 0; top: .25em; width: 24px; height: 24px; border-radius: 50%;
    background: var(--teal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E") center / 15px no-repeat;
}

/* Image frame */
.img-frame { position: relative; }
.img-frame img { border-radius: 24px; box-shadow: var(--shadow-lg); width: 100%; }
.img-frame::before {
    content: ""; position: absolute; inset: 18px -18px -18px 18px; border-radius: 24px;
    background: var(--yellow); z-index: -1;
}

/* Schedule table */
.schedule { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.schedule div { background: #fff; border-radius: 14px; padding: 18px 12px; text-align: center; border: 1px solid var(--line); }
.schedule strong { display: block; font-family: var(--font-head); color: var(--navy); font-size: 1.1rem; }
.schedule span { font-size: .9rem; color: var(--muted); }
.schedule .test { background: var(--navy); border-color: var(--navy); }
.schedule .test strong, .schedule .test span { color: #fff; }

/* Quote */
.quote-box {
    background: var(--navy); color: #fff; border-radius: 26px; padding: 50px;
    position: relative; overflow: hidden;
}
.quote-box::after {
    content: "\201C"; position: absolute; right: 30px; top: -30px; font-size: 14rem;
    font-family: Georgia, serif; color: rgba(255, 255, 255, .08); line-height: 1;
}
.quote-box h2, .quote-box h3 { color: #fff; }
.quote-box p { color: #d4daf8; font-size: 1.12rem; }

/* ---------- Inner page hero ---------- */
.page-hero {
    position: relative; overflow: hidden;
    background: linear-gradient(120deg, var(--navy) 0%, #24338a 60%, var(--blue) 100%);
    color: #fff; padding: 56px 0;
}
.page-hero::before {
    content: ""; position: absolute; inset: 0;
    background-image: url('../images/math-pattern-light.svg'); background-size: 380px; opacity: .25;
}
.page-hero-inner { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.page-hero h1 { color: #fff; margin-bottom: .2em; }
.page-hero p { color: #d4daf8; font-size: 1.12rem; max-width: 620px; margin: 0; }
.page-hero-art { width: 300px; max-width: 34%; flex-shrink: 0; }
.breadcrumb { font-size: .92rem; margin-bottom: 10px; color: #aab4ec; }
.breadcrumb a { color: var(--yellow); }
.breadcrumb a:hover { color: #fff; }
.breadcrumb span { margin: 0 4px; }

/* ---------- Math Lab layout ---------- */
.lab-layout { display: grid; grid-template-columns: 290px 1fr; gap: 44px; padding-top: 50px; padding-bottom: 80px; align-items: start; }
.lab-sidebar { position: sticky; top: 100px; display: flex; flex-direction: column; gap: 22px; }
.lab-menu { background: #fff; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.lab-menu summary {
    list-style: none; cursor: pointer;
    font-family: var(--font-head); font-weight: 700; font-size: 1.15rem;
    background: var(--orange); color: #fff; padding: 14px 20px;
    display: flex; justify-content: space-between; align-items: center;
}
.lab-menu summary::-webkit-details-marker { display: none; }
.lab-menu summary::after { content: "\25BE"; transition: transform .2s; }
.lab-menu:not([open]) summary::after { transform: rotate(-90deg); }
.lab-menu ul { list-style: none; margin: 0; padding: 8px; }
.lab-menu li a {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
    color: var(--ink); font-weight: 700; font-size: .98rem; line-height: 1.3;
}
.lab-menu li a .icon { color: var(--blue); width: 20px; height: 20px; }
.lab-menu li a:hover { background: var(--soft); color: var(--blue); }
.lab-menu li a.active { background: var(--navy); color: #fff; }
.lab-menu li a.active .icon { color: var(--yellow); }

.sidebar-card {
    background: linear-gradient(140deg, var(--teal), #0c8f84); color: #fff;
    border-radius: var(--radius); padding: 24px;
}
.sidebar-card h3 { color: #fff; margin-bottom: .3em; }
.sidebar-card p { color: #e0fbf8; font-size: .95rem; }

.lab-content { min-width: 0; }

/* Article typography */
.prose > *:first-child { margin-top: 0; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; color: var(--blue); }
.prose p, .prose li { color: #343a5c; }
.prose .lead { font-size: 1.2rem; color: var(--ink); font-weight: 600; }
.prose img { border-radius: var(--radius); margin: 10px 0 24px; }
.prose ol li, .prose ul li { margin-bottom: .45em; }
.prose blockquote {
    margin: 28px 0; padding: 22px 26px; border-left: 6px solid var(--orange);
    background: var(--cream); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 1.12rem; font-weight: 600; color: var(--navy);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.callout {
    display: flex; gap: 18px; align-items: flex-start;
    background: var(--soft); border-radius: var(--radius); padding: 22px 24px; margin: 28px 0;
    border: 1px dashed #c4ccf3;
}
.callout .card-icon { margin: 0; width: 50px; height: 50px; border-radius: 14px; }
.callout .card-icon .icon { width: 26px; height: 26px; }
.callout p:last-child { margin-bottom: 0; }

.feature-figure { margin: 6px 0 30px; border-radius: var(--radius); overflow: hidden; background: var(--soft); }
.feature-figure img { margin: 0; border-radius: 0; width: 100%; }
.feature-figure figcaption { font-size: .9rem; color: var(--muted); padding: 10px 16px; }

.mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 20px 0 28px; }
.mini-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.mini-card h4 { margin: 0 0 .3em; font-size: 1.1rem; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.mini-card h4 .icon { color: var(--orange); }
.mini-card p { margin: 0; font-size: .97rem; color: var(--muted); }

.num-list { list-style: none; padding: 0; counter-reset: n; }
.num-list li { counter-increment: n; position: relative; padding: 14px 18px 14px 66px; background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; }
.num-list li::before {
    content: counter(n); position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; border-radius: 10px; background: var(--orange); color: #fff;
    font-family: var(--font-head); font-weight: 800; display: grid; place-items: center;
}
.num-list li:nth-child(3n+2)::before { background: var(--blue); }
.num-list li:nth-child(3n)::before { background: var(--teal); }

.station-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 22px 0 30px; }
.station { text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 8px; font-weight: 700; font-size: .92rem; color: var(--navy); }
.station b { display: block; width: 40px; height: 40px; margin: 0 auto 8px; border-radius: 50%; color: #fff; font-family: var(--font-head); line-height: 40px; font-size: 1.15rem; }

.lab-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 50px; padding-top: 30px; border-top: 2px dashed var(--line); }
.lab-pager a { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; color: var(--navy); font-family: var(--font-head); font-weight: 700; font-size: 1.08rem; transition: border-color .2s, transform .2s; }
.lab-pager a:hover { border-color: var(--orange); transform: translateY(-2px); }
.lab-pager small { font-family: var(--font-body); color: var(--muted); font-size: .85rem; font-weight: 700; }
.lab-pager .pager-next { text-align: right; grid-column: 2; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 40px; align-items: start; }
.contact-info { display: flex; flex-direction: column; gap: 18px; }
.info-item { display: flex; gap: 16px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.info-item .card-icon { margin: 0; width: 52px; height: 52px; border-radius: 14px; }
.info-item .card-icon .icon { width: 26px; height: 26px; }
.info-item h3 { margin: 0 0 .15em; font-size: 1.15rem; }
.info-item p { margin: 0; color: var(--muted); }

.form-card { background: #fff; border-radius: 24px; padding: 38px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: .95rem; margin-bottom: 6px; color: var(--navy); }
.field input, .field select, .field textarea {
    width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
    padding: 12px 16px; border: 2px solid var(--line); border-radius: 12px; background: #fbfcff;
    transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47, 75, 216, .12); background: #fff; }
.field textarea { min-height: 140px; resize: vertical; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { padding: 14px 18px; border-radius: 12px; margin-bottom: 20px; font-weight: 600; }
.alert-success { background: #e3f8f4; color: #0b6f65; border: 1px solid #b4ece3; }
.alert-error { background: #ffecef; color: #b0193c; border: 1px solid #ffc6d2; }
.alert ul { margin: 6px 0 0; }

/* ---------- CTA band ---------- */
.cta-band { background: linear-gradient(110deg, var(--orange), #ff9a3c 55%, var(--yellow)); padding: 50px 0; position: relative; overflow: hidden; }
.cta-band::before { content: ""; position: absolute; inset: 0; background-image: url('../images/math-pattern-light.svg'); background-size: 340px; opacity: .3; }
.cta-inner { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.cta-band h2 { color: #fff; margin: 0 0 .15em; }
.cta-band p { color: #fff6ea; margin: 0; font-size: 1.1rem; font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { background: #0f1744; color: #b8c0e8; font-size: .97rem; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1.2fr 1.3fr; gap: 40px; padding-top: 64px; padding-bottom: 50px; }
.site-footer h3 { color: #fff; font-size: 1.2rem; margin-bottom: 16px; }
.brand-footer, .brand-footer:hover { color: #fff; margin-bottom: 16px; }
.brand-footer .brand-text small { color: #8f99cf; }
.footer-links, .footer-contact { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 8px; }
.site-footer a { color: #d9defa; }
.site-footer a:hover { color: var(--yellow); }
.footer-contact li { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.footer-contact .icon { color: var(--yellow); margin-top: 4px; }
.social { display: flex; gap: 10px; margin-top: 10px; }
.social a { background: rgba(255, 255, 255, .08); padding: 6px 14px; border-radius: 999px; font-size: .9rem; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .08); }
.footer-bottom-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 18px; font-size: .9rem; }


/* ---------- Reveal animation ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .js .reveal { opacity: 1; transform: none; }
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 1080px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .hero-badge.b1 { left: 0; }
    .hero-badge.b2 { right: 0; }
}

@media (max-width: 960px) {
    .nav-toggle { display: flex; }
    .site-nav {
        position: absolute; left: 0; right: 0; top: 100%;
        height: calc(100vh - 78px); overflow-y: auto;
        flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 18px;
        background: var(--bg); padding: 24px 24px 30px; border-top: 1px solid var(--line);
        opacity: 0; visibility: hidden; transform: translateY(-10px);
        transition: opacity .25s, transform .25s, visibility .25s;
    }
    .nav-open .site-nav { opacity: 1; visibility: visible; transform: none; }
    .nav-open { overflow: hidden; }
    .site-nav ul { flex-direction: column; gap: 6px; }
    .site-nav ul a { font-size: 1.3rem; padding: 14px 18px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
    .nav-cta { justify-content: center; }

    .hero-inner, .grid-2, .contact-grid { grid-template-columns: 1fr; gap: 40px; }
    .hero { padding: 50px 0 70px; }
    .hero-art { max-width: 560px; margin: 0 auto; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .lab-layout { grid-template-columns: 1fr; gap: 28px; padding-top: 28px; }
    .lab-sidebar { position: static; }
    .lab-sidebar .sidebar-card { display: none; }
    .schedule { grid-template-columns: repeat(3, 1fr); }
    .section { padding: 70px 0; }
}

@media (max-width: 680px) {
    body { font-size: 16px; }
    .container { padding: 0 16px; }
    .topbar-note { display: none; }
    .topbar-inner { justify-content: center; }
    .topbar a { margin-left: 0; }
    .grid-3, .grid-4, .mini-grid, .form-row { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 30px; }
    .page-hero { padding: 40px 0; }
    .page-hero-art { display: none; }
    .station-row { grid-template-columns: repeat(2, 1fr); }
    .schedule { grid-template-columns: repeat(2, 1fr); }
    .form-card, .quote-box { padding: 26px 20px; }
    .lab-pager { grid-template-columns: 1fr; }
    .lab-pager .pager-next { grid-column: auto; }
    .hero-badge { font-size: .88rem; padding: 8px 12px; }
    .hero-badge .dot { width: 28px; height: 28px; }
    .brand-text strong { font-size: 1.5rem; }
    .brand img { width: 40px; height: 40px; }
    .section { padding: 56px 0; }
    .section-head { margin-bottom: 34px; }
    .img-frame::before { inset: 10px -10px -10px 10px; }
    .callout { flex-direction: column; }
}

/* Utilities */
.container-narrow { max-width: 900px; }
.formula-spaced { margin-bottom: 50px; }

/* ---------- Math Lab content components ---------- */
.fact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin: 18px 0 30px; }
.fact-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px 20px 18px; box-shadow: var(--shadow); }
.fact-card p { margin: 0; font-weight: 600; color: var(--ink); }
.fact-num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--yellow); color: var(--navy); font-family: var(--font-head); font-weight: 800; margin-bottom: 10px; }
.fact-card:nth-child(3n+2) .fact-num { background: var(--teal); color: #fff; }
.fact-card:nth-child(3n) .fact-num { background: var(--pink); color: #fff; }

.wonder-list { display: grid; gap: 12px; margin: 18px 0 30px; }
.wonder { font-family: var(--font-head); font-weight: 700; font-size: clamp(1.1rem, 2.6vw, 1.5rem); color: #fff; background: linear-gradient(110deg, var(--navy), var(--blue)); border-radius: 14px; padding: 14px 22px; overflow-wrap: anywhere; }

.riddles { display: grid; gap: 12px; margin-top: 16px; }
.riddle { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.riddle summary { list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: flex-start; padding: 16px 20px; font-weight: 700; color: var(--navy); }
.riddle summary::-webkit-details-marker { display: none; }
.riddle summary .icon { color: var(--orange); margin-top: 4px; }
.riddle summary::after { content: "Reveal"; margin-left: auto; font-size: .8rem; background: var(--soft); color: var(--blue); padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.riddle[open] summary::after { content: "Hide"; }
.riddle p { margin: 0; padding: 0 20px 18px 52px; color: var(--teal); font-weight: 700; font-size: 1.08rem; }

.content-table { width: 100%; border-collapse: collapse; margin: 16px 0 30px; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); font-size: .97rem; }
.content-table th { background: var(--navy); color: #fff; text-align: left; padding: 12px 16px; font-family: var(--font-head); font-weight: 700; }
.content-table td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: top; }
.content-table tr:nth-child(even) td { background: #fafbff; }
.table-wrap { overflow-x: auto; }

.story-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; margin: 22px 0; box-shadow: var(--shadow); border-top: 5px solid var(--orange); }
.story-card:nth-of-type(3n+2) { border-top-color: var(--blue); }
.story-card:nth-of-type(3n) { border-top-color: var(--teal); }
.story-card h3 { margin-top: 0; color: var(--navy); }
.story-card .moral { background: var(--cream); border-radius: 10px; padding: 12px 16px; font-weight: 700; color: var(--navy); margin: 0; }

.op-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 18px 0 30px; }
.op-card { border-radius: 16px; padding: 22px; color: #fff; }
.op-card h3 { color: #fff; margin: 0 0 .3em; display: flex; align-items: center; gap: 10px; }
.op-card h3 .sym { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.22); display: grid; place-items: center; font-size: 1.6rem; }
.op-card p { color: rgba(255,255,255,.92); margin: 0; }

@media (max-width: 680px) {
    .op-grid { grid-template-columns: 1fr; }
    .riddle p { padding-left: 20px; }
}

.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 18px; }
.game-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); transition: transform .2s; }
.game-card:hover { transform: translateY(-4px); }
.game-card h3 { margin: 10px 0 .4em; color: var(--navy); font-size: 1.2rem; }
.game-card p { margin: 0; font-size: .98rem; }
.game-letter { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--orange); color: #fff; font-family: var(--font-head); font-weight: 800; font-size: 1.3rem; }
.game-card:nth-child(4n+2) .game-letter { background: var(--blue); }
.game-card:nth-child(4n+3) .game-letter { background: var(--teal); }
.game-card:nth-child(4n) .game-letter { background: var(--pink); }
.callout .riddle { margin-top: 12px; }
@media (max-width: 680px) { .game-grid { grid-template-columns: 1fr; } }

.shape-row { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-end; justify-content: center; background: var(--soft); border-radius: var(--radius); padding: 30px 20px; margin: 10px 0 30px; }
.shape { display: block; }
.shape-triangle { width: 0; height: 0; border-left: 42px solid transparent; border-right: 42px solid transparent; border-bottom: 74px solid var(--yellow); }
.shape-square { width: 72px; height: 72px; background: var(--blue); border-radius: 8px; transform: rotate(8deg); }
.shape-circle { width: 78px; height: 78px; background: var(--teal); border-radius: 50%; }
.shape-rect { width: 110px; height: 60px; background: var(--pink); border-radius: 8px; transform: rotate(-6deg); }

.quote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 18px 0 34px; }
.quote-card { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: space-between; border-left: 5px solid var(--yellow); }
.quote-card:nth-child(3n+2) { border-left-color: var(--teal); }
.quote-card:nth-child(3n) { border-left-color: var(--pink); }
.prose .quote-card blockquote { margin: 0 0 12px; padding: 0; border: 0; background: none; font-size: 1.08rem; }
.quote-card figcaption { font-family: var(--font-head); font-weight: 700; color: var(--orange); }

.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 18px; }
.role-item { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; font-family: var(--font-head); font-weight: 700; color: var(--navy); line-height: 1.25; }
.role-item .tile-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.role-item .tile-icon .icon { width: 22px; height: 22px; }
.prose .quote-box p { color: #d4daf8; }
.prose .callout h3, .prose .op-card h3 { margin-top: 0; }
.prose .callout h3 { color: var(--navy); }
