/* ==========================================================================
   Virtual factory tour (page-tour.php + tour.js) and the homepage teaser
   ========================================================================== */
.wrap--wide { max-width: 1400px; }

.tour-hero {
  position: relative; overflow: hidden; color: #fff; text-align: center;
  padding: 64px 0 120px;
  background:
    linear-gradient(180deg, rgba(15,36,56,.92), rgba(15,36,56,.97)),
    url("../img/tour/01-m.webp") center / cover;
}
.tour-hero h1 { font-size: clamp(28px, 4vw, 44px); color: #fff; margin: 10px auto 12px; max-width: 22ch; }
.tour-hero p { color: #B9C7D0; max-width: 62ch; margin: 0 auto; }
.tour-hero .section-eyebrow { color: var(--amber); }
.tour-section { margin-top: -84px; padding-bottom: 24px; position: relative; z-index: 1; }

/* ---- Viewer shell ---- */
.tour {
  --tour-h: min(78vh, 760px);
  position: relative; width: 100%; height: var(--tour-h); min-height: 360px;
  background: #05101a; border-radius: 14px; overflow: hidden; isolation: isolate;
  box-shadow: 0 30px 70px rgba(5, 16, 26, .45), 0 0 0 1px rgba(255,255,255,.06);
  color: #fff; user-select: none; -webkit-user-select: none;
}
.tour-stage { position: absolute; inset: 0; outline: none; cursor: pointer; }
.tour:not(.is-started) .tour-stage,
.tour.is-end .tour-stage,
.tour.is-junction .tour-stage { cursor: default; }
.tour-cam { position: absolute; inset: 0; transform: scale(1.08); will-change: transform; }
.tour-layer { position: absolute; inset: 0; transform-origin: 50% 56%; will-change: transform, opacity; }
.tour-layer img { width: 100%; height: 100%; object-fit: cover; object-position: var(--pan, 50%) 50%; max-width: none; pointer-events: none; }
.tour-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5,16,26,.62) 0%, rgba(5,16,26,0) 22%, rgba(5,16,26,0) 62%, rgba(5,16,26,.7) 100%),
    radial-gradient(ellipse at 50% 55%, rgba(0,0,0,0) 55%, rgba(0,0,0,.35) 100%);
}

