/* --- Basic Setup --- */
body { margin: 0; font-family: 'Raleway', sans-serif; overflow: hidden; background-color: #1a1a1a; }

/* --- Smoke Background --- */
#bg-video { position: fixed; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; transition: opacity 0.8s ease-in-out; opacity: 0; }
body.smoke-bg-active #bg-video { opacity: 1; animation: color-tint-cycle 20s linear infinite; }
@keyframes color-tint-cycle { 0% { filter: brightness(1.0) hue-rotate(0deg); } 50% { filter: brightness(1.0) hue-rotate(90deg); } 100% { filter: brightness(1.0) hue-rotate(0deg); } }

/* --- Vertical Page Transitions --- */
.page { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: flex-start; align-items: center; text-align: center; opacity: 0; transform: scale(0.95); visibility: hidden; z-index: 1; overflow: hidden; transition: opacity 0.5s ease-out, transform 0.5s ease-out; }
.page.active { opacity: 1; transform: scale(1); visibility: visible; transition: transform 2.4s cubic-bezier(0.65, 0, 0.35, 1), opacity 2.4s cubic-bezier(0.65, 0, 0.35, 1); z-index: 2; }
.page.is-exiting { z-index: 3; }
.page.exit-up { animation: exit-up-curve 2.4s cubic-bezier(0.65, 0, 0.35, 1) forwards; }
@keyframes exit-up-curve { 0% { transform: translateY(0) translateX(0) rotate(0deg) scale(1); opacity: 1; } 50% { transform: translateY(-40%) translateX(20%) rotate(-5deg) scale(0.9); opacity: 0.7; } 100% { transform: translateY(-100%) translateX(-20%) rotate(10deg) scale(0.8); opacity: 0; } }
.page.exit-down { transform: translateY(60%) translateX(30%) rotate(20deg) scale(0.8); opacity: 0; }
#page1, #page2 { background-color: transparent; }
#page3, #page4 { background-color: #111; }

/* --- Glowing & Transparent Text --- */
.page-content { position: relative; padding-top: 60px; width: 90%; max-width: 1200px; color: rgba(255, 255, 255, 0.9); text-align: center; z-index: 10; flex-shrink: 0; }
.page-content h2, h1 {
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.7), 0 0 25px rgba(200, 220, 255, 0.5), 0 0 40px rgba(180, 200, 255, 0.3);
}
.page1-content { 
    display: flex; flex-direction: column; justify-content: center; align-items: center; 
    height: 100%; width: 100%; padding: 0;
}

/* Split title on two lines with slight horizontal offset */
.title-split { 
  font-size: clamp(3rem, 10vw, 8rem);
  line-height: 0.9;
  margin: 0;
  font-weight: 300;
  color: rgba(255,255,255,0.92);
}
.title-split span { display: block; }
.title-split span:last-child { 
  transform: translateX(-0.25em);
}

.landing-buttons { margin-top: 6vh; display: flex; gap: 14px; }
.landing-buttons button { 
  padding: 12px 28px; font-size: 1.05rem; color: white; background-color: rgba(0, 0, 0, 0.3); border: 2px solid rgba(255, 255, 255, 0.8); border-radius: 50px; cursor: pointer; backdrop-filter: blur(5px); 
}
.landing-buttons #enter-button { margin-top: 0; padding: 12px 28px; font-size: 1.05rem; animation: none; }
.landing-buttons button:hover { background-color: rgba(255,255,255,0.2); }

.landing-info {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(320px, 90vw, 1100px);
  max-width: clamp(320px, 90vw, 1100px);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.landing-info-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}
