/* ================================================================
   STEMULUS — GLOBAL RESPONSIVE STYLESHEET
   Mobile-first overrides for all 27 pages
   Breakpoints: 480px (phone) | 768px (tablet) | 1024px (desktop+)
   ================================================================ */

/* ----------------------------------------------------------------
   0. BASE — prevent horizontal overflow site-wide
   ---------------------------------------------------------------- */
html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

img,
video,
iframe,
embed,
object,
canvas {
    max-width: 100%;
}

/* ----------------------------------------------------------------
   1. CUSTOM CURSOR — disable completely on touch devices
   ---------------------------------------------------------------- */
@media (hover: none) and (pointer: coarse) {
    body {
        cursor: auto !important;
    }

    #cursor-ring,
    #cursor-dot,
    .custom-cursor,
    .cursor-ring,
    .cursor-glow {
        display: none !important;
    }
}

/* ----------------------------------------------------------------
   2. HAMBURGER BUTTON STYLES
   (button element is injected by mobile-nav.js)
   ---------------------------------------------------------------- */
#nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    padding: 6px;
    z-index: 1002;
    flex-shrink: 0;
    border-radius: 6px;
    transition: background 0.2s;
}

#nav-hamburger:hover {
    background: rgba(255, 255, 255, 0.08);
}

#nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: transform 0.32s cubic-bezier(0.23, 1, 0.32, 1),
        opacity 0.25s ease;
    transform-origin: center;
}

/* Animate to ✕ when open */
#nav-hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

#nav-hamburger.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

#nav-hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ----------------------------------------------------------------
   3. MOBILE FULL-SCREEN NAV DRAWER
   ---------------------------------------------------------------- */
#mobile-nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #070d1f;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.77, 0, 0.175, 1);
    padding: 5rem 2rem 3rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#mobile-nav-drawer.open {
    transform: translateX(0);
}

#mobile-nav-drawer a {
    color: rgba(245, 240, 232, 0.7) !important;
    text-decoration: none;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: clamp(1rem, 5vw, 1.5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    transition: color 0.2s, padding-left 0.2s;
    display: block;
    -webkit-tap-highlight-color: transparent;
}

#mobile-nav-drawer a:first-child {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

#mobile-nav-drawer a:hover,
#mobile-nav-drawer a:focus {
    color: #f4600c !important;
    padding-left: 0.75rem;
}

#mobile-nav-drawer .mnav-enroll {
    margin-top: 2rem;
    background: #f4600c;
    color: #fff !important;
    text-align: center;
    padding: 1rem 2rem;
    border: none;
    border-bottom: none !important;
    border-top: none !important;
    border-radius: 4px;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    display: block;
}

#mobile-nav-drawer .mnav-enroll:hover {
    background: #d94e08;
    padding-left: 0.5rem;
}

/* ── Close button inside the drawer ── */
#mnav-close-btn {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(245, 240, 232, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s, transform 0.25s;
    -webkit-tap-highlight-color: transparent;
    z-index: 1003;
}

#mnav-close-btn:hover,
#mnav-close-btn:focus {
    background: #f4600c;
    color: #fff;
    transform: rotate(90deg);
    outline: none;
}


/* ----------------------------------------------------------------
   4. NAV — COLLAPSE LINKS ON MOBILE, SHOW HAMBURGER
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    #nav-hamburger {
        display: flex !important;
    }

    /* Hide the two flex children (links + buttons) of nav-editorial,
     but NOT the logo anchor and NOT our injected hamburger */
    .nav-editorial>div {
        display: none !important;
    }

    .nav-editorial {
        padding: 1rem 1.2rem !important;
        align-items: center;
    }

    /* Fade nav bg immediately on mobile (mix-blend-mode: difference looks bad) */
    .nav-editorial {
        mix-blend-mode: normal !important;
        background: rgba(7, 13, 31, 0.96) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
    }

    /* Logo: don't over-filter on dark bg */
    .nav-logo-editorial img {
        width: 72px !important;
        filter: invert(1) !important;
    }
}

