/* ==========================================================================
   TOUR WALK – 3D-Tourverlauf
   Eigenstaendiges Modul. Alle Klassen beginnen mit .fts-walk oder .ftw-.
   Farben, Schriften und Radien kommen aus den Variablen in style.css.
   ========================================================================== */

/* position: sticky braucht einen Body ohne eigenen Scroll-Container.
   overflow-x: hidden (style.css) macht den Body dazu, clip nicht. */
body.fts-has-walk { overflow-x: clip; }

.fts-walk-section[hidden] { display: none; }

/* Ansicht pro Tour: nur 3D-Verlauf, oder A/B-Test (Klasse am <html> aus inc/tour-walk.php) */
body.fts-walk-mode-walk .tour-timeline,
html.fts-ab-b body.fts-walk-mode-ab .tour-timeline { display: none; }
html.fts-ab-a body.fts-walk-mode-ab .fts-walk-section { display: none; }
.fts-walk-section { background: var(--color-bg); }

.fts-walk-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-lg);
    flex-wrap: wrap;
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-lg);
}
.fts-walk-intro .section-label { margin-bottom: var(--space-xs); }
.fts-walk-intro h2 { font-size: var(--text-2xl); }
.fts-walk-skip {
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-light);
    text-decoration: underline;
    text-underline-offset: 4px;
}
.fts-walk-skip:hover { color: var(--color-primary-dark); }

.fts-walk {
    --ftw-top: 0px;
    --ftw-g: 220px;
    --ftw-sky: #dff5f3;
    --ftw-fog: #f8f8f8;
    --ftw-road: #e9e9e9;
    --ftw-walkway: #f3f3f3;
    --ftw-mtn: #dfe8e7;
    --ftw-water: #bfe6e3;
    --ftw-park: #dcefd9;
    --ftw-ink: var(--color-text);
    --ftw-card: var(--color-white);
    --ftw-gut: clamp(1rem, 4vw, 2rem);
    position: relative;
    color: var(--color-text);
}

.ftw-stage {
    position: sticky;
    top: var(--ftw-top);
    height: calc(100vh - var(--ftw-top));
    height: calc(100dvh - var(--ftw-top));
    overflow: hidden;
    background: linear-gradient(var(--ftw-sky) 0, var(--ftw-fog) 46%);
}