.landing-info-button {
  padding: 12px 28px;
  font-size: 1.05rem;
  color: white;
  background-color: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50px;
  cursor: pointer;
  backdrop-filter: blur(5px);
  transition: background-color 0.3s ease;
}
.landing-info-button:hover,
.landing-info-button:focus-visible {
  background-color: rgba(255, 255, 255, 0.2);
}
#info-button {
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 6px;
  cursor: pointer;
  backdrop-filter: none;
}
#info-button:hover,
#info-button:focus-visible {
  background: none;
  color: #fff;
  text-decoration-thickness: 2px;
}
.landing-info-panel {
  width: 100%;
  background-color: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 18px;
  padding: 22px 26px;
  color: rgba(240, 240, 240, 0.92);
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  text-align: left;
  min-height: 60vh;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.landing-info-panel[hidden] {
  display: none !important;
}
.landing-info-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.landing-info-section[hidden] {
  display: none !important;
}
.landing-info-blurb {
  margin: 0 0 16px 0;
  font-size: 1.38rem;
  line-height: 1.6;
  text-align: center;
}
.landing-info-break {
  margin: 6px 0 12px 0;
  width: 100%;
  border: 0;
  height: 0;
}
.landing-info-features {
  margin-top: 18px;
}
.landing-info-features h3 {
  margin: 0 0 10px 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
}
.landing-info-credits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-top: 10px;
}
.landing-info-credits-group h4 {
  margin: 0 0 8px 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.85);
}
.landing-info-credits-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(230, 230, 230, 0.9);
}
.landing-info-credits-note {
  margin: 6px 0 0 0;
  font-size: 0.95rem;
  color: rgba(230, 230, 230, 0.9);
}
.landing-info-credits-note h4 {
  margin: 0 0 6px 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.85);
}
.interaction-guide-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.interaction-guide-list li h4 {
  margin: 0 0 6px 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.9);
}
.interaction-guide-list li p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: rgba(230, 230, 230, 0.9);
}
.landing-info-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: auto;
}
.landing-info-tab {
  padding: 10px 22px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  backdrop-filter: blur(4px);
}
.landing-info-tab:hover,
.landing-info-tab:focus-visible {
  background-color: rgba(255, 255, 255, 0.18);
}
.landing-info-tab[aria-selected="true"] {
  background-color: rgba(255, 255, 255, 0.35);
  color: #111;
}
.landing-features-list {
  margin: 0;
  padding-left: 18px;
  list-style: decimal;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  color: rgba(230, 230, 230, 0.9);
}
.landing-features-list li {
  text-align: left;
  line-height: 1.5;
}

/* --- Page 1: Landing --- */
#enter-button {
    margin-top: 25vh;
    padding: 15px 40px; font-size: 1.2rem; color: white; background-color: rgba(0, 0, 0, 0.3); border: 2px solid rgba(255, 255, 255, 0.8); border-radius: 50px; cursor: pointer; backdrop-filter: blur(5px); animation: float-button 6s ease-in-out infinite; 
}
#enter-button:hover { background-color: rgba(255, 255, 255, 0.2); animation-play-state: paused; }
@keyframes float-button { 0% { transform: translateY(0px); } 50% { transform: translateY(-10px); } 100% { transform: translateY(0px); } }

/* --- Mood Grid --- */
#mood-grid-container { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; width: 90%; max-width: 800px; padding: 20px; box-sizing: border-box; overflow-y: auto; flex-grow: 1; }
.mood-card { background-color: rgba(255, 255, 255, 0.1); border: 3px solid rgba(141, 159, 241, 0.2); border-radius: 15px; padding: 30px 20px; text-align: center; color: white; cursor: pointer; transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s; backdrop-filter: blur(5px); display: flex; flex-direction: column; justify-content: center; align-items: center; }
.mood-card:hover { background-color: rgba(255, 255, 255, 0.2); transform: scale(1.05); box-shadow: 0 0 25px rgba(255, 255, 255, 0.2); }
.mood-name { font-size: 1.9rem; font-weight: bold; text-shadow: 0 0 8px rgba(255, 255, 255, 0.6); margin-bottom: 15px; }
.mood-description { font-size: 1rem; color: rgba(255, 255, 255, 0.7); margin: 0; max-width: 300px; }

/* --- Place List Screen --- */
.overlay-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #111; z-index: 50; transform: translateY(100%); transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1); display: flex; flex-direction: column; }
.overlay-screen.visible { transform: translateY(0); }
.overlay-header { display: flex; justify-content: center; align-items: center; padding: 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.15); flex-shrink: 0; }
.place-list-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.place-list-action-button {
  padding: 10px 24px;
  font-size: 1rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 26px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.place-list-action-button:hover,
.place-list-action-button:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.75);
}
.overlay-list { overflow-y: auto; padding: 20px; }
.place-item { background-color: rgba(255, 255, 255, 0.05); padding: 20px; border-radius: 10px; margin-bottom: 15px; cursor: pointer; }
.place-list-subtitle { margin: 0 0 18px 0; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.9rem; color: rgba(255, 255, 255, 0.65); text-align: center; }
.place-item h3 { margin: 0 0 5px 0; font-size: 1.4rem; color: rgba(255, 255, 255, 0.95); text-shadow: 0 0 8px rgba(255, 255, 255, 0.3); }
.place-item p { margin: 0; font-size: 1rem; color: rgba(255, 255, 255, 0.7); }

