/**
 * Mobile layout: load after page-specific CSS (see includes/mobile_head.php).
 */

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* —— Header: hamburger + drawer (from header.css) —— */
.header-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.header-menu-toggle:focus-visible {
    outline: 2px solid var(--neon-500);
    outline-offset: 2px;
}

.header-menu-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

body.header-nav-open .header-menu-toggle .header-menu-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.header-nav-open .header-menu-toggle .header-menu-toggle-bar:nth-child(2) {
    opacity: 0;
}

body.header-nav-open .header-menu-toggle .header-menu-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.header-nav-backdrop {
    display: none;
}

/* Header drawer: up to 1024px (tablet). Between 769–1024 the old 768px breakpoint left
   desktop `display: contents` + hidden mobile bar — nav could vanish so only the logo showed. */
@media (max-width: 1024px) {
    .header {
        padding: 10px 16px;
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-top: max(10px, env(safe-area-inset-top));
        flex-wrap: nowrap;
    }

    .header-menu-toggle {
        display: flex;
    }

    /* Menu + Buy ticket on one row when closed; Buy ticket hidden while drawer is open.
       Stack above .header-nav-panel (z-index 999): the fixed drawer follows in DOM order and
       paints on top of auto z-index siblings, so it can cover the controls if transform
       does not fully clear the header strip (e.g. subpixel / compositing on mobile). */
    .header-mobile-bar-end {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        flex-wrap: nowrap;
        flex-shrink: 0;
        position: relative;
        z-index: 1001;
    }

    body.header-nav-open .header-btn-mobile-bar {
        display: none;
    }

    /* Drawer lists nav only (no duplicate Buy ticket). */
    .header-nav-panel .header-btn-buy {
        display: none;
    }

    .header-btn-mobile-bar {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 10px 14px;
        font-size: 14px;
        line-height: 18px;
    }

    .header-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 998;
        background: rgba(5, 18, 43, 0.72);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    body.header-nav-open .header-nav-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        cursor: pointer;
    }

    .header-nav-panel {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 24px;
        position: fixed;
        top: 0;
        right: 0;
        width: min(100%, 320px);
        max-width: 100vw;
        height: 100%;
        height: 100dvh;
        margin: 0;
        padding: calc(var(--header-bar-height) + 16px) 20px 32px;
        padding-bottom: max(32px, env(safe-area-inset-bottom));
        z-index: 999;
        background: var(--bg-secondary);
        border-left: 1px solid var(--border-primary);
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
        overflow-y: auto;
        overscroll-behavior: contain;
        transform: translateX(100%);
        transition: transform 0.25s ease;
    }

    body.header-nav-open .header-nav-panel {
        transform: translateX(0);
    }

    .header-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .header-nav .nav-item {
        position: relative;
        padding: 14px 12px 14px 32px;
        font-size: 18px;
        line-height: 24px;
    }

    /* Active page: dot to the left of the label (not centered under text). */
    .header-nav .nav-item.active::after {
        top: 50%;
        bottom: auto;
        left: 12px;
        transform: translateY(-50%);
        width: 6px;
        height: 6px;
    }

    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .header-actions .header-btn {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }

    /* Party/social/course/course-packages: less space under fixed header before breadcrumbs */
    .party-breadcrumbs {
        padding-top: max(90px, calc(env(safe-area-inset-top) + 56px));
    }
}

@media (min-width: 1025px) {
    .header-menu-toggle {
        display: none !important;
    }

    .header-nav-backdrop {
        display: none !important;
    }

    .header-nav-panel {
        display: contents;
    }

    /* Mobile-only bar (Buy ticket + menu); desktop uses .header-actions Buy ticket. */
    .header-mobile-bar-end {
        display: none !important;
    }
}

/* —— Global sections (from style.css) —— */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }

    .section {
        padding: 72px 0;
    }

    .section-header {
        margin-bottom: 40px;
    }

    .section-title {
        font-size: 36px;
        line-height: 44px;
    }

    .section-subtitle {
        font-size: 18px;
        line-height: 26px;
    }

    .section-title-decoration {
        width: 72px;
        height: 56px;
        font-size: 20px;
    }

    .btn-primary,
    .btn-secondary {
        font-size: 18px;
        line-height: 28px;
        padding: 14px 22px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .section {
        padding: 56px 0;
    }

    .section-title {
        font-size: 30px;
        line-height: 38px;
    }
}

