/* ── Design tokens ──────────────────────────
   The 3D exhibition's colours and corner radii, in one place. Set on <body> rather than
   .td-ausstellung so the tour popover (driver.js appends it to <body>) gets them too. */
.template-3d-objekt {
    --td-accent: #111;                  /* primary actions, titles, active states (was purple #66267b) */
    --td-highlight: #111;               /* hover, markers (was lime #c9d52d) */
    --td-ink: #111;                     /* text */
    --td-border: rgba(0, 0, 0, 0.15);   /* outlines of buttons and chips */
    --td-radius-pill: 999px;            /* buttons, chips, labels, capsules */
    --td-radius-card: 12px;             /* cards inside a panel */
    --td-radius-panel: 16px;            /* floating panels (filter, info, tour) */
    --td-panel-pad: clamp(24px, 3.2vw, 52px);   /* left/right padding of the side panels' content (detail, info) */
}

/* read by screen readers, not shown (the live region in 3d-objekt/a11y.js) */
.td-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* first Tab stop: hidden until it gets the keyboard focus, then shown top left */
.td-skip-link {
    position: fixed;
    top: var(--padding-global, 20px);
    left: var(--padding-global, 20px);
    z-index: 6000;   /* above the Werke list and the panels */
    padding: 12px 20px;
    border: none;
    border-radius: var(--td-radius-pill);
    background: #fff;
    color: var(--td-ink);
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    transform: translateY(-200%);
}

.td-skip-link:focus,
.td-skip-link:focus-visible {
    transform: none;
}

/* keyboard focus on the 3D exhibition pages: the site-wide ring (index.css) is purple */
.template-3d-objekt button:focus-visible,
.template-3d-objekt a:focus-visible,
.template-3d-objekt [tabindex]:focus-visible {
    outline-color: var(--td-ink);
}

.td-ausstellung {
    position: relative;
    width: 100%;
    height: 100svh;
    overflow: hidden;
    background-color: #ffffff;
}

.td-ausstellung #td-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Vignette over the 3D canvas. Matches the former post-processing shader at
   strength 0.52 (LOOK.vignette in 3d-objekt.js):
   colour × (1 − 0.52·(1 − smoothstep(1.35, 0.38, r))), r = 1 at the edge midpoints
   (closest-side ellipse) — a black layer with that alpha gives the same result. */
.td-vignette {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(closest-side at 50% 50%,
        rgba(0,0,0,0) 38%,
        rgba(0,0,0,0.022) 50%,
        rgba(0,0,0,0.068) 60%,
        rgba(0,0,0,0.132) 70%,
        rgba(0,0,0,0.208) 80%,
        rgba(0,0,0,0.288) 90%,
        rgba(0,0,0,0.366) 100%,
        rgba(0,0,0,0.434) 110%,
        rgba(0,0,0,0.487) 120%,
        rgba(0,0,0,0.520) 135%);
}

.td-ausstellung button {
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    touch-action: manipulation;
}

.td-ausstellung button * {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

/* popup */
.td-popup {
    position: fixed;
    top: 0;
    right: 0;
    width: 50vw;
    height: 100svh;
    /* near-opaque: at 0.6 the dimmed scene behind turned the panel grey under the text */
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    /* Outfit has no Cyrillic/Arabic glyphs (transcripts): fall back to a sans, not Times */
    font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--black-main);
    transform: translateX(100%);
    /* closed: also out of the Tab order (visibility), switched off once the slide-out is done */
    visibility: hidden;
    transition: transform 0.4s ease, visibility 0s linear 0.4s;
    z-index: 2200;
    padding: 0 0 var(--padding-global);
    box-sizing: border-box;
    overflow-y: auto;
}

/* full width on touch devices and on any narrow screen (half of a phone is too narrow to read) */
@media (hover: none) and (pointer: coarse), (max-width: 900px) {
    .td-popup {
        width: 100vw;
    }
}

.td-popup.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.4s ease, visibility 0s;
}

.td-popup-nav {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: flex-end;
    padding: var(--padding-global) var(--padding-global) 0;
    z-index: 1;
}

.td-popup-close {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--black-main);
    font-size: 1rem;
    cursor: pointer;
    opacity: 1;
    transition: background-color 0.2s;
}

.td-popup-close:hover {
    background-color: rgba(255, 255, 255, 1);
}

.td-popup-inner {
    margin-top: var(--padding-global);
    padding: 0 var(--td-panel-pad);   /* wider sides than the close button's row */
    display: flex;
    flex-direction: column;
    gap: var(--padding-global);
}

/* small copy of an image artwork on top — only where the full-width panel covers it */
.td-popup-thumb {
    display: none;
}

@media (hover: none) and (pointer: coarse), (max-width: 900px) {
    .td-popup-thumb:not([hidden]) {
        display: block;
        max-width: 100%;
        max-height: 40svh;
        width: auto;
        height: auto;
        object-fit: contain;
    }
}

/* title and author as one block (the panel's sections are a full gap apart) */
.td-popup-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.td-popup-author {
    margin: 0;
    font-size: clamp(17px, 1.4vw, 20px);
    font-weight: 300;
    line-height: 1.3;
    color: rgba(0, 0, 0, 0.6);
}

.td-popup-author[hidden] {
    display: none;
}

.td-popup-title {
    margin: 0;
    font-size: clamp(28px, 3vw, 44px);
    font-weight: 100;
    line-height: 1.15;
    letter-spacing: 0;
    color: var(--td-ink);
}

.td-popup-media {
    width: 100%;
}

.td-popup-media[hidden] {
    display: none;
}

.td-popup-video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 72svh;
    background: #000;
}

/* transcript of the Hintergrundton: sits close under its player, like a transcript under
   an audio block (the panel's sections are otherwise a full gap apart) */
.td-popup-bg-script {
    margin-top: calc(8px - var(--padding-global));
}

.td-popup-bg-script:empty {
    display: none;
}

/* several transcripts of the same sound (Original, translations): one under the other */
.td-popup-bg-script .td-script + .td-script {
    margin-top: 8px;
}

/* the artwork's own sound (player + transcript) is set off from the detail blocks after it */
.td-detail-bg:not([hidden]) ~ .td-popup-blocks:not(:empty) {
    margin-top: calc(var(--padding-global) * 1.5);
}

.td-popup-blocks > * + * {
    margin-top: var(--padding-global);
}

.td-popup-blocks .kb-block-text {
    font-size: 16px;
    color: rgba(0, 0, 0, 0.82);
}

.td-popup-blocks .kb-block-text > :last-child {
    margin-bottom: 0;
}