/* --- Map & 360 Views --- */
#map-container, #panorama-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; object-fit: cover; background-color: #000; }
.map-overlay-content { position: absolute; left: 0; bottom: 0; transform: none; width: 100%; max-width: 100%; background: rgba(10, 10, 200, 0.1); backdrop-filter: blur(6px); padding: 20px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; z-index: 10; box-sizing: border-box; }
#map-action-buttons { display: flex; gap: 12px; margin-top: 12px; position: sticky; bottom: 0; padding-top: 4px; align-items: stretch; flex-wrap: nowrap; }
#map-action-buttons button {
  width: 100%;
  height: 44px; /* enforce equal button height */
  padding: 0 16px; /* vertical height controlled by height */
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  cursor: pointer;
  backdrop-filter: blur(5px);
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0; /* normalize browser defaults */
  flex: 1 1 0;
  min-width: 0;
}
#map-action-buttons button:hover {
  background-color: rgba(255, 255, 255, 0.15);
}
#map-action-buttons button.is-active,
#map-action-buttons button:disabled {
  background-color: rgba(170, 210, 255, 0.22);
  border-color: rgba(210, 235, 255, 0.7);
  box-shadow: 0 0 18px rgba(170, 210, 255, 0.45);
  color: #fff;
  cursor: default;
  opacity: 1;
}
#map-action-buttons button.is-active:hover,
#map-action-buttons button:disabled:hover {
  background-color: rgba(170, 210, 255, 0.22);
}

/* --- 360 View & Map Controls --- */
.top-left-back-button { position: absolute; top: 20px; left: 20px; z-index: 20; padding: 10px 20px; font-size: 1rem; color: white; background-color: rgba(0, 0, 0, 0.42); border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 20px; cursor: pointer; backdrop-filter: blur(5px); }
.top-right-throw-button { position: absolute; top: 20px; right: 20px; z-index: 20; padding: 10px 20px; font-size: 1rem; color: white; background-color: rgba(0, 0, 0, 0.42); border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 20px; cursor: pointer; backdrop-filter: blur(5px); }
#pano-controls { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 20; background: rgba(0,0,0,0.42); backdrop-filter: blur(8px); border-radius: 15px; padding: 15px; display: flex; flex-direction: column; gap: 15px; align-items: center; }
.control-group { display: flex; align-items: center; gap: 10px; }
.control-group label { color: rgba(255, 255, 255, 0.8); font-size: 0.9rem; }
.audio-controls button { background: rgba(255,255,255,0.2); color: white; border: 1px solid rgba(255,255,255,0.4); padding: 8px 15px; border-radius: 8px; cursor: pointer; transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease; }

/* Gen button visual states */
@keyframes dt-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0px rgba(160, 200, 255, 0.0); }
  50% { transform: scale(1.06); box-shadow: 0 0 16px rgba(160, 200, 255, 0.35); }
  100% { transform: scale(1); box-shadow: 0 0 0px rgba(160, 200, 255, 0.0); }
}

#gen-music-button.is-loading {
  background: rgba(180, 200, 255, 0.25);
  border-color: rgba(200, 220, 255, 0.65);
  animation: dt-pulse 1.2s ease-in-out infinite;
}

@keyframes dt-zen-recording {
  0%   { background: rgba(255, 105, 180, 0.18); box-shadow: 0 0 8px rgba(255, 105, 180, 0.35); transform: scale(1); }
  50%  { background: rgba(255, 105, 180, 0.38); box-shadow: 0 0 18px rgba(255, 140, 200, 0.55); transform: scale(1.04); }
  100% { background: rgba(255, 105, 180, 0.18); box-shadow: 0 0 8px rgba(255, 105, 180, 0.35); transform: scale(1); }
}

#gen-music-button.zen-hold-disabled {
  animation: dt-zen-noaudio 0.6s ease-in-out;
  border-color: rgba(255, 140, 140, 0.85);
}