/* ---- Floor arrows (Street View style) ---- */
.tour-floor { position: absolute; inset: 0; pointer-events: none; }
.tour:not(.is-started) .tour-floor { opacity: 0; }
.tour-arrow {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto;
  background: none; border: 0; padding: 0; cursor: pointer; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: tour-arrow-in .6s .35s both cubic-bezier(.2,.8,.2,1);
}
.tour-arrow-disc {
  width: 86px; height: 86px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle, rgba(5,16,26,.55), rgba(5,16,26,.72) 70%);
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(5,16,26,.35), 0 14px 30px rgba(0,0,0,.45);
  transform: perspective(300px) rotateX(58deg);
  transition: transform .25s ease, background .25s ease, border-color .25s ease;
}
.tour-arrow-disc svg {
  width: 46px; height: 46px; fill: none; stroke: #fff; stroke-width: 3;
  stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4));
}
.tour-arrow--left .tour-arrow-disc svg { transform: rotate(-45deg); }
.tour-arrow--right .tour-arrow-disc svg { transform: rotate(45deg); }
.tour-arrow:hover .tour-arrow-disc,
.tour-arrow:focus-visible .tour-arrow-disc {
  background: radial-gradient(circle, rgba(232,153,46,.75), rgba(232,153,46,.3) 70%);
  border-color: var(--amber);
  transform: perspective(300px) rotateX(50deg) scale(1.1);
}
.tour-arrow:focus-visible { outline: none; }
.tour-arrow.is-offscreen { opacity: .55; }
.tour-arrow--forward .tour-arrow-disc { animation: tour-breathe 2.4s ease-in-out infinite; }
.tour-arrow-label {
  font-size: 13px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  padding: 7px 14px; border-radius: 999px; background: rgba(5,16,26,.72);
  border: 1px solid rgba(255,255,255,.2); box-shadow: 0 6px 20px rgba(0,0,0,.3);
  transition: background .2s ease, color .2s ease;
}
.tour-arrow:hover .tour-arrow-label { background: var(--amber); color: var(--ink); border-color: var(--amber); }
@keyframes tour-arrow-in { from { opacity: 0; transform: translate(-50%, -30%); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes tour-breathe {
  0%, 100% { box-shadow: 0 0 0 4px rgba(5,16,26,.35), 0 14px 30px rgba(0,0,0,.45), 0 0 0 4px rgba(232,153,46,.7); }
  50% { box-shadow: 0 0 0 4px rgba(5,16,26,.35), 0 14px 30px rgba(0,0,0,.45), 0 0 0 20px rgba(232,153,46,0); }
}

/* ---- HUD ---- */
.tour-top {
  position: absolute; top: 0; left: 0; right: 0; padding: 18px 20px; z-index: 3;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; pointer-events: none;
  transition: opacity .4s ease;
}
.tour-zone { display: flex; flex-direction: column; gap: 3px; max-width: min(520px, 60%); }
.tour-zone::before { content: ""; width: 34px; height: 3px; border-radius: 2px; background: var(--tour-accent, var(--amber)); margin-bottom: 8px; transition: background .4s ease; }
.tour-zone-name { font-family: Georgia, "Times New Roman", serif; font-size: clamp(18px, 2.2vw, 26px); font-weight: 700; line-height: 1.2; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.tour-zone-desc { font-size: 13.5px; color: rgba(255,255,255,.85); text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.tour-zone.is-changing .tour-zone-name,
.tour-zone.is-changing .tour-zone-desc { animation: tour-text-in .7s both cubic-bezier(.2,.8,.2,1); }
.tour-zone.is-changing .tour-zone-desc { animation-delay: .08s; }
@keyframes tour-text-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tour-step {
  font-size: 12.5px; font-weight: 700; letter-spacing: .06em; white-space: nowrap;
  padding: 6px 12px; border-radius: 999px; background: rgba(5,16,26,.55); border: 1px solid rgba(255,255,255,.18);
  margin-right: 150px; /* room for the tool buttons */
}
.tour[data-zone="main"] { --tour-accent: #8FA0AC; }
.tour[data-zone="junction"] { --tour-accent: #FFFFFF; }
.tour[data-zone="left"] { --tour-accent: var(--amber); }
.tour[data-zone="right"] { --tour-accent: #4FA3D1; }

.tour-tools { position: absolute; top: 14px; right: 16px; z-index: 4; display: flex; gap: 8px; transition: opacity .4s ease; }
.tour-tools [data-act="play"] .tour-btn-text { display: none; }
.tour-tools [data-act="play"] { width: 42px; padding: 0; }

.tour-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  font: 600 14px/1 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: #fff; white-space: nowrap;
  background: rgba(5,16,26,.6); border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background .2s ease, border-color .2s ease, transform .15s ease, opacity .2s ease;
}
.tour-btn:hover:not(:disabled) { background: rgba(5,16,26,.85); border-color: rgba(255,255,255,.5); }
.tour-btn:active:not(:disabled) { transform: scale(.97); }
.tour-btn:disabled { opacity: .35; cursor: default; }
.tour-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tour-btn--icon { width: 42px; padding: 0; }
.tour-tools .tour-btn svg,
.tour-intro-badge svg,
.tour-start svg { fill: currentColor; stroke: none; }
.tour-btn--primary { background: var(--amber); color: var(--ink); border-color: var(--amber); }
.tour-btn--primary:hover:not(:disabled) { background: #F2AA48; border-color: #F2AA48; }
.tour-btn .i-pause,
.tour-btn .i-exit { display: none; }
.tour.is-playing .i-play { display: none; }
.tour.is-playing .i-pause { display: block; }
.tour.is-playing [data-act="play"] { background: var(--amber); color: var(--ink); border-color: var(--amber); }
.tour.is-full .i-full { display: none; }
.tour.is-full .i-exit { display: block; }

.tour-bar {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 999px;
  background: rgba(5,16,26,.45); border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: opacity .4s ease;
}
.tour:not(.is-started) .tour-bar,
.tour:not(.is-started) .tour-map,
.tour:not(.is-started) .tour-top,
.tour:not(.is-started) .tour-tools [data-act="map"] { opacity: 0; pointer-events: none; }
.tour-branch-bar { display: flex; gap: 10px; align-items: center; }
.tour-branch-bar[hidden],
.tour-btn[hidden] { display: none; }
.tour-branch-q { font-size: 13px; color: rgba(255,255,255,.88); padding: 0 4px 0 8px; white-space: nowrap; }

/* ---- Map ---- */
.tour-map {
  position: absolute; right: 16px; bottom: 18px; z-index: 3; width: 196px;
  padding: 10px 12px 12px; border-radius: 12px;
  background: rgba(5,16,26,.62); border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: opacity .4s ease, transform .3s ease;
}
.tour-map-title { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.6); margin-bottom: 4px; }
.tour-map svg { width: 100%; height: auto; display: block; overflow: visible; }
.map-route { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.map-route--main { stroke: #8FA0AC; }
.map-route--left { stroke: #E8992E; }
.map-route--right { stroke: #4FA3D1; }
.map-dot { cursor: pointer; }
.map-dot circle:not(.map-hit) { fill: #05101a; stroke: rgba(255,255,255,.55); stroke-width: 1.4; transition: fill .3s, stroke .3s; }
.map-hit { fill: transparent; }
.map-dot.is-visited circle:not(.map-hit) { fill: rgba(255,255,255,.8); stroke: #fff; }
.map-dot--left.is-visited circle:not(.map-hit) { fill: #E8992E; stroke: #E8992E; }
.map-dot--right.is-visited circle:not(.map-hit) { fill: #4FA3D1; stroke: #4FA3D1; }
.map-dot:hover circle:not(.map-hit) { stroke: #fff; stroke-width: 2.4; }
.map-you {
  fill: rgba(232,153,46,.25); stroke: #E8992E; stroke-width: 2; pointer-events: none;
  transition: cx .6s cubic-bezier(.45,.05,.25,1), cy .6s cubic-bezier(.45,.05,.25,1);
  animation: tour-ping 1.8s ease-out infinite;
}
@keyframes tour-ping { 0% { stroke-opacity: 1; stroke-width: 2; } 100% { stroke-opacity: .2; stroke-width: 6; } }
.tour-map-legend { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; font-size: 10.5px; color: rgba(255,255,255,.78); line-height: 1.25; }
.tour-map-legend .lg { display: flex; align-items: center; gap: 5px; }
.tour-map-legend .lg::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.lg--left::before { background: #E8992E; }
.lg--right::before { background: #4FA3D1; }
.tour-map-toggle { display: none; }

/* ---- End of corridor ---- */
.tour-end {
  position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 3;
  width: min(560px, calc(100% - 32px)); text-align: center; padding: 18px 20px;
  border-radius: 14px; background: rgba(5,16,26,.8); border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  animation: tour-text-in .5s both;
}
.tour-end[hidden] { display: none; }
.tour-end p { margin: 0 0 12px; font-weight: 600; }
.tour-end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* ---- Intro ---- */
.tour-intro {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse at center, rgba(5,16,26,.5), rgba(5,16,26,.88));
  transition: opacity .6s ease;
}
.tour-intro.is-leaving { opacity: 0; pointer-events: none; }
.tour-intro[hidden] { display: none; }
.tour-intro-card { text-align: center; max-width: 520px; }
.tour-intro-badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
}
.tour-intro-badge svg { width: 16px; height: 16px; color: var(--amber); }
.tour-intro h2 { font-size: clamp(26px, 3.4vw, 40px); color: #fff; margin: 16px 0 10px; line-height: 1.2; }
.tour-intro p { color: rgba(255,255,255,.85); margin: 0 0 22px; }
.tour-start { font-size: 16px; padding: 15px 30px; gap: 10px; box-shadow: 0 12px 30px rgba(232,153,46,.35); }
.tour-start svg { width: 18px; height: 18px; }
.tour .tour-hint { font-size: 12.5px; color: rgba(255,255,255,.55); margin: 18px 0 0; letter-spacing: .02em; }
.tour-hint--touch { display: none; }
@media (pointer: coarse) {
  .tour-hint--keys { display: none; }
  .tour .tour-hint--touch { display: block; }
}

.tour-loader { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; pointer-events: none; }
.tour-loader[hidden] { display: none; }
.tour-loader span { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: var(--amber); animation: tour-spin .8s linear infinite; }
@keyframes tour-spin { to { transform: rotate(360deg); } }
.tour-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tour-noscript { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 7; padding: 12px 16px; border-radius: 8px; background: rgba(5,16,26,.85); text-align: center; }

/* ---- Fullscreen ---- */
.tour:fullscreen { height: 100vh; border-radius: 0; }
.tour.is-pseudo-full { position: fixed; inset: 0; z-index: 1000; height: 100vh; height: 100dvh; border-radius: 0; }
html.tour-lock,
html.tour-lock body { overflow: hidden; }

/* ---- Zone cards under the viewer ---- */
.tour-zones-section { padding-top: 64px; }
.tour-zone-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.tour-zone-card {
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}
.tour-zone-card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(15,36,56,.14); }
.tour-zone-img { aspect-ratio: 16 / 10; overflow: hidden; background: var(--ink); }
.tour-zone-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.tour-zone-card:hover .tour-zone-img img { transform: scale(1.06); }
.tour-zone-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; font-size: 13.5px; color: var(--steel); }
.tour-zone-body strong { font-size: 16px; color: var(--ink); }
.tour-zone-range { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; color: var(--amber-deep); }
.tour-zone-body em { font-style: normal; font-weight: 700; color: var(--blueprint); margin-top: 4px; }

/* ---- Homepage teaser ---- */
.tour-teaser { position: relative; overflow: hidden; background: var(--ink); color: #fff; padding: 90px 0; }
.tour-teaser-bg { position: absolute; inset: 0; }
.tour-teaser-bg img { width: 100%; height: 100%; object-fit: cover; opacity: .28; filter: saturate(.7); }
.tour-teaser::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(15,36,56,.96) 0%, rgba(15,36,56,.78) 55%, rgba(15,36,56,.55) 100%); }
.tour-teaser-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1.05fr; gap: 56px; align-items: center; }
.tour-teaser h2 { color: #fff; font-size: clamp(28px, 3.4vw, 40px); margin: 10px 0 14px; line-height: 1.2; }
.tour-teaser p { color: #C3D0D8; margin: 0 0 26px; max-width: 52ch; }
.tour-teaser .section-eyebrow { color: var(--amber); }
.tour-teaser-stats { display: flex; gap: 32px; margin-bottom: 30px; }
.tour-teaser-stats strong { display: block; font-family: Georgia, serif; font-size: 30px; color: #fff; line-height: 1.1; }
.tour-teaser-stats span { font-size: 12.5px; color: #9FB0BC; }
.tour-teaser .btn { display: inline-flex; align-items: center; gap: 8px; }
.tour-teaser-preview {
  position: relative; display: block; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 10;
  box-shadow: 0 30px 60px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.08);
}
.tour-teaser-preview img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(.2,.8,.2,1); }
.tour-teaser-preview:hover img { transform: scale(1.12); }
.tour-teaser-preview::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,16,26,0) 50%, rgba(5,16,26,.6)); }
.tour-teaser-play {
  position: absolute; left: 50%; top: 50%; z-index: 1; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(232,153,46,.95); color: var(--ink);
  animation: tour-pulse 2.2s ease-out infinite;
}
.tour-teaser-play svg { width: 34px; height: 34px; fill: currentColor; margin-left: 4px; }
@keyframes tour-pulse { 0% { box-shadow: 0 0 0 0 rgba(232,153,46,.55); } 100% { box-shadow: 0 0 0 26px rgba(232,153,46,0); } }
.tour-teaser-chip {
  position: absolute; left: 16px; bottom: 14px; z-index: 1; font-size: 12.5px; font-weight: 700;
  padding: 6px 12px; border-radius: 999px; background: rgba(5,16,26,.7); border: 1px solid rgba(255,255,255,.2);
}
.nav-menu .nav-tour::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); margin-inline-end: 6px; vertical-align: 2px; }

/* ---- Responsive ---- */
@media (max-width: 1000px) {
  .tour-zone-grid { grid-template-columns: repeat(2, 1fr); }
  .tour-teaser-inner { grid-template-columns: 1fr; gap: 36px; }
}
@media (max-width: 760px) {
  .tour-hero { padding: 44px 0 96px; }
  .tour-section .wrap { padding: 0 10px; }
  .tour { --tour-h: min(70vh, 580px); border-radius: 10px; }
  .tour-top { padding: 14px; }
  .tour-zone { max-width: 62%; }
  .tour-zone-desc { display: none; }
  .tour-step { position: absolute; top: 64px; left: 14px; margin: 0; font-size: 11.5px; padding: 4px 10px; }
  .tour-tools { top: 10px; right: 10px; gap: 6px; }
  .tour-tools .tour-btn { width: 38px; height: 38px; }
  .tour-map-toggle { display: inline-flex; }
  .tour-map { top: 56px; bottom: auto; right: 10px; width: 164px; opacity: 0; pointer-events: none; transform: translateY(-6px); }
  .tour.is-started.map-open .tour-map { opacity: 1; pointer-events: auto; transform: none; }
  .tour-bar { bottom: 10px; width: calc(100% - 20px); gap: 6px; padding: 6px; border-radius: 16px; }
  .tour-bar > [data-act="back"] { flex: none; width: 42px; padding: 0; }
  .tour-bar > [data-act="back"] .tour-btn-text { display: none; }
  .tour-bar > [data-act="forward"] { flex: 1; }
  .tour-branch-bar { flex: 1; gap: 6px; }
  .tour-branch-q { display: none; }
  .tour-branch-bar .tour-btn { flex: 1; min-width: 0; font-size: 12px; padding: 0 8px; gap: 5px; white-space: normal; line-height: 1.15; text-align: center; }
  .tour-arrow-disc { width: 64px; height: 64px; }
  .tour-arrow-disc svg { width: 34px; height: 34px; }
  .tour-arrow-label { display: none; }
  .tour-end { bottom: 72px; padding: 14px; }
  .tour-zone-grid { grid-template-columns: 1fr; }
  .tour-teaser { padding: 64px 0; }
  .tour-teaser-stats { gap: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .tour-arrow,
  .tour-arrow--forward .tour-arrow-disc,
  .map-you,
  .tour-teaser-play { animation: none; }
}