.td-popup-blocks :is(h1, h2, h3, h4) {
    margin: 1.4em 0 0.5em;
    font-size: 1.15em;
    font-weight: var(--bold);
    line-height: 1.3;
    color: var(--td-ink);
}

.td-popup-blocks :is(h1, h2, h3, h4):first-child {
    margin-top: 0;
}

/* Section title block (td_section_title): a hairline above sets the sections apart */
.td-popup-blocks > .td-section-title {
    padding-top: var(--padding-global);
    border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.td-popup-blocks > .td-section-title:not(:first-child) {
    margin-top: calc(var(--padding-global) * 1.5);
}

.td-popup-blocks > .td-section-title:first-child {
    padding-top: 0;
    border-top: 0;
}

.td-popup-blocks :is(ul, ol) {
    margin: 0 0 0.75em;
    padding-left: 1.3em;
    line-height: 1.6;
}

.td-popup-blocks ul { list-style: disc; }
.td-popup-blocks ol { list-style: decimal; }

.td-popup-blocks a {
    color: var(--td-ink);
    text-decoration: underline;
    text-decoration-color: rgba(0, 0, 0, 0.35);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s;
}
.td-popup-blocks a:hover {
    text-decoration-color: var(--td-ink);
}
/* Enter in the Panel = new paragraph (gap below), Shift+Enter = <br>, a plain line break */
.td-popup-blocks p { line-height: 1.65; margin: 0 0 0.75em; }
.td-popup-blocks figure {
    margin-left: 0;
    margin-right: 0;
}

/* image blocks: a centred column, not the full panel width (they outweighed the artwork
   itself); video blocks stay full width */
.td-popup-blocks figure:has(img) {
    max-width: min(100%, 520px);
    margin-left: auto;
    margin-right: auto;
}

/* image blocks right after one another (Impressum): two columns, each image centred in its cell */
.td-image-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 24px;
}

.td-popup-blocks .td-image-grid figure {
    max-width: 100%;
    margin: 0;
}

.td-popup-blocks .td-image-grid figure img {
    width: 100%;
    max-height: 40svh;
    object-fit: contain;
}

/* uncropped portrait images: cap the height too */
.td-popup-blocks figure:not([data-crop="true"]) img {
    width: auto;
    max-width: 100%;
    max-height: 60svh;
    margin: 0 auto;
}

.td-popup-blocks figure img,
.td-popup-blocks figure video {
    display: block;
    width: 100%;
    height: auto;
}

/* aspect-ratio container when data-crop is enabled */
.td-popup-blocks figure[data-ratio][data-crop="true"] {
    position: relative;
    overflow: hidden;
}
.td-popup-blocks figure[data-ratio="1/1"][data-crop="true"]   { padding-bottom: 100%; }
.td-popup-blocks figure[data-ratio="4/3"][data-crop="true"]   { padding-bottom: 75%; }
.td-popup-blocks figure[data-ratio="3/2"][data-crop="true"]   { padding-bottom: 66.67%; }
.td-popup-blocks figure[data-ratio="16/9"][data-crop="true"]  { padding-bottom: 56.25%; }
.td-popup-blocks figure[data-ratio][data-crop="true"] img,
.td-popup-blocks figure[data-ratio][data-crop="true"] video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* image block — when wrapped in a link */
.td-popup-blocks figure a {
    display: block;
    text-decoration: none;
}
.td-popup-blocks figure a:hover img {
    opacity: 0.85;
    transition: opacity 0.2s;
}

/* video block */
.td-popup-blocks figure video {
    background: #000;
}

.td-popup-blocks figure iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
}

.td-popup-blocks figcaption {
    font-size: 0.78em;
    line-height: 1.4;
    color: inherit;
    opacity: 0.55;
    margin-top: 6px;
    padding: 0 2px;
    text-align: center;
}

/* info panel (nav ⓘ): slides in from the right like the detail popup — same width, fill,
   close button and dimmed scene behind (.td-detail-backdrop) */
.td-intro {
    position: fixed;
    top: 0;
    right: 0;
    width: 50vw;
    height: 100svh;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    color: var(--td-ink);
    font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
    /* no top padding: the sticky close button brings its own space (its margin + the gap) */
    padding: 0 var(--td-panel-pad) var(--padding-global);
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 2200;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--padding-global);
    transform: translateX(100%);
    /* closed: also out of the Tab order (visibility), switched off once the slide-out is done */
    visibility: hidden;
    transition: transform 0.4s ease, visibility 0s linear 0.4s;
}

/* full width on touch devices and on any narrow screen (half of a phone is too narrow to read) */
@media (hover: none) and (pointer: coarse), (max-width: 900px) {
    .td-intro {
        width: 100vw;
    }
}

.td-intro.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.4s ease, visibility 0s;
}

/* same round button as .td-popup-close, and like it sticky: stays at the top while scrolling */
.td-intro-close {
    position: sticky;
    top: var(--padding-global);     /* where the detail popup's close button sits */
    z-index: 1;
    align-self: flex-end;
    flex-shrink: 0;
    margin-top: var(--padding-global);
    margin-right: calc(var(--padding-global) - var(--td-panel-pad));   /* out of the side padding */
    backdrop-filter: blur(8px);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    color: var(--td-ink);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.td-intro-close:hover {
    background-color: #fff;
}

/* head: title (same as the detail popup's) + the exhibition's description */
.td-intro-head {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: calc(var(--padding-global) * 0.8);
}

.td-intro h2 {
    margin: 0;
    font-size: clamp(28px, 3vw, 44px);
    font-weight: 100;
    line-height: 1.15;
    letter-spacing: 0;
    color: var(--td-ink);
}

.td-intro-desc {
    margin: 0;
    max-width: 62ch;
    font-size: 17px;
    font-weight: 300;
    line-height: 1.6;
    color: var(--td-ink);
}

/* one section per topic, each under a rule with a small label */
.td-intro-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--padding-global);
    margin-top: var(--padding-global);
    padding-top: var(--padding-global);
    border-top: 1px solid var(--td-ink);
}

.td-intro-label {
    margin: 0;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--td-ink);
}

/* controls: a grid across the panel's width, one cell per action (keys above, what they do below) */
.td-intro-controls {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.td-intro-controls li {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--td-border);
    border-radius: var(--td-radius-card);
}

