/* ============================================
       DESIGN TOKENS / CSS VARIABLES
       ============================================ */
:root {
  /* Heritage Tour Color Palette */
  --background: hsl(40, 20%, 97%);
  --foreground: hsl(30, 15%, 15%);
  --card: hsl(40, 25%, 99%);
  --card-foreground: hsl(30, 15%, 15%);

  /* Warm forest green - heritage feel */
  --primary: hsl(150, 35%, 28%);
  --primary-foreground: hsl(40, 20%, 97%);

  /* Warm stone secondary */
  --secondary: hsl(35, 25%, 92%);
  --secondary-foreground: hsl(30, 15%, 25%);

  --muted: hsl(35, 20%, 93%);
  --muted-foreground: hsl(30, 10%, 45%);

  /* Subtle gold accent */
  --accent: hsl(38, 60%, 55%);
  --accent-foreground: hsl(30, 15%, 15%);

  --border: hsl(35, 20%, 88%);

  /* Custom tour-specific tokens */
  --tour-header-bg: hsl(150, 32%, 25%);
  --tour-audio-bg: hsl(150, 35%, 22%);
  --tour-progress: hsl(150, 40%, 45%);
  --tour-card-shadow: hsl(30, 20%, 75%);

  --radius: 0.75rem;
}

/* ============================================
       BASE STYLES
       ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Playfair Display", Georgia, serif;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ============================================
       LAYOUT
       ============================================ */
.tour-page {
  min-height: 100vh;
  padding-bottom: 5rem;
}

.container {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ============================================
       HEADER
       ============================================ */
.tour-header {
  padding: 1rem;
  background-color: var(--card);
  border-bottom: 1px solid var(--border);
}

.tour-header__label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}

.tour-header__title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.2;
}

.tour-header__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.tour-header__subtitle {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.tour-header__divider {
  color: var(--muted-foreground);
  opacity: 0.4;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background-color: hsla(38, 60%, 55%, 0.15);
  color: var(--accent);
}

/* ============================================
       AUDIO PLAYER
       ============================================ */
.audio-player {
  background: linear-gradient(
    135deg,
    var(--tour-header-bg),
    var(--tour-audio-bg)
  );
  padding: 1.25rem 1rem;
}

.audio-player__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.audio-player__label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsla(40, 20%, 97%, 0.7);
  margin-bottom: 0.125rem;
}

.audio-player__title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--primary-foreground);
}

.audio-player__step {
  background-color: hsla(255, 255%, 255%, 0.15);
  color: var(--primary-foreground);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
}

.audio-player__controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.audio-rewind-toast {
  font-size: 0.75rem;
  color: #fff;
  background-color: hsla(255, 255%, 255%, 0.12);
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
}

.audio-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.audio-btn--rewind {
  width: 2.5rem;
  height: 2.5rem;
  background-color: hsla(255, 255%, 255%, 0.1);
}

.audio-btn--rewind:hover {
  background-color: hsla(255, 255%, 255%, 0.2);
}

.audio-btn--play {
  width: 3.5rem;
  height: 3.5rem;
  background-color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.audio-btn--play:hover {
  transform: scale(1.05);
}

.audio-btn--play svg {
  fill: var(--primary);
  color: var(--primary);
}

.audio-progress {
  flex: 1;
}

.audio-progress__track {
  height: 0.375rem;
  border-radius: 9999px;
  background-color: hsla(255, 255%, 255%, 0.2);
  overflow: hidden;
  cursor: pointer;
}

.audio-progress__track.is-dragging {
  cursor: grabbing;
}

.audio-progress__fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--tour-progress), var(--accent));
  transition: width 0.15s ease;
}

.audio-progress__times {
  display: flex;
  justify-content: space-between;
  margin-top: 0.375rem;
}

.audio-progress__time {
  font-size: 0.75rem;
  color: hsla(40, 20%, 97%, 0.6);
}

.audio-player__ambient {
  margin-top: 1rem;
}

.ambient-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: hsla(40, 20%, 97%, 0.7);
  background-color: hsla(255, 255%, 255%, 0.1);
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  transition: color 0.2s ease;
}

.ambient-btn:hover {
  color: var(--primary-foreground);
}

.ambient-btn__dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background-color: var(--accent);
  animation: pulse 2s infinite;
}

.ambient-btn--paused .ambient-btn__dot {
  animation: none;
  opacity: 0.45;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ============================================
       MAP SECTION
       ============================================ */
.map-section {
  position: relative;
  height: 16rem;
  background: linear-gradient(135deg, var(--secondary), var(--muted));
}

@media (min-width: 768px) {
  .map-section {
    height: 20rem;
  }
}

.map-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
}

.map-placeholder__icon {
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.map-placeholder__text {
  font-size: 0.875rem;
}

.map-controls {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.map-control-btn {
  width: 2rem;
  height: 2rem;
  background-color: var(--card);
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.map-control-btn:hover {
  background-color: hsla(38, 60%, 55%, 0.1);
}

.map-control-btn svg {
  width: 1rem;
  height: 1rem;
  color: var(--foreground);
}

.map-location {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: hsla(40, 25%, 99%, 0.9);
  backdrop-filter: blur(4px);
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.map-location__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: var(--primary);
  animation: pulse 2s infinite;
}

.map-location__text {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--foreground);
}

/* ============================================
       SITE DESCRIPTION
       ============================================ */
.description-section {
  padding: 1.5rem 1rem;
}

.tour-card {
  background-color: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 4px 20px -4px hsla(30, 20%, 75%, 0.3);
}

@media (min-width: 768px) {
  .tour-card {
    padding: 1.5rem;
  }
}

.tour-card__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.75rem;
}

@media (min-width: 768px) {
  .tour-card__title {
    font-size: 1.5rem;
  }
}

.tour-card__text {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--muted-foreground);
}

