/* ============================================
   ABOUT PAGE RESPONSIVE FIXES
   Making the storyteller beautiful on all screens
   ============================================ */

/* ============================================
   CRITICAL FIX: SUB-NAVIGATION VISIBILITY
   ============================================ */

/* Desktop: Show sub-nav */
@media (min-width: 1025px) {
    .sub-navigation {
        display: block !important;
    }
    
    .mobile-nav-toggle {
        display: none !important;
    }
}

/* Tablet & Mobile: HIDE sub-nav completely */
@media (max-width: 1024px) {
    .sub-navigation {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    .mobile-nav-toggle {
        display: inline-flex !important;
    }
    
    /* Adjust hero padding since sub-nav is gone */
    .hero {
        padding-top: 100px !important; /* Only header height + buffer */
    }
}

/* ============================================
   TABLET BREAKPOINT (768px - 1024px)
   ============================================ */

@media (min-width: 768px) and (max-width: 1024px) {
    /* Container adjustments */
    .container {
        padding: 0 32px;
    }
    
    /* Hero section */
    .hero {
        min-height: 85vh;
        padding-top: 100px !important;
    }
    
    .hero h1 {
        font-size: clamp(2.8rem, 7vw, 5rem);
        line-height: 1.15;
        margin-bottom: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: clamp(1.1rem, 2.2vw, 1.35rem);
    }
    
    /* Three Lenses Section */
    .three-lenses {
        padding: 100px 0;
    }
    
    .section-title {
        font-size: clamp(2.2rem, 5vw, 3.2rem);
        margin-bottom: 80px;
    }
    
    .lens {
        margin-bottom: 150px;
    }
    
    .lens-number {
        font-size: 4.5rem;
    }
    
    .lens-title {
        font-size: clamp(1.8rem, 4vw, 2.4rem);
    }
    
    .lens-content {
        grid-template-columns: 1fr;
        gap: 50px;
    }
    
    .lens-text {
        font-size: 1.05rem;
        line-height: 1.75;
    }
    
    /* Portrait in Lens 2 */
    .portrait-frame {
        max-width: 420px;
        height: 500px;
        margin: 0 auto;
    }
    
    .lens-2 .interactive-card {
        position: relative;
        bottom: auto;
        left: auto;
        max-width: 100%;
        margin-top: -60px;
    }
    
    /* Interactive cards */
    .interactive-card {
        padding: 40px;
    }
    
    .card-title {
        font-size: 1.4rem;
    }
    
    /* Timeline */
    .timeline-section {
        padding: 100px 0;
    }
    
    .timeline::before {
        left: 32px;
    }
    
    .timeline-item,
    .timeline-item:nth-child(even) {
        flex-direction: column;
    }
    
    .timeline-content {
        margin: 0 0 0 64px;
        padding: 35px;
    }
    
    .timeline-marker {
        left: 32px;
        width: 16px;
        height: 16px;
    }
    
    .timeline-date {
        font-size: 1.7rem;
    }
    
    .timeline-title {
        font-size: 1.2rem;
    }
    
    /* Magician Section */
    .magician-section {
        padding: 100px 0;
    }
    
    .magician-reveal {
        padding: 60px 40px;
    }
    
    .magician-text {
        font-size: clamp(1.4rem, 2.8vw, 2rem);
    }
    
    .magic-cards.revealed {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    
    /* Ecosystem */
    .ecosystem-section {
        padding: 100px 0;
    }
    
    .ecosystem-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    
    /* CTA */
    .cta-section {
        padding: 100px 0;
    }
    
    .cta-title {
        font-size: clamp(2.2rem, 4.5vw, 3.2rem);
    }
    
    .cta-text {
        font-size: 1.1rem;
    }
    
    /* Footer */
    .site-footer {
        padding: 70px 0 35px;
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 36px;
    }
}

/* ============================================
   MOBILE BREAKPOINT (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {
    /* Force hide sub-navigation */
    .sub-navigation {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    /* Container */
    .container {
        padding: 0 20px;
    }
    
    /* Hero Section */
    .hero {
        min-height: auto;
        padding-top: 100px !important;
        padding-bottom: 60px;
    }
    
    .hero-content {
        padding: 0 10px;
    }
    
    .hero h1 {
        font-size: clamp(2.2rem, 8vw, 3.5rem);
        line-height: 1.2;
        margin-bottom: 1.25rem;
    }
    
    .hero-subtitle {
        font-size: clamp(1rem, 4vw, 1.25rem);
        line-height: 1.6;
    }
    
    /* Three Lenses Section */
    .three-lenses {
        padding: 70px 0;
    }
    
    .section-title {
        font-size: clamp(2rem, 7vw, 2.8rem);
        margin-bottom: 60px;
        line-height: 1.2;
    }
    
    .lens {
        margin-bottom: 100px;
    }
    
    .lens-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 30px;
    }
    
    .lens-number {
        font-size: 3.5rem;
        opacity: 0.15;
    }
    
    .lens-title {
        font-size: clamp(1.6rem, 6vw, 2.2rem);
        line-height: 1.25;
    }
    
    .lens-content {
        grid-template-columns: 1fr;
        gap: 35px;
    }
    
    .lens-text {
        font-size: 1rem;
        line-height: 1.75;
    }
    
    .lens-text p {
        margin-bottom: 1.25rem;
    }
    
    /* Portrait Integration - Mobile Optimization */
    .portrait-composition {
        margin-bottom: 20px;
    }
    
    .portrait-frame {
        max-width: 100%;
        height: 420px;
        margin: 0 auto;
    }
    
    .portrait-image {
        border-radius: 180px 180px 16px 16px; /* Smaller arch on mobile */
        box-shadow: 15px 15px 0px rgba(78, 205, 196, 0.08);
    }
    
    .lens-2 .lens-content {
        display: flex;
        flex-direction: column-reverse; /* Text first on mobile */
    }
    
    .lens-2 .interactive-card {
        position: relative;
        bottom: auto;
        left: auto;
        max-width: 100%;
        padding: 28px;
        margin-top: -50px; /* Overlap with portrait */
        margin-bottom: 20px;
    }
    
    /* Interactive Cards */
    .interactive-card {
        padding: 32px;
        border-radius: 16px;
    }
    
    .card-icon {
        width: 52px;
        height: 52px;
        margin-bottom: 24px;
    }
    
    .card-icon .icon-svg {
        width: 30px;
        height: 30px;
    }
    
    .card-title {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }
    
    .card-description {
        font-size: 0.95rem;
        line-height: 1.65;
    }
    
    /* Timeline Section */
    .timeline-section {
        padding: 70px 0;
    }
    
    .timeline::before {
        left: 20px;
        width: 1.5px;
    }
    
    .timeline-item,
    .timeline-item:nth-child(even) {
        flex-direction: column;
        margin-bottom: 70px;
    }
    
    .timeline-content {
        margin: 0 0 0 50px;
        padding: 28px;
        border-radius: 12px;
    }
    
    .timeline-marker {
        left: 20px;
        width: 14px;
        height: 14px;
        border: 3px solid var(--bg-body);
    }
    
    .timeline-date {
        font-size: 1.5rem;
        margin-bottom: 12px;
    }
    
    .timeline-title {
        font-size: 1.15rem;
        margin-bottom: 12px;
    }
    
    .timeline-description {
        font-size: 0.95rem;
        line-height: 1.7;
    }
    
    /* Magician Section */
    .magician-section {
        padding: 70px 0;
    }
    
    .magician-reveal {
        padding: 50px 28px;
        border-radius: 20px;
    }
    
    .magician-text {
        font-size: clamp(1.3rem, 5vw, 1.8rem);
        line-height: 1.5;
        margin-bottom: 30px;
    }
    
    .magic-cards.revealed {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 40px;
    }
    
    .magic-card {
        padding: 32px 24px;
        border-radius: 12px;
    }
    
    .magic-card-title {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .magic-card-text {
        font-size: 0.95rem;
        line-height: 1.65;
    }
    
    /* Ecosystem Section */
    .ecosystem-section {
        padding: 70px 0;
    }
    
    .ecosystem-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 60px;
    }
    
    .ecosystem-item {
        padding: 32px;
        border-radius: 16px;
    }
    
    .ecosystem-icon .icon-svg {
        width: 24px;
        height: 24px;
    }
    
    .ecosystem-title {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }
    
    .ecosystem-description {
        font-size: 0.9rem;
        line-height: 1.65;
    }
    
    .ecosystem-link {
        margin-top: 16px;
        font-size: 0.9rem;
    }
    
    /* CTA Section */
    .cta-section {
        padding: 70px 0;
    }
    
    .cta-content {
        padding: 0 10px;
    }
    
    .cta-title {
        font-size: clamp(2rem, 7vw, 3rem);
        margin-bottom: 24px;
        line-height: 1.2;
    }
    
    .cta-text {
        font-size: 1.05rem;
        line-height: 1.7;
        margin-bottom: 40px;
    }
    
    .cta-button {
        padding: 18px 40px;
        font-size: 1rem;
        border-radius: 40px;
        min-height: 48px; /* Touch target */
    }
    
    /* Footer */
    .site-footer {
        padding: 60px 0 30px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 32px;
        margin-bottom: 50px;
    }
    
    .footer-brand h3 {
        font-size: 1.5rem;
        margin-bottom: 16px;
    }
    
    .footer-brand img {
        height: 46px;
        margin-bottom: 16px;
    }
    
    .footer-text {
        font-size: 0.95rem;
        line-height: 1.65;
    }
    
    .footer-col h4 {
        font-size: 0.85rem;
        margin-bottom: 20px;
    }
    
    .footer-links li {
        margin-bottom: 12px;
    }
    
    .footer-links a {
        font-size: 0.95rem;
        padding: 6px 0;
        display: inline-block;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding-top: 24px;
        font-size: 0.85rem;
    }
}

/* ============================================
   SMALL MOBILE (max-width: 480px)
   ============================================ */

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .hero {
        padding-top: 90px !important;
    }
    
    .hero h1 {
        font-size: clamp(2rem, 9vw, 3rem);
    }
    
    .lens-number {
        font-size: 3rem;
    }
    
    .portrait-frame {
        height: 380px;
    }
    
    .portrait-image {
        border-radius: 160px 160px 12px 12px;
    }
    
    .timeline-content {
        margin: 0 0 0 44px;
        padding: 24px;
    }
    
    .timeline-marker {
        left: 16px;
        width: 12px;
        height: 12px;
    }
    
    .timeline::before {
        left: 16px;
    }
    
    .magician-reveal {
        padding: 40px 20px;
    }
    
    .cta-button {
        padding: 16px 32px;
    }
}

