/* =========================================================================
   Apple-Style Custom Properties & Reset
   ========================================================================= */
:root {
    /* Colors - Apple uses mostly B&W with subtle grays and a signature blue */
    --clr-black: #000000;
    --clr-dark-gray: #1d1d1f;
    --clr-light-gray: #f5f5f7;
    --clr-white: #ffffff;
    --clr-blue: #0066cc; /* Link blue */
    --clr-text-main: #1d1d1f;
    --clr-text-light: #86868b;
    --clr-crimson: #E63946; /* Keeping a hint of the original MIT red */
    
    /* Typography */
    /* System fonts attempt to load San Francisco on Apple devices */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Layout */
    --global-nav-h: 44px;
    --chapter-nav-h: 52px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    background-color: var(--clr-white);
}

body.apple-theme {
    font-family: var(--font-sans);
    color: var(--clr-text-main);
    line-height: 1.47059;
    letter-spacing: -0.022em;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    opacity: 1;
    transition: opacity 0.4s cubic-bezier(0.645, 0.045, 0.355, 1);
}

body.apple-theme.fade-out {
    opacity: 0;
}

a {
    text-decoration: none;
    color: inherit;
}

ul { list-style: none; }

.text-center { text-align: center; }
.text-white { color: var(--clr-white) !important; }
.bg-white { background-color: var(--clr-white); }
.bg-gray { background-color: var(--clr-light-gray); }

/* =========================================================================
   Global Navigation (The dark bar at the very top)
   ========================================================================= */
.global-nav {
    position: absolute; /* Apple's global nav usually stays at top */
    top: 0;
    width: 100%;
    height: var(--global-nav-h);
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
}

.global-nav-content {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 1rem;
}

.nav-logo {
    color: #f5f5f7;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.01em;
}

.global-nav-links {
    display: flex;
    gap: 2rem;
}

.global-nav-links a {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    transition: color 0.3s;
}

.global-nav-links a:hover,
.global-nav-links a.active {
    color: #ffffff;
}

/* =========================================================================
   Chapter Navigation (The sticky bar)
   ========================================================================= */
.chapter-nav {
    position: sticky;
    top: 0;
    width: 100%;
    height: var(--chapter-nav-h);
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.16);
    z-index: 9998;
    transition: background-color 0.3s;
}

/* We need margin-top to clear the global nav initially */
.apple-theme {
    padding-top: var(--global-nav-h);
}

.chapter-nav-content {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 1rem;
}

.chapter-brand {
    font-weight: 600;
    font-size: 21px;
    letter-spacing: -0.01em;
}

.chapter-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.chapter-links a {
    font-size: 12px;
    color: var(--clr-text-main);
}

.chapter-links a:hover {
    color: var(--clr-blue);
}

.btn-buy {
    background-color: var(--clr-blue);
    color: white !important;
    padding: 4px 11px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 400;
}

.btn-buy:hover {
    background-color: #0077ED;
}

/* =========================================================================
   Apple Hero Section
   ========================================================================= */
.apple-hero {
    padding: 30px 0;
    background-color: var(--clr-black);
    color: var(--clr-light-gray);
    text-align: center;
    overflow: hidden;
    min-height: auto;
    display: flex;
    flex-direction: column;
}

.hero-text-container {
    padding: 0 20px;
    max-width: 800px;
    margin: 0 auto;
    z-index: 10;
}

.apple-headline {
    font-size: 28px;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -0.005em;
    margin-bottom: 6px;
}

.apple-subheadline {
    font-size: 15px;
    line-height: 1.2;
    font-weight: 400;
    letter-spacing: .004em;
    margin-bottom: 0;
    color: #f5f5f7;
}

.apple-hero-desc {
    font-size: 13px;
    line-height: 1.381;
    font-weight: 400;
    letter-spacing: .011em;
    color: var(--clr-text-light);
}

