/* ---------- Base / page ---------- */
html,
body {
  height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-family: Arial, sans-serif;
  background: #f3f4f6;
  color: #111827;
}

/* ---------- Header ---------- */
header {
  flex: 0 0 auto;
  background: #8b1e1e;
  color: #ffffff;
  text-align: center;
  padding: 0.75rem 1rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.4rem;
  line-height: 1.2;
  font-weight: 700;
}

header span {
  font-size: 0.95rem;
  line-height: 1.4;
}

header img {
  vertical-align: middle;
  margin: 0 0.2rem;
}

/* ---------- Main layout ---------- */
main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* ---------- Stop content card historic-- */
#stop-info {
  position: relative;
  flex: 1 1 auto;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 1.1rem 1.2rem 1.1rem 1.1rem;
  border-radius: 14px;
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(110, 78, 40, 0.45) transparent;

  color: #3b2a1f;
  background:
    radial-gradient(circle at 20% 18%, rgba(255,255,255,0.28), transparent 22%),
    radial-gradient(circle at 78% 30%, rgba(255,255,255,0.18), transparent 18%),
    radial-gradient(circle at 35% 78%, rgba(120,72,24,0.06), transparent 20%),
    radial-gradient(circle at 82% 82%, rgba(120,72,24,0.05), transparent 18%),
    linear-gradient(180deg, #f6edd2 0%, #efe2bf 100%);

  border: 1px solid rgba(104, 71, 35, 0.28);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.45),
    inset 0 -8px 18px rgba(92, 58, 24, 0.05);
}

/* stop info scrollbar styling for WebKit browsers (Chrome, Safari, Edge) - keeps it thin and subtle, with rounded thumb */
#stop-info::-webkit-scrollbar {
  width: 10px;
}

#stop-info::-webkit-scrollbar-track {
  background: transparent;
  margin: 10px 0; /* keeps it from reaching all the way into rounded corners */
}

#stop-info::-webkit-scrollbar-thumb {
  background: rgba(110, 78, 40, 0.38);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

#stop-info::-webkit-scrollbar-thumb:hover {
  background: rgba(110, 78, 40, 0.55);
  border: 2px solid transparent;
  background-clip: padding-box;
}


/* ---------- Stop title ---------- */
#stop-title {
  margin: 0.5rem 0 0.9rem;
  color: #7f1d1d;
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 700;
}

/* ---------- Body text ---------- */
#stop-text,
#extra-text {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  display: block;
  max-width: 100%;
  margin-bottom: 1rem;
  color: #111827;
  font-size: 1.05rem;
  line-height: 1.65;
}

#stop-text p,
#extra-text p {
  margin: 0 0 0.9rem;
}

#stop-text ul,
#extra-text ul,
#stop-text ol,
#extra-text ol {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
}

#stop-text li,
#extra-text li {
  margin-bottom: 0.45rem;
}

#stop-text h3,
#stop-text h4,
#extra-text h3,
#extra-text h4 {
  color: #7f1d1d;
  margin: 1rem 0 0.6rem;
  line-height: 1.25;
}

/* ---------- Buttons ---------- */
button {
  margin: 0.35rem 0.35rem 0.5rem 0;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  color: #111827;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

button:hover {
  background: #f8fafc;
}

button:active {
  transform: translateY(1px);
}

button:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

/* Primary action */
#narrate-btn {
  background: #8b1e1e;
  color: #ffffff;
  border-color: #8b1e1e;
}

#narrate-btn:hover {
  background: #741818;
}

/* Stop button slightly emphasized */
#stop-btn {
  border-color: #9ca3af;
}

/* Extra info button */
#narrate-extra-btn {
  min-width: 3rem;
}

/* ---------- Prev / Next row ---------- */
.nav-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.nav-buttons button {
  flex: 1 1 auto;
  min-width: 120px;
  margin: 0;
}

/* ---------- Map ---------- */
#map {
  flex: 0 0 30dvh;
  flex-shrink: 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  background: #dbe4ea;
}

/* ---------- Locate button ---------- */
.locate-btn {
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #94a3b8;
  padding: 0.5rem 0.75rem;
  color: #111827;
}

/* Push Leaflet controls above browser bars */
.leaflet-bottom.leaflet-right {
  margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
}

/* ---------- Highlighted narration chunk ---------- */
.chunk {
  display: block;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}

/* Highlighted chunk gets "lantern style" color highlights */
.chunk.highlight {
  background: rgba(245, 197, 66, 0.45);
  color: #2b1d12;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(160, 100, 20, 0.10) inset;
}

/* ---------- Small-screen tuning ---------- */
@media (max-width: 480px) {
  header h1 {
    font-size: 1.25rem;
  }

  header span {
    font-size: 0.9rem;
  }

  #stop-title {
    font-size: 1.35rem;
  }

  #stop-text,
  #extra-text {
    font-size: 1rem;
    line-height: 1.6;
  }

  button {
    width: 100%;
    margin-right: 0;
  }

  .nav-buttons {
    flex-direction: column;
  }

  .nav-buttons button {
    width: 100%;
  }
}