/* ═══════════════════════════════════════════════
   PHILMONT 2025 — style.css
   ═══════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  /* Backgrounds — dark slate with blue-green cast */
  --ink:            #1c2526;
  --surface:        #232e30;
  --surface-raised: #2a373a;

  /* Text */
  --cream:          #f0ece3;
  --cream-muted:    #c8c2b8;

  /* Accent — outdoors orange */
  --orange:         #e8640a;
  --orange-light:   #f07c30;

  /* Secondary — teal */
  --teal:           #3a7a72;
  --teal-light:     #56a89c;

  /* Muted / UI chrome */
  --stone:          #7a9099;
  --stone-light:    #b0c4ca;

  /* Legacy aliases — keeps old references working during transition */
  --parchment:      var(--cream);
  --parchment-dark: #d8d3c8;
  --rust:           #b84a14;
  --rust-light:     var(--orange);
  --pine:           var(--teal);
  --pine-light:     var(--teal-light);
  --gold:           var(--orange);
  --gold-light:     var(--orange-light);

  --sidebar-w:      360px;
  --elev-h:         110px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--ink);
  color: var(--cream);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════
   LOADING SCREEN
══════════════════════════════════════ */
#loading {
  position: fixed;
  inset: 0;
  background: var(--ink);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease;
}

#loading.fade-out { opacity: 0; pointer-events: none; }

#loading h2 {
  font-family: 'Lora', serif;
  font-size: 38px;
  color: var(--cream);
  font-weight: 700;
  margin-bottom: 6px;
}

#loading p {
  font-size: 10px;
  color: var(--stone-light);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 32px;
}

.loading-bar {
  width: 200px;
  height: 2px;
  background: #333;
  position: relative;
  overflow: hidden;
}

.loading-bar::after {
  content: '';
  position: absolute;
  left: -60%;
  top: 0;
  width: 60%;
  height: 100%;
  background: var(--rust-light);
  animation: loadpulse 1.2s ease-in-out infinite;
}

@keyframes loadpulse {
  to { left: 100%; }
}

/* ══════════════════════════════════════
   HEADER
══════════════════════════════════════ */
#header {
  background: var(--surface);
  color: var(--cream);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 2px solid var(--orange);
  z-index: 100;
  position: relative;
}

#header-title {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

/* #header-title .eyebrow {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  margin-bottom: 3px;
  display:inline;
}*/

#header-title h1 {
  font-family: 'Lora', serif;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--parchment);
  margin:8px 0;

}

#header-title .sub {
  font-size: 10px;
  color: var(--stone-light);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 2px;
  font-weight: 500;
}

#header-stats {
  display: flex;
  gap: 24px;
}

.h-stat { text-align: center; }

.h-stat .val {
  font-family: 'Lora', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--orange-light);
  line-height: 1;
  margin: 6px 0;
}

.h-stat .lbl {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stone-light);
  margin-top: 2px;
  font-weight: 500;
}

#header-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── Shared button style ── */
.ctrl-btn {
  background: transparent;
  border: 1px solid var(--stone);
  color: var(--cream-muted);
  padding: 6px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 3px;
}

.ctrl-btn:hover {
  border-color: var(--orange);
  color: var(--orange-light);
}

.ctrl-btn.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

/* ══════════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════════ */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.06);
  position: relative;
  z-index: 10;
}

#sidebar-top {
  background: var(--ink);
  padding: 12px 0 0;
  flex-shrink: 0;
}

#sidebar-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stone-light);
  padding: 0 16px 8px;
  font-weight: 500;
}

/* ── Day list ── */
#day-list {
  overflow-y: auto;
  flex-shrink: 0;
  max-height: 145px;
  background: var(--ink);
  border-bottom: 2px solid var(--orange);
}

#day-list::-webkit-scrollbar       { width: 4px; }
#day-list::-webkit-scrollbar-track { background: var(--ink); }
#day-list::-webkit-scrollbar-thumb { background: var(--stone); border-radius: 2px; }

.day-item {
  display: flex;
  align-items: center;
  padding: 5px 10px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.15s;
  gap: 10px;
}

.day-item:hover  { background: rgba(255,255,255,0.05); }

.day-item.active {
  background: rgba(232,100,10,0.15);
  border-left: 3px solid var(--orange);
}

.day-item.active .day-num { color: var(--gold-light); }

.day-num {
  font-family: 'Lora', serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--stone-light);
  min-width: 30px;
  line-height: 1;
}

.day-info  { flex: 1; min-width: 0; }

.day-camp {
  font-size: 13px;
  font-weight: 600;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
  font-family: 'DM Sans', sans-serif;
}