.td-intro-keys {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.td-intro-keys i {
    margin: 0 4px;
    font-style: normal;
    font-size: 12px;
    font-weight: 300;
    color: rgba(0, 0, 0, 0.55);
}

.td-intro-action {
    font-size: 15px;
    font-weight: 300;
    line-height: 1.4;
    color: var(--td-ink);
}

.td-intro-controls--mobile {
    display: none;
}

@media (hover: none) and (pointer: coarse) {
    .td-intro-controls--desktop { display: none; }
    .td-intro-controls--mobile  { display: grid; }
}

.td-key {
    display: inline-block;
    background: transparent;
    border: 1px solid var(--td-ink);
    border-radius: 6px;
    padding: 0 7px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 400;
    color: var(--td-ink);
    line-height: 1.6;
}

/* focus overlay buttons */
.td-focus-back,
.td-focus-open {
    position: fixed;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    border: none;
    cursor: pointer;
    transition: opacity 0.3s ease, visibility 0.3s ease, background 0.2s;
}

/* same capsule as the navigation (see "Navigation" below) */
.td-focus-back {
    top: var(--td-nav-top);
    left: var(--padding-global);
}

.td-focus-open {
    top: var(--td-nav-top);
    right: var(--padding-global);
}

.td-ausstellung.is-focused .td-focus-back,
.td-ausstellung.is-focused .td-focus-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.td-ausstellung.is-detail-open .td-focus-open {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── Frame HUD ───────────────────────────── */

/* Title (and author) of the artwork under the pointer: top left, on the line of the nav
   capsule (the focus view's Zurück button takes this spot, the label is hidden then).
   One white-outlined label holding both lines: title, the author under it, smaller and
   softer. Rounded like a capsule — with the title alone it is one. */
.td-frame-hud {
    position: fixed;
    top: var(--td-nav-top);
    left: var(--padding-global);
    max-width: calc(100vw - var(--padding-global) * 2 - 120px);   /* clear of the nav capsule */
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    box-sizing: border-box;
    padding: 9px 22px 10px;
    border: 1px solid #fff;
    border-radius: 23px;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.td-frame-hud.is-visible {
    opacity: 1;
}

.td-ausstellung.is-focused .td-frame-hud {
    opacity: 0;
}

.td-frame-hud-title,
.td-frame-hud-author {
    max-width: 100%;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.td-frame-hud-title {
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.td-frame-hud-author {
    font-size: 15px;
    line-height: 1.3;
    opacity: 0.75;
}

.td-frame-hud-author[hidden] {
    display: none;
}

/* phones / touch devices: smaller */
@media (hover: none) and (pointer: coarse), (max-width: 600px) {
    .td-frame-hud {
        padding: 7px 14px 8px;
        border-radius: 18px;
    }
    .td-frame-hud-title {
        font-size: 16px;
    }
    .td-frame-hud-author {
        font-size: 12px;
    }
}

/* ── Audio HUD ───────────────────────────── */

.td-audio-hud {
    position: fixed;
    bottom: var(--padding-global);        /* same line as the bottom bar (info moved to the nav) */
    left: var(--padding-global);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 36px;                     /* = bottom bar height */
    box-sizing: border-box;
    background: var(--td-capsule-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--td-radius-pill);
    padding: 7px 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.td-audio-hud.is-active {
    opacity: 1;
}

.td-audio-hud-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.td-audio-hud-icon {
    font-size: 12px;
    color: var(--td-accent);
    flex-shrink: 0;
}

.td-audio-hud-arrow {
    font-size: 14px;
    display: inline-block;
    transition: transform 0.15s ease;
    flex-shrink: 0;
    line-height: 1;
}

.td-audio-hud-title {
    font-weight: 600;
    color: var(--td-ink);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (hover: none) and (pointer: coarse) {
    .td-audio-hud {
        bottom: calc(24px + 110px + 12px);
        left: var(--padding-global);
    }
}

/* ── Space info bar ──────────────────────── */

.td-space-info {
    position: fixed;
    bottom: var(--padding-global);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 6px;
    /* same capsule as the navigation */
    background: var(--td-capsule-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-radius: var(--td-radius-pill);
    padding: 4px;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    pointer-events: auto;
    transition: opacity 0.3s;
}

/* Werke / Filter — pill buttons inside the info bar */
.td-space-info-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--td-ink);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: var(--td-radius-pill);
    padding: 7px 12px;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.td-space-info-btn svg {
    flex-shrink: 0;
}

.td-space-info-btn:hover {
    background: var(--td-highlight);
    border-color: var(--td-highlight);
}

.td-space-info-btn:focus-visible {
    outline: 2px solid var(--td-accent);
    outline-offset: 2px;
}

.td-ausstellung.is-focused .td-space-info,
.td-ausstellung.is-focused .td-space-info * {
    opacity: 0;
    visibility: hidden;   /* also out of the Tab order */
    pointer-events: none !important;
}

/* ── Focus prev/next nav ─────────────────── */

.td-focus-nav {
    position: fixed;
    bottom: var(--padding-global);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2100;
    display: flex;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s, visibility 0.3s;
}

.td-ausstellung.is-focused .td-focus-nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.td-focus-prev,
.td-focus-next {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 50%;
    font-size: 1.1rem;
    color: var(--td-ink);
    cursor: pointer;
    transition: background 0.2s;
}


.td-focus-prev:hover,
.td-focus-next:hover {
    background: var(--td-highlight);
    border-color: var(--td-highlight);
}

/* ── Gallery nearest highlight ───────────── */

.td-gallery-item.is-near .td-gallery-item-img {
    outline-color: var(--td-accent);
}

/* ── Gallery selected arrows ─────────────── */

.td-gallery-selected-prev,
.td-gallery-selected-next {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    flex-shrink: 0;
    border: 1px solid var(--td-border);
    border-radius: 50%;
    font-size: 1rem;
    color: var(--td-ink);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.td-gallery-selected-prev:hover,
.td-gallery-selected-next:hover {
    background: var(--td-ink);
    border-color: var(--td-ink);
    color: #fff;
}

/* ── Gallery list popup ──────────────────── */

.td-gallery-list {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    font-family: 'Outfit', sans-serif;
}

.td-gallery-list.is-open {
    opacity: 1;
    visibility: visible;
}

.td-gallery-list-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px clamp(20px, 4vw, 56px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.td-gallery-list-title {
    font-size: clamp(16px, 2vw, 24px);
    font-weight: 100;
    letter-spacing: 0;
    line-height: 1.2;
    color: var(--td-ink);
    margin: 0;
    flex: 1;
}

.td-gallery-list-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--td-ink);
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.td-gallery-list-close:hover { opacity: 1; }

/* ── Category filter of the list (its own, not the room's) ── */

.td-gallery-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
    padding: clamp(14px, 2vw, 22px) clamp(20px, 4vw, 56px);
}

.td-gallery-list.has-selection .td-gallery-cats {
    display: none;
}

/* "Alle" has no category colour */
.td-gallery-cat:not(.td-chip--category)[aria-pressed="true"] {
    background: var(--td-accent);
    border-color: var(--td-accent);
    color: #fff;
}

/* phones: one swipeable row instead of many wrapped lines */
@media (max-width: 600px) {
    .td-gallery-cats {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .td-gallery-cats .td-chip {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

/* ── Selected detail ─────────────────────── */

.td-gallery-selected {
    display: none;
}

/* Like a slider: ← on the left, the artwork in the middle, → on the right. */
.td-gallery-list.has-selection .td-gallery-selected {
    --stage-pad: clamp(20px, 4vw, 56px);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    overflow-y: auto;
    padding: clamp(16px, 3vw, 32px) var(--stage-pad) clamp(32px, 5vw, 64px);
    gap: 0;
}

.td-gallery-selected > * {
    width: 100%;
    max-width: 1100px;
}

.td-gallery-list.has-selection .td-gallery-list-grid {
    display: none;
}

.td-gallery-selected-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    margin-bottom: clamp(16px, 2.5vw, 28px);
}

.td-gallery-selected-back {
    background: none;
    border: none;
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--td-ink);
    cursor: pointer;
    padding: 0;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.td-gallery-selected-back:hover { opacity: 1; }

/* "03 / 30" */
.td-gallery-selected-index {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.1em;
    color: rgba(0, 0, 0, 0.6);
}

/* Fixed height = the tallest an artwork gets (image max-height + its title line, also when
   the button wraps under the title). The ← → buttons are centred in it, so they stay in
   the same place whatever the image's proportions; the artwork is centred between them. */
.td-gallery-selected-stage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
    min-height: calc(62vh + 110px);
}

/* image + the line under it; only as wide as the image, so the title starts at the
   image's left edge (the text line takes its width from the image, not the other way) */
.td-gallery-selected-item {
    display: flex;
    flex-direction: column;
    width: fit-content;
    min-width: 0;
}

/* the image at its own proportions — room left for the two 36px buttons and their gaps */
.td-gallery-selected-img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(860px, calc(100vw - var(--stage-pad) * 2 - 72px - 32px));
    max-height: 62vh;
}

.td-gallery-selected-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    width: 0;
    min-width: 100%;
    box-sizing: border-box;
    margin-top: clamp(14px, 1.6vw, 22px);
}

.td-gallery-selected-heading {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.td-gallery-selected-author {
    margin: 0;
    font-size: clamp(15px, 1.3vw, 18px);
    font-weight: 300;
    line-height: 1.3;
    color: rgba(0, 0, 0, 0.6);
}

.td-gallery-selected-author[hidden] {
    display: none;
}

.td-gallery-selected-title {
    min-width: 0;
    font-size: clamp(20px, 2.2vw, 28px);
    font-weight: 300;
    letter-spacing: 0;
    color: var(--td-ink);
    margin: 0;
    line-height: 1.25;
    text-align: left;
}

.td-gallery-selected-3d {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--td-ink);
    border-radius: var(--td-radius-pill);
    color: var(--td-ink);
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 10px 20px;
    transition: background 0.2s, color 0.2s;
}

.td-gallery-selected-3d:hover {
    background: var(--td-ink);
    color: #fff;
}

/* ── Grid ────────────────────────────────── */

.td-gallery-list-grid {
    flex: 1;
    overflow-y: auto;
    padding: clamp(20px, 3vw, 40px) clamp(20px, 4vw, 56px);
    display: grid;
    grid-template-columns: repeat(4, 1fr);   /* never more than four across */
    gap: clamp(20px, 2.4vw, 36px);
    align-content: start;
}

/* a <button> (reachable with Tab, opened with Enter / Space): its own look reset */
.td-gallery-item {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
}

/* keyboard focus: ring around the picture, like hover — not around the whole cell */
.td-gallery-item:focus-visible {
    outline: none;
}

.td-gallery-item:focus-visible .td-gallery-item-img {
    outline: 2px solid var(--td-ink);
    outline-offset: 3px;
}

.td-gallery-item-img {
    width: 100%;
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    background-color: rgba(0, 0, 0, 0.06);
    transition: outline 0.15s;
    outline: 2px solid transparent;
}

.td-gallery-item:hover .td-gallery-item-img {
    outline-color: var(--td-highlight);
}

.td-gallery-item-title {
    margin: 0;
    font-size: 18px;
    font-weight: 300;
    color: var(--td-ink);
    line-height: 1.3;
}

/* author under the title: smaller, softer (like on hover and in the detail panel) */
.td-gallery-item-author {
    margin: -4px 0 0;   /* closer to its title than the item's gap */
    font-size: 15px;
    font-weight: 300;
    line-height: 1.3;
    color: rgba(0, 0, 0, 0.6);
}

@media (max-width: 1100px) {
    .td-gallery-list-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 760px) {
    .td-gallery-list-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .td-gallery-item-title {
        font-size: 15px;
    }
    .td-gallery-item-author {
        font-size: 13px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .td-space-info {
        bottom: auto;
        top: calc(var(--td-nav-h) + 8px);
        left: auto;
        right: var(--padding-global);
        transform: none;
    }
}

/* minimap */
.td-minimap {
    position: fixed;
    right: var(--padding-global);
    bottom: var(--padding-global);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    border-radius: var(--td-radius-card);
    z-index: 2000;
    padding: 6px;
    padding-top: 20px;
    box-sizing: border-box;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.td-minimap:not(.is-open) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.td-minimap-canvas {
    display: block;
}

.td-minimap-close {
    position: absolute;
    top: 3px;
    right: 5px;
    background: none;
    border: none;
    color: var(--black-main);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    font-family: inherit;
    opacity: 0.5;
}

.td-minimap-close:hover {
    opacity: 1;
}

.td-minimap-open {
    position: fixed;
    right: var(--padding-global);
    bottom: var(--padding-global);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--td-border);
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    color: var(--black-main);
    font-size: 0.65rem;
    font-weight: var(--bold);
    letter-spacing: 0.05em;
    cursor: pointer;
    z-index: 2000;
    font-family: inherit;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.td-minimap-open.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── Guided tour (driver.js) ─────────────────────── */

/* The overlay never takes pointer input: the visitor has to be able to walk, drag the
   view and click the highlighted artwork while a step is open. */
.driver-overlay,
.driver-overlay * {   /* the svg's cut-out path takes clicks on its own */
    pointer-events: none !important;
}

/* driver.css disables pointer input on everything but the highlighted element while a
   tour runs (.driver-active *). The scene and the main controls must stay usable. */
.driver-active #td-canvas,
.driver-active .td-joystick,
.driver-active .td-joystick *,
.driver-active .td-space-info-btn,
.driver-active .td-nav-btn {
    pointer-events: auto;
}

/* "try it" steps (walk / look around): no dimming, the whole scene stays visible */
body.td-tour-free .driver-overlay {
    opacity: 0 !important;
}

/* invisible anchors the tour points at */
.td-tour-anchor {
    position: fixed;
    left: 50%;
    bottom: 76px;    /* popover sits just above the bottom bar, clear of the wall text */
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.td-tour-art {
    position: fixed;
    pointer-events: none;
}

/* it's driver's highlighted element (auto pointer events) — the click must reach the artwork */
.driver-active .td-tour-art {
    pointer-events: none !important;
}

.driver-popover.td-tour button:focus:not(:focus-visible) {
    outline: none;
}

.driver-popover.td-tour {
    font-family: 'Outfit', sans-serif;
    color: var(--td-ink);
    background: #fff;
    border-radius: var(--td-radius-panel);
    box-shadow: none;
    padding: 16px 18px 14px;
    max-width: 320px;
}

.driver-popover.td-tour .driver-popover-title {
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    color: var(--td-accent);
}

.driver-popover.td-tour .driver-popover-description {
    font-family: inherit;
    font-size: 13px;
    line-height: 1.55;
    color: #222;
}

.driver-popover.td-tour .td-tour-hint {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.5);
}

.driver-popover.td-tour .driver-popover-progress-text {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.45);
}

.driver-popover.td-tour .driver-popover-footer button {
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-shadow: none;
    color: var(--td-ink);
    background: #fff;
    border: 1px solid var(--td-border);
    border-radius: var(--td-radius-pill);
    padding: 7px 14px;
}

.driver-popover.td-tour .driver-popover-footer button:hover {
    background: var(--td-highlight);
    border-color: var(--td-highlight);
    color: #fff;
}

.driver-popover.td-tour .driver-popover-footer .driver-popover-next-btn {
    background: var(--td-accent);
    border-color: var(--td-accent);
    color: #fff;
}

/* already dark: inverts on hover */
.driver-popover.td-tour .driver-popover-footer .driver-popover-next-btn:hover {
    background: #fff;
    border-color: var(--td-ink);
    color: var(--td-ink);
}

.driver-popover.td-tour .driver-popover-close-btn {
    color: rgba(0, 0, 0, 0.4);
}

/* driver focuses the popover after a key press (W/↑…), which shows a focus ring on ×;
   Esc also closes the tour */
.driver-popover.td-tour .driver-popover-close-btn:focus {
    outline: none;
}

.driver-popover.td-tour .td-key {
    font-size: 11px;
}

/* "Tour starten" in the info panel */
/* same button as "In 3D ansehen": dark line and text, filled on hover */
.td-intro-tour {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--td-ink);
    background: transparent;
    border: 1px solid var(--td-ink);
    border-radius: var(--td-radius-pill);
    padding: 11px 22px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.td-intro-tour:hover {
    background: var(--td-ink);
    color: #fff;
}

/* ── Rotate prompt (portrait on touch) ───── */

.td-rotate-prompt {
    display: none;
}

@media (hover: none) and (pointer: coarse) and (orientation: portrait) {
    .td-rotate-prompt:not(.is-dismissed) {
        display: flex;
        align-items: center;
        gap: 10px;
        position: fixed;
        top: 16px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 9000;
        background: rgba(255, 255, 255, 0.72);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(0, 0, 0, 0.1);
        padding: 10px 14px 10px 18px;
        border-radius: var(--td-radius-pill);
        white-space: nowrap;
        font-family: 'Outfit', sans-serif;
        font-size: 0.82rem;
        font-weight: 500;
        color: var(--td-ink);
    }
}

.td-rotate-icon {
    display: inline-block;
    color: var(--td-accent);
    font-size: 1.1rem;
    animation: td-rotate-hint 2s ease-in-out infinite;
}

.td-rotate-close {
    background: none;
    border: none;
    color: rgba(0, 0, 0, 0.4);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0 0 0 6px;
    line-height: 1;
}

.td-rotate-close:hover {
    color: var(--td-ink);
}

@keyframes td-rotate-hint {
    0%, 100% { transform: rotate(0deg); }
    50%       { transform: rotate(90deg); }
}

/* ── Loading overlay ─────────────────────── */

.td-loading {
    position: absolute;
    inset: 0;
    z-index: 3000;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    font-family: 'Outfit', sans-serif;
}

.td-loading.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.td-loading-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: clamp(280px, 46vw, 560px);
    max-width: calc(100vw - 48px);
}

.td-loading-label {
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.55);
    margin: 0 0 14px;
}

/* large and thin, no accent bar — like the titles in the exhibition's panels */
.td-loading-title {
    font-size: clamp(28px, 4.5vw, 52px);
    font-weight: 100;
    line-height: 1.15;
    letter-spacing: 0;
    color: var(--td-ink);
    margin: 0 0 clamp(28px, 4vw, 44px);
}

.td-loading-hint {
    font-size: 14px;
    font-weight: 300;
    color: rgba(0, 0, 0, 0.6);
    margin: 0 0 12px;
}

.td-loading-bar-wrap {
    width: 100%;
    height: 1px;
    background: rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
}

.td-loading-bar {
    height: 100%;
    width: 0%;
    background: var(--td-accent);
    transition: width 0.25s ease;
}

.td-loading-text {
    margin: 0;
    font-size: 12px;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.06em;
    color: rgba(0, 0, 0, 0.6);
}

/* ── Joysticks (touch only) ──────────────── */

.td-joystick {
    display: none;
}

@media (hover: none) and (pointer: coarse) {
    .td-joystick {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        width: 110px;
        height: 110px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.25);
        backdrop-filter: blur(8px);
        border: 1px solid rgba(0, 0, 0, 0.1);
        z-index: 2000;
        touch-action: none;
        -webkit-tap-highlight-color: transparent;
    }

    #td-joy-move {
        bottom: 24px;
        left: 24px;
    }

    #td-joy-look {
        bottom: 24px;
        right: 24px;
    }

    .td-joystick-knob {
        width: 46px;
        height: 46px;
        border-radius: 50%;
        background: var(--td-accent);
        opacity: 0.75;
        position: absolute;
        pointer-events: none;
    }

    .td-ausstellung.is-focused .td-joystick {
        display: none;
    }


    /* minimap open button — next to the info button */
    .td-minimap-open {
        top: var(--padding-global);
        left: calc(var(--padding-global) + 50px);
        right: auto;
        bottom: auto;
    }

    /* minimap panel — top left, below the navigation */
    .td-minimap {
        right: auto;
        left: var(--padding-global);
        bottom: auto;
        top: calc(var(--td-nav-h) + 8px);
    }
}

/* ── hide minimap + navigation while a frame is focused (the focus view uses the top corners) */
.td-ausstellung.is-focused .td-minimap,
.td-ausstellung.is-focused .td-minimap-open,
.td-ausstellung.is-focused .td-nav {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── Category / tag filter ───────────────── */

.td-space-info-filter.is-active,
.td-space-info-filter[aria-expanded="true"] {
    background: var(--td-accent);
    border-color: var(--td-accent);
    color: #fff;
}

.td-filter {
    position: fixed;
    bottom: calc(var(--padding-global) + 58px);   /* clear of the bottom bar (≈ 46px) + a gap */
    left: 50%;
    transform: translate(-50%, 8px);
    z-index: 2000;
    width: min(440px, calc(100vw - 32px));
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: var(--td-radius-panel);
    padding: 16px 18px;
    font-family: 'Outfit', sans-serif;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.td-filter.is-open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.td-ausstellung.is-focused .td-filter {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.td-filter-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--td-accent);
    margin: 0 0 8px;
}

.td-filter-chips,
.td-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.td-filter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.td-filter-result {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.5);
}

.td-filter-reset {
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--td-accent);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.td-filter-reset:disabled {
    color: rgba(0, 0, 0, 0.25);
    cursor: default;
}

/* Chips — used in the filter panel, popup and gallery detail */
.td-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    color: var(--td-ink);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--td-border);
    border-radius: var(--td-radius-pill);
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.td-chip:hover {
    border-color: var(--td-ink);
}

/* a chip that only shows something (detail panel): not a button, no hover */
.td-chip--label,
.td-chip--label:hover {
    border-color: var(--td-border);
    cursor: default;
}

.td-chip--category::before {
    content: '';
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--chip-color, var(--td-accent));
}