/* ----------------------------------------------------------------
   5. TYPOGRAPHY — tighten minimum sizes for small screens
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    .editorial-heading {
        font-size: clamp(26px, 8vw, 72px) !important;
        line-height: 1 !important;
        letter-spacing: -0.02em !important;
        margin-inline: 0 !important;
        /* kill negative margin bleed-out */
    }

    .editorial-heading.break-out {
        margin-inline: 0 !important;
    }

    /* Hero headline: force each span to its own block line */
    #hero-section h1 {
        line-height: 1.05 !important;
        margin: 0 !important;
    }

    .hero-word {
        display: block !important;
        overflow: visible !important;
        line-height: 1.05 !important;
    }

    .reveal-inner {
        display: block !important;
    }

    .hero-line-1 {
        font-size: clamp(28px, 9vw, 100px) !important;
    }

    .hero-line-2 {
        font-size: clamp(32px, 11vw, 130px) !important;
    }

    .hero-line-3 {
        font-size: clamp(26px, 7.5vw, 85px) !important;
    }

    .stat-num {
        font-size: clamp(38px, 10vw, 80px) !important;
    }

    .skill-tag {
        font-size: clamp(18px, 5vw, 36px) !important;
    }

    .prog-card-title {
        font-size: clamp(18px, 4.5vw, 30px) !important;
    }

    h1,
    h2,
    h3 {
        word-break: break-word;
        overflow-wrap: break-word;
    }
}

@media (max-width: 480px) {
    .editorial-heading {
        font-size: clamp(22px, 8.5vw, 46px) !important;
    }

    .hero-word {
        line-height: 1.1 !important;
        overflow: visible !important;
    }

    .hero-line-1 {
        font-size: clamp(26px, 10vw, 56px) !important;
    }

    .hero-line-2 {
        font-size: clamp(30px, 12vw, 72px) !important;
    }

    .hero-line-3 {
        font-size: clamp(22px, 9vw, 50px) !important;
    }
}

/* ----------------------------------------------------------------
   6. ASYMMETRIC EDITORIAL GRIDS → STACK
   ---------------------------------------------------------------- */
@media (max-width: 1024px) {

    .editorial-grid,
    .editorial-grid-reverse,
    .difference-grid {
        grid-template-columns: 1fr !important;
        gap: 2.5rem !important;
    }
}

/* ----------------------------------------------------------------
   7. CURRICULUM GRID
   ---------------------------------------------------------------- */
@media (max-width: 1024px) {
    .curriculum-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Kill the stagger transforms on tablet */
    .curriculum-grid .card-offset {
        transform: none !important;
    }

    .curriculum-grid .card-bleed {
        margin-top: 0 !important;
    }

    .curriculum-grid .card-tall {
        grid-row: auto !important;
    }
}

@media (max-width: 600px) {
    .curriculum-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ----------------------------------------------------------------
   8. STATS ROW
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    .stats-raw {
        grid-template-columns: 1fr 1fr !important;
        overflow-x: hidden;
    }

    .stat-block {
        padding: 2rem 1rem !important;
        border-right: none !important;
        border-bottom: 1px solid currentColor;
    }

    .stat-block:nth-child(even) {
        border-right: none !important;
    }

    .stat-block:nth-last-child(-n+2) {
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    .stats-raw {
        grid-template-columns: 1fr !important;
    }

    .stat-block:last-child {
        border-bottom: none;
    }
}

/* ----------------------------------------------------------------
   9. SKILL STATEMENT
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    .skill-statement {
        flex-direction: column !important;
        gap: 2rem !important;
        padding: 3rem 1.2rem !important;
    }

    .skill-label-col {
        width: 100% !important;
        flex-shrink: unset !important;
    }
}

/* ----------------------------------------------------------------
   10. SECTIONS — reduce excessive padding on mobile
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    .curriculum-section {
        padding: 4rem 1.2rem !important;
    }

    .difference-section {
        padding: 4rem 1.2rem !important;
    }

    .stats-section {
        padding: 0 1.2rem !important;
    }

    .hero-preai {
        padding-left: 1.2rem !important;
        padding-right: 1.2rem !important;
    }

    .cta-section {
        padding: 4rem 1.2rem !important;
    }

    /* Section header inside curriculum */
    .curriculum-section .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1.5rem !important;
        margin-bottom: 3rem !important;
    }

    /* Remove negative margin bleed patterns */
    .full-bleed {
        width: 100% !important;
        margin-inline: 0 !important;
    }
}

@media (max-width: 480px) {
    .curriculum-section {
        padding: 2.5rem 1rem !important;
    }

    .difference-section {
        padding: 2.5rem 1rem !important;
    }

    .hero-preai {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .hero-text-container {
        padding-top: 14vh !important;
    }
}

/* ----------------------------------------------------------------
   11. HERO CTA ROW
   ---------------------------------------------------------------- */
@media (max-width: 640px) {
    .hero-cta-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
        margin-top: 3vh !important;
    }

    .btn-primary-raw {
        display: block !important;
        text-align: center !important;
        width: 100% !important;
        padding: 1.1rem 1rem !important;
    }
}