#gen-music-button.is-recording {
  animation: dt-zen-recording 0.9s ease-in-out infinite;
  border-color: rgba(255, 160, 220, 0.85);
  color: #fff;
}

.audio-controls button.has-audio {
  background: rgba(200, 230, 255, 0.28);
  color: #fff;
  border-color: rgba(220, 240, 255, 0.8);
  box-shadow: 0 0 18px rgba(180, 220, 255, 0.55);
}

@keyframes dt-zen-noaudio {
  0% { box-shadow: 0 0 0 rgba(255, 120, 120, 0); transform: scale(1); }
  50% { box-shadow: 0 0 14px rgba(255, 120, 120, 0.55); transform: scale(1.05); }
  100% { box-shadow: 0 0 0 rgba(255, 120, 120, 0); transform: scale(1); }
}

/* --- Toggle Switch --- */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255, 255, 255, 0.18); transition: .4s; border-radius: 28px; border: 1px solid rgba(255, 255, 255, 0.28); }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: rgba(255, 255, 255, 0.95); transition: .4s; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,0.35); }
input:checked + .slider { background-color: rgba(255, 255, 255, 0.38); }
input:checked + .slider:before { transform: translateX(22px); }

/* --- Font Sizes & Responsive --- */
h1 { font-size: 4.5rem; margin: 0; }
h2 { font-size: 3.5rem; margin: 0; }
p { font-size: 1.3rem; }

@media (max-width: 768px) {
    h1 { font-size: 2.8rem; }
    h2 { font-size: 2.2rem; }
    p { font-size: 1.1rem; }
    .page-content, .page1-content { padding-top: 40px; }

    #mood-grid-container { 
        grid-template-columns: 1fr;
        width: 100%;
        padding: 15px;
        gap: 15px;
    }
    .mood-name { font-size: 1.5rem; }
    .mood-description { font-size: 0.9rem; }
    .place-item h3 { font-size: 1.2rem; }
    #pano-controls { flex-direction: column; bottom: 15px; }
}

/* Improve scroll performance and prevent scroll during 360 drag */
#panorama-container,
#panorama-container canvas,
#panorama-container video,
#panorama-container .vjs-tech {
  touch-action: none;
  -ms-touch-action: none;
  overscroll-behavior: contain;
}

#pano-wrapper { position:absolute; inset:0; }

/* ==========================
   OVERRIDES (2025-09-07)
   Map tweaks: dark "hack" + better overlay readability + 360 button styling
   ========================== */

/* 1) "Hacky" dark map by inverting OSM tiles & controls (scoped) */
#map-container .leaflet-layer,
#map-container .leaflet-control-zoom-in,
#map-container .leaflet-control-zoom-out,
#map-container .leaflet-control-attribution {
  filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

/* Keep popups readable (popups are not inside .leaflet-layer usually, but add guard) */
#map-container .leaflet-popup-content-wrapper,
#map-container .leaflet-popup-tip {
  filter: none;
}

/* 2) Map overlay readability (Name + Description) */
.map-overlay-content {
  background: rgba(18, 18, 18, 0.6) !important;
  color: #d8d8d8 !important;
  /* Limit height and keep buttons visible by using a flex column */
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* inner text area scrolls */
  align-self: stretch; /* ensure full-width under .page flex centering */
  width: 100%;
}

/* Scrollable text area; hide scrollbar */
#map-text {
  flex: 1 1 auto;
  min-height: 0; /* allow flex child to shrink for scrolling */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none; /* Firefox */
}
#map-text::-webkit-scrollbar { width: 0; height: 0; }

/* Stronger title color; softer body color */
#map-place-title {
  color: #e8e8e8 !important;
  text-align: center;
  display: block;
  margin: 0 0 10px 0;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
}
#map-place-title-text {
  display: block;
  font-size: 1.6rem;
  line-height: 1.3;
  margin: 0;
}
.map-place-title-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.map-place-gmaps-link,
.map-place-ar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
.map-place-gmaps-link img,
.map-place-ar-link img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.map-place-gmaps-link:hover,
.map-place-ar-link:hover,
.map-place-gmaps-link:focus-visible,
.map-place-ar-link:focus-visible {
  transform: scale(1.05);
  background-color: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
}
.map-place-gmaps-link.is-disabled,
.map-place-ar-link.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
.map-place-ar-link[hidden] {
  display: none !important;
}
#map-place-description {
  color: #d0d0d0 !important;
}