/* ============================================
   TYPOGRAPHY REFINEMENTS FOR MOBILE
   ============================================ */

@media (max-width: 768px) {
    /* Playfair Display optimization for mobile readability */
    h1, h2, h3, h4,
    .hero h1,
    .section-title,
    .lens-title,
    .timeline-date,
    .timeline-title,
    .magician-text,
    .card-title,
    .ecosystem-title,
    .cta-title {
        letter-spacing: -0.01em;
        font-weight: 600;
    }
    
    /* Improve body text readability */
    .lens-text,
    .timeline-description,
    .card-description,
    .ecosystem-description,
    .cta-text,
    .footer-text {
        letter-spacing: 0.01em;
    }
    
    /* Ensure highlight words are tappable */
    .highlight-word {
        padding: 2px 0;
        min-height: 44px;
        display: inline-block;
        line-height: 44px;
        vertical-align: middle;
    }
}

/* ============================================
   MOBILE DRAWER ENHANCEMENTS
   ============================================ */

@media (max-width: 1024px) {
    .mobile-menu-overlay {
        position: fixed !important;
        inset: 0 !important;
        background-color: var(--bg-body) !important;
        z-index: 11000 !important;
        transform: translateX(100%) !important;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
        display: flex !important;
        flex-direction: column !important;
        visibility: hidden;
        opacity: 0;
    }
    
    .mobile-menu-overlay.active {
        transform: translateX(0) !important;
        visibility: visible;
        opacity: 1;
    }
    
    .mobile-drawer-header {
        padding: 0 24px;
        height: 80px;
    }
    
    .mobile-drawer-content {
        padding: 40px 28px;
    }
    
    .mobile-link.main {
        font-size: 2.2rem;
        margin-bottom: 12px;
        min-height: 48px;
    }
    
    .mobile-link.sub {
        font-size: 1.05rem;
        margin-bottom: 14px;
        min-height: 44px;
    }
}