/* Kulisse */
.ftw-sun { position: absolute; left: 0; top: 25%; width: 56px; height: 56px; border-radius: 50%; background: var(--color-secondary); opacity: .55; will-change: transform; }
.ftw-mtns { position: absolute; left: 0; bottom: 54%; width: 100%; max-width: none; height: 90px; fill: var(--ftw-mtn); }
/* Cerro San Cristobal mit Seilbahn und Maria, Costanera Center */
.ftw-cerro, .ftw-torre { position: absolute; bottom: 54%; width: auto; max-width: none; }
.ftw-cerro { right: calc(50% + 34px); height: 120px; opacity: .9; }
.ftw-cerro .ch { fill: var(--ftw-park); stroke: var(--color-text-light); stroke-width: 1.1; vector-effect: non-scaling-stroke; }
.ftw-cerro .cl { fill: none; stroke: var(--color-text-light); stroke-width: .9; vector-effect: non-scaling-stroke; }
.ftw-cerro .cs { fill: var(--ftw-fog); stroke: var(--color-text-light); stroke-width: .9; vector-effect: non-scaling-stroke; }
.ftw-cerro .gon { animation: ftw-gon 18s linear infinite; }
.ftw-cerro .g2 { animation-delay: -6s; }
.ftw-cerro .g3 { animation-delay: -12s; }
@keyframes ftw-gon { from { transform: translate(0, 0); } to { transform: translate(-84px, -77px); } }
.ftw-torre { left: calc(50% + 40px); height: 150px; opacity: .8; }
.ftw-torre .tb { fill: var(--ftw-fog); stroke: var(--color-text-light); stroke-width: 1.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ftw-torre .tl { fill: none; stroke: var(--color-text-light); stroke-width: .7; vector-effect: non-scaling-stroke; opacity: .7; }

.ftw-floor { position: absolute; left: 0; right: 0; top: 46%; bottom: 0; background: linear-gradient(var(--ftw-fog) 0, var(--ftw-walkway) 45%); }
.ftw-scene { position: absolute; inset: 0; perspective: 600px; perspective-origin: 50% 46%; overflow: hidden; }
.ftw-world { position: absolute; left: 50%; top: 46%; width: 0; height: 0; transform-style: preserve-3d; will-change: transform; }
.ftw-it { position: absolute; left: 0; top: 0; transform-origin: 0 0; visibility: hidden; }

.ftw-tile {
    width: 240px; height: 160px;
    background:
        linear-gradient(var(--color-primary) 50%, transparent 50%) 50% 0 / 8px 80px repeat-y,
        linear-gradient(90deg, var(--color-border) 0 4px, transparent 4px calc(100% - 4px), var(--color-border) calc(100% - 4px)),
        var(--ftw-road);
}
.ftw-wall svg { display: block; max-width: none; }
.ftw-wall .f { fill: var(--ftw-card); stroke: var(--ftw-ink); stroke-width: 1.6; stroke-linejoin: round; }
.ftw-wall .aw { fill: var(--color-primary); stroke: var(--ftw-ink); stroke-width: 1.2; }
.ftw-wall .aw2 { fill: var(--color-secondary); stroke: var(--ftw-ink); stroke-width: 1.2; }

/* Fassaden aus der Einstellungsseite: deckend weiss, Linien verblassen in der Ferne */
.ftw-fimg { position: relative; background: var(--im) 0 0 / 100% 100% no-repeat; }
.ftw-fimg::before, .ftw-sidew .ftw-fimg::after { content: ""; position: absolute; inset: 0; -webkit-mask: var(--im) 0 0 / 100% 100% no-repeat; mask: var(--im) 0 0 / 100% 100% no-repeat; }
.ftw-fimg::before { background: #fff; opacity: var(--fk, 0); }
.ftw-sidew .ftw-fimg::after { background: rgba(20, 40, 45, .09); }
.ftw-sidew.l .ftw-fimg { transform: scaleX(-1); }

/* Gebaeude-Zeichnungen und Figuren */
.ftw-bd { cursor: default; }
.ftw-bd[data-k] { cursor: pointer; }
.fts-walk .ftw-bd img { display: block; width: 100%; max-width: none; height: auto; -webkit-mask-image: linear-gradient(#000 93%, transparent 100%); mask-image: linear-gradient(#000 93%, transparent 100%); }
.ftw-bd__cap { position: absolute; left: 50%; top: 100%; transform: translate(-50%, -150%); background: var(--color-text); color: var(--color-white); padding: 4px 12px; border-radius: var(--radius-full); white-space: nowrap; font: 600 11px/1.3 var(--font-body); text-transform: uppercase; letter-spacing: .1em; }
.ftw-bd:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 4px; }
.fts-walk .ftw-shot .ftw-shot__draw { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; padding: 8px 10px; }
.fts-walk .ftw-fig { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font: inherit; color: var(--color-text); }
.fts-walk .ftw-fig img { display: block; height: 58px; width: auto; max-width: none; transform-origin: 50% 100%; animation: ftw-dance .55s ease-in-out infinite alternate; }
.ftw-fig__lab { background: var(--ftw-card); border: 1px solid var(--color-border); padding: 2px 10px; border-radius: var(--radius-full); white-space: nowrap; font: 500 12px/1.6 var(--font-body); }
.ftw-fig:focus-visible .ftw-fig__lab { outline: 2px solid var(--color-primary); outline-offset: 3px; }
@keyframes ftw-dance { from { transform: rotate(-2.5deg); } to { transform: rotate(2.5deg) translateY(-2px); } }
.fts-walk .ftw-sheet__img .ftw-shot__draw { object-fit: contain; padding: 8px; }

/* Dunkler Modus: Strichzeichnungen umkehren */
[data-theme="dark"] .fts-walk .ftw-fimg, [data-theme="dark"] .fts-walk .ftw-bd img, [data-theme="dark"] .fts-walk .ftw-fig img,
[data-theme="dark"] .fts-walk .ftw-shot__draw, [data-theme="dark"] .ftw-cerro .maria { filter: invert(1) hue-rotate(180deg); }

.fts-walk .ftw-ico { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ftw-label { font-family: var(--font-body); font-size: 11px; font-weight: 600; line-height: 1.3; text-transform: uppercase; letter-spacing: .1em; }

/* Hauptstopp */
.ftw-stop {
    width: min(290px, 76vw);
    background: var(--ftw-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 12px;
    cursor: pointer;
}
.ftw-pin { position: absolute; left: 50%; bottom: 100%; width: 2px; height: 110px; margin-left: -1px; background: var(--color-primary); }
.ftw-pin b {
    position: absolute; left: 50%; top: 0; transform: translateX(-50%);
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--color-primary); color: var(--color-white);
    font: 700 24px/48px var(--font-heading); text-align: center;
    box-shadow: var(--shadow-base);
}
.ftw-shot { position: relative; aspect-ratio: 2 / 1; border-radius: var(--radius-md); overflow: hidden; background: var(--color-bg-alt); display: grid; place-items: center; color: var(--color-gray-400); }
.fts-walk .ftw-shot img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.ftw-shot .ftw-ico { width: 40px; height: 40px; }
.ftw-stop__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 4px 0; color: var(--color-text-light); }
.ftw-pill { background: var(--color-primary); color: var(--color-white); padding: 2px 10px; border-radius: var(--radius-full); font: 600 12px/1.6 var(--font-body); white-space: nowrap; }
.ftw-stop__title { font-family: var(--font-heading); font-size: 25px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; margin: 6px 4px 10px; text-wrap: balance; }
.ftw-more {
    display: inline-flex; align-items: center; gap: 6px; margin: 0 4px 4px;
    font: 600 12px/1 var(--font-heading); text-transform: uppercase; letter-spacing: .05em;
    border: 2px solid var(--color-text); border-radius: var(--radius-full); padding: 8px 14px;
}
.ftw-more .ftw-ico { width: 14px; height: 14px; }

/* Tafel auf dem Weg */
.fts-walk .ftw-fact {
    width: min(260px, 68vw);
    background: var(--color-bg-dark); color: var(--color-white);
    border-radius: var(--radius-lg); padding: 14px 16px;
    box-shadow: var(--shadow-lg);
    text-align: left; font: inherit; cursor: pointer;
}
.ftw-fact .ftw-label { display: block; color: var(--color-primary); margin-bottom: 6px; }
.ftw-fact__text { display: block; font-size: 15.5px; line-height: 1.45; }
.ftw-fact::after { content: ""; position: absolute; left: 50%; top: 100%; width: 2px; height: 90px; margin-left: -1px; background: var(--color-bg-dark); }

/* Symbol am Wegrand */
.fts-walk .ftw-poi { display: flex; flex-direction: column; align-items: center; color: var(--color-text); cursor: pointer; font: inherit; }
.ftw-poi__plate { width: 64px; height: 64px; border-radius: 50%; background: var(--ftw-card); border: 1px solid var(--color-border); box-shadow: var(--shadow-base); display: grid; place-items: center; }
.ftw-poi__plate .ftw-ico { width: 30px; height: 30px; }
.ftw-poi__lab { margin-top: 6px; background: var(--ftw-card); border: 1px solid var(--color-border); padding: 2px 10px; border-radius: var(--radius-full); white-space: nowrap; font: 500 12px/1.6 var(--font-body); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ftw-poi__stick { width: 2px; height: 66px; background: var(--color-border); }
.ftw-poi--camera .ftw-poi__plate { background: var(--color-secondary); border-color: var(--color-secondary); color: var(--color-white); }

.ftw-stop:focus-visible, .ftw-fact:focus-visible, .ftw-poi:focus-visible .ftw-poi__plate { outline: 2px solid var(--color-primary); outline-offset: 3px; }

/* Kopfzeile mit Karte */
.ftw-hud {
    position: absolute; left: 0; right: 0; top: 0;
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    padding: 12px var(--ftw-gut) 30px;
    pointer-events: none;
    background: linear-gradient(var(--ftw-sky) 60%, transparent);
}
.ftw-hud__text { min-width: 0; }
.ftw-hud__title { font-family: var(--font-heading); font-size: clamp(18px, 3vw, 32px); font-weight: 600; line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; margin-bottom: 6px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.ftw-hud__meta { font-size: 13px; line-height: 1.5; color: var(--color-text-light); font-variant-numeric: tabular-nums; }
.ftw-hud__meta span, .ftw-hud__meta strong { display: block; }
.ftw-hud__meta strong { color: var(--color-text); font-weight: 600; }
.ftw-mini { flex: none; width: clamp(140px, 22vw, 250px); background: var(--ftw-card); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-base); padding: 5px; }
.ftw-mini[hidden] { display: none; }
.ftw-map { display: block; width: 100%; height: auto; border-radius: 11px; background: var(--color-bg-alt); }
.ftw-map .river { fill: none; stroke: var(--ftw-water); stroke-linecap: round; stroke-linejoin: round; }
.ftw-map .park { fill: none; stroke: var(--ftw-park); stroke-linecap: round; stroke-linejoin: round; }
.ftw-map .ave { fill: none; stroke: var(--color-border); stroke-linecap: round; stroke-linejoin: round; }
.ftw-map .hill { fill: var(--ftw-park); }
.ftw-map .ghost { fill: none; stroke: var(--color-text-light); stroke-width: 3; stroke-dasharray: 1 7; stroke-linecap: round; }
.ftw-map .drawn { fill: none; stroke: var(--color-primary); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.ftw-map .dot { fill: var(--ftw-card); stroke: var(--color-text); stroke-width: 3; }
.ftw-map .dot.sm { stroke-width: 2; stroke: var(--color-text-light); }
.ftw-map .dot.done { fill: var(--color-primary); stroke: var(--color-primary); }
.ftw-map .me { fill: var(--color-secondary); stroke: var(--ftw-card); stroke-width: 3; }

/* Fusszeile */
.ftw-bottom { position: absolute; left: 0; right: 0; bottom: 0; pointer-events: none; }
.ftw-hintrow { display: flex; justify-content: center; padding: 0 var(--ftw-gut); margin-bottom: 10px; }
.ftw-hint { background: var(--color-text); color: var(--color-white); padding: 7px 14px; border-radius: var(--radius-full); text-align: center; font: 600 10px/1.3 var(--font-body); text-transform: uppercase; letter-spacing: .1em; transition: opacity var(--transition-base); }
.ftw-bar {
    pointer-events: auto;
    background: var(--ftw-card);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -6px 16px rgba(0, 0, 0, .06);
    padding: 10px var(--ftw-gut);
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 72px;
}
.ftw-bar__text { min-width: 0; font-size: 14px; line-height: 1.35; color: var(--color-text-light); }
.ftw-bar__top { display: block; font: 600 11px/1.3 var(--font-body); text-transform: uppercase; letter-spacing: .1em; color: var(--color-primary-dark); }
.fts-walk .ftw-cta { flex: none; padding: 0 20px; min-height: 48px; font-size: 13px; }

/* Panel "Mehr Infos" */
.ftw-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); z-index: 4; }
.ftw-scrim[hidden], .ftw-sheet[hidden], .ftw-sheet__img[hidden], .ftw-sheet__link[hidden] { display: none; }
.ftw-sheet {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
    max-height: 82%; overflow: auto;
    background: var(--ftw-card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .2);
    padding: 16px var(--ftw-gut) calc(18px + env(safe-area-inset-bottom, 0px));
}
.ftw-sheet__in { max-width: 560px; margin: 0 auto; }
.ftw-sheet__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ftw-sheet__kind { font: 600 11px/1.3 var(--font-body); text-transform: uppercase; letter-spacing: .1em; color: var(--color-primary-dark); }
.fts-walk .ftw-sheet__close { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--color-border); background: var(--ftw-card); color: var(--color-text); display: grid; place-items: center; }
.ftw-sheet__close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ftw-sheet__title { font-family: var(--font-heading); font-size: 28px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; margin: 6px 0 10px; text-wrap: balance; }
.ftw-sheet__img { position: relative; aspect-ratio: 16 / 8; border-radius: var(--radius-md); overflow: hidden; background: var(--color-bg-alt); margin-bottom: 12px; }
.fts-walk .ftw-sheet__img img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.ftw-sheet__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13px; color: var(--color-text-light); margin-bottom: 10px; }
.ftw-sheet__meta > span { display: inline-flex; align-items: center; gap: 6px; }
.ftw-sheet__meta .ftw-ico { width: 15px; height: 15px; }
.fts-walk .ftw-sheet__text { margin: 0 0 14px; max-width: 60ch; font-size: 16px; line-height: 1.55; }
.fts-walk .ftw-sheet__link { min-height: 48px; padding: 0 22px; }

@media (min-width: 880px) {
    .ftw-sun { width: 80px; height: 80px; }
}
@media (prefers-reduced-motion: reduce) {
    .ftw-hint { transition: none; }
    .fts-walk .ftw-fig img, .ftw-cerro .gon { animation: none; }
}