.td-chip--category[aria-pressed="true"] {
    background: var(--chip-color, var(--td-accent));
    border-color: var(--chip-color, var(--td-accent));
    color: #fff;
}

.td-chip--category[aria-pressed="true"]::before {
    background: #fff;
}

.td-chip--tag::before {
    content: '#';
    color: rgba(0, 0, 0, 0.35);
}

.td-chip--tag[aria-pressed="true"] {
    background: var(--td-accent);
    border-color: var(--td-accent);
    color: #fff;
}

.td-chip--tag[aria-pressed="true"]::before {
    color: rgba(255, 255, 255, 0.6);
}

.td-meta[hidden] {
    display: none;
}

.td-gallery-item[hidden] {
    display: none;
}

@media (hover: none) and (pointer: coarse) {
    .td-filter {
        bottom: auto;
        top: calc(var(--td-nav-h) + 8px + 58px);   /* under the bar (≈ 46px) + a gap */
        left: auto;
        right: var(--padding-global);
        transform: translateY(-8px);
    }

    .td-filter.is-open {
        transform: none;
    }
}

/* ── Audio block (td_audio) in the item popup ───────── */

.td-audio {
    display: grid;
    grid-template-columns: 40px 1fr;
    column-gap: 12px;
    row-gap: 8px;
    align-items: center;
    padding: 14px 16px;
    background: transparent;
    border: 1px solid var(--td-ink);
    border-radius: var(--td-radius-card);
    font-family: inherit;
}