/* Directions list formatting */
.directions-summary {
  margin: 2px 0 12px; /* extra space before list */
  font-weight: 600;
  color: #e8e8e8;
}
.directions-list {
  margin: 8px 0 0;
  padding-left: 0;
  line-height: 1.35;
  list-style: none;
  counter-reset: dt-dir;
}
.directions-list li {
  margin: 4px 0;
  text-align: left;
  counter-increment: dt-dir;
}
.dir-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: start;
  column-gap: 18px;
}
.dir-step {
  color: #e8e8e8;
  grid-column: 1;
  min-width: 0;
  position: relative;
  text-align: left;
  /* Make wrapped lines align with the instruction text, not the number */
  padding-left: 38px; /* 28px number width + 10px gap */
}
.dir-step::before {
  content: counter(dt-dir) ".";
  font-weight: 600;
  color: #cfdcff;
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;       /* fixed number column */
  text-align: right;
}
.dir-meta {
  color: #bdbdbd;
  font-size: 0.9rem;
  margin-left: 0;
  text-align: right;
  white-space: nowrap;
  grid-column: 2;
}

/* Mobile: stack distance meta on a new line and reduce title size */
@media (max-width: 768px) {
  .directions-list {
    margin: 6px 0 0;
    padding: 0;
  }
  .directions-list li {
    margin: 0.5rem 0;
  }
  .dir-row {
    /* Let the distance/time column size to its content to avoid clipping */
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 4px;
    margin: 0;
  }
  .dir-step { grid-column: 1; text-align: left; padding-right: 4px; padding-left: 22px; }
  .directions-list .dir-meta {
    grid-column: 2;
    text-align: right;
    padding-left: 2px;
    white-space: normal;        /* allow wrap on narrow screens */
    overflow-wrap: anywhere;    /* prevent clipping */
  }
  .dir-step::before {
    width: 18px;  /* smaller number column on mobile */
    text-align: right;
  }
  #map-place-title { font-size: 1.4rem; }
  .dir-step { font-size: 0.95rem; }
  .directions-list .dir-meta { font-size: 0.85rem; }
}

@media (min-width: 769px) {
  /* Desktop: keep list centered but align content left */
  .directions-list {
    max-width: 70ch;
    margin-left: auto;
    margin-right: auto;
  }
  .directions-summary {
    text-align: center;
  }
  .dir-row { column-gap: 24px; }
  .dir-step { padding-left: 42px; }
  .dir-step::before { width: 32px; }
  .dir-meta { justify-self: end; }
}

/* 3) Make "View in 360°" match the glassy back button style */
#view-360-button {
  width: 100%;
  margin-top: 15px;
  padding: 12px 18px;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 20px;
  background: rgba(255,255,255,0.14);
  color: #f2f2f2;
  cursor: pointer;
  backdrop-filter: blur(5px);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.06s ease;
}
#view-360-button:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.36);
}
#view-360-button:active {
  transform: translateY(1px);
}


/* --- Pano popup (match back button theme) --- */
#pano-hotspot-popup.pano-popup {
  position: absolute;
  z-index: 25;
  max-width: 240px;
  padding: 10px 14px;
  background-color: rgba(0,0,0,0.42);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  backdrop-filter: blur(5px);
  pointer-events: auto; /* allow tapping 'Know' */
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.2;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
}
.dt-know-hotspot-anchor {
  width: 0;
  height: 0;
  transition: none !important;
}
.dt-know-hotspot {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.7);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.35;
  white-space: nowrap;
  backface-visibility: hidden;
  will-change: transform;
  --dt-know-scale: 1;
  transform: translate(-50%, -50%) scale(var(--dt-know-scale));
  transition: opacity 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  user-select: none;
}
.dt-know-hotspot:hover,
.dt-know-hotspot:focus-visible {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.65);
  border-color: rgba(255, 255, 255, 0.9);
}
@media (hover: none) {
  .dt-know-hotspot {
    opacity: 1;
  }
}

/* Make 360 video/photo loaders pure black */
#pano-wrapper,
#panorama-container,
#panorama-container .pnlm-render-container,
.video-js,
.vjs-tech,
.vjs-poster {
  background-color: #000 !important;
}

/* Hide Pannellum long-press about box/title if surfaced */
#panorama-container .pnlm-about-msg,
#panorama-container .pnlm-title {
  display: none !important;
}

