/* ================================================================
   MOBILE STYLES — public site only
   Loaded last so it overrides public.css / app.css on small screens.
   Every rule lives inside a media query (or is gated to mobile via the
   hamburger toggle) so the desktop design is left completely untouched.

   Breakpoints:
     900px — navigation collapses into a hamburger menu
     768px — multi-column page/section layouts stack to one column
     480px — fine tuning for narrow phones
   ================================================================ */

/* ================================================================
   HEADER / NAVIGATION
   ================================================================ */

/* Hamburger button — hidden on desktop, shown below 900px. */
.main-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 9px 8px;
    margin-left: 4px;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

.main-nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--color-brand-black);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 900px) {
    .main-nav-toggle {
        display: flex;
    }

    /* Push lang switcher + hamburger to the right; logo stays left. */
    .main-nav-inner {
        gap: 12px;
    }

    .main-nav-lang {
        margin-left: auto;
    }

    /* Animate the bars into an X when the menu is open. */
    .main-nav.open .main-nav-toggle span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .main-nav.open .main-nav-toggle span:nth-child(2) {
        opacity: 0;
    }

    .main-nav.open .main-nav-toggle span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* The links become a full-width dropdown panel under the bar. */
    .main-nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 2px;
        background: #fff;
        border-bottom: 1px solid var(--color-stone-200);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
        padding: 10px clamp(16px, 5vw, 32px) 16px;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
    }

    .main-nav.open .main-nav-links {
        display: flex;
    }

    .main-nav-item {
        position: static;
    }

    /* Larger tap targets for touch. */
    .main-nav-link {
        padding: 12px 10px;
        font-size: 15px;
        border-radius: 8px;
    }

    /* Child menus are shown inline (no hover on touch), indented. */
    .main-nav-has-children > .main-nav-dropdown {
        display: block;
        position: static;
        min-width: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 0 0 4px 12px;
        margin: 0 0 4px;
    }

    .main-nav-dropdown-link {
        padding: 10px;
        font-size: 14px;
        color: var(--color-stone-500);
    }
}

/* ================================================================
   HOMEPAGE — hp- sections (no responsive rules existed before)
   ================================================================ */

@media (max-width: 768px) {
    .hp-hero {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .hp-tracks {
        grid-template-columns: 1fr;
    }

    .hp-reach-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .hp-cta-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* About page two-column body stacks. */
    .about-body {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* ================================================================
   FOOTER
   ================================================================ */

@media (max-width: 768px) {
    .hp-footer-top {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
        margin-bottom: 32px;
        padding-bottom: 32px;
    }

    /* Brand/about column spans the full width above the link columns. */
    .hp-footer-top > :first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .hp-footer-top {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .hp-footer-about {
        max-width: none;
    }

    .hp-footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .hp-footer-regs {
        flex-wrap: wrap;
        gap: 8px 20px;
    }
}

/* ================================================================
   TABLES — certificate verification substances table
   The table already scrolls horizontally (.vc-substances-wrap has
   overflow-x:auto). Tighten cell padding so more fits on a phone.
   ================================================================ */

@media (max-width: 600px) {
    .vc-substances-table th,
    .vc-substances-table td {
        padding-left: 12px;
        padding-right: 12px;
    }

    .vc-substances-table {
        min-width: 460px;
    }
}