.hero-image-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 40px;
    position: relative;
    /* Blend mode hack for black backgrounds */
}

.hero-image-blend {
    max-width: 90%;
    /* We mask the image to blend it into the black background */
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    opacity: 0.8;
}

/* =========================================================================
   Standard Sections & Typography
   ========================================================================= */
.apple-section {
    padding: 100px 20px;
}

.apple-container {
    max-width: 980px;
    margin: 0 auto;
}

.apple-section-title {
    font-size: 48px;
    line-height: 1.08349;
    font-weight: 600;
    letter-spacing: -0.003em;
    margin-bottom: 20px;
}

.apple-section-copy {
    font-size: 21px;
    line-height: 1.381;
    font-weight: 400;
    color: var(--clr-text-light);
    max-width: 600px;
    margin: 0 auto 60px auto;
}

.apple-link {
    font-size: 17px;
    line-height: 1.47059;
    font-weight: 400;
    color: var(--clr-blue);
    display: inline-flex;
    align-items: center;
}

.apple-link:hover {
    text-decoration: underline;
}

.apple-link .chevron {
    font-size: 12px;
    margin-left: 4px;
}

/* =========================================================================
   Feature Grid (Context/Value)
   ========================================================================= */
.apple-feature-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
    max-width: 980px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.apple-feature-card {
    flex: 1;
    min-width: 250px;
    text-align: center;
}

.icon-container {
    font-size: 40px;
    margin-bottom: 20px;
}

.apple-feature-card h3 {
    font-size: 21px;
    line-height: 1.19048;
    font-weight: 600;
    letter-spacing: .011em;
    margin-bottom: 8px;
}

.apple-feature-card p {
    font-size: 17px;
    color: var(--clr-text-light);
}

/* =========================================================================
   Program Gallery (Cards)
   ========================================================================= */
.apple-program-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 450px);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.apple-card {
    border-radius: 20px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.apple-card:hover {
    transform: scale(1.02);
}

.dark-card {
    background-color: var(--clr-black);
    color: var(--clr-light-gray);
}

.light-card {
    background-color: var(--clr-white);
    color: var(--clr-text-main);
}

.card-content {
    z-index: 2;
    max-width: 300px;
}

.card-eyebrow {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 8px;
    display: block;
    color: var(--clr-text-light);
}

.card-title {
    font-size: 32px;
    line-height: 1.125;
    font-weight: 600;
    letter-spacing: .004em;
    margin-bottom: 12px;
}

.card-desc {
    font-size: 17px;
    line-height: 1.47059;
    margin-bottom: 20px;
    color: var(--clr-text-light);
}

/* =========================================================================
   Heavy Hero (Methodology Image Block)
   ========================================================================= */
.apple-heavy-hero {
    position: relative;
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.heavy-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.heavy-hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.6);
}

.heavy-hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 0 20px;
}

.apple-massive-title {
    font-size: 64px;
    line-height: 1.0625;
    font-weight: 600;
    letter-spacing: -0.009em;
    margin-bottom: 20px;
}

/* =========================================================================
   Tabs / ROI Section
   ========================================================================= */
.apple-tabs-container {
    max-width: 800px;
    margin: 40px auto 0 auto;
}

.apple-tab-nav {
    display: flex;
    justify-content: center;
    border-bottom: 1px solid #d2d2d7;
    margin-bottom: 40px;
}

.apple-tab {
    background: none;
    border: none;
    padding: 15px 30px;
    font-size: 17px;
    color: var(--clr-text-light);
    cursor: pointer;
    font-family: var(--font-sans);
    position: relative;
    transition: color 0.3s;
}

.apple-tab:hover {
    color: var(--clr-text-main);
}

.global-nav-links a.active {
    color: var(--clr-text-main);
    opacity: 1;
}

/* Language Switcher */
.lang-switcher {
    margin-left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--clr-text-light);
}