@media (min-width: 768px) {
  .tour-card__text {
    font-size: 1rem;
  }
}

.read-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
  transition: color 0.2s ease;
}

.read-more-btn:hover {
  color: hsla(150, 35%, 28%, 0.8);
}

.read-more-btn:hover svg {
  transform: translateX(2px);
}

.read-more-btn svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s ease;
}

/* ============================================
       GALLERY
       ============================================ */
.gallery-section {
  padding: 0 1rem 2rem;
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.gallery-header__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
}

.gallery-header__count {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 0.5rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--muted), var(--secondary));
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px -8px hsla(30, 20%, 75%, 0.4);
}

.gallery-item__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item__placeholder svg {
  width: 2rem;
  height: 2rem;
  color: var(--muted-foreground);
  opacity: 0.4;
}

.gallery-item__video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: hsla(30, 15%, 15%, 0.3);
}

.gallery-item__play-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: hsla(255, 255%, 255%, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item__play-btn svg {
  width: 1rem;
  height: 1rem;
  color: var(--foreground);
  fill: var(--foreground);
  margin-left: 2px;
}

.gallery-item__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem;
  background: linear-gradient(to top, hsla(30, 15%, 15%, 0.6), transparent);
}

.gallery-item__caption-text {
  font-size: 0.75rem;
  color: white;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
       BOTTOM NAVIGATION
       ============================================ */
.tour-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: hsla(40, 25%, 99%, 0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

.tour-nav__inner {
  max-width: 42rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-btn--prev {
  color: var(--muted-foreground);
}

.nav-btn--prev:hover {
  color: var(--foreground);
  background-color: var(--secondary);
}

.nav-btn--next {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.nav-btn--next:hover {
  background-color: hsla(150, 35%, 28%, 0.9);
}

.nav-btn svg {
  width: 1rem;
  height: 1rem;
}

.step-dots {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.step-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background-color: hsla(30, 10%, 45%, 0.3);
  transition: all 0.2s ease;
}

.step-dot:hover {
  background-color: hsla(30, 10%, 45%, 0.5);
}

.step-dot--active {
  width: 1.5rem;
  background-color: var(--primary);
}

/* ============================================
       ICONS (inline SVG references)
       ============================================ */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: middle;
}

/* ============================================
       MAP
       ============================================ */

.map-section {
  position: relative;
  height: 420px;
  border-radius: 18px;
  overflow: hidden;
  background: #eee;
}

.map-shell,
.map-canvas {
  width: 100%;
  height: 100%;
}

/* Leaflet container fix */
.map-canvas {
  z-index: 0;
}

/* Controls overlay */
.map-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 500;
}

.map-control-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #e6dccf;
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

/* Location badge */
.map-location {
  position: absolute;
  right: 16px;
  bottom: 16px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e6dccf;
  border-radius: 999px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  z-index: 500;
}

.map-location__dot {
  width: 8px;
  height: 8px;
  background: #c99738;
  border-radius: 50%;
}

/* ============================================
       GALLERY
       ============================================ */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.gallery-item {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: #eee;
  aspect-ratio: 1 / 1;
}

.gallery-item__thumb {
  position: absolute;
  inset: 0;
}

.gallery-item__video-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
}

.gallery-item__play-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
}

.gallery-item__play-btn svg {
  width: 22px;
  height: 22px;
  fill: #1f3f2e;
}

.gallery-item__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
}

.gallery-item__caption-text {
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ============================================
   LIGHTBOX
   ============================================ */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999; /* 👈 must be higher than map, controls, etc */
}

.lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: #000;
  padding: 10px;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.lightbox img,
.lightbox iframe,
.lightbox video {
  max-width: 80vw;
  max-height: 80vh;
  border-radius: 10px;
  display: block;
}

.lightbox-close {
  margin-top: 10px;
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: #f8f3ea;
  color: #1f3f2e;
  font-weight: 700;
  cursor: pointer;
}

/* ============================================
   MAP STEP MARKERS
   ============================================ */

.step-marker {
  background: transparent;
}

.step-marker__inner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), hsl(150, 40%, 20%));
  border: 2px solid white;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);

  display: flex;
  align-items: center;
  justify-content: center;

  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.step-marker__number {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  line-height: 1;
  transform: translateY(0.5px); /* optical centring */
}

/* Active step */
.step-marker__inner.is-active {
  background: linear-gradient(135deg, var(--accent), hsl(38, 60%, 45%));
  box-shadow: 0 10px 28px rgba(201, 151, 56, 0.45);
  transform: scale(1.12);
}

/* Hover (desktop) */
.step-marker__inner:hover {
  transform: scale(1.08);
}

.user-marker {
  background: transparent;
}

.user-dot {
  width: 14px;
  height: 14px;
  background: var(--primary);
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 6px rgba(31, 63, 46, 0.15), 0 4px 12px rgba(0, 0, 0, 0.35);
}

.tour-card__text {
  transition: max-height 0.3s ease, opacity 0.2s ease;
}

/* ============================================
   AUDIO STEP NAVIGATION
   ============================================ */

.audio-step-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: hsla(255, 255%, 255%, 0.15);
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
}

.audio-step-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary-foreground);
  white-space: nowrap;
}

.audio-step-btn {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background-color: hsla(255, 255%, 255%, 0.2);
  color: var(--primary-foreground);
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.audio-step-btn:hover:not(:disabled) {
  background-color: hsla(255, 255%, 255%, 0.35);
  transform: scale(1.05);
}

.audio-step-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.audio-step-icon {
  width: 22px;
  height: 22px;
  display: block; /* prevents inline baseline shift */
}

.nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