.td-audio-play {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--td-ink);
    background: transparent;
    color: var(--td-ink);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.td-audio-play:hover {
    background: var(--td-ink);
    color: #fff;
}

.td-audio-play:focus-visible,
.td-audio-progress:focus-visible {
    outline: 2px solid var(--td-ink);
    outline-offset: 2px;
}

.td-audio-play .td-audio-icon-pause,
.td-audio.is-playing .td-audio-play .td-audio-icon-play {
    display: none;
}

.td-audio.is-playing .td-audio-play .td-audio-icon-pause {
    display: block;
}

.td-audio.is-playing .td-audio-play {
    background: var(--td-ink);
    border-color: var(--td-ink);
    color: #fff;
}

.td-audio-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* td_caption block (Hinweis): small heading, close above the block after it */
.td-popup-blocks .td-caption {
    margin: 0;
    font-size: 18px;
    font-weight: 300;
    line-height: 1.25;
    color: var(--td-ink);
}

.td-popup-blocks > .td-caption + * {
    margin-top: 10px;
}

.td-audio .td-audio-title {
    margin: 0;
    font-size: 16px;
    font-weight: 300;
    line-height: 1.3;
    color: var(--td-ink);
    overflow: hidden;
    white-space: nowrap;   /* too long: scrolls (marquee in detail.js) */
}

