/* ============================================================
   Sovereign AI Corridor — mobile / responsive layer
   Scoped overrides only. Desktop styles above 768px untouched.
   Real selectors from the project markup. No visual redesign.
   ============================================================ */

/* ---------- Global safety: never allow horizontal scroll ---------- */
@media (max-width: 1023px) {
    html, body {
        overflow-x: clip;
    }
    img, video, canvas, svg, iframe {
        max-width: 100%;
    }
    img, video {
        height: auto;
    }
}

/* ---------- Keyboard focus: visible everywhere ---------- */
:focus-visible {
    outline: 2px solid #00D9FF;
    outline-offset: 3px;
    border-radius: 2px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   HEADER — fix crowding on narrow screens
   ============================================================ */
@media (max-width: 768px) {
    header {
        padding: 14px 18px;
    }

    .header-right {
        gap: 0;
    }

    /* Company name + clock move into the menu panel on phones,
       so the bar shows only logo + menu button. */
    .company-inc,
    .time-display {
        display: none;
    }

    /* Larger, comfortable tap target for the menu button */
    .menu-trigger {
        width: 44px;
        height: 44px;
        align-items: center;
    }

    .logo {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 70vw;
    }
}

/* On very narrow phones, tighten further */
@media (max-width: 380px) {
    header {
        padding: 12px 14px;
    }
}

/* ============================================================
   MOBILE MENU PANEL (built by mobile-menu.js)
   ============================================================ */
.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: #141414;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 18px 24px 32px;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    overflow-y: auto;
}

.mobile-menu.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.mobile-menu-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
    margin-bottom: 32px;
}

.mobile-menu-brand {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.1em;
}

.mobile-menu-close {
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-close:hover {
    border-color: #fff;
}

.mobile-menu nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-menu-link {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 28px;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.mobile-menu-meta {
    margin-top: auto;
    padding-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.65);
    text-transform: uppercase;
}

/* Lock page scroll while the menu is open */
body.menu-open {
    overflow: hidden;
}

/* ============================================================
   HERO — single column on phones, text first then visual
   ============================================================ */
@media (max-width: 767px) {
    .hero-content {
        padding: 104px 20px 28px;
        min-width: 0; /* allow the grid item to shrink below content width */
    }

    .hero-title h1 {
        /* 9vw keeps the long word "INFRASTRUCTURE." inside 320px viewports */
        font-size: clamp(1.75rem, 9vw, 3.4rem);
        line-height: 0.98;
        max-width: none;
        overflow-wrap: break-word;
    }

    .hero-title .tag {
        font-size: 12px;
    }

    .hero-intro {
        max-width: none;
        margin-top: 28px;
    }

    .hero-intro p {
        font-size: 15px;
    }

    /* Corridor metrics: wrap / stack, stay legible */
    .hero-stats {
        flex-wrap: wrap;
        gap: 18px 28px;
        padding-top: 20px;
    }

    .hero-stat {
        min-width: 90px;
    }

    .hero-stat .value {
        font-size: 26px;
    }

    .hero-visual {
        min-height: auto;
        padding: 0 20px 48px;
    }

    .floating-image-container {
        width: 100%;
        max-width: 560px;
    }

    .hero-typewriter {
        font-size: 12px;
        max-width: calc(100% - 24px);
    }

    .core-threads {
        padding-top: 28px;
    }

    .thread-list li {
        font-size: 13px;
    }
}

/* ============================================================
   AUDIO / PODCAST section
   ============================================================ */
@media (max-width: 767px) {
    .audio-section {
        height: auto;
        min-height: 100svh;
        padding: 48px 0;
    }

    .audio-container-center {
        padding: 0 20px;
        gap: 36px;
    }

    .audio-title {
        font-size: clamp(2rem, 9vw, 2.75rem);
        line-height: 1.05;
    }

    .audio-subtitle {
        font-size: 14px;
    }

    /* Big, tappable play control */
    .play-button {
        min-height: 52px;
        min-width: 52px;
        padding: 14px 30px;
        font-size: 13px;
    }

    .audio-progress-area {
        width: 100%;
    }

    #audio-progress-container {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .waveform-container {
        gap: 2px;
        overflow: hidden;
    }

    .waveform-bar {
        width: 3px;
        flex-shrink: 0;
    }

    .audio-time {
        font-size: 12px;
    }
}

/* Chapters / episode cards */
@media (max-width: 767px) {
    .chapters-container {
        padding: 36px 20px;
        max-width: none;
    }

    .chapter-card {
        padding: 18px;
        width: 100%;
    }

    .chapter-card h5 {
        font-size: 15px;
        line-height: 1.4;
    }

    .chapter-number,
    .chapter-time {
        font-size: 11px;
    }
}

/* ============================================================
   VIDEO / DOCUMENTARY player
   ============================================================ */
@media (max-width: 767px) {
    .video-section {
        padding: 56px 20px;
    }

    .video-title {
        font-size: clamp(1.9rem, 8.5vw, 2.5rem);
        line-height: 1.05;
    }

    .video-subtitle {
        font-size: 14px;
    }

    .video-player-wrapper {
        width: 100%;
    }

    .main-video {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .video-controls {
        padding: 12px;
    }

    .video-play-btn {
        width: 76px;
        height: 76px;
    }

    .video-progress-area,
    #video-progress-container {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .video-time {
        font-size: 12px;
    }
}

/* ============================================================
   CINEMATIC / FILM sections
   ============================================================ */
@media (max-width: 767px) {
    .film-section {
        height: auto;
        min-height: 100svh;
        padding: 80px 0;
    }

    .film-content {
        padding: 0 20px;
        max-width: none;
    }

    .film-title {
        font-size: clamp(1.8rem, 8vw, 2.4rem);
        line-height: 1.05;
    }

    .film-description {
        font-size: 14px;
        line-height: 1.6;
    }

    .film-label {
        font-size: 11px;
    }
}

/* ============================================================
   DATA / INFRASTRUCTURE SPEC section
   ============================================================ */
@media (max-width: 767px) {
    .data-section {
        padding: 56px 20px;
    }

    .section-title {
        font-size: clamp(1.7rem, 7.5vw, 2.2rem);
        line-height: 1.1;
    }

    .section-label {
        font-size: 11px;
    }

    .data-grid {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

    .data-card {
        padding: 18px 14px;
    }

    .data-card h4 {
        font-size: 12px;
    }

    .data-card .value {
        font-size: 26px;
    }
}

/* Very narrow phones: stack spec cards single column */
@media (max-width: 380px) {
    .data-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   QUOTE section
   ============================================================ */
@media (max-width: 767px) {
    .quote-section {
        padding: 56px 20px;
    }

    .quote-container {
        gap: 24px;
    }

    .quote-content blockquote {
        font-size: 19px;
        line-height: 1.5;
    }

    .quote-image {
        max-width: 160px;
    }
}

/* ============================================================
   FOOTER
   ============================================================ */
@media (max-width: 767px) {
    footer {
        padding: 40px 20px;
    }

    .footer-link {
        padding: 12px 0;
        display: inline-block;
    }
}