.day-meta {
  font-size: 10px;
  color: var(--stone-light);
  margin-top: 1px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.day-play-btn {
  background: transparent;
  border: 1px solid var(--stone);
  color: var(--stone-light);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.day-play-btn:hover,
.day-play-btn.playing {
  border-color: var(--orange);
  color: var(--orange);
  background: rgba(232,100,10,0.15);
}

/* ── Day detail panel ── */
#day-detail {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  background: var(--surface);
  color: var(--cream);
}

#day-detail::-webkit-scrollbar       { width: 4px; }
#day-detail::-webkit-scrollbar-track { background: var(--ink); }
#day-detail::-webkit-scrollbar-thumb { background: var(--stone); border-radius: 2px; }

/* Placeholder state */
#day-detail-placeholder {
  text-align: center;
  padding: 40px 20px;
  color: var(--stone);
}

.placeholder-icon  { font-size: 28px; margin-bottom: 12px; }

.placeholder-title {
  font-family: 'Lora', serif;
  font-size: 16px;
  color: var(--cream);
  margin-bottom: 8px;
}

.placeholder-body {
  font-size: 11px;
  line-height: 1.7;
  font-weight: 300;
  font-style: italic;
}

/* Detail content elements */
#detail-day-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 4px;
  font-weight: 500;
}

#detail-camp-name {
  font-family: 'Lora', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--cream);
  line-height: 1.1;
  margin-bottom: 4px;
}

#detail-route {
  font-size: 10px;
  color: var(--stone-light);
  letter-spacing: 0.12em;
  margin-bottom: 14px;
  text-transform: uppercase;
  font-weight: 500;
}

.detail-stats-row {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border: 0px solid #c8bfb0;
}

.d-stat {
  flex: 1;
  padding: 8px 10px;
  text-align: center;
  border-right: 0px solid #c8bfb0;
}

.d-stat:last-child { border-right: none; }

.d-stat .dv {
  font-family: 'Lora', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--orange-light);
  line-height: 1;
}

.d-stat .dl {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stone-light);
  margin-top: 6px;
  font-weight: 500;
}

.detail-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 16px 0;
}

#detail-features { margin-bottom: 14px; }

.feature-tag {
  display: inline-block;
  background: rgba(58,122,114,0.25);
  color: var(--teal-light);
  border: 1px solid rgba(86,168,156,0.3);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 2px;
  margin: 2px 3px 2px 0;
  font-weight: 500;
}

#detail-narrative {
  font-size: 15px;
  line-height: 1.5;
  color: var(--cream-muted);
  font-style: normal;
  font-weight: 300;
  border-left: 3px solid var(--orange);
  padding-left: 14px;
  margin-bottom: 16px;
}

#detail-photos-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 8px;
  font-weight: 500;
}

#detail-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.photo-thumb {
  aspect-ratio: 1;
  background: var(--surface-raised);
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: opacity 0.2s;
}

.photo-thumb:hover { opacity: 0.85; }

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--stone-light);
  width: 100%;
  height: 100%;
}

.detail-animate-btn {
  width: 100%;
  text-align: center;
  padding: 10px;
  margin-top: 16px;
}

/* ══════════════════════════════════════
   MAP AREA
══════════════════════════════════════ */
#map-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

#map { flex: 1; position: relative; }

/* ── Animation progress bar ── */
#anim-bar {
  display: none;
  position: absolute;
  bottom: calc(var(--elev-h) + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28,37,38,0.95);
  border: 1px solid var(--stone);
  border-radius: 4px;
  padding: 8px 16px;
  color: var(--cream);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0.06em;
  z-index: 50;
  gap: 12px;
  align-items: center;
  min-width: 240px;
  justify-content: space-between;
}

#anim-bar.visible { display: flex; }

#anim-stop-btn, #anim-end-btn {
  border: none;
  color: #fff;
  padding: 4px 12px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  border-radius: 3px;
}
#anim-stop-btn { background: var(--stone); }
#anim-end-btn  { background: var(--orange); }

/* ── Elevation strip ── */
#elevation-strip {
  height: var(--elev-h);
  background: var(--surface);
  flex-shrink: 0;
  padding: 8px 16px 10px;
  position: relative;
  border-top: 1px solid rgba(255,255,255,0.06);
}

#elev-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 4px;
  font-weight: 500;
}

#elevation-strip canvas {
  width: 100% !important;
  height: 72px !important;
}

/* ══════════════════════════════════════
   PHOTO MODAL
══════════════════════════════════════ */
#photo-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,8,6,0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