/* taller hit area than the visible 3px track */
.td-audio-progress {
    position: relative;
    height: 12px;
    cursor: pointer;
}

.td-audio-progress::before,
.td-audio-progress-fill {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    height: 3px;
    transform: translateY(-50%);
}

.td-audio-progress::before {
    right: 0;
    background: rgba(0, 0, 0, 0.12);
}

.td-audio-progress-fill {
    width: 0;
    background: var(--td-ink);
}

.td-audio-time {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: rgba(0, 0, 0, 0.5);
}

/* ── Transcript under a sound in the item popup (snippet td_script) ─────── */
/* Closed at first, opens on click (native <details>). Sits under the Hintergrundton player and
   under every td_audio block. */

.td-script {
    background: transparent;
    border: 1px solid var(--td-ink);
    border-radius: var(--td-radius-card);
    font-family: inherit;
}

/* a transcript right after an audio block belongs to it: sit close under the player */
.td-popup-blocks > .td-audio + .td-script {
    margin-top: 8px;
}

.td-script-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--td-radius-card);
    font-size: 16px;
    font-weight: 300;
    line-height: 1.3;
    color: var(--td-ink);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.td-script-summary::-webkit-details-marker {
    display: none;
}

.td-script-summary:focus-visible {
    outline: 2px solid var(--td-ink);
    outline-offset: 2px;
}

.td-script-chevron {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.td-script[open] .td-script-chevron {
    transform: rotate(180deg);
}

.td-script-body {
    padding: 4px 16px 18px;
}

.td-script-text {
    font-size: 15px;
    color: rgba(0, 0, 0, 0.82);
}

/* own paragraph rhythm: the transcript under the Hintergrundton player sits outside
   .td-popup-blocks, so it doesn't get that container's paragraph rule */
.td-script-text p {
    line-height: 1.65;
    margin: 0 0 0.75em;
}

.td-script-text p:last-child {
    margin-bottom: 0;
}

/* ── Background sound player (focus nav, between ← and →) ─── */

.td-focus-nav {
    align-items: center;
    max-width: calc(100vw - 32px);
}

.td-bg-player {
    /* fixed width — sizing to the title left short titles with almost no progress bar
       to click; viewport minus ←/→ (2×44px), gaps (2×8px) and the 16px side gutters */
    flex: 0 0 auto;
    width: min(360px, calc(100vw - 32px - 88px - 16px));
    min-width: 0;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 0 4px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: var(--td-radius-pill);
    font-family: 'Outfit', sans-serif;
    box-sizing: border-box;
}

.td-bg-player[hidden] {
    display: none;
}

.td-bg-player-play {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--td-border);
    background: #fff;
    color: var(--td-ink);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
}