/* —— Footer (from footer.css) —— */
@media (max-width: 768px) {
    .footer {
        padding: 40px 20px;
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(40px, env(safe-area-inset-bottom));
    }

    .footer-content {
        padding: 40px 20px;
        margin: -40px -20px;
    }

    .footer-nav {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        flex-wrap: nowrap;
    }

    .footer-links {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 12px;
        justify-content: flex-end;
        flex: 1;
        min-width: 0;
    }

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

@media (max-width: 480px) {
    .footer-link {
        font-size: 13px;
        line-height: 22px;
        padding: 6px 8px;
    }
}

/* —— Home (from home.css) —— */
@media (max-width: 768px) {
    .hero {
        height: auto;
        min-height: 75svh;
        display: flex;
        flex-direction: column;
    }

    /* Fixed viewport height so the photo crop stays constant when copy/buttons sit lower. */
    .hero-bg {
        height: 75svh;
        top: 0;
        right: 0;
        bottom: auto;
        left: 0;
        width: 100%;
        transform: none;
    }

    .hero-gradient {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
    }

    .hero-content {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        width: 100%;
        box-sizing: border-box;
        min-height: 0;
        padding: 88px 20px max(0px, env(safe-area-inset-bottom));
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-top: max(88px, calc(env(safe-area-inset-top) + 72px));
        gap: 0;
    }

    /* Intro first, then headline as a tight tagline next to the Zouk copy */
    .hero-description {
        order: 1;
        margin-top: auto;
        padding-top: 310px;
        font-size: 18px;
        line-height: 26px;
    }

    .hero-heading {
        order: 2;
        font-family: 'Urbanist', sans-serif;
        font-weight: 700;
        font-size: 30px;
        line-height: 36px;
        margin: 14px 0 0;
        max-width: 22ch;
        text-wrap: balance;
        color: var(--text-primary);
        letter-spacing: -0.02em;
        text-shadow: 0 0 20px rgba(60, 150, 255, 0.4), 0 0 36px rgba(60, 150, 255, 0.2);
    }

    .hero-buttons {
        order: 3;
        margin-top: 20px;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: 16px;
    }

    .hero-buttons .btn-primary,
    .hero-buttons .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .event-title {
        font-size: 24px;
        line-height: 32px;
    }

    .carousel-btn {
        width: 48px;
        height: 48px;
    }

    .carousel-page {
        font-size: 18px;
        line-height: 26px;
    }

    /* Nearest events: full-width cards — no side fade (home.css mask). */
    #events .events-grid-wrapper {
        -webkit-mask-image: none;
        mask-image: none;
        margin-bottom: 20px;
        padding: 24px 0 16px;
    }

    /* Tighter gap: nearest events → What makes ZoukKTH special */
    .section.home-section-nearest-events {
        padding-bottom: 20px;
    }

    .section.home-section-after-events {
        padding-top: 16px;
    }

    .why-title {
        font-size: 28px;
        line-height: 36px;
    }

    .why-content {
        gap: 16px;
    }

    .why-number {
        font-size: 16px;
        line-height: 22px;
    }

    .why-text {
        font-size: 14px;
        line-height: 21px;
    }

    .why-item {
        padding: 6px 0;
    }

    .why-image {
        height: 260px;
    }

    /* Find your flow + three feature cards — hidden on small screens */
    section.features-section {
        display: none;
    }

    /* Location stack: map + details share full container width (line + text align to map width) */
    .location-row {
        gap: 12px;
        align-items: stretch;
        width: 100%;
    }

    .location-row-shared-map {
        gap: 12px;
    }

    .location-items-stack {
        flex: 0 1 auto;
        gap: 16px;
        width: 100%;
        max-width: 100%;
        align-self: stretch;
        box-sizing: border-box;
    }

    .location-row-map,
    .location-row-shared-map .location-row-map {
        flex: 0 0 auto;
        align-self: stretch;
        width: 100%;
        max-width: 100%;
        height: 300px;
        min-height: 300px;
        box-sizing: border-box;
    }

    /* Full-width line under map: border on map is clipped by overflow:hidden + radius; draw rule on next sibling */
    .location-row-map + .location-items-stack {
        border-top: 2px solid var(--alfa-grey-2);
    }

    .location-row-map + .location-items-stack > .location-item:first-child {
        border-top: none;
    }

    /* Course / course-packages: map + single .location-item (not .location-items-stack) — same full width as map */
    .location-row-map + .location-item {
        width: 100%;
        max-width: 100%;
        align-self: stretch;
        box-sizing: border-box;
    }

    /* Fill map width: header + rows stretch; avoid content-width “column” under full-width line */
    .location-item .location-header {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .location-item .location-title {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .location-item .location-details {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .location-item .location-detail {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .location-title {
        font-size: 22px;
        line-height: 28px;
    }

    .location-detail-text {
        font-size: 14px;
        line-height: 21px;
        flex: 0 1 auto;
        min-width: 0;
    }

    .location-detail-icon {
        width: 20px;
        height: 20px;
    }

    .location-details {
        gap: 8px;
        padding-top: 10px;
        padding-bottom: 8px;
    }

    /* Match party page .party-location-card divider */
    .location-item {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        align-self: stretch;
        box-sizing: border-box;
        padding-top: 16px;
        border-top: 2px solid var(--alfa-grey-2);
    }

    .location-detail-place {
        margin-left: 26px;
    }

    .location-toggle {
        width: 44px;
        height: 44px;
    }

    /* FAQ: full width inside container (desktop uses padding: 0 98px on .faq-content) */
    .faq-content {
        padding-left: 0;
        padding-right: 0;
    }

    /* FAQ: smaller copy + compact chevron (foldout control) on mobile */
    #faq .section-subtitle {
        font-size: 16px;
        line-height: 24px;
    }

    .faq-question {
        font-size: 18px;
        line-height: 26px;
    }

    .faq-answer {
        padding-bottom: 24px;
    }

    .faq-answer-text {
        font-size: 14px;
        line-height: 22px;
    }

    .faq-answer img {
        max-width: 100%;
        height: auto;
    }

    .faq-toggle {
        width: 44px;
        height: 44px;
    }

    .faq-toggle i {
        font-size: 18px;
    }

    .faq-empty {
        font-size: 14px;
        line-height: 22px;
    }

    /* Course page FAQ: same mobile scale as home #faq */
    .class-faq-header p {
        font-size: 16px;
        line-height: 24px;
    }

    .class-faq-question {
        font-size: 18px;
        line-height: 26px;
    }

    .class-faq-body {
        padding-bottom: 24px;
    }

    .class-faq-body p {
        font-size: 14px;
        line-height: 22px;
    }

    .class-faq-toggle {
        width: 44px;
        height: 44px;
    }

    .class-faq-toggle i {
        font-size: 18px;
    }

    .class-faq .decoration-spotlight {
        transform: translate(-50%, -20px);
    }

    #faq .decoration-spotlight {
        transform: translate(-50%, -20px);
    }
}

@media (max-width: 480px) {
    .hero-content {
        padding-top: max(76px, calc(env(safe-area-inset-top) + 60px));
    }

    .hero-heading {
        font-size: 26px;
        line-height: 32px;
    }

    .hero-description {
        font-size: 16px;
        line-height: 24px;
    }

    #faq .section-subtitle {
        font-size: 15px;
        line-height: 22px;
    }

    .faq-question {
        font-size: 16px;
        line-height: 24px;
    }

    .faq-answer-text {
        font-size: 13px;
        line-height: 20px;
    }

    .faq-toggle {
        width: 40px;
        height: 40px;
    }

    .faq-toggle i {
        font-size: 16px;
    }

    .class-faq-header p {
        font-size: 15px;
        line-height: 22px;
    }

    .class-faq-question {
        font-size: 16px;
        line-height: 24px;
    }

    .class-faq-body p {
        font-size: 13px;
        line-height: 20px;
    }

    .class-faq-toggle {
        width: 40px;
        height: 40px;
    }

    .class-faq-toggle i {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-menu-toggle-bar,
    .header-nav-panel,
    .header-nav-backdrop {
        transition: none;
    }
}