/* ----------------------------------------------------------------
   12. FOOTER
   ---------------------------------------------------------------- */
@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 2rem !important;
    }
}

@media (max-width: 640px) {
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    .footer-editorial {
        padding: 3rem 1.2rem 2rem !important;
    }

    .footer-bottom {
        flex-direction: column !important;
        gap: 0.4rem !important;
        text-align: center !important;
    }
}

/* ----------------------------------------------------------------
   13. PROGRAM CARDS
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    .prog-card {
        padding: 1.5rem !important;
    }
}

/* ----------------------------------------------------------------
   14. ENROLL PAGE — sidebar + form stack on tablet/mobile
   ---------------------------------------------------------------- */
@media (max-width: 1024px) {

    /* Override the lg:grid-cols-5 Tailwind grid on the main enroll layout */
    .lg\:grid-cols-5 {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .glass-form {
        padding: 1.5rem !important;
        margin: 0 !important;
        border-radius: 1.2rem !important;
    }
}

/* ----------------------------------------------------------------
   15. TAILWIND GRID PATTERN OVERRIDES
   Handles common grid-cols-2/3/4 used across all pages
   ---------------------------------------------------------------- */
@media (max-width: 640px) {

    /* Force single column */
    .grid-cols-2:not([class*="lg\:grid-cols"]),
    .sm\:grid-cols-2,
    .md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    .grid-cols-3,
    .sm\:grid-cols-3,
    .md\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }

    .grid-cols-4,
    .sm\:grid-cols-4,
    .md\:grid-cols-4 {
        grid-template-columns: 1fr 1fr !important;
    }

    .grid-cols-5 {
        grid-template-columns: 1fr !important;
    }

    .grid-cols-6 {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 768px) {
    .lg\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    .lg\:grid-cols-3 {
        grid-template-columns: 1fr 1fr !important;
    }

    .lg\:grid-cols-4 {
        grid-template-columns: 1fr 1fr !important;
    }

    .lg\:grid-cols-5 {
        grid-template-columns: 1fr !important;
    }

    .lg\:grid-cols-6 {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* ----------------------------------------------------------------
   16. TAILWIND FLEX DIRECTION OVERRIDES
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    .lg\:flex-row {
        flex-direction: column !important;
    }

    /* Keep children from shrinking to nothing */
    .lg\:w-1\/2 {
        width: 100% !important;
    }

    .lg\:w-1\/3 {
        width: 100% !important;
    }

    .lg\:w-2\/3 {
        width: 100% !important;
    }
}

/* ----------------------------------------------------------------
   17. BUTTONS & TAP TARGETS
   ---------------------------------------------------------------- */
@media (max-width: 768px) {

    button,
    input[type="submit"],
    input[type="button"],
    a.btn,
    .btn-primary-raw {
        min-height: 44px;
    }

    /* Full-width the main enroll CTA on small screens */
    a[href*="enroll"][class*="rounded"],
    a[href*="enroll.html"][class*="rounded"] {
        display: block !important;
        text-align: center !important;
    }
}

/* ----------------------------------------------------------------
   18. TABLES — prevent horizontal blowout
   ---------------------------------------------------------------- */
table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ----------------------------------------------------------------
   19. SCROLL HINT — hide on mobile (saves space)
   ---------------------------------------------------------------- */
@media (max-width: 640px) {
    .hero-scroll-hint {
        display: none !important;
    }
}

/* ----------------------------------------------------------------
   20. GRAIN ANIMATION — lower frequency on mobile
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    #grain {
        animation-duration: 4s !important;
    }
}

/* ----------------------------------------------------------------
   21. PROGRAMS / PRICING / BLOG GRID OVERRIDES (Tailwind pages)
   ---------------------------------------------------------------- */
@media (max-width: 768px) {

    /* Programs page grid */
    .programs-grid {
        grid-template-columns: 1fr !important;
    }

    /* Pricing cards */
    .pricing-grid {
        grid-template-columns: 1fr !important;
    }

    /* Blog grid */
    .blog-grid {
        grid-template-columns: 1fr !important;
    }

    /* Contact two-col layout */
    .contact-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ----------------------------------------------------------------
   22. MOBILE UTILITIES
   ---------------------------------------------------------------- */
@media (max-width: 640px) {

    /* Remove large negative margins that can cause overflow */
    [style*="margin-left: -"] {
        margin-left: 0 !important;
    }

    [style*="margin-right: -"] {
        margin-right: 0 !important;
    }

    /* Ensure paddings don't overflow */
    [class*="px-"] {
        max-width: 100% !important;
    }
}

/* ----------------------------------------------------------------
   23. PREAI-HERO SPLIT — already has responsive CSS in preai-overhaul.css
       but add extra phone-specific touch
   ---------------------------------------------------------------- */
@media (max-width: 480px) {
    .preai-hero-text {
        padding: 6rem 1.2rem 3rem !important;
    }

    .preai-hero-ctas {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .preai-hero-cta-primary {
        text-align: center !important;
    }
}

/* ----------------------------------------------------------------
   24. MISC COMPONENT FIXES
   ---------------------------------------------------------------- */
/* Ensure inline-block badges don't wrap mid-word */
.badge,
[class*="rounded-full"][class*="px-"] {
    white-space: nowrap;
}

/* Dashboard / admin table scrolling */
.overflow-x-auto {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Sidebar layouts in dashboard pages */
@media (max-width: 768px) {
    .sidebar {
        display: none !important;
    }

    .main-content {
        width: 100% !important;
        margin-left: 0 !important;
    }
}

/* Remove horizontal scroll risk from fixed wide elements */
@media (max-width: 640px) {
    .w-screen {
        width: 100% !important;
    }

    .min-w-\[600px\] {
        min-width: 0 !important;
    }
}

/* ----------------------------------------------------------------
   INDEX PAGE — inline-style element overrides
   ---------------------------------------------------------------- */

/* Hero stats strip: 3-col → scroll on very small screens */
@media (max-width: 500px) {
    #hero-stats-strip {
        grid-template-columns: 1fr !important;
        position: relative !important;
        /* pull out of absolute so it stacks below hero */
    }

    #hero-stats-strip>div {
        border-right: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
        padding: 0.8rem 1.2rem !important;
    }

    #hero-stats-strip>div:last-child {
        border-bottom: none;
    }

    /* Push section to accommodate the now-stacked strip */
    .hero-preai {
        padding-bottom: 0 !important;
    }
}

@media (min-width: 501px) and (max-width: 768px) {

    /* Tighten padding on the inline stats cells */
    #hero-stats-strip>div {
        padding: 0.8rem 0.8rem !important;
    }
}

/* CTA buttons in the "Ready to Start?" section — stack on phone */
@media (max-width: 640px) {
    .hero-cta-stacked {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
    }

    .hero-cta-stacked .btn-primary-raw,
    .hero-cta-stacked .btn-ghost-raw {
        display: block !important;
        text-align: center !important;
        width: 100% !important;
    }
}

/* ── Timeline section: horizontal GSAP-driven on ALL screen sizes ── */

/* Horizontal flex row for GSAP to translate */
.timeline-scroll-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    will-change: transform;
}