.td-bg-player-play:hover {
    background: var(--td-highlight);
    border-color: var(--td-highlight);
}

.td-bg-player.is-playing .td-bg-player-play {
    background: var(--td-accent);
    border-color: var(--td-accent);
    color: #fff;
}

.td-bg-player.is-loading .td-bg-player-play {
    opacity: 0.4;
    cursor: default;
}

.td-bg-player-play:focus-visible,
.td-bg-player-progress:focus-visible {
    outline: 2px solid var(--td-accent);
    outline-offset: 2px;
}

.td-bg-player .td-audio-icon-pause,
.td-bg-player.is-playing .td-audio-icon-play {
    display: none;
}

.td-bg-player.is-playing .td-audio-icon-pause {
    display: block;
}

.td-bg-player-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.td-bg-player-title {
    margin: 0;
    font-size: 16px;
    font-weight: 300;
    line-height: 1.25;
    color: var(--td-ink);
    overflow: hidden;
    white-space: nowrap;
}

/* Sound titles (marquee() in detail.js): a title too long for its line (.is-overflowing)
   scrolls right to left in a loop, whether the sound plays or not; one that fits stands still. */
.td-marquee,
.td-marquee-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.td-marquee-text ~ .td-marquee-text {
    display: none;   /* the copies that make the loop seamless */
}

.is-overflowing .td-marquee {
    display: inline-flex;
    overflow: visible;
    animation: td-marquee var(--marquee-dur, 10s) linear infinite;
}

.is-overflowing .td-marquee-text,
.is-overflowing .td-marquee-text ~ .td-marquee-text {
    display: inline;
    overflow: visible;
    padding-right: 3em;   /* the gap before the next copy — = MARQUEE_GAP */
}

/* soft edges where the text runs in and out */
.is-overflowing {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

@keyframes td-marquee {
    to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
    .is-overflowing .td-marquee { animation: none; }
}

.td-bg-player-time {
    flex-shrink: 0;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    color: rgba(0, 0, 0, 0.5);
}

@media (max-width: 480px) {
    .td-bg-player-time {
        display: none;
    }
}

/* prev/next stay perfect circles next to the flexible bg player */
.td-focus-prev,
.td-focus-next {
    flex-shrink: 0;
    padding: 0;
    color: var(--td-ink);
}

/* sound-direction HUD is only for walking around — the focus view has its own player */
.td-ausstellung.is-focused .td-audio-hud {
    opacity: 0;
}

/* ── Detail panel focus: backdrop + background-sound player ── */

/* between the focus controls (2100) and the panel (2200): dims the scene, takes its
   clicks, and closes the panel when clicked (see closeDetail) */
.td-detail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2150;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s ease, visibility 0.35s;
    cursor: pointer;
}

.td-ausstellung.is-detail-open .td-detail-backdrop,
.td-ausstellung:has(.td-intro.is-open) .td-detail-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.td-detail-bg[hidden] {
    display: none;
}

/* ── Navigation ─────────────────────────────
   No full-width bar (it boxed in the ceiling): the actions float as a small translucent
   capsule in the top right corner (top left shows the hovered artwork's title, see
   .td-frame-hud). The focus view's Zurück / Details buttons use the same capsule. Faded
   while walking (.is-moving, see animate()). */

.td-ausstellung {
    --td-nav-top: 12px;
    --td-nav-cap: 36px;                                   /* capsule height */
    --td-nav-h: calc(var(--td-nav-top) + var(--td-nav-cap));  /* space the nav takes */
    --td-capsule-bg: rgba(255, 255, 255, 0.85);          /* shared by nav, focus + bottom bar */
}

.td-nav {
    position: fixed;
    top: var(--td-nav-top);
    left: var(--padding-global);
    right: var(--padding-global);
    z-index: 2050;                 /* above the scene UI (2000), under the detail backdrop (2150) */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    pointer-events: none;          /* only the capsules take clicks */
    transition: opacity 0.3s, visibility 0.3s;
}

.td-nav > * {
    pointer-events: auto;
}

.td-nav-actions,
.td-focus-back,
.td-focus-open {
    height: var(--td-nav-cap);
    display: flex;
    align-items: center;
    background: var(--td-capsule-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: calc(var(--td-nav-cap) / 2);
    font-family: 'Outfit', sans-serif;
    color: var(--td-ink);
    transition: opacity 0.15s ease-out, background 0.2s, color 0.2s;   /* coming back: quick */
}

.td-focus-back span,
.td-focus-open span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.td-nav-actions {
    gap: 2px;
    padding: 0 3px;
    flex-shrink: 0;
}

.td-focus-back,
.td-focus-open {
    gap: 8px;
    padding: 0 16px 0 12px;
}

.td-focus-back:hover,
.td-focus-open:hover {
    background: var(--td-highlight);
}

.td-nav-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--td-ink);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.td-nav-btn[hidden] {
    display: none;
}

.td-nav-btn:hover {
    background: var(--td-highlight);
}

.td-nav-btn:focus-visible,
.td-focus-back:focus-visible,
.td-focus-open:focus-visible {
    outline: 2px solid var(--td-accent);
    outline-offset: 2px;
}

/* two-state icons: .is-off = muted / in fullscreen */
.td-nav-btn .td-nav-ico-off,
.td-nav-btn.is-off .td-nav-ico-on {
    display: none;
}

.td-nav-btn.is-off .td-nav-ico-off {
    display: block;
}

.td-nav-sound.is-off {
    color: var(--td-accent);
}

/* walking / turning: step back so the view opens up (gently); hover brings it back */
.td-ausstellung.is-moving .td-nav > *:not(:hover) {
    opacity: 0.4;
    transition-duration: 0.5s;
}

/* ── Scene UI: outline style ────────────────
   Everything that floats over the 3D scene — the top-right nav, the bottom bar, the focus
   view's Zurück / Details / ← →, the sound-direction label, the minimap button — wears the
   look of the hovered artwork's title (.td-frame-hud-title): no fill, a white line, white
   text and icons. Hover / active = filled white with dark content. The focus view's sound
   player is the exception: a solid white capsule with dark content (it has to stay readable
   on top of the artwork).
   Kept in one block on top of the rules above, so the look can be changed or dropped here.
   Panels that open over the scene (filter, info, tour, detail, Werke list) are not part of it. */