.lang-switcher a {
    opacity: 0.6;
    transition: opacity 0.2s;
    text-decoration: none;
}

.lang-switcher a:hover {
    opacity: 1;
}

.lang-switcher .active-lang {
    color: var(--clr-text-main);
    font-weight: 500;
    opacity: 1;
}

.lang-switcher .divider {
    opacity: 0.3;
}

/* Chapter Navigation */
.apple-tab.active {
    color: var(--clr-text-main);
    font-weight: 600;
}

.apple-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--clr-text-main);
}

.apple-tab-content {
    display: none;
    animation: simpleFade 0.4s ease forwards;
}

.apple-tab-content.active {
    display: block;
}

.tab-typography h3 {
    font-size: 40px;
    font-weight: 600;
    margin-bottom: 15px;
}

.tab-typography p {
    font-size: 21px;
    color: var(--clr-text-light);
}

.roi-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
}

.roi-item {
    background-color: var(--clr-white);
    padding: 40px;
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.roi-item.highlight {
    background-color: var(--clr-black);
    color: var(--clr-white);
}

.roi-pax {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 15px;
}

.roi-profit {
    font-size: 48px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

.roi-label {
    font-size: 17px;
    color: var(--clr-text-light);
}

/* =========================================================================
   Apple Footer
   ========================================================================= */
.apple-footer {
    background-color: #f5f5f7;
    padding: 40px 20px;
    font-size: 12px;
    color: var(--clr-text-light);
    border-top: 1px solid #d2d2d7;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #d2d2d7;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.footer-col h4 {
    color: var(--clr-text-main);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.footer-col p {
    margin-bottom: 5px;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
}

.footer-legal a {
    margin-left: 15px;
    color: var(--clr-text-light);
}

.footer-legal a:hover {
    color: var(--clr-text-main);
    text-decoration: underline;
}

/* =========================================================================
   Animations (Scroll Reveal Logic)
   ========================================================================= */
.reveal {
    opacity: 0;
    will-change: transform, opacity;
}

/* Simple fade in */
.reveal.fadeIn.is-visible {
    animation: sfFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Slide up */
.reveal.slideUp {
    transform: translateY(40px);
}

.reveal.slideUp.is-visible {
    animation: sfSlideUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Scale up for hero/cards */
.reveal.scaleUp {
    transform: scale(0.95);
}

.reveal.scaleUp.is-visible {
    animation: sfScaleUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

@keyframes sfFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes sfSlideUp {
    0% { opacity: 0; transform: translateY(40px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes sfScaleUp {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes simpleFade {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 834px) {
    .apple-program-gallery {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    
    .apple-card {
        min-height: 400px;
    }
    
    .apple-headline { font-size: 44px; }
    .apple-subheadline { font-size: 24px; }
    .apple-massive-title { font-size: 48px; }
    
    .global-nav-links li:not(.lang-switcher) { 
        display: none; 
    }
    
    .lang-switcher {
        margin-left: 0;
    }
}

@media (max-width: 734px) {
    .apple-headline { font-size: 32px; }
    .apple-subheadline { font-size: 21px; }
    .apple-hero-desc, .apple-section-copy { font-size: 19px; }
    .apple-section-title { font-size: 32px; }
    
    .chapter-links {
        display: none; /* In a real apple site, a dropdown chevron appears here */
    }
    
    .chapter-links li:last-child {
        display: block; /* Keep buy button */
    }
    
    .roi-grid { flex-direction: column; }
}

/* =========================================================================
   Apple-Style Modals
   ========================================================================= */
.apple-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 40px 20px;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.4s, opacity 0.4s ease;
}

.apple-modal-overlay.active {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s 0s, opacity 0.4s ease;
}

.apple-modal {
    background-color: rgba(255, 255, 255, 0.85); /* Apple glassmorphism */
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    padding: 40px;
    position: relative;
    margin: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.apple-modal.active {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
    z-index: 10001;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(0,0,0,0.1);
    border: none;
    font-size: 24px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clr-text-main);
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(0,0,0,0.2);
}

.modal-content-inner .card-eyebrow {
    margin-bottom: 15px;
}

.modal-content-inner .apple-section-title {
    font-size: 32px;
    line-height: 1.1;
    margin-bottom: 20px;
}

.modal-audience, .modal-duration {
    font-size: 15px;
    color: var(--clr-text-light);
    margin-bottom: 10px;
}

.modal-body-text {
    margin-top: 25px;
    font-size: 17px;
    line-height: 1.5;
    color: var(--clr-text-main);
}

.modal-result {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

/* Update full-width card */
.full-width-card {
    grid-column: 1 / -1;
    min-height: 300px;
}

/* =========================================================================
   Apple-Style Form Inputs and Overlays
   ========================================================================= */
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    background: rgba(255,255,255,0.8);
    font-family: inherit;
    font-size: 15px;
    color: var(--clr-text-main);
    margin-top: 6px;
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus {
    border-color: var(--clr-blue);
}
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    background: rgba(255,255,255,0.8);
    font-family: inherit;
    font-size: 15px;
    color: var(--clr-text-main);
    margin-top: 6px;
    outline: none;
    cursor: pointer;
}
.modal-btn {
    background-color: var(--clr-blue);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 15px;
}
.modal-btn:hover {
    background-color: #0052a3;
}
.modal-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.1);
}
.relation-link {
    display: inline-block;
    padding: 6px 12px;
    background: #f5f5f7;
    border: 1px solid #e5e5ea;
    border-radius: 8px;
    font-size: 13px;
    color: var(--clr-blue);
    margin-right: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.relation-link:hover {
    background: #e5e5ea;
    color: #0052a3;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 12px;
}
@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* =========================================================================
   Responsive Design Overrides for Smartphones
   ========================================================================= */

/* Brand text elements */
.short-brand {
    display: none;
}

#tree-container {
    width: 100%;
    height: 700px;
    background-color: #fafafa;
    border-top: 1px solid #d2d2d7;
    border-bottom: 1px solid #d2d2d7;
    position: relative;
    overflow: hidden;
}

@media (max-width: 734px) {
    .chapter-links {
        display: flex !important; /* Prevent hiding on mobile */
        gap: 0.8rem !important;
    }
    .chapter-links a {
        font-size: 11px !important;
    }
}

@media (max-width: 600px) {
    :root {
        --global-nav-h: 36px;
        --chapter-nav-h: 44px;
    }
    
    .nav-logo {
        font-size: 13px;
    }
    
    .chapter-brand {
        font-size: 16px;
    }
    
    .full-brand {
        display: none;
    }
    
    .short-brand {
        display: inline;
    }
    
    #home.apple-hero {
        padding-top: 25px !important;
        padding-bottom: 20px !important;
        min-height: auto !important;
    }
    
    #focus-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 0 16px !important;
        margin: 15px auto 5px auto !important;
    }
    
    #focus-bar > div {
        text-align: center;
        width: 100%;
    }
    
    #focus-bar > div:last-child {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }
    
    #treeFocusSelect {
        width: 100% !important;
    }
    
    #tree-container {
        height: 500px;
    }
    
    /* Scrollable Modals on Tall / Small Screens */
    .apple-modal-overlay {
        align-items: flex-start;
        overflow-y: auto;
        padding: 20px 10px;
    }
    
    .apple-modal {
        padding: 24px 16px;
        width: 100%;
        margin: auto;
        position: relative;
        transform: scale(0.95) translateY(10px);
    }
    
    .apple-modal.active {
        transform: scale(1) translateY(0);
    }
    
    .modal-content-inner .apple-section-title {
        font-size: 24px;
    }
    
    .modal-duration {
        font-size: 14px;
        margin-bottom: 15px !important;
    }
}
