/* ---------- 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 ---------- */
/* Old 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;
}
*/

/* ---------- Plaque Header ---------- */
header {
  flex: 0 0 auto;
  /*background: #1f140d; /* A dark, historic wood/wall color to frame the plaque */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  z-index: 10;
}

.historic-plaque {
  /* Brass/Bronze metallic gradient */
  background: linear-gradient(135deg, #8a7342 0%, #b39b59 35%, #e8d596 50%, #b39b59 65%, #6e5a2e 100%);
  border: 3px solid #4a3b1c; /* Dark oxidized edge */
  border-radius: 0px;
  padding: 0.6rem 2rem;
  text-align: center;
  box-shadow: 
    inset 0 0 10px rgba(0,0,0,0.6), /* Inner tarnish/depth */
    0 6px 10px rgba(0,0,0,0.5); /* Physical drop shadow off the wall */
  
  /* Engraved Text Styling */
  color: #2b1d12; 
  font-family: "Times New Roman", Times, serif; /* Classic, formal serif */
  text-transform: uppercase;
  letter-spacing: 1px;
}

.historic-plaque h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 900;
  /* This double text-shadow creates the 3D 'engraved' illusion */
  text-shadow: 1px 1px 0px rgba(255,255,255,0.4), -1px -1px 0px rgba(0,0,0,0.3);
}

.plaque-brand {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: 3px;
  opacity: 0.85;
}

/* ---------- Map GPS Context Update ---------- */
.map-gps-context {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #fff7df;
  opacity: 0.8;
  top: 13px; /* Aligns it vertically in your map header */
}

/* ---------- 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 ---------- *//* old map styles, now replaced by sheet styles below
#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;
}





/* Let reading area breathe */
#stop-info {
  min-height: calc(100vh - 70px);
  padding-bottom: 110px; /* room for floating controls */
}

/* Hide old fixed/bottom map area if your map currently lives there */
#map-container,
.map-container {
  display: none;
}

/* Floating action button */
.fab {
  position: fixed;
  right: 18px;
  bottom: 92px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 0;
  font-size: 1.45rem;
  background: rgba(74, 39, 19, 0.92);
  color: #fff7df;
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
  z-index: 900;
}

.map-fab:active {
  transform: scale(0.96);
}

.map-fab {
  position: fixed;
  right: 18px;
  bottom: 92px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 0;
  background: rgba(74, 39, 19, 0.92);
  color: #fff7df;
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
  z-index: 900;
  cursor: pointer;
  /* Flexbox makes the SVG perfectly centered */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* Floating narration controls */
.tts-floating-controls {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(39, 25, 15, 0.92);
  box-shadow: 0 8px 24px rgba(0,0,0,0.38);
  z-index: 950;
  backdrop-filter: blur(8px);
}

.tts-floating-controls button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  font-size: 1.15rem;
  background: #f5deb3;
  color: #2d1a0f;
  /* Flexbox will ensure that the icons SVGs are centered */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#ttsExtraBtn {
  background: #d4a373; /* Slightly darker/distinct from the #f5deb3 buttons */
  color: #fff;
}

/* Bottom sheet map */
.map-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 1000;
}

.map-sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.map-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(58vh, 520px);
  background: #efe1bf;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 32px rgba(0,0,0,0.45);
  transform: translateY(105%);
  transition: transform 260ms ease;
  z-index: 1001;
  overflow: hidden;
}

.map-sheet.open {
  transform: translateY(0);
}

.map-sheet-header {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #3c2415;
}

.map-sheet-handle {
  display:none; /* Hidden for now, replaced with you are here code */
  width: 54px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.55);
}

#uRhereMan {
  height: 20px;
  border-radius: 10px;
  padding-left: 10px;
}
#uRhereSpan {
  font-size: 0.85rem;
  color: #fff7df;
  opacity: 0.8;
  margin-left: 6px;
  padding-right: 64px; /* space for close button on the right */
}

.map-sheet-close {
  position: absolute;
  right: 12px;
  top: 6px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.16);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

#mapSheetMapHolder {
  height: calc(100% - 44px);
  width: 100%;
}

/* Leaflet map inside sheet */
#map {
  height: 100%;
  width: 100%;
}

/* --- Photos --- */
.stop-photo {
  width: 100%;
  border-radius: 12px;
  margin: 12px 0 6px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  object-fit: cover;
  background: rgba(0,0,0,0.05); /* subtle placeholder color while loading */
}

.photo-caption {
  font-size: 0.85rem;
  color: #5c4532;
  text-align: center;
  margin-bottom: 16px;
  font-style: italic;
}

/* --- Monetization / upgrade Card --- */
/* --- Tour Upgrades / Local Tips --- */
#upgrade-card {
  display: block;
  width: 100%;
}

/* The entire clickable card */
.upgrade-box {
  display: block;
  background: #fffdf5;
  border: 2px dashed #c29567;
  border-radius: 12px;
  padding: 16px;
  margin: 20px 0;
  text-decoration: none; /* Prevents underline on the text */
  box-shadow: 0 4px 10px rgba(104, 71, 35, 0.08);
  transition: transform 0.15s ease, background 0.15s ease;
}

.upgrade-box:active {
  transform: scale(0.98);
  background: #fceecf;
}

/* The "Local Tip" Title */
.tips-header {
  font-weight: 900;
  color: #8b1e1e; /* Historic burgundy tie-in */
  margin-bottom: 8px;
  font-size: 1.05rem;
}

/* The Main Pitch Text */
.upgrade-text {
  color: #3b2a1f;
  font-size: 0.90rem;
  line-height: 1.5;
  font-weight: 600;
}

/* The Disclosure */
.paid-disclosure {
  font-size: 0.75rem;
  font-style: italic;
  color: #7a6855;
  margin-top: 12px;
  border-top: 1px solid rgba(194, 149, 103, 0.3); /* Subtle divider line */
  padding-top: 8px;
  line-height: 1.3;
}

/* --- Directions Box --- */
.directions-box {
  background: rgba(255, 255, 255, 0.5);
  border-left: 4px solid #8b1e1e; /* Historic Burgundy */
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  margin-top: 24px;
  font-size: 0.95rem;
  color: #2b1d12;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* --- Footer Spacer --- */
.scroll-spacer {
  height: 110px; /* Forces enough blank space so the user can scroll text past the floating buttons */
  width: 100%;
}

/* --- Settings Modal --- */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-window {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -45%);
  width: 90%;
  max-width: 400px;
  background: #fdfaf5;
  border-radius: 16px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
}

/* Modal Open States */
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal-window.open { opacity: 1; transform: translate(-50%, -50%); pointer-events: auto; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e0d5c1;
}

.modal-header h3 { margin: 0; font-family: "Times New Roman", serif; color: #2b1d12; }
.modal-close { background: none; border: 0; color: #888; cursor: pointer; display: flex; padding: 0;}

.modal-body { padding: 24px 20px; }
.setting-group { display: flex; flex-direction: column; gap: 8px; }
.setting-group label { font-weight: 600; color: #4a3b1c; }
.setting-hint { font-size: 0.8rem; color: #666; text-align: center; margin-top: 8px; }

/* Custom Slider */
input[type=range] { width: 100%; accent-color: #c29567; }

/* Reset Button */
.danger-btn {
  background: white;
  border: 2px solid #d32f2f;
  color: #d32f2f;
  padding: 12px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  text-transform: uppercase;
}
.danger-btn:active { background: #ffebee; }


#tips {
  font-weight: 900;

}

#paid {
  font-size: smaller;
  font-style: italic;
}




/* ---------- 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%;
  }
}