.td-ausstellung {
    --td-ui-line: #fff;                          /* line, text and icons */
}

.td-nav-actions,
.td-focus-back,
.td-focus-open,
.td-space-info,
.td-focus-prev,
.td-focus-next,
.td-audio-hud,
.td-minimap-open {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--td-ui-line);
    box-sizing: border-box;
    color: var(--td-ui-line);
}

/* nav buttons */
.td-nav-btn,
.td-nav-sound.is-off {
    color: var(--td-ui-line);
}

.td-nav-btn:hover,
.td-focus-back:hover,
.td-focus-open:hover,
.td-focus-prev:hover,
.td-focus-next:hover,
.td-minimap-open:hover {
    background: var(--td-ui-line);
    border-color: var(--td-ui-line);
    color: var(--td-ink);
}

/* bottom bar: Werke / Filter have no line of their own — the capsule around them has one */
.td-space-info-btn {
    background: transparent;
    border-color: transparent;
    color: var(--td-ui-line);
    font-size: 15px;
    font-weight: 300;
    padding: 10px 18px;
}

.td-space-info-btn svg {
    width: 16px;
    height: 16px;
}

/* while a filter is on: how many artworks it found, after "Filter" */
.td-space-info-filter-found {
    font-variant-numeric: tabular-nums;
    text-transform: none;
    letter-spacing: 0.02em;
}

.td-space-info-filter-found[hidden] {
    display: none;
}

.td-space-info-btn:hover,
.td-space-info-filter.is-active,
.td-space-info-filter[aria-expanded="true"] {
    background: var(--td-ui-line);
    border-color: var(--td-ui-line);
    color: var(--td-ink);
}

/* focus view: sound player — white capsule, dark content */
.td-bg-player {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-color: #fff;
}

.td-bg-player-play {
    background: transparent;
    border-color: var(--td-ink);
    color: var(--td-ink);
}

.td-bg-player-play:hover,
.td-bg-player.is-playing .td-bg-player-play {
    background: var(--td-ink);
    border-color: var(--td-ink);
    color: #fff;
}


/* sound-direction label */
.td-audio-hud-icon,
.td-audio-hud-title {
    color: var(--td-ui-line);
}

/* filter panel: like the focus view's sound player — a solid white panel with dark content
   (without a fill its many chips were unreadable over the scene). No accent colour: a
   chosen chip is filled dark, its colour dot stays.
   Scoped to .td-filter: the same chips also sit in the detail panel and the Werke list. */
.td-filter {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: var(--td-ink);
}

.td-filter-label,
.td-filter-reset {
    color: var(--td-ink);
}

.td-filter-label,
.td-filter-result,
.td-filter-reset {
    font-size: 12px;
    font-weight: 400;
}

.td-filter .td-chip {
    background: transparent;
    font-size: 13px;
    font-weight: 400;
}

.td-filter .td-chip--category[aria-pressed="true"],
.td-filter .td-chip--tag[aria-pressed="true"] {
    background: var(--td-ink);
    border-color: var(--td-ink);
    color: #fff;
}

.td-filter .td-chip--category[aria-pressed="true"]::before {
    background: var(--chip-color, #fff);
}

/* ── Wall text: language switch ─────────────
   ‹ › beside the wall text and the language names under it (sign-langs.js places them every
   frame). They sit on the light wall, so — unlike the white scene UI — they are drawn in ink.
   Fade in while the visitor stands in front of the text, out otherwise. */
.td-sign-arrow,
.td-sign-langs,
.td-sign-impressum {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1900;                 /* over the canvas + vignette, under the scene UI (2000) */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0s 0.6s;
}

.td-sign-arrow.is-visible,
.td-sign-langs.is-visible,
.td-sign-impressum.is-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s ease, visibility 0s;
}

/* walking / turning: step back like the nav does */
.td-ausstellung.is-moving .td-sign-arrow.is-visible:not(:hover),
.td-ausstellung.is-moving .td-sign-langs.is-visible:not(:hover),
.td-ausstellung.is-moving .td-sign-impressum.is-visible:not(:hover) {
    opacity: 0.35;
}

.td-sign-arrow {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: 1px solid var(--td-ink);
    border-radius: 50%;
    color: var(--td-ink);
    cursor: pointer;
}

.td-sign-arrow:hover {
    background: var(--td-ink);
    color: #fff;
}

.td-sign-langs {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    white-space: nowrap;
}

.td-sign-lang {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--td-radius-pill);
    font-family: 'Outfit', 'Noto Sans', 'Vazirmatn', sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 1.2;
    color: var(--td-ink);
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 0.2s, border-color 0.2s;
}

.td-sign-lang:hover {
    opacity: 1;
}

.td-sign-lang[aria-pressed="true"] {
    opacity: 1;
    border-color: var(--td-ink);
}

/* Impressum section of the info panel (before "Steuerung"); its blocks look as in the detail panel */
.td-intro-blocks {
    width: 100%;
    max-width: 62ch;
}

/* the same language names in the info panel, under its text */
.td-intro-langs {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: -14px;            /* first name lines up with the text, not its pill */
}

/* "| Impressum" right of the language names, set like them
   (own rules, not .td-sign-lang — its opacity / transition would undo the fade above) */
.td-sign-impressum {
    display: flex;
    align-items: center;
    padding: 0;
    background: transparent;
    border: 0;
    font-family: 'Outfit', 'Noto Sans', 'Vazirmatn', sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--td-ink);
    cursor: pointer;
}

.td-sign-sep {
    padding: 0 6px 0 4px;
    opacity: 0.35;
}

.td-sign-impressum-label {
    padding: 6px 14px;
    border: 1px solid transparent;
    border-radius: var(--td-radius-pill);
    opacity: 0.55;
    transition: opacity 0.2s, border-color 0.2s;
}

.td-sign-impressum:hover .td-sign-impressum-label {
    opacity: 1;
    border-color: var(--td-ink);
}

.td-intro-impressum:focus {
    outline: none;
}

/* info panel in a language switched at the wall: Cyrillic / Persian glyphs at Outfit's weights */
.td-intro-head {
    font-family: 'Outfit', 'Noto Sans', 'Vazirmatn', sans-serif;
}

.td-intro-head h2 {
    font-family: inherit;
}

/* subtitle: between the title and the description, a step larger than the text */
.td-intro-subtitle {
    margin: 0;
    font-size: 20px;
    font-weight: 300;
    line-height: 1.45;
    color: var(--td-ink);
}

/* sign-langs.js sets the text as plain text — keep the Panel's line breaks */
.td-intro-subtitle,
.td-intro-desc {
    white-space: pre-line;
}
