/* ===========================================
   MOBILE STYLES - NOBODYS Gallery
   ===========================================
   
   This is a separate stylesheet for easy tweaking.
   Values can later be moved to WP Admin ACF fields.
   
   Key differences from desktop:
   - Nav doesn't take a column (content uses full width)
   - 3 columns for content
   - Nav is hidden, logo bar at top toggles it
   - Fullscreen uses full width
   - Biography uses 2 columns in filtered mode
   - Panels use admin span (max 2)
   
   =========================================== */

@media (max-width: 640px), (pointer: coarse) and (hover: none) and (max-height: 540px) {

    html {
        background: var(--client-default-bg, var(--hover-bg, #000000));
    }
    
    /* ===========================================
       MOBILE VARIABLES
       Edit these to quickly adjust mobile layout
       =========================================== */
    :root {
        /* Layout */
        --mobile-edge-margin: 10px;
        --mobile-panel-gap: 10px;
        --mobile-columns: 3;
        --mobile-panel-padding: 10px;
        
        /* Nav/Logo */
        --mobile-logo-height: 100px;
        --mobile-logo-max-width: 60vw;
        --mobile-logo-padding: 15px;
        --mobile-header-height: calc(var(--mobile-logo-height) + (var(--mobile-logo-padding) * 2));
        --mobile-logo-offset-y: -10px;
        --mobile-logo-hit-top: 0px;
        --mobile-logo-hit-height: 62px;
        --mobile-logo-hit-left: 0px;
        --mobile-logo-hit-right: 0px;
        --mobile-flow-top-gap: -76px;
        --mobile-focused-content-top: calc(var(--mobile-header-height) + env(safe-area-inset-top) + var(--mobile-flow-top-gap) + 40px);
        --mobile-focused-intro-gap: clamp(6px, 1.4vh, 14px);
        --mobile-toggle-width: 48px;
        --mobile-toggle-gap: 2px;
        --mobile-toggle-line-gap: 1px;
        --mobile-toggle-offset-y: 34px;
        --mobile-toggle-line-size: 14px;
        --mobile-toggle-make-spacing: 0.38em;
        --mobile-toggle-your-spacing: 0.38em;
        --mobile-toggle-own-spacing: 0.58em;
        --mobile-toggle-rules-spacing: 0.31em;
        
        /* Typography - Nav */
        --mobile-nav-section-size: 22px;
        --mobile-nav-item-size: 30px;
        --mobile-nav-item-padding: 0px;
        --mobile-nav-item-gap: 8px;
        
        /* Typography - Content */
        --mobile-tooltip-size: 22px;
        --mobile-bio-title-size: 20px;
        --mobile-bio-text-size: 14px;
        --mobile-bio-line-height: 1.5;
        --mobile-inline-icon-gap: 0.32em;
        --mobile-tooltip-name-gap: calc(0.44em + 3px);
        --mobile-inline-icon-baseline: 0.14em;
        
        /* Fullscreen */
        --mobile-fullscreen-title-size: 18px;
        --mobile-fullscreen-detail-size: 14px;
    }
    
    /* Override main variables */
    :root {
        --edge-margin: var(--mobile-edge-margin);
        --panel-gap: var(--mobile-panel-gap);
    }

    .stream-container-desktop {
        display: none;
    }

    .stream-container-mobile {
        display: none;
    }

    #mobile-flow {
        display: block;
        position: relative;
        width: 100%;
        padding-top: var(--mobile-focused-content-top);
        padding-bottom: env(safe-area-inset-bottom);
        box-sizing: border-box;
    }

    #mobile-flow.page-about-us,
    #mobile-flow.page-contacts {
        height: auto;
        min-height: 0;
        padding-top: calc(var(--mobile-header-height) + env(safe-area-inset-top) + var(--mobile-focused-intro-gap));
    }

    .mobile-flow-grid {
        display: flex;
        flex-direction: column;
        gap: var(--mobile-panel-gap);
        padding: 0;
        box-sizing: border-box;
        will-change: transform;
        transform-style: preserve-3d;
    }

    .mobile-flow-row {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    #mobile-flow {
        perspective: 900px;
        perspective-origin: 50% 50%;
    }

    #mobile-flow .stream-panel {
        transform-style: preserve-3d;
        will-change: transform, filter;
    }

    .mobile-flow-row[data-align="left"] {
        justify-content: flex-start;
    }

    .mobile-flow-row[data-align="center"] {
        justify-content: center;
    }

    .mobile-flow-row[data-align="right"] {
        justify-content: flex-end;
    }

    #mobile-flow .stream-panel {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        background: transparent;
        transform-origin: 50% 50%;
    }

    body.mobile-flow-filter #mobile-flow .panel-tooltip {
        opacity: 1 !important;
        visibility: visible !important;
    }

    body.mobile-flow:not(.filter-mode) #mobile-flow .stream-panel:not(.fullscreen) {
        --tooltip-dash-offset-y: calc(var(--ui-dash-offset-y) - 2px);
    }

    body.mobile-filter-entering #mobile-flow .stream-panel,
    body.mobile-filter-entering #mobile-flow .panel-tooltip {
        visibility: hidden !important;
    }

    .mobile-flow-info .text-content-column {
        opacity: 1;
        width: 100%;
        max-width: 100%;
    }

    /* Match mobile info page insets/spacing to biography layout */
    #mobile-flow.page-about-us .mobile-flow-info .mobile-flow-row,
    #mobile-flow.page-contacts .mobile-flow-info .mobile-flow-row {
        padding: 0 var(--mobile-panel-padding);
        box-sizing: border-box;
    }

    #mobile-flow.page-about-us .mobile-flow-grid.mobile-flow-info,
    #mobile-flow.page-contacts .mobile-flow-grid.mobile-flow-info {
        height: auto;
        min-height: 0;
    }

    #mobile-flow.page-about-us .mobile-flow-info .text-content-column,
    #mobile-flow.page-contacts .mobile-flow-info .text-content-column {
        line-height: var(--mobile-bio-line-height);
    }

    #mobile-flow.page-about-us .mobile-flow-info .text-content-column {
        font-size: var(--about-text-size, 14px);
    }

    /* About Us on mobile: optional centering only when JS marks short content. */
    #mobile-flow.page-about-us .mobile-flow-info.about-centered {
        min-height: calc(
            (var(--vh, 1vh) * 100) -
            (var(--mobile-header-height) + env(safe-area-inset-top) + var(--mobile-flow-top-gap)) -
            env(safe-area-inset-bottom)
        );
    }

    #mobile-flow.page-about-us .mobile-flow-info.about-centered .mobile-flow-row:first-child {
        margin-top: auto;
    }

    #mobile-flow.page-about-us .mobile-flow-info.about-centered .mobile-flow-row:last-child {
        margin-bottom: auto;
    }

    #mobile-flow.page-contacts .mobile-flow-info .text-content-column {
        font-size: var(--contacts-text-size, 14px);
    }

    /* ===========================================
       NAV - Hidden during splash
       =========================================== */
    body.splash-active:not(.splash-nav-enabled) .nav,
    body.splash-active:not(.splash-nav-enabled) .nav-logo,
    body.splash-active:not(.splash-nav-enabled) .nav-mobile-toggle {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Mobile splash: stretch to full viewport (including browser chrome area where supported). */
    body.splash-active .splash-video-container {
        position: fixed;
        top: 0;
        right: 0;
        bottom: -2px;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        height: 100lvh;
        max-height: none;
        background: var(--client-default-bg, var(--splash-bg, #c2d1d1));
    }

    html.mobile-safari body.splash-active .splash-video-container,
    body.mobile-safari.splash-active .splash-video-container {
        bottom: 0;
        height: 100vh;
        height: 100dvh;
    }

    /* Mobile splash media: fit full video within viewport instead of cover-cropping */
    body.splash-active .splash-video-container video,
    body.splash-active .splash-video-container iframe {
        top: 0;
        left: 0;
        transform: none;
        width: 100%;
        height: 100%;
        min-width: 0;
        min-height: 0;
    }

    body.splash-active .splash-video-container video,
    body.splash-active .splash-video-container iframe {
        object-fit: contain;
        object-position: center center;
    }

    /* Click exit: fade splash media over 1 second. */
    .splash-video-container {
        opacity: 1;
        transition: opacity 1s ease;
    }

    body.splash-exiting .splash-video-container {
        opacity: 0;
        pointer-events: none;
    }

    body.splash-active:not(.splash-exiting) #mobile-flow,
    body.splash-active:not(.splash-exiting) #text-content-container,
    body.splash-active:not(.splash-exiting) #photo-gallery,
    body.splash-active:not(.splash-exiting) .stream-container-desktop,
    body.splash-active:not(.splash-exiting) .stream-container-mobile {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    body.splash-active.splash-exiting #mobile-flow,
    body.splash-active.splash-exiting #text-content-container,
    body.splash-active.splash-exiting #photo-gallery,
    body.splash-active.splash-exiting .stream-container-desktop,
    body.splash-active.splash-exiting .stream-container-mobile {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transition: opacity 1s ease;
    }

    body.splash-active:not(.splash-exiting) .stream-container-desktop .stream-panel,
    body.splash-active:not(.splash-exiting) .stream-container-mobile .stream-panel {
        opacity: 0 !important;
        visibility: hidden !important;
    }

    body.splash-active.splash-exiting .stream-container-desktop .stream-panel,
    body.splash-active.splash-exiting .stream-container-mobile .stream-panel {
        opacity: 1 !important;
        visibility: visible !important;
        transition: opacity 1s ease;
    }

    /* ===========================================
       NAV - Header Bar (starts hidden, shown by JS)
       =========================================== */
    .nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        flex-direction: column;
        align-items: center;
        padding: 0;
        background: transparent;
        z-index: 300;
        /* iOS safe area for notch */
        padding-top: env(safe-area-inset-top);
        /* Start hidden - JS adds .visible class after splash */
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.5s ease, visibility 0.5s ease;
        /* Let taps pass through except on explicit nav controls. */
        pointer-events: none;
    }

    html.ios-chrome .nav,
    body.ios-chrome .nav {
        top: var(--ios-chrome-nav-viewport-top, 0px);
    }

    /* Show nav after splash ends */
    .nav.fonts-loaded.visible {
        opacity: 1;
        visibility: visible;
    }

    .nav > * {
        width: 100%;
        max-width: var(--mobile-logo-max-width);
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
        pointer-events: auto;
    }

    .nav-mobile-bar {
        width: 100%;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
        display: grid;
        grid-template-columns: var(--mobile-toggle-width) minmax(0, 1fr) var(--mobile-toggle-width);
        align-items: start;
        column-gap: var(--mobile-toggle-gap);
        padding: var(--mobile-logo-padding) var(--mobile-edge-margin);
        position: relative;
        z-index: 301;
        pointer-events: none;
    }

    .nav-logo-link {
        grid-column: 2;
        justify-self: center;
        display: block;
        position: relative;
        width: calc(100vw - (var(--mobile-edge-margin) * 2) - (var(--mobile-toggle-width) * 2) - (var(--mobile-toggle-gap) * 2));
        max-width: 100%;
        min-width: 0;
        pointer-events: none;
    }

    /* Nav logo area */
    .nav-logo {
        width: 100%;
        height: var(--mobile-logo-height);
        aspect-ratio: auto;
        margin: 0;
        padding: 0;
        cursor: pointer;
        position: relative;
        z-index: 301;
        background: transparent;
        box-sizing: border-box;
        border: none;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        pointer-events: none;
    }

    .nav-logo-hit-area {
        display: block;
        position: absolute;
        left: var(--mobile-logo-hit-left);
        right: var(--mobile-logo-hit-right);
        top: var(--mobile-logo-hit-top);
        height: var(--mobile-logo-hit-height);
        z-index: 302;
        pointer-events: auto;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .nav-mobile-toggle {
        grid-column: 1;
        justify-self: start;
        position: absolute;
        top: calc(var(--mobile-logo-padding) + var(--mobile-toggle-offset-y));
        left: var(--mobile-edge-margin);
        right: auto;
        display: flex;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 0;
        width: var(--mobile-toggle-width);
        min-width: 44px;
        height: 48px;
        min-height: 48px;
        max-width: var(--mobile-toggle-width);
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--hover-fg);
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        pointer-events: auto;
        font-family: 'ITCGaramondStd', 'EB Garamond', Garamond, Georgia, 'Times New Roman', serif;
        text-transform: none;
        z-index: 302;
        overflow: visible;
        user-select: none;
        -webkit-user-select: none;
    }

    .nav-mobile-toggle::before {
        content: '';
        position: absolute;
        inset: -12px;
        /* This pseudo-element extends the tap target beyond the visible
           button bounds. pointer-events: auto is required for it to
           actually capture taps. */
        pointer-events: auto;
    }

    html.mobile-hamburger-right .nav-mobile-toggle,
    body.mobile-hamburger-right .nav-mobile-toggle {
        grid-column: 3;
        justify-self: end;
        left: auto;
        right: var(--mobile-edge-margin);
        justify-content: flex-end;
    }

    .nav-mobile-toggle-icon {
        /* Pure CSS hamburger / X toggle — no Font Awesome dependency.
           Three lines are drawn with the element itself + ::before + ::after.
           When [data-nav-state="open"] is set on the parent button,
           the lines rotate into an X shape. */
        display: block;
        pointer-events: none;
        position: relative;
        z-index: 1;
        width: 20px;
        height: 2px;
        background: currentColor;
        border-radius: 1px;
        transition: background 0.25s ease;
        margin-top: 9px; /* vertically centre the 3 lines within the tap target */
    }

    .nav-mobile-toggle-icon::before,
    .nav-mobile-toggle-icon::after {
        content: '';
        position: absolute;
        left: 0;
        width: 100%;
        height: 2px;
        background: currentColor;
        border-radius: 1px;
        transition: transform 0.25s ease, top 0.25s ease;
    }

    .nav-mobile-toggle-icon::before {
        top: -7px;
    }

    .nav-mobile-toggle-icon::after {
        top: 7px;
    }

    /* X state — middle line hidden, top/bottom rotate to form cross */
    .nav-mobile-toggle[data-nav-state="open"] .nav-mobile-toggle-icon {
        background: transparent;
    }

    .nav-mobile-toggle[data-nav-state="open"] .nav-mobile-toggle-icon::before {
        top: 0;
        transform: rotate(45deg);
    }

    .nav-mobile-toggle[data-nav-state="open"] .nav-mobile-toggle-icon::after {
        top: 0;
        transform: rotate(-45deg);
    }

    .nav-mobile-toggle:focus-visible {
        outline: 1px solid currentColor;
        outline-offset: 2px;
    }

    .nav-mobile-toggle-line {
        --line-tracking: 0em;
        display: flex;
        justify-content: center;
        width: 100%;
        border-top: 0;
        padding-top: 0;
        line-height: 0.75;
        font-size: var(--mobile-toggle-line-size);
        letter-spacing: var(--line-tracking);
        margin-right: calc(var(--line-tracking) * -1);
        white-space: nowrap;
        text-align: center;
    }

    .nav-mobile-toggle-line-make {
        --line-tracking: var(--mobile-toggle-make-spacing);
    }

    .nav-mobile-toggle-line-your {
        --line-tracking: var(--mobile-toggle-your-spacing);
    }

    .nav-mobile-toggle-line-own {
        --line-tracking: var(--mobile-toggle-own-spacing);
    }

    .nav-mobile-toggle-line-rules {
        --line-tracking: var(--mobile-toggle-rules-spacing);
    }

    .nav-logo svg {
        width: 100%;
        height: 100%;
        max-width: none;
        display: block;
    }

    .nav-logo {
        -webkit-tap-highlight-color: transparent;
        transform: translate3d(0, var(--mobile-logo-offset-y), 0);
        will-change: transform;
    }

    html.ios-chrome .nav-logo,
    body.ios-chrome .nav-logo {
        transform: none;
        will-change: auto;
    }

    html.ios-chrome .nav-logo svg,
    body.ios-chrome .nav-logo svg {
        overflow: visible;
    }

    .nav-logo:active {
        opacity: 1;
    }

    /* ===========================================
       NAV - Hidden Content (shown when open)
       =========================================== */
    .nav-section,
    .nav-items,
    .nav-divider {
        display: block;
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        filter: none;
        transform: translateY(6px);
        pointer-events: none;
        transition: opacity 0.4s ease, transform 0.5s ease;
    }

    .nav-section {
        transform: none;
        transition: opacity 0.4s ease;
    }

    /* ===========================================
       NAV - Open State (full page overlay)
       =========================================== */
    .nav.mobile-open,
    .nav.mobile-open-lite {
        bottom: 0;
        height: calc(var(--vh, 1vh) * 100);
        max-height: calc(var(--vh, 1vh) * 100);
        display: flex;
        flex-direction: column;
        background: transparent;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding-bottom: env(safe-area-inset-bottom);
        padding-top: env(safe-area-inset-top);
        pointer-events: auto;
    }

    .nav.mobile-open > *,
    .nav.mobile-open-lite > * {
        position: relative;
        z-index: 1;
        pointer-events: auto;
    }

    #nav-backdrop {
        position: fixed;
        inset: 0;
        background: var(--hover-bg);
        opacity: 0;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        z-index: 250;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    #nav-backdrop.active {
        opacity: calc(1 - var(--mobile-nav-dim-opacity, 0.2));
        pointer-events: auto;
    }

    /* Lite nav tint: dim content, keep page chrome tinted */
    html.mobile-nav-dim,
    body.mobile-nav-dim {
        background-color: var(--hover-bg, var(--client-default-bg, #000000)) !important;
    }

    body.mobile-nav-dim #mobile-flow {
        opacity: var(--mobile-nav-dim-opacity, 0.2);
        transition: opacity 0.2s ease;
    }

    body.mobile-nav-dim #text-content-container,
    body.mobile-nav-dim .stream-container,
    body.mobile-nav-dim .splash-video-container {
        opacity: var(--mobile-nav-dim-opacity, 0.2);
        transition: opacity 0.2s ease;
    }

    body.mobile-nav-dim.photo-gallery-mode #photo-gallery {
        opacity: var(--mobile-nav-dim-opacity, 0.2) !important;
        transition: opacity 0.2s ease;
    }

    .nav.mobile-open .nav-logo,
    .nav.mobile-open-lite .nav-logo {
        background: transparent;
    }

    .nav.mobile-open .nav-section,
    .nav.mobile-open .nav-items,
    .nav.mobile-open .nav-divider,
    .nav.mobile-open-lite .nav-section,
    .nav.mobile-open-lite .nav-items,
    .nav.mobile-open-lite .nav-divider {
        display: block;
        opacity: 1;
        max-height: none;
        filter: blur(0);
        transform: translateY(0);
        pointer-events: auto;
        padding-left: var(--mobile-edge-margin);
        padding-right: var(--mobile-edge-margin);
        width: 100%;
        max-width: var(--mobile-logo-max-width);
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    .nav.mobile-open .nav-section,
    .nav.mobile-open-lite .nav-section {
        padding-top: clamp(5px, 1.2vh, 10px);
        padding-bottom: clamp(5px, 1.2vh, 10px);
        padding-left: 0;
        padding-right: 0;
        font-size: var(--mobile-nav-section-size);
        text-align: center;
    }

    .nav.mobile-open .nav-section::after,
    .nav.mobile-open-lite .nav-section::after {
        content: none;
    }

    .nav.mobile-open .nav-section:first-of-type,
    .nav.mobile-open-lite .nav-section:first-of-type {
        margin-top: clamp(4px, 1vh, 10px);
        position: relative;
    }

    .nav.mobile-open .nav-section:first-of-type::before,
    .nav.mobile-open-lite .nav-section:first-of-type::before {
        content: '';
        display: block;
        width: 100%;
        height: var(--nav-divider-height, 3px);
        background: currentColor;
        opacity: 0.9;
        margin-top: var(--nav-divider-margin-top, 5px);
        margin-bottom: var(--nav-divider-margin-bottom, 5px);
    }

    /* Nav items - one per line on mobile */
    .nav.mobile-open .nav-items,
    .nav.mobile-open-lite .nav-items {
        display: block;
        overflow-x: hidden;
        overflow-y: visible;
        gap: 0;
        padding-bottom: clamp(8px, 1.8vh, 18px);
        padding-left: 0;
        padding-right: 0;
        text-align: center;
    }

    .nav.mobile-open .nav-items::-webkit-scrollbar,
    .nav.mobile-open-lite .nav-items::-webkit-scrollbar {
        width: 0;
        height: 0;
    }

    .nav.mobile-open .nav-item,
    .nav.mobile-open-lite .nav-item {
        display: block;
        width: 100%;
        font-size: var(--mobile-nav-item-size);
        padding: var(--mobile-nav-item-padding) 0;
        white-space: normal;
        text-align: center;
    }

    .nav.mobile-open .nav-item-name,
    .nav.mobile-open-lite .nav-item-name {
        display: block;
        text-align: center;
    }

    .nav.mobile-open .nav-item-prefix,
    .nav.mobile-open-lite .nav-item-prefix {
        display: none;
        width: 0;
        margin: 0;
    }

    .nav.mobile-open .nav-divider,
    .nav.mobile-open-lite .nav-divider {
        margin-top: clamp(8px, 1.8vh, 16px);
        margin-bottom: clamp(8px, 1.8vh, 16px);
        height: var(--nav-divider-height, 3px);
        padding: 0;
    }

    .nav.mobile-open .nav-divider:last-of-type,
    .nav.mobile-open-lite .nav-divider:last-of-type {
        margin-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    /* Mobile nav lite readability tweaks (no backdrop overlay) */
    .nav.mobile-open-lite {
        bottom: auto;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        padding-top: env(safe-area-inset-top);
    }

    .nav.mobile-open-lite .nav-section,
    .nav.mobile-open-lite .nav-item {
        text-shadow: none;
    }

    /* ===========================================
       STREAM CONTAINER - Full Width (no nav column)
       =========================================== */
    #stream-mobile {
        padding-top: calc(var(--mobile-header-height) + env(safe-area-inset-top) + var(--mobile-flow-top-gap));
        padding-bottom: env(safe-area-inset-bottom);
        box-sizing: border-box;
        /* No right padding for nav - content uses full width */
        padding-right: 0;
    }

    body.mobile-flat #stream-mobile {
        padding-top: 0;
    }

    html.mobile-flat {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    body.mobile-flat {
        overflow-x: hidden !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        position: static !important;
    }

    html.mobile-flow,
    html.mobile-flow.mobile-flow-filter {
        overflow-x: clip !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    body.mobile-flow,
    body.mobile-flow-filter {
        overflow-x: clip !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    body.mobile-flat .stream-container-mobile {
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        height: auto !important;
        overflow: visible !important;
        pointer-events: auto;
        perspective: 600px;
        perspective-origin: 50% 50%;
        transform-style: preserve-3d;
        border-top: 1px solid rgba(255, 0, 0, 0.6);
        border-bottom: 1px solid rgba(255, 0, 0, 0.6);
    }

    body.mobile-flat .stream-inner {
        position: relative;
        display: flow-root;
        min-height: calc(var(--vh, 1vh) * 100);
        height: auto;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        width: 100%;
        transform: none;
        transform-style: preserve-3d;
        pointer-events: auto;
    }

    body.mobile-flat .flat-river-track {
        position: relative;
        width: 100%;
        min-height: calc(var(--vh, 1vh) * 100);
        will-change: transform;
        transform: translate3d(0, 0, 0);
        transform-style: preserve-3d;
    }


    body.mobile-flat .stream-panel {
        position: relative !important;
        display: block;
        left: auto !important;
        top: auto !important;
        transform: none;
        background: transparent;
        transform-style: preserve-3d;
    }

    body.mobile-flat .stream-panel .panel-image-wrapper {
        transform-style: preserve-3d;
        will-change: transform;
    }

    body.mobile-flat .stream-panel .panel-image-wrapper {
        padding: 0 var(--mobile-panel-padding);
        box-sizing: border-box;
        background: transparent;
        height: 100%;
    }

    body.mobile-flat .stream-panel:not(.fullscreen) .video-wrapper {
        left: var(--mobile-panel-padding);
        right: var(--mobile-panel-padding);
        width: auto;
    }

    body.mobile-flat .panel-tooltip {
        padding: 0 var(--mobile-panel-padding);
        box-sizing: border-box;
    }

    body.mobile-flat .video-preloader {
        left: calc(var(--mobile-panel-padding) + 10px);
    }

    body.mobile-flow .panel-play-button,
    body.mobile-flat .panel-play-button {
        width: 64px;
        height: 64px;
        --panel-play-glyph-width: 40px;
        --panel-play-glyph-height: 48px;
        top: 50%;
        margin-top: 0;
        border-radius: 14px;
        background: transparent;
        box-shadow: none;
        filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
    }

    body.mobile-flow .panel-play-button::before,
    body.mobile-flat .panel-play-button::before {
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'%3E%3Cpath d='M62.8,199.5c-1,0.8-2.4,0.6-3.3-0.4c-0.4-0.5-0.6-1.1-0.5-1.8V42.6c-0.2-1.3,0.7-2.4,1.9-2.6c0.7-0.1,1.3,0.1,1.9,0.4l154.7,77.7c2.1,1.1,2.1,2.8,0,3.8L62.8,199.5z'/%3E%3C/svg%3E");
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'%3E%3Cpath d='M62.8,199.5c-1,0.8-2.4,0.6-3.3-0.4c-0.4-0.5-0.6-1.1-0.5-1.8V42.6c-0.2-1.3,0.7-2.4,1.9-2.6c0.7-0.1,1.3,0.1,1.9,0.4l154.7,77.7c2.1,1.1,2.1,2.8,0,3.8L62.8,199.5z'/%3E%3C/svg%3E");
    }

    body.mobile-flow .panel-play-button:active,
    body.mobile-flat .panel-play-button:active {
        border-radius: 0;
    }

    /* Keep fullscreen affordance visible while teaser is playing on mobile. */
    body.mobile-flow .stream-panel.teaser-playing .panel-play-button,
    body.mobile-flat .stream-panel.teaser-playing .panel-play-button {
        opacity: 1;
        pointer-events: auto;
        transform: translate(-50%, -50%) scale(1);
    }

    body.mobile-flow .stream-panel.inline-full:not(.full-video-ended) .panel-play-button,
    body.mobile-flat .stream-panel.inline-full:not(.full-video-ended) .panel-play-button {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    body.mobile-flow .stream-panel.teaser-playing .panel-image-wrapper img,
    body.mobile-flow .stream-panel.inline-full .panel-image-wrapper img,
    body.mobile-flat .stream-panel.teaser-playing .panel-image-wrapper img,
    body.mobile-flat .stream-panel.inline-full .panel-image-wrapper img {
        -webkit-clip-path: inset(0 0 1px 0);
        clip-path: inset(0 0 1px 0);
    }

    body.mobile-flat .nav-logo {
        background: transparent;
    }

    body.filter-mode .nav-logo {
        background: transparent;
    }

    body.filter-mode {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        height: auto !important;
        min-height: 100% !important;
        overscroll-behavior-y: none;
        overscroll-behavior-x: none;
        touch-action: pan-y;
    }

    html.filter-mode {
        overscroll-behavior-x: none;
    }

    html.photo-gallery-mode {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100% !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    body.photo-gallery-mode {
        overflow-x: clip !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    body.photo-gallery-mode #photo-gallery {
        display: block !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
        overflow: visible !important;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
        padding-top: var(--mobile-focused-content-top);
        padding-bottom: calc(var(--mobile-edge-margin) + env(safe-area-inset-bottom));
        box-sizing: border-box;
    }

    body.photo-gallery-mode #mobile-flow,
    body.photo-gallery-mode #biography-panel,
    body.photo-gallery-mode .mobile-bio-extras,
    body.photo-gallery-mode #filtered-layer {
        display: none !important;
    }

    body.photo-gallery-mode .stream-container-mobile,
    body.photo-gallery-mode .stream-container-desktop,
    body.photo-gallery-mode #stream-mobile {
        display: none !important;
        overflow: hidden !important;
        pointer-events: none !important;
    }

    body.filter-mode .stream-container-mobile {
        position: relative;
        height: auto;
        overflow: visible;
        pointer-events: auto;
        perspective: none;
        transform-style: flat;
    }

    body.filter-mode #stream-mobile {
        overflow-x: hidden;
        touch-action: pan-y;
    }

    body.filter-mode .stream-inner {
        position: relative;
        min-height: calc(var(--vh, 1vh) * 100);
        height: auto;
        transform: none;
        transform-style: flat;
        pointer-events: auto;
    }

    body.mobile-flat .mobile-flat-grid {
        position: absolute;
        top: 0;
        left: 0;
        pointer-events: none;
        z-index: 5;
        opacity: 0;
    }

    body.mobile-flat .mobile-flat-grid-col {
        position: absolute;
        top: 0;
        bottom: 0;
        border-left: 1px solid rgba(255, 0, 0, 0.35);
        border-right: 1px solid rgba(255, 0, 0, 0.2);
    }

    body.mobile-flat.flat-hide-panels .stream-panel {
        opacity: 0;
        pointer-events: none;
    }

    body.mobile-flat.flat-hide-panels .panel-tooltip {
        opacity: 0;
    }

    body.mobile-flat .mobile-flat-panel-toggle {
        position: fixed;
        top: calc(env(safe-area-inset-top) + 6px);
        left: 6px;
        z-index: 1001;
        background: rgba(0, 0, 0, 0.55);
        color: #ffffff;
        border: 1px solid rgba(255, 255, 255, 0.6);
        border-radius: 999px;
        padding: 4px 10px;
        font-size: 12px;
        font-family: inherit;
        letter-spacing: 0.03em;
    }

    #stream-inner {
        /* Content uses full width, 3 columns */
        width: 100%;
    }

    /* ===========================================
       PANELS - Use admin span (max 2)
       =========================================== */
    .stream-panel {
        /* Panels sized by JS based on admin span */
    }

    .panel-tooltip {
        font-size: var(--mobile-tooltip-size);
        margin-top: 7px;
    }

    .stream-panel.inline-full .panel-tooltip {
        margin-top: 7px;
        position: relative;
        padding-right: 0;
    }

    .stream-panel.inline-full .tooltip-name {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .tooltip-name {
        display: inline-flex;
        align-items: baseline;
        gap: var(--mobile-tooltip-name-gap);
        width: auto;
        min-width: 0;
        max-width: 100%;
        overflow: visible;
        column-gap: var(--ui-inline-dash-gap);
    }

    .tooltip-text {
        overflow: visible;
        text-overflow: clip;
    }

    .stream-panel.inline-full .tooltip-name.tooltip-name-has-timecode {
        display: grid;
        grid-template-columns: max-content max-content auto;
        column-gap: var(--mobile-tooltip-name-gap);
        overflow: visible;
        position: relative;
        width: 100%;
    }

    .stream-panel.inline-full .tooltip-timecode.mobile-inline-timecode {
        justify-self: end;
        text-align: right;
        white-space: nowrap;
        font-size: 16px;
        line-height: 1.2;
        padding-left: 10px;
        opacity: 1;
    }

    .stream-panel.inline-full > .tooltip-more.tooltip-more-inline {
        position: absolute;
        right: 0;
        bottom: calc(100% + 4px);
        margin: 0;
        padding: 0;
        display: inline-flex;
        align-items: baseline;
        gap: var(--mobile-inline-icon-gap);
        text-align: right;
        white-space: nowrap;
        z-index: 220;
        line-height: 1.2;
        font-size: 20px;
        font-family: 'ITCGaramondStd', 'EB Garamond', Garamond, Georgia, 'Times New Roman', serif;
        font-weight: normal;
        opacity: 1;
    }

    .tooltip-dash {
        position: relative;
        top: calc(var(--mobile-inline-icon-baseline) - 2px);
        vertical-align: middle;
    }

    .tooltip-dash.loading {
        animation: tooltip-dash-spin 0.8s linear infinite;
    }

    .stream-panel.inline-full > .tooltip-more.tooltip-more-inline .tooltip-more-arrow,
    .stream-panel.inline-full > .tooltip-more.tooltip-more-inline .tooltip-more-label {
        font-size: 1em;
        line-height: 1.2;
    }

    .stream-panel.inline-full > .tooltip-more.tooltip-more-inline .tooltip-more-arrow {
        --ui-arrow-offset-y: calc(var(--mobile-inline-icon-baseline) - 2px);
        line-height: 1;
    }

    /* ===========================================
       FILTERED MODE - Biography scrolls with page
       =========================================== */
    body.filter-mode #stream-mobile {
        /* Scrollable in filter mode */
    }

    /* Biography panel - legacy filter-mode (desktop-style) */
    body.filter-mode #biography-panel {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: none !important;
        top: var(--mobile-edge-margin) !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 var(--mobile-panel-padding);
        box-sizing: border-box;
    }

    /* Biography panel - mobile flow filtered (under logo, in flow) */
    body.mobile-flow-filter #biography-panel {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        margin-top: var(--mobile-focused-intro-gap);
        width: 100% !important;
        max-width: none !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 var(--mobile-panel-padding);
        box-sizing: border-box;
    }

    body.mobile-flow-filter .mobile-bio-extras {
        position: relative;
        width: 100%;
        padding: 0 var(--mobile-panel-padding) 0;
        box-sizing: border-box;
        font-family: 'ITCGaramondStd', 'EB Garamond', Garamond, Georgia, 'Times New Roman', serif;
        color: var(--hover-fg);
        font-smooth: never;
        -webkit-font-smoothing: auto;
        -moz-osx-font-smoothing: auto;
        text-rendering: auto;
        font-optical-sizing: none;
        font-kerning: none;
        font-variant-ligatures: none;
        font-feature-settings: "kern" 0, "liga" 0, "clig" 0, "calt" 0, "dlig" 0;
    }

    #biography-panel .bio-name {
        font-size: var(--mobile-bio-title-size);
    }

    #biography-panel .bio-text {
        font-size: var(--mobile-bio-text-size);
        line-height: var(--mobile-bio-line-height);
    }

    body.mobile-flow-filter .biography-section-toggle,
    body.mobile-flow-filter .biography-section-toggle:hover,
    body.mobile-flow-filter .biography-section-toggle:active {
        opacity: 1 !important;
        transition: none !important;
    }

    body.mobile-flow-filter .biography-section-toggle,
    body.mobile-flow-filter .biography-section-label,
    body.mobile-flow-filter .biography-section-symbol,
    body.mobile-flow-filter .photo-gallery-intro-name-link,
    body.mobile-flow-filter .photo-gallery-back-link,
    body.photo-gallery-mode .photo-gallery-intro-name-link,
    body.photo-gallery-mode .photo-gallery-back-link {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    /* ===========================================
       FULLSCREEN MODE - Edge to Edge
       =========================================== */
    .stream-panel.fullscreen {
        /* Full width - edge to edge, no margins */
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        /* Center vertically */
        top: 50% !important;
        transform: translateY(-50%) !important;
        /* Height based on 16:9 aspect ratio */
        height: auto !important;
        aspect-ratio: 16/9 !important;
        max-height: calc(100dvh - var(--mobile-logo-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 80px) !important;
        /* No border radius or background for edge to edge */
        border-radius: 0 !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
    }

    /* Video wrapper fills fullscreen panel completely */
    .stream-panel.fullscreen .video-wrapper {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: transparent !important;
    }

    body.mobile-landscape-video-fallback,
    html.mobile-landscape-video-fallback {
        overflow: hidden !important;
        overscroll-behavior: none !important;
    }

    body.mobile-landscape-video-fallback #mobile-flow {
        padding-top: 0 !important;
    }

    body.mobile-landscape-video-fallback .nav,
    body.mobile-landscape-video-fallback .nav-logo,
    body.mobile-landscape-video-fallback .nav-mobile-toggle,
    body.mobile-landscape-video-fallback #biography-panel,
    body.mobile-landscape-video-fallback .mobile-bio-extras,
    body.mobile-landscape-video-fallback .stream-panel:not(.inline-full),
    body.mobile-landscape-video-fallback .stream-panel.inline-full > .tooltip-more.tooltip-more-inline,
    body.mobile-landscape-video-fallback .stream-panel.inline-full .panel-tooltip,
    body.mobile-landscape-video-fallback .stream-panel.inline-full .panel-play-button {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    body.mobile-landscape-video-fallback .stream-panel.inline-full {
        position: fixed !important;
        inset: 0 !important;
        left: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        height: 100lvh !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        z-index: 9998 !important;
        background: var(--fullscreen-bg, var(--hover-bg, #000000)) !important;
    }

    body.mobile-landscape-video-fallback .stream-panel.inline-full .panel-image-wrapper,
    body.mobile-landscape-video-fallback .stream-panel.inline-full .video-wrapper,
    body.mobile-landscape-video-fallback .stream-panel.inline-full .video-player-shell,
    body.mobile-landscape-video-fallback .stream-panel.inline-full .video-player-shell .jwplayer,
    body.mobile-landscape-video-fallback .stream-panel.inline-full .video-player-shell video,
    body.mobile-landscape-video-fallback .stream-panel.inline-full .video-player-shell iframe {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
    }

    body.mobile-landscape-video-fallback .stream-panel.inline-full .panel-image-wrapper {
        padding: 0 !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        background: transparent !important;
    }

    body.mobile-landscape-video-fallback .stream-panel.inline-full .panel-image-wrapper img,
    body.mobile-landscape-video-fallback .stream-panel.inline-full .video-player-shell video,
    body.mobile-landscape-video-fallback .stream-panel.inline-full .video-player-shell iframe {
        object-fit: cover !important;
        background: transparent !important;
    }

    .stream-panel.fullscreen video,
    .stream-panel.fullscreen iframe {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        background: transparent !important;
    }

    /* Panel image wrapper also fills */
    .stream-panel.fullscreen .panel-image-wrapper {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: transparent !important;
        border-radius: 0 !important;
        overflow: hidden !important;
    }

    .stream-panel.fullscreen .panel-image-wrapper img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    /* Fullscreen tooltip - fixed at bottom of screen */
    .stream-panel.fullscreen .panel-tooltip {
        position: fixed !important;
        bottom: calc(20px + env(safe-area-inset-bottom)) !important;
        left: var(--mobile-edge-margin) !important;
        right: var(--mobile-edge-margin) !important;
        top: auto !important;
        text-align: center;
        opacity: 1 !important;
        visibility: visible !important;
        margin-top: 0 !important;
    }

    /* Fullscreen video info */
    .video-info-panel {
        font-size: var(--mobile-fullscreen-detail-size);
        padding: var(--mobile-edge-margin);
        padding-bottom: calc(var(--mobile-edge-margin) + env(safe-area-inset-bottom));
    }

    .video-info-panel .video-title {
        font-size: var(--mobile-fullscreen-title-size);
    }

    /* Fullscreen nav arrows */
    .fullscreen-nav {
        bottom: calc(60px + env(safe-area-inset-bottom));
    }

    /* ===========================================
       PHOTO GALLERY
       =========================================== */
    #photo-gallery {
        top: auto;
        bottom: auto;
        height: auto;
        overflow-y: visible !important;
        overflow-x: hidden !important;
        overscroll-behavior-y: auto;
        overscroll-behavior-x: none;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        padding-bottom: 0;
    }

    #photo-gallery .photo-gallery-inner,
    .mobile-filter-photo-gallery {
        --photo-gallery-edge: var(--mobile-edge-margin);
        padding: 0 var(--mobile-edge-margin);
        gap: 10px;
    }

    #photo-gallery .photo-gallery-intro,
    .mobile-filter-photo-gallery .photo-gallery-intro {
        margin-top: var(--mobile-focused-intro-gap);
    }

    #photo-gallery .photo-gallery-intro {
        margin-bottom: -6px;
    }

    #photo-gallery .photo-gallery-caption,
    #photo-gallery .photo-caption-last-main,
    .mobile-filter-photo-gallery .photo-gallery-caption,
    .mobile-filter-photo-gallery .photo-caption-last-main {
        --caption-sticky-top: calc(
            env(safe-area-inset-top) +
            var(--mobile-logo-padding) +
            var(--mobile-logo-height) +
            var(--mobile-logo-offset-y) +
            4px
        );
    }

    #photo-gallery .photo-gallery-intro-name,
    #photo-gallery .photo-gallery-intro-project,
    #photo-gallery .photo-gallery-intro-text,
    .mobile-filter-photo-gallery .photo-gallery-intro-name,
    .mobile-filter-photo-gallery .photo-gallery-intro-project,
    .mobile-filter-photo-gallery .photo-gallery-intro-text {
        max-width: 100%;
    }

    #photo-gallery .photo-caption-text,
    .mobile-filter-photo-gallery .photo-caption-text,
    .mobile-filter-photo-gallery .photo-caption-title-label,
    .mobile-filter-photo-gallery .photo-caption-description {
        font-size: var(--mobile-bio-title-size);
        line-height: 1.15;
    }

    #photo-gallery .photo-caption-text,
    .mobile-filter-photo-gallery .photo-caption-text {
        margin-bottom: 3px;
    }

    .mobile-filter-photo-gallery .photo-caption-title-row {
        margin-bottom: 0.35em;
    }

    #photo-gallery .photo-caption-title-label,
    #photo-gallery .photo-caption-description,
    .mobile-filter-photo-gallery .photo-caption-seq,
    #photo-gallery .photo-caption-seq {
        font-size: 1em;
    }

    #photo-gallery .photo-caption-seq-row,
    .mobile-filter-photo-gallery .photo-caption-seq-row,
    #photo-gallery .photo-caption-seq,
    .mobile-filter-photo-gallery .photo-caption-seq {
        font-size: 15px;
        line-height: 1em;
    }

    #photo-gallery .photo-caption-seq-row,
    .mobile-filter-photo-gallery .photo-caption-seq-row {
        margin-top: 0;
    }

    /* ===========================================
       INFO PAGES (About, Contacts, Representation)
       =========================================== */
    #text-content-container {
        top: calc(var(--mobile-header-height) + env(safe-area-inset-top) + 10px);
        padding: var(--mobile-edge-margin);
        padding-bottom: calc(var(--mobile-edge-margin) + env(safe-area-inset-bottom));
    }

    /* ===========================================
       SAFE AREAS
       =========================================== */
    #stream-mobile {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
