/* Academics-page-specific variables (colors/fonts come from style.css) */
:root {
    --cbs-yellow: #F9C013;
    --page-bg: #F9F9FF;
    --bg-card-light: #E4E4F0;
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
}

body { background: var(--page-bg); }

.container { max-width: 1140px; }

.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: 0.3s ease;
    border: none;
}
.btn-navy { background-color: var(--primary-dark); color: #fff; }
.btn-yellow { background-color: var(--cbs-yellow); color: var(--primary-dark); }
.btn-outline { background-color: transparent; border: 1px solid rgba(255,255,255,0.4); color: #fff; }


/* ===== Intro Section ===== */
.intro { text-align: center; padding: 80px 0 60px; }
.badge {
    background-color: #F9C013;
    color: #1E293B;
    font-size: 11px;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 24px;
}
.intro h1 { font-size: 52px; margin-bottom: 20px; }
.intro p { max-width: 600px; margin: 0 auto; font-size: 15px; color: #475569; }

/* ===== Philosophy Bento Grid ===== */
.philosophy-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 24px;
    margin-bottom: 100px;
}

.card {
    background: var(--page-bg);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
    overflow: hidden;
    border: 1px solid #E2E8F0;
}

.card h3 { font-size: 22px; margin-bottom: 14px; position: relative; z-index: 2; }
.card p { font-size: 14px; color: #475569; line-height: 1.6; position: relative; z-index: 2; }
.icon-wrap { margin-bottom: 24px; color: #1E293B; position: relative; z-index: 2; }

.card-navy { background: #0B172E; border: none; }
.card-navy h3, .card-navy p { color: #fff; }
.card-navy p { opacity: 0.8; }
.card-navy .icon-wrap { color: #FFFFFF; }

.card-gray { background: var(--bg-card-light); border: none; }

/* Grid Spans */
.cell-1 { grid-column: span 3; background: #E4E4F0; border: none; }
.cell-2 { grid-column: span 3; }
.cell-3 { grid-column: span 2; }
.cell-4 { grid-column: span 4; }
.cell-5 { grid-column: span 4; }
.cell-6 { grid-column: span 2; }

/* ===== CIRCLE CARD FLEX ===== */
.card-wide-flex {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    padding-right: 320px !important;
    background: #E4E4F0;
    min-height: 300px;
}
.card-wide-flex .card-content {
    max-width: 100%;
    position: relative;
    z-index: 2;
}
.circle-img {
    position: absolute !important;
    right: 32px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 260px !important;
    height: 260px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    z-index: 1 !important;
    display: block !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* ===== Learning Path Section ===== */
.learning-section { background: var(--page-bg); padding: 80px 0 60px; }
.section-header { margin-bottom: 80px; text-align: left; }
.section-header h2 { font-size: 42px; margin-bottom: 16px; }
.section-header p { font-size: 16px; max-width: 420px; line-height: 1.6; }

.stage-label {
    display: flex; align-items: center; gap: 12px; font-size: 11px;
    font-weight: 700; color: #94A3B8; text-transform: uppercase;
    letter-spacing: 1.5px; margin-bottom: 16px;
}
.stage-label::before { content: ""; display: block; width: 30px; height: 1px; background: #D4AF37; }

.feature-list { list-style: none; margin-top: 24px; }
.feature-list li { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 600; color: var(--text-dark); margin-bottom: 14px; }
.feature-icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

.stage-i-row  { display: grid; grid-template-columns: 1fr 1.2fr; gap: 80px; align-items: start; margin-bottom: 100px; }
.stage-i-text h2 { font-size: 38px; margin-bottom: 16px; line-height: 1.1; }
.comp-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.comp-1-left,
.comp-1-right {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: var(--border-radius-md);
}

.stage-ii-row { display: grid; grid-template-columns: 1.2fr 1fr; gap: 80px; align-items: start; margin-bottom: 100px; }
.stage-ii-text h2 { font-size: 38px; margin-bottom: 16px; line-height: 1.1; }
.comp-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.comp-2-left,
.comp-2-right {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 480px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: var(--border-radius-md);
}
.comp-2-right { margin-top: 48px; }

.stage-iii-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 80px; align-items: center; margin-bottom: 40px; }
.stage-iii-text h2 { font-size: 38px; margin-bottom: 16px; line-height: 1.1; }
.comp-3 img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 20px; }

/* Beyond the Classroom */
.beyond-section { padding: 80px 0; background: var(--page-bg); }
.beyond-row { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: start; }
.beyond-text { text-align: left; width: 100%; }
.beyond-text h2 { font-size: 34px; margin-bottom: 16px; text-align: left; }
.beyond-text p { text-align: left; margin: 0; }
.card-list { display: flex; flex-direction: column; gap: 16px; margin-top: 28px; }
.info-card { background: var(--bg-card-light); padding: 20px 24px; border-radius: var(--border-radius-md); display: flex; align-items: flex-start; gap: 16px; }
.info-card h4 { color: var(--primary-dark); font-size: 15px; margin-bottom: 4px; font-weight: 600; }
.beyond-image { position: relative; padding-top: 0; }
.beyond-image img { width: 100%; border-radius: 16px; object-fit: cover; height: 360px; }
.floating-badge { position: absolute; bottom: -16px; left: 20px; background: #9A7E15; color: #fff; padding: 16px 24px; border-radius: 8px; font-size: 14px; font-weight: 500; line-height: 1.5; }

/* CTA Banner */
.cta-banner { background: var(--primary-dark); border-radius: 24px; padding: 60px; text-align: center; color: #fff; margin: 80px 0 60px; }
.cta-banner h2 { color: #fff; font-size: 32px; margin-bottom: 12px; }
.cta-banner p { color: rgba(255,255,255,0.8); font-size: 15px; margin-bottom: 32px; }
.cta-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }


/* =============================================
   RESPONSIVE — mobile-first from 340 px up
   ============================================= */

/* --- 340px base (smallest supported viewport) --- */
@media (max-width: 479px) {
    .container { padding-left: 16px; padding-right: 16px; }

    /* Intro */
    .intro { padding: 48px 0 36px; }
    .intro h1 { font-size: 26px; line-height: 1.2; }
    .intro p { font-size: 14px; }

    /* Philosophy grid → single column */
    .philosophy-grid { grid-template-columns: 1fr; gap: 16px; margin-bottom: 48px; }
    .cell-1, .cell-2, .cell-3, .cell-4, .cell-5, .cell-6 { grid-column: span 1; }
    .card { padding: 28px 24px; }
    .card h3 { font-size: 18px; }

    /* Wide-flex cards → stacked */
    .card-wide-flex { flex-direction: column; align-items: flex-start; padding: 28px 24px !important; min-height: unset; }
    .card-wide-flex .card-content { margin-bottom: 24px; padding-right: 0; }
    .circle-img {
        position: relative !important; right: auto !important; top: auto !important;
        transform: none !important; width: 180px !important; height: 180px !important;
        margin: 0 auto !important;
    }

    /* Learning section */
    .learning-section { padding: 48px 0 32px; }
    .section-header { margin-bottom: 40px; }
    .section-header h2 { font-size: 26px; }
    .section-header p { font-size: 14px; }

    /* Stage rows → single column */
    .stage-i-row, .stage-ii-row, .stage-iii-row {
        grid-template-columns: 1fr; gap: 28px; margin-bottom: 48px;
    }
    .stage-i-text h2, .stage-ii-text h2, .stage-iii-text h2 { font-size: 24px; }
    .stage-ii-row .comp-2 { order: 1; }
    .stage-ii-row .stage-ii-text { order: 0; }

    /* Image pairs → side by side small, shorter ratio so the pair doesn't run tall */
    .comp-1 { grid-template-columns: 1fr 1fr; gap: 10px; }
    .comp-2 { grid-template-columns: 1fr 1fr; gap: 8px; }
    .comp-1-left, .comp-1-right { max-height: 220px; }
    .comp-2-left, .comp-2-right { max-height: 280px; }
    .comp-2-right { margin-top: 24px; }

    /* Beyond */
    .beyond-section { padding: 48px 0; }
    .beyond-row { grid-template-columns: 1fr; gap: 32px; }
    .beyond-text h2 { font-size: 22px; }
    .beyond-image img { height: 220px; }
    .floating-badge { font-size: 12px; padding: 12px 16px; left: 12px; bottom: -12px; }

    /* CTA */
    .cta-banner { padding: 36px 20px; border-radius: 16px; margin: 48px 0 36px; }
    .cta-banner h2 { font-size: 22px; }
    .cta-actions { flex-direction: column; align-items: center; gap: 12px; }
    .cta-actions .btn { width: 100%; text-align: center; }
}

/* --- 480px – 767px (large phones / small tablets) --- */
@media (min-width: 480px) and (max-width: 767px) {
    .container { padding-left: 20px; padding-right: 20px; }

    .intro { padding: 60px 0 44px; }
    .intro h1 { font-size: 32px; }

    .philosophy-grid { grid-template-columns: 1fr; gap: 18px; margin-bottom: 60px; }
    .cell-1, .cell-2, .cell-3, .cell-4, .cell-5, .cell-6 { grid-column: span 1; }
    .card { padding: 32px 28px; }

    .card-wide-flex { flex-direction: column; align-items: flex-start; padding: 32px 28px !important; min-height: unset; }
    .card-wide-flex .card-content { margin-bottom: 28px; padding-right: 0; }
    .circle-img {
        position: relative !important; right: auto !important; top: auto !important;
        transform: none !important; width: 200px !important; height: 200px !important;
        margin: 0 auto !important;
    }

    .learning-section { padding: 60px 0 40px; }
    .section-header { margin-bottom: 48px; }
    .section-header h2 { font-size: 30px; }

    .stage-i-row, .stage-ii-row, .stage-iii-row {
        grid-template-columns: 1fr; gap: 32px; margin-bottom: 56px;
    }
    .stage-i-text h2, .stage-ii-text h2, .stage-iii-text h2 { font-size: 28px; }
    .stage-ii-row .comp-2 { order: 1; }
    .stage-ii-row .stage-ii-text { order: 0; }

    .beyond-section { padding: 56px 0; }
    .beyond-row { grid-template-columns: 1fr; gap: 36px; }
    .beyond-text h2 { font-size: 26px; }
    .beyond-image img { height: 260px; }
    .floating-badge { font-size: 13px; padding: 13px 18px; }

    .cta-banner { padding: 44px 28px; margin: 56px 0 44px; }
    .cta-banner h2 { font-size: 26px; }
    .cta-actions { flex-direction: column; align-items: center; gap: 12px; }
    .cta-actions .btn { width: 100%; text-align: center; }
}

/* --- 768px – 1023px (tablets) --- */
@media (min-width: 768px) and (max-width: 1023px) {
    .intro h1 { font-size: 40px; }

    .philosophy-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .cell-1, .cell-2, .cell-3, .cell-6 { grid-column: span 1; }
    .cell-4, .cell-5 { grid-column: span 2; }

    .card-wide-flex { padding-right: 260px !important; min-height: 260px; }
    .circle-img { width: 200px !important; height: 200px !important; right: 24px !important; }

    .section-header h2 { font-size: 34px; }
    .stage-i-row, .stage-ii-row, .stage-iii-row { gap: 40px; }
    .stage-i-text h2, .stage-ii-text h2, .stage-iii-text h2 { font-size: 30px; }

    .beyond-text h2 { font-size: 28px; }
    .beyond-row { gap: 48px; }

    .cta-banner { padding: 48px 40px; }
    .cta-banner h2 { font-size: 28px; }
}

/* --- 1024px+ (desktop — already handled by base styles) --- */

/* ===== ANIMATIONS ===== */

/* --- Base fade-up state (applied via JS) --- */
.fade-up {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.65s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}
.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays for children */
.stagger-children > * { opacity: 0; transform: translateY(28px); transition: opacity 0.55s cubic-bezier(0.4,0,0.2,1), transform 0.55s cubic-bezier(0.4,0,0.2,1); }
.stagger-children.visible > *:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0ms; }
.stagger-children.visible > *:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 80ms; }
.stagger-children.visible > *:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 160ms; }
.stagger-children.visible > *:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 240ms; }
.stagger-children.visible > *:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 320ms; }
.stagger-children.visible > *:nth-child(6) { opacity: 1; transform: translateY(0); transition-delay: 400ms; }

/* --- Hero on-load animation --- */
@keyframes heroFadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
.intro .badge   { animation: heroFadeUp 0.6s cubic-bezier(0.4,0,0.2,1) 0.1s both; }
.intro h1       { animation: heroFadeUp 0.6s cubic-bezier(0.4,0,0.2,1) 0.22s both; }
.intro p        { animation: heroFadeUp 0.6s cubic-bezier(0.4,0,0.2,1) 0.34s both; }

/* --- Card hover lift --- */
.card {
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1),
                box-shadow 0.28s cubic-bezier(0.4,0,0.2,1),
                border-color 0.28s ease;
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.09);
}
.card-navy:hover { box-shadow: 0 12px 32px rgba(11,23,46,0.35); }

/* --- Info card hover --- */
.info-card {
    transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease, border-left-color 0.25s ease;
    border-left: 3px solid transparent;
}
.info-card:hover {
    background: #e4eaf2;
    border-left-color: #D4AF37;
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* --- Card list stagger (info cards in beyond section) --- */
.card-list-stagger > .info-card {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.5s cubic-bezier(0.4,0,0.2,1),
                transform 0.5s cubic-bezier(0.4,0,0.2,1),
                background 0.25s ease,
                border-left-color 0.25s ease,
                box-shadow 0.25s ease;
}
.card-list-stagger.visible > .info-card:nth-child(1) { opacity: 1; transform: translateX(0); transition-delay: 0ms; }
.card-list-stagger.visible > .info-card:nth-child(2) { opacity: 1; transform: translateX(0); transition-delay: 120ms; }
.card-list-stagger.visible > .info-card:nth-child(3) { opacity: 1; transform: translateX(0); transition-delay: 240ms; }

/* Hover still works after animating in */
.card-list-stagger.visible > .info-card:hover {
    background: #e4eaf2;
    border-left-color: #D4AF37;
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* --- Floating badge bounce-in --- */
@keyframes badgePop {
    0%   { opacity: 0; transform: scale(0.75); }
    70%  { transform: scale(1.06); }
    100% { opacity: 1; transform: scale(1); }
}
.floating-badge.visible {
    animation: badgePop 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.3s both;
}
.floating-badge { opacity: 0; }

/* --- Shimmer on CTA yellow button --- */
.btn-yellow {
    position: relative;
    overflow: hidden;
}
.btn-yellow::after {
    content: '';
    position: absolute;
    top: 0; left: -75%;
    width: 50%; height: 100%;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.45) 50%, transparent 70%);
    transform: skewX(-20deg);
    transition: left 0.55s ease;
}
.btn-yellow:hover::after { left: 130%; }

/* --- Stage label line draw --- */
.stage-label::before {
    width: 0;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1) 0.2s;
}
.stage-label.line-visible::before { width: 30px; }

/* --- Staggered image pair reveal --- */
.img-reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s cubic-bezier(0.4,0,0.2,1), transform 0.6s cubic-bezier(0.4,0,0.2,1); }
.img-reveal.visible { opacity: 1; transform: translateY(0); }
.img-reveal.delay-1 { transition-delay: 150ms; }

/* --- Card pair reveal: fade-in + slide-up, 2 cards per scroll trigger.
   Applied via JS (initCardPairReveal) to the philosophy-grid cards and
   the beyond-section info-cards. Each group of 2 fades up together the
   moment that group scrolls into view — independent of the other
   groups — rather than the whole list animating in at once. --- */
.reveal-pair {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal-pair.visible {
    opacity: 1;
    transform: translateY(0);
}
/* Second card in each pair lands a beat after the first */
.reveal-pair.reveal-pair-delay.visible {
    transition-delay: 140ms;
}

/* ===========================================================
   PHILOSOPHY GRID — scroll-triggered entrance + icon
   micro-interaction.

   Reuses the site's existing IntersectionObserver pattern:
   add class="philosophy-grid stagger-children" to the grid
   container in academics.html. When the observer adds
   .visible to that container (same way it already does for
   other .stagger-children / .fade-up sections), each card
   fades up in sequence as the section scrolls into view.
   The existing .stagger-children rules already handle 6
   children with staggered delays (0ms → 400ms) — the rule
   below only layers in a slight scale to match the card look.
   =========================================================== */
.philosophy-grid.stagger-children > .card {
    transform: translateY(28px) scale(0.98);
}
.philosophy-grid.stagger-children.visible > .card {
    transform: translateY(0) scale(1);
}

/* Icon nudges and gently bounces on card hover */
.philosophy-grid .icon-wrap svg,
.philosophy-grid .icon-wrap i {
    display: inline-block;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.philosophy-grid .card:hover .icon-wrap svg,
.philosophy-grid .card:hover .icon-wrap i {
    transform: translateY(-4px) rotate(-6deg) scale(1.08);
}

/* Subtle gold border-glow sweep on hover for cards */
.philosophy-grid .card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(120deg, transparent 40%, rgba(212,175,55,0.55) 50%, transparent 60%);
    background-size: 220% 220%;
    background-position: -120% 0;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}
.philosophy-grid .card:hover::before {
    opacity: 1;
    animation: borderSweep 1.1s ease forwards;
}
@keyframes borderSweep {
    from { background-position: -120% 0; }
    to   { background-position: 120% 0; }
}

/* --- Reduced motion override --- */
@media (prefers-reduced-motion: reduce) {
    .fade-up, .stagger-children > *, .img-reveal, .card-list-stagger > .info-card, .reveal-pair { transition: none !important; opacity: 1 !important; transform: none !important; }
    .intro .badge, .intro h1, .intro p { animation: none !important; opacity: 1 !important; transform: none !important; }
    .floating-badge { opacity: 1 !important; animation: none !important; }
    .btn-yellow::after { display: none; }
    .philosophy-grid.stagger-children > .card { transform: none !important; }
    .philosophy-grid .card:hover .icon-wrap svg,
    .philosophy-grid .card:hover .icon-wrap i { transform: none !important; }
    .philosophy-grid .card:hover::before { animation: none !important; opacity: 0 !important; }
}