.portrait-image {
    object-fit: cover;
    object-position: var(--portrait-x, 60%) 50%;
}

.portrait-frame {
    position: relative;
}

.portrait-guidelines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 250px 250px 20px 20px;
    outline: 2px dashed rgba(255, 107, 107, 0.35);
    outline-offset: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.portrait-guidelines.active {
    opacity: 1;
}

.portrait-controls {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 12000;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    backdrop-filter: blur(8px);
}

.portrait-controls input[type="range"] {
    width: 180px;
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Improve touch targets on mobile */
@media (max-width: 768px) {
    a, button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link,
    .footer-links a,
    .ecosystem-link,
    .mobile-link {
        padding: 8px 4px;
    }
}

/* Focus states for keyboard navigation */
.highlight-word:focus-visible,
.interactive-card:focus-visible,
.magic-card:focus-visible,
.ecosystem-item:focus-visible {
    outline: 3px solid var(--coral);
    outline-offset: 4px;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Reduce animations on mobile for performance */
@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
    .interactive-card,
    .magic-card,
    .ecosystem-item {
        transition: transform 0.3s ease;
    }
}

/* Disable parallax effects on mobile */
@media (max-width: 768px) {
    .lens-number {
        transform: none !important;
    }
}

/* Reduce animation complexity on mobile */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================
   DARK MODE REFINEMENTS FOR MOBILE
   ============================================ */

[data-theme="dark"] {
    @media (max-width: 768px) {
        .timeline-marker {
            border-color: #1a1a1a;
        }
        
        .portrait-image {
            box-shadow: 15px 15px 0px rgba(78, 205, 196, 0.12);
        }
    }
}

/* ============================================
   LOADING & SMOOTH SCROLL
   ============================================ */

@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* ============================================
   CRITICAL: ENSURE SUB-NAV NEVER SHOWS ON MOBILE
   ============================================ */

@media (max-width: 1024px) {
    .sub-navigation {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        position: absolute !important;
        left: -9999px !important;
    }
}