/* --- 360 UI auto-hide (fade) --- */
#page4 #pano-controls,
#page4 #back-button,
#page4 #throw-random-360-button {
  transition: opacity 0.35s ease;
}
#page4.hide-ui #pano-controls,
#page4.hide-ui #back-button,
#page4.hide-ui #throw-random-360-button {
  opacity: 0;
  pointer-events: none;
}




/* --- Hotspot Gallery Overlay --- */
.gallery-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s;
  backdrop-filter: blur(8px);
}

.gallery-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.gallery-close-button {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.42);
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 2rem;
  line-height: 44px;
  text-align: center;
  padding: 0;
  cursor: pointer;
  z-index: 102;
  transition: transform 0.2s;
}
.gallery-close-button:hover {
    transform: scale(1.1);
}

.gallery-content-container {
  width: 90%;
  max-width: 450px; /* Controls the width of the vertical gallery */
  height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  scrollbar-width: none; /* Hide by default */
}

/* Remove desktop-specific scrollbar styling; hide all scrollbars globally below */

/* --- Global: Hide all scrollbars (preserve scroll) --- */
* {
  scrollbar-width: none !important;     /* Firefox */
  -ms-overflow-style: none;              /* IE and old Edge */
}
*::-webkit-scrollbar {
  width: 0 !important;                   /* Chrome/Safari/Edge */
  height: 0 !important;
}

/* --- Gallery: scale text to ~75% --- */
.gallery-overlay .text-overlay .title {
  font-size: 1.875rem; /* was 2.5rem (~75%) */
}
.gallery-overlay .text-overlay .description {
  font-size: 0.75rem; /* was 1rem (~75%) */
}

.gallery-item {
  position: relative;
  width: 100%;
  margin-bottom: 0; /* Remove gap between stacked images */
  border-radius: 0; /* No rounded corners on images */
  overflow: hidden;
  color: white;
}

/* Intro slide keeps a nice readable height */
.gallery-item--intro {
  min-height: 55vh;
}

/* Image items: show the full image (no crop), widths matched, heights vary */
.image-item { padding-top: 0; background: none; }
.image-item .gallery-img {
  width: 100%;
  height: auto;
  display: block;
}

/* --- Text Overlay on First Image --- */
.gallery-item:first-child .text-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  box-sizing: border-box;
}

.text-overlay .title {
  font-size: 2.5rem;
  font-weight: bold;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
}

.text-overlay .description {
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-wrap; /* Respects newlines in the JSON string */
  text-shadow: 1px 1px 6px rgba(0,0,0,0.8);
}


/* --- Layout Variations --- */

/* SIDE LAYOUT */
.text-overlay.layout-side {
  flex-direction: row;
}
.text-overlay.layout-side .title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 20px 10px;
  background: linear-gradient(to left, rgba(0,0,0,0.6), transparent);
  text-align: center;
}
.text-overlay.layout-side .description {
  padding: 20px;
  flex-grow: 1;
  overflow-y: auto;
}


/* TOP LAYOUT */
.text-overlay.layout-top {
  flex-direction: column;
  justify-content: flex-start; /* Changed from flex-end */
  padding: 25px;
  /* Gradient now starts from the top and fades down */
  background: linear-gradient(to bottom, rgba(0,0,0,0.85) 40%, transparent); 
}
.text-overlay.layout-top .title {
  margin-bottom: 15px; /* Increased spacing a bit */
 
}

.text-overlay.layout-top .description {
  padding: 20px;
  flex-grow: 1;
  overflow-y: auto;
}
#exit-fullscreen-button {
  position: absolute;
  top: 20px;
  right: 20px; /* reserve space: Throw button shifts via its own right */
  z-index: 21; /* above other buttons */
  padding: 8px 14px;
  font-size: 1.2rem;
  color: white;
  background-color: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  cursor: pointer;
  backdrop-filter: blur(5px);
  line-height: 1;
  transition: opacity 0.35s ease;
  display: none; /* hidden when not fullscreen */
}
#page4.is-fullscreen #exit-fullscreen-button { display: inline-block; }
#page4.hide-ui #exit-fullscreen-button { opacity: 0; pointer-events: none; transition: opacity 0.35s ease; }

/* Nudge Throw button left a bit to avoid overlap with X */
#throw-random-360-button { right: 62px; }