.timeline-step {
    min-width: 380px;
    width: 380px;
    flex-shrink: 0;
    padding: 2.5rem 2rem;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
}

.timeline-step:first-child {
    border-left: none;
}

.timeline-step-num {
    font-family: 'Clash Display', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.08);
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 1rem;
}

.timeline-step-age {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--orange, #f4600c);
    margin-bottom: 0.5rem;
}

.timeline-step-title {
    font-family: 'Clash Display', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.timeline-step-desc {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.35);
    max-width: 320px;
}

.timeline-header {
    padding: 5rem 5vw 3rem;
}

/* ── Tablet: slightly narrower cards ── */
@media (max-width: 1024px) {
    .timeline-step {
        min-width: 320px;
        width: 320px;
        padding: 2rem 1.5rem;
    }

    .timeline-step-num {
        font-size: 2.5rem;
    }
}

/* ── Mobile: cards sized to ~80vw so one fills most of the screen ── */
@media (max-width: 768px) {
    .timeline-step {
        min-width: 80vw;
        width: 80vw;
        padding: 2rem 1.5rem;
    }

    .timeline-step-num {
        font-size: 2rem;
    }

    .timeline-step-title {
        font-size: 1.15rem;
    }

    .timeline-step-desc {
        max-width: 100%;
    }

    .timeline-header {
        padding: 3rem 1.2rem 2rem;
    }
}

@media (max-width: 480px) {
    .timeline-step {
        min-width: 85vw;
        width: 85vw;
        padding: 1.5rem 1.2rem;
    }
}