#photo-modal.open { display: flex; }

#photo-modal-inner {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.1);
  max-width: 94vw;
  width: 94vw;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

#modal-img {
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: contain;
  background: #000;
}

#modal-info {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

#modal-title {
  font-family: 'Lora', serif;
  font-size: 20px;
  color: var(--cream);
  margin-bottom: 4px;
  font-weight: 600;
}

#modal-caption {
  font-size: 13px;
  color: var(--stone-light);
  font-style: italic;
  line-height: 1.6;
  font-weight: 300;
}

#modal-meta {
  font-size: 9px;
  color: var(--stone);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 10px;
  font-weight: 500;
}

#modal-close {
  background: transparent;
  border: none;
  color: var(--stone-light);
  font-size: 22px;
  cursor: pointer;
  position: absolute;
  top: 16px;
  right: 20px;
  line-height: 1;
  z-index: 2;
}

#modal-close:hover { color: var(--parchment); }

#modal-prev, #modal-next {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(10,8,6,0.6);
  border: 1px solid var(--stone);
  color: var(--parchment);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 8px 12px;
  z-index: 2;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
#modal-prev { left: 0; }
#modal-next { right: 0; }
#modal-prev:hover, #modal-next:hover { background: rgba(10,8,6,0.9); }

#modal-counter {
  font-size: 10px;
  color: var(--stone-light);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  margin-top: 6px;
}

/* ══════════════════════════════════════
   MAPBOX OVERRIDES
══════════════════════════════════════ */
.mapboxgl-ctrl-logo    { display: none !important; }
.mapboxgl-ctrl-attrib  { font-size: 9px !important; opacity: 0.5; }

.camp-popup .mapboxgl-popup-content {
  background: var(--ink);
  color: var(--parchment);
  border: 1px solid var(--ink);
  padding: 10px 14px;
  border-radius: 0;
  font-family: 'DM Sans', sans-serif;
  min-width: 140px;
}

.camp-popup .mapboxgl-popup-tip { border-top-color: var(--ink) !important; }

.photo-hover-popup .mapboxgl-popup-content {
  background: var(--ink);
  border: 1px solid var(--ink);
  padding: 0;
  border-radius: 4px;
  overflow: hidden;
  pointer-events: none;
}
.photo-hover-popup .mapboxgl-popup-tip { border-top-color: var(--ink) !important; }

.popup-day {
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 3px;
  font-weight: 300;
}

.popup-name {
  font-family: 'Lora', serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--parchment);
}

.popup-miles {
  font-size: 10px;
  color: var(--stone-light);
  margin-top: 3px;
  font-weight: 300;
}

/* ══════════════════════════════════════
   MOBILE LAYOUT  (≤ 768px)
══════════════════════════════════════ */
@media (max-width: 768px) {
  /* Hide desktop header entirely */
  #header { display: none; }

  /* Use dynamic viewport height so the browser chrome doesn't eat the layout */
  body { height: 100dvh; }

  /* Stack map above sidebar */
  #main {
    flex-direction: column;
    height: 100dvh;
  }

  /* Map + elevation strip = top 40%
     order: -1 pulls it above the sidebar despite coming second in the DOM */
  #map-area {
    height: 40dvh;
    flex: none;
    order: -1;
  }

  /* Shrink elevation strip — 110px is too tall inside a 40dvh slot */
  #elevation-strip {
    height: 66px;
    padding: 5px 12px 7px;
  }

  #elevation-strip canvas {
    height: 40px !important;
  }

  /* Reposition animation bar since --elev-h changed */
  #anim-bar {
    bottom: calc(66px + 8px);
  }

  /* Sidebar becomes full-width bottom panel (60dvh total) */
  #sidebar {
    width: 100%;
    flex: 1;
    min-height: 0;
    border-right: none;
    border-top: 2px solid var(--orange);
  }

  /* Hide the "Select a day to explore" label — no room on mobile */
  #sidebar-top { display: none; }

  /* Day list = ~10% of viewport, scrolls horizontally if needed */
  #day-list {
    max-height: 10dvh;
  }

  /* Slightly tighter day rows */
  .day-item { padding: 4px 10px; }

  .day-camp { font-size: 12px; }

  /* Day detail fills remaining ~50dvh */
  #day-detail { flex: 1; }

  /* Tighter detail typography */
  #detail-camp-name { font-size: 20px; }

  #detail-narrative { font-size: 14px; }

  /* Photo grid: 4 columns on mobile */
  #detail-photo-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Modal: full-screen on mobile */
  #photo-modal-inner {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }
}
