/*
 * 4D Vision - Viewer platform chrome integration
 * Scope: loading/error states, info panels, platform buttons and toolbars only.
 * Exception: the final "legacy light surfaces" block restores dark text and
 * coherent links only on legacy white panels (POI boxes, tooltips, fancybox
 * HTML slides, passcode/lead forms, product panels and the white map/VR helper
 * controls). It never repaints those white backgrounds and never styles the
 * panorama canvas, Pannellum UI, hotspots or custom tour controls.
 * Never style panorama canvas, Pannellum UI, hotspots, POIs, tour modals,
 * custom_html or custom tour controls beyond that text-contrast exception.
 * Loaded after the legacy viewer CSS and before custom.css/custom_<code>.css;
 * :where() keeps specificity low so custom tour CSS remains authoritative.
 */

:where(body.brand-4d) #background_loading {
    background-color: var(--4d-bg-deep, #070B14);
}

:where(body.brand-4d) .loading .protect {
    width: calc(100vw - 2rem);
    max-width: 430px;
    padding: clamp(1.15rem, 4vw, 1.75rem);
    color: var(--4d-text, #F5F8FC);
    text-align: center;
    background: rgba(18, 26, 39, 0.94);
    border: 1px solid var(--4d-border-glow, rgba(21, 223, 239, 0.18));
    border-radius: var(--4d-radius-lg, 18px);
    box-shadow: var(--4d-shadow-lg, 0 24px 64px rgba(0, 0, 0, 0.42));
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

:where(body.brand-4d) .protect_title {
    color: var(--4d-text, #F5F8FC);
}

:where(body.brand-4d) .protect_description {
    color: var(--4d-text-muted, #AAB4C3);
}

:where(body.brand-4d) .password-wrapper {
    width: min(320px, calc(100vw - 4rem));
    overflow: hidden;
    background: var(--4d-surface, #121A27);
    border: 1px solid var(--4d-border, #263247);
    border-radius: var(--4d-radius, 12px);
    box-shadow: var(--4d-shadow-sm, 0 6px 18px rgba(0, 0, 0, 0.22));
}

:where(body.brand-4d) .password-wrapper input {
    width: calc(100% - 80px);
    height: 2.75rem;
    padding: 0.55rem 0.8rem;
    color: var(--4d-text, #F5F8FC);
    background: transparent;
    border: 0;
    border-radius: 0;
    text-indent: 0;
}

:where(body.brand-4d) .password-wrapper input::placeholder {
    color: var(--4d-text-subtle, #8A93A6);
}

:where(body.brand-4d) .password-wrapper input:focus {
    background: transparent;
    box-shadow: inset 0 0 0 2px rgba(21, 223, 239, 0.5);
}

:where(body.brand-4d) #vt_password.error_input,
:where(body.brand-4d) .error_input {
    box-shadow: 0 0 0 3px rgba(255, 91, 110, 0.24);
}

:where(body.brand-4d) .password-wrapper button {
    width: 80px;
    height: 2.75rem;
    color: #FFFFFF;
    background-color: var(--4d-blue-electric, #066BFB);
    background-image: var(--4d-gradient-primary-button, linear-gradient(135deg, #066BFB, #15DFEF));
    border: 0;
    border-radius: 0;
    font: inherit;
    text-shadow: none;
}

:where(body.brand-4d) .password-wrapper button:hover,
:where(body.brand-4d) .password-wrapper button:focus {
    color: #FFFFFF;
    background-color: var(--4d-blue-primary, #0579F8);
    box-shadow: inset 0 0 0 2px rgba(21, 223, 239, 0.62);
    outline: 0;
}

:where(body.brand-4d) #icon_play {
    color: #FFFFFF;
    background: var(--4d-gradient-primary, linear-gradient(135deg, #066BFB, #15DFEF, #6E35E8));
    border: 1px solid rgba(21, 223, 239, 0.5);
    border-radius: 50%;
    box-shadow: 0 18px 48px rgba(6, 107, 251, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    text-shadow: 0 1px 12px rgba(7, 11, 20, 0.4);
    transition: transform var(--4d-duration, 220ms) var(--4d-ease, ease), box-shadow var(--4d-duration, 220ms) var(--4d-ease, ease);
}

:where(body.brand-4d) #icon_play:hover,
:where(body.brand-4d) #icon_play:focus-visible {
    box-shadow: var(--4d-focus-ring, 0 0 0 3px rgba(21, 223, 239, 0.34)), 0 20px 54px rgba(6, 107, 251, 0.42);
    outline: 0;
    transform: translate(-50%, -50%) scale(1.04);
}

:where(body.brand-4d) .progress-circle,
:where(body.brand-4d) #loading_pano,
:where(body.brand-4d) .loading_vr {
    color: var(--4d-cyan, #15DFEF);
}

:where(body.brand-4d) .loading_vr {
    background: rgba(7, 11, 20, 0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

:where(body.brand-4d) #loading_pano {
    filter: drop-shadow(0 0 10px rgba(21, 223, 239, 0.4));
}

:where(body.brand-4d) #loading_pano svg path {
    stroke: var(--4d-cyan, #15DFEF);
}

:where(body.brand-4d) #loading_pano svg circle {
    fill: var(--4d-cyan, #15DFEF);
}

:where(body.brand-4d) .info_box_content {
    width: min(760px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    padding: clamp(1.15rem, 3vw, 2rem);
    overflow: auto;
    color: var(--4d-text, #F5F8FC);
    text-align: left;
    background: rgba(18, 26, 39, 0.98);
    border: 1px solid var(--4d-border-glow, rgba(21, 223, 239, 0.18));
    border-radius: var(--4d-radius-lg, 18px);
    box-shadow: var(--4d-shadow-lg, 0 24px 64px rgba(0, 0, 0, 0.42));
    scrollbar-color: #40516A var(--4d-bg-deep, #070B14);
    scrollbar-width: thin;
}

:where(body.brand-4d) .info_box_content h1,
:where(body.brand-4d) .info_box_content h2,
:where(body.brand-4d) .info_box_content h3,
:where(body.brand-4d) .info_box_content h4,
:where(body.brand-4d) .info_box_content h5,
:where(body.brand-4d) .info_box_content h6 {
    color: var(--4d-text, #F5F8FC);
}

:where(body.brand-4d) .info_box_content a {
    color: var(--4d-cyan, #15DFEF);
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

:where(body.brand-4d) .info_box_content a:hover,
:where(body.brand-4d) .info_box_content a:focus {
    color: #FFFFFF;
}

:where(body.brand-4d) .info_box_content hr {
    border-color: var(--4d-border, #263247);
}

:where(body.brand-4d) .info_box_content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--4d-radius, 12px);
}

:where(body.brand-4d) .info_box_content blockquote {
    padding-left: 1rem;
    color: var(--4d-text-muted, #AAB4C3);
    border-left: 2px solid var(--4d-cyan, #15DFEF);
}

:where(body.brand-4d) .controls_btn:focus-visible,
:where(body.brand-4d) .p_control:focus-visible,
:where(body.brand-4d) .fullscreen_control:focus-visible,
:where(body.brand-4d) .song_control:focus-visible,
:where(body.brand-4d) .map_control:focus-visible,
:where(body.brand-4d) .map_tour_control:focus-visible,
:where(body.brand-4d) .menu_controls .title i:focus-visible,
:where(body.brand-4d) .list_alt_menu .title i:focus-visible,
:where(body.brand-4d) .arrows_nav i:focus-visible,
:where(body.brand-4d) .list_slider #list_left:focus-visible,
:where(body.brand-4d) .list_slider #list_right:focus-visible {
    outline: 2px solid var(--4d-cyan, #15DFEF);
    outline-offset: 2px;
}

:where(body.brand-4d) .fullscreen_control,
:where(body.brand-4d) .song_control,
:where(body.brand-4d) .map_control,
:where(body.brand-4d) .map_tour_control,
:where(body.brand-4d) .menu_controls .title i,
:where(body.brand-4d) .list_alt_menu .title i {
    color: var(--4d-text, #F5F8FC);
    text-shadow: 0 1px 8px rgba(7, 11, 20, 0.55);
}

:where(body.brand-4d) .fullscreen_control:hover,
:where(body.brand-4d) .song_control:hover,
:where(body.brand-4d) .map_control:hover,
:where(body.brand-4d) .map_tour_control:hover,
:where(body.brand-4d) .menu_controls .title i:hover,
:where(body.brand-4d) .list_alt_menu .title i:hover {
    color: var(--4d-cyan, #15DFEF);
}

:where(body.brand-4d) .svt-player-privacy {
    position: fixed;
    bottom: 4.5rem;
    bottom: max(4.5rem, calc(env(safe-area-inset-bottom, 0px) + 4.5rem));
    left: 50%;
    z-index: 60;
    width: auto;
    width: max-content;
    max-width: calc(100vw - 1.5rem);
    max-width: min(34rem, calc(100vw - 1.5rem));
    color: var(--4d-text, #F5F8FC);
    font-size: 0.78rem;
    line-height: 1.45;
    transform: translateX(-50%);
}

:where(body.brand-4d) .svt-player-privacy[hidden] {
    display: none;
}

:where(body.brand-4d) .svt-player-privacy details {
    width: 100%;
    max-height: calc(100vh - 6rem);
    max-height: min(22rem, calc(100vh - 6rem));
    overflow: auto;
    background: rgba(18, 26, 39, 0.94);
    border: 1px solid var(--4d-border, #263247);
    border-radius: var(--4d-radius, 12px);
    box-shadow: var(--4d-shadow, 0 14px 34px rgba(0, 0, 0, 0.3));
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

:where(body.brand-4d) .svt-player-privacy summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.55rem;
    align-items: baseline;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    list-style: none;
}

:where(body.brand-4d) .svt-player-privacy summary::-webkit-details-marker {
    display: none;
}

:where(body.brand-4d) .svt-player-privacy summary:focus-visible {
    outline: 2px solid var(--4d-cyan, #15DFEF);
    outline-offset: 2px;
}

:where(body.brand-4d) .svt-player-privacy__summary {
    color: var(--4d-text, #F5F8FC);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(21, 223, 239, 0.58);
    text-underline-offset: 0.18em;
}

:where(body.brand-4d) .svt-player-privacy__hint {
    color: var(--4d-text-muted, #AAB4C3);
    font-size: 0.72rem;
}

:where(body.brand-4d) .svt-player-privacy__body {
    padding: 0.25rem 0.75rem 0.7rem;
    border-top: 1px solid var(--4d-border, #263247);
}

:where(body.brand-4d) .svt-player-privacy__body p {
    margin: 0.55rem 0 0;
    color: var(--4d-text-muted, #AAB4C3);
}

:where(body.brand-4d) .svt-player-privacy__body a {
    color: var(--4d-cyan, #15DFEF);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

:where(body.brand-4d) .svt-player-privacy__body a:hover,
:where(body.brand-4d) .svt-player-privacy__body a:focus {
    color: #FFFFFF;
}

:where(body.brand-4d) .svt-player-privacy__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}

/*
 * Legacy light surfaces.
 *
 * viewer/css/index.css paints several legacy panels with a white background
 * but no explicit text colour, so they inherit the light brand body colour
 * (#F5F8FC) and become unreadable. The same happens to the Fancybox HTML
 * slide, whose white content inherits the same body colour.
 *
 * This exception only restores dark ink for the text on those light surfaces:
 * it never repaints a background, which stays owned by viewer/css/index.css
 * and by Fancybox, so the custom tour CSS remains authoritative when it themes
 * the same surface with a dark background and light text. Descendants use
 * `color: inherit` instead of hard-coded ink, so a themed surface keeps its
 * chosen text colour. Interactive controls are excluded from that broad rule:
 * the legacy `.button_material` submit button keeps its own black background
 * and white label (viewer/css/index.css), and the dark `.info_box_content`
 * panel keeps its own light text. No declaration uses the important flag, and
 * custom.css/custom_<code>.css still load after this file.
 */

/* Fancybox HTML lightbox: white content, no explicit ink. */
:where(body.brand-4d) :where(.fancybox-slide--html) .fancybox-content {
    color: #111827;
}

:where(body.brand-4d) :where(.fancybox-slide--html) .fancybox-content :where(*:not(.button_material):not(.button_material *):not(.info_box_content):not(.info_box_content *)) {
    color: inherit;
}

:where(body.brand-4d) :where(.fancybox-slide--html) .fancybox-content :where(a:not(.button_material):not(.info_box_content *)) {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

/* POI text boxes: white background, no explicit ink. */
:where(body.brand-4d) .box_poi {
    color: #111827;
}

:where(body.brand-4d) .box_poi :where(*:not(.button_material):not(.button_material *)) {
    color: inherit;
}

:where(body.brand-4d) .box_poi :where(a:not(.button_material)) {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

/*
 * Tooltips: text variants, embed variants and image previews.
 * The viewer writes the tour-configured tooltip colour as an inline style on
 * the tooltip root. Descendants therefore use `color: inherit` so a dark
 * tooltip configured by the tour keeps its light text, while a default white
 * tooltip inherits the dark ink set on the root below. Links follow the same
 * configured colour instead of forcing a blue that could disappear on a dark
 * tooltip background.
 */
:where(body.brand-4d) .tooltip_text,
:where(body.brand-4d) .tooltip_text_embed,
:where(body.brand-4d) .tooltip_text_embed_m,
:where(body.brand-4d) .tooltip_preview,
:where(body.brand-4d) .tooltip_preview_m,
:where(body.brand-4d) .tooltip_preview_square,
:where(body.brand-4d) .tooltip_preview_square_m,
:where(body.brand-4d) .tooltip_preview_rect,
:where(body.brand-4d) .tooltip_preview_rect_m {
    color: #111827;
}

:where(body.brand-4d) .tooltip_text *,
:where(body.brand-4d) .tooltip_text_embed *,
:where(body.brand-4d) .tooltip_text_embed_m *,
:where(body.brand-4d) .tooltip_preview *,
:where(body.brand-4d) .tooltip_preview_m *,
:where(body.brand-4d) .tooltip_preview_square *,
:where(body.brand-4d) .tooltip_preview_square_m *,
:where(body.brand-4d) .tooltip_preview_rect *,
:where(body.brand-4d) .tooltip_preview_rect_m * {
    color: inherit;
}

:where(body.brand-4d) .tooltip_text a,
:where(body.brand-4d) .tooltip_text_embed a,
:where(body.brand-4d) .tooltip_text_embed_m a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

/* Passcode and lead capture panels: white background, black legacy ink. */
:where(body.brand-4d) .passcode_div,
:where(body.brand-4d) .leads_div {
    color: #111827;
}

:where(body.brand-4d) .passcode_div :where(*:not(.button_material):not(.button_material *)),
:where(body.brand-4d) .leads_div :where(*:not(.button_material):not(.button_material *)) {
    color: inherit;
}

:where(body.brand-4d) .passcode_div :where(a:not(.button_material)),
:where(body.brand-4d) .leads_div :where(a:not(.button_material)) {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

:where(body.brand-4d) .leads_div .svt_form_consent_error {
    color: #B91C1C;
}

/* Product lightbox content: white panel, title had no explicit ink. */
:where(body.brand-4d) .product-content {
    color: #111827;
}

:where(body.brand-4d) .product-content a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

/*
 * Legacy material submit buttons inside the light panels.
 * viewer/css/index.css:2486 gives `.button_material` a #000000 background and
 * #FFFFFF text. The broad `color: inherit` rules above exclude it and its
 * descendants, and this explicit rule restores the white label even when a
 * tour CSS customises the surrounding panel. It is loaded before the tour
 * custom CSS, so the custom selectors still win at equal specificity.
 */
:where(body.brand-4d) :where(.fancybox-slide--html) .fancybox-content :where(.button_material),
:where(body.brand-4d) :where(.fancybox-slide--html) .fancybox-content :where(.button_material *),
:where(body.brand-4d) .box_poi :where(.button_material),
:where(body.brand-4d) .box_poi :where(.button_material *),
:where(body.brand-4d) .passcode_div :where(.button_material),
:where(body.brand-4d) .passcode_div :where(.button_material *),
:where(body.brand-4d) .leads_div :where(.button_material),
:where(body.brand-4d) .leads_div :where(.button_material *) {
    color: #FFFFFF;
    text-decoration: none;
}

/* White helper controls (grab cursor and live status) with no explicit ink. */
:where(body.brand-4d) .live_status,
:where(body.brand-4d) #vs_grab {
    color: #111827;
}

/* Visible focus rings on light surfaces: the brand cyan ring is too faint on white. */
:where(body.brand-4d) .fancybox-content a:focus-visible,
:where(body.brand-4d) .box_poi a:focus-visible,
:where(body.brand-4d) .tooltip_text a:focus-visible,
:where(body.brand-4d) .passcode_div a:focus-visible,
:where(body.brand-4d) .leads_div a:focus-visible,
:where(body.brand-4d) .product-content a:focus-visible,
:where(body.brand-4d) .fancybox-content .input_material input:focus,
:where(body.brand-4d) .fancybox-content .input_material textarea:focus,
:where(body.brand-4d) .fancybox-content .select-text:focus,
:where(body.brand-4d) .box_poi .input_material input:focus,
:where(body.brand-4d) .box_poi .input_material textarea:focus,
:where(body.brand-4d) .box_poi .select-text:focus,
:where(body.brand-4d) .leads_div .input_material input:focus,
:where(body.brand-4d) .leads_div .input_material textarea:focus,
:where(body.brand-4d) .leads_div .select-text:focus,
:where(body.brand-4d) #passcode:focus {
    outline: 2px solid #0F4C81;
    outline-offset: 2px;
}

@media (max-width: 767.98px) {
    :where(body.brand-4d) .info_box_content {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
        padding: 1rem;
    }

    :where(body.brand-4d) .svt-player-privacy {
        bottom: 4.25rem;
        bottom: max(4.25rem, calc(env(safe-area-inset-bottom, 0px) + 4.25rem));
    }
}

@media (max-width: 420px) {
    :where(body.brand-4d) .password-wrapper {
        width: 100%;
    }

    :where(body.brand-4d) .password-wrapper input {
        width: calc(100% - 64px);
    }

    :where(body.brand-4d) .password-wrapper button {
        width: 64px;
    }
}

@media (prefers-reduced-motion: reduce) {
    :where(body.brand-4d) #icon_play {
        transition: none;
    }
}

@media (forced-colors: active) {
    :where(body.brand-4d) .loading .protect,
    :where(body.brand-4d) .info_box_content,
    :where(body.brand-4d) .password-wrapper {
        border: 1px solid CanvasText;
    }
}
