/* Questa Sightlines — design system
   Branded per the KCEC Visual Style Guide (Feb 2018): Kit Carson Grey
   #414141 + Electric Yellow #FDB913, Nexa-first type stack with the
   policy-approved sans fallbacks. Surfaces are soft "glass" cards floating
   over the map; map chrome is restyled to match. */

@font-face {
  font-family: "Inter";
  src: url("../vendor/inter/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #2e2e2e;
  --ink-soft: rgba(46, 46, 46, 0.64);
  --paper: #f7f6f3;
  --paper-glass: rgba(252, 251, 248, 0.9);
  --dark-glass: rgba(38, 38, 38, 0.74);
  --grey: #414141;         /* Kit Carson Grey (Pantone Black 7C) */
  --grey-deep: #353535;
  --accent: #fdb913;       /* Electric Yellow (Pantone 7408C) */
  --accent-deep: #e8a90c;
  --on-accent: #2e2e2e;    /* text on yellow — passes AA */
  --line: rgba(46, 46, 46, 0.12);
  --radius: 14px;
  --shadow-1: 0 1px 2px rgba(20, 20, 20, 0.10), 0 4px 16px rgba(20, 20, 20, 0.14);
  --shadow-2: 0 2px 6px rgba(20, 20, 20, 0.16), 0 14px 36px rgba(20, 20, 20, 0.26);
  --contours: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='180' viewBox='0 0 560 180'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='1.4'%3E%3Cpath d='M0 38c70-22 150 16 225-6s150-28 225-6 70 16 110 9'/%3E%3Cpath d='M0 88c80-28 165 22 250-4s165-34 250-4 40 12 60 12'/%3E%3Cpath d='M0 138c65-16 140 20 215-2s160-24 235-4 70 12 110 7'/%3E%3C/g%3E%3C/svg%3E");
  --sans: "Nexa", "Inter", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
}

body { display: flex; flex-direction: column; }

:focus-visible {
  outline: 2px solid var(--grey);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- top bar ---------- */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 18px;
  color: #fff;
  background: var(--contours) right -40px center / auto 220% no-repeat,
              linear-gradient(135deg, #383838, #474747);
  border-bottom: 3px solid var(--accent);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-mark { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.brand-sub {
  font-size: 11px;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tagline { margin: 0; font-size: 12.5px; color: rgba(255, 255, 255, 0.85); text-align: right; }

/* ---------- stage (map + floating UI) ---------- */
.stage { position: relative; flex: 1 1 auto; min-height: 0; }
/* z-index: 0 traps Leaflet's internal z-indexes below the floating panels */
#map { position: absolute; inset: 0; z-index: 0; background: #3d3d3b; }

.fatal {
  padding: 28px;
  max-width: 520px;
  margin: 40px auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}

/* ---------- markers ---------- */
.vp-pin { outline-offset: 3px; }
.vp-pin-dot {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  background: var(--accent);
  color: var(--on-accent);
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.vp-pin:hover .vp-pin-dot,
.vp-pin:focus-visible .vp-pin-dot {
  transform: scale(1.14);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 8px 18px rgba(0, 0, 0, 0.35);
}
.vp-pin-dot.is-approx {
  background: #fff;
  color: var(--grey);
  border: 2px dashed #8d8d8d;
}
.vp-pin.is-open .vp-pin-dot {
  background: var(--grey);
  border-color: var(--accent);
  color: var(--accent);
}

/* brand the Leaflet chrome */
.leaflet-bar { border: 0 !important; border-radius: 10px; box-shadow: var(--shadow-1); overflow: hidden; }
.leaflet-bar a {
  width: 34px; height: 34px; line-height: 34px;
  color: var(--grey);
  background: var(--paper-glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line) !important;
  font-family: var(--sans);
}
.leaflet-bar a:hover { background: var(--accent); color: var(--on-accent); }
.leaflet-control-layers {
  border: 0 !important;
  border-radius: 10px;
  box-shadow: var(--shadow-1);
  background: var(--paper-glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font-family: var(--sans);
}
.leaflet-container { font-family: var(--sans); }
.leaflet-control-attribution {
  background: rgba(252, 251, 248, 0.85) !important;
  color: var(--ink-soft);
  font-size: 10px;
}
.leaflet-tooltip.vp-tip {
  background: var(--dark-glass);
  color: #fff;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow-1);
  font: 600 12px/1.2 var(--sans);
  padding: 6px 10px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.leaflet-tooltip-top.vp-tip::before { border-top-color: rgba(38, 38, 38, 0.74); }

/* ---------- location panel (desktop) ---------- */
.loc-panel {
  position: absolute;
  z-index: 850;
  top: 14px; left: 14px;
  width: 296px;
  max-height: calc(100% - 28px);
  overflow-y: auto;
  padding: 14px 12px;
  border-radius: var(--radius);
  background: var(--paper-glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow-1);
  scrollbar-width: thin;
  scrollbar-color: rgba(46, 46, 46, 0.25) transparent;
}
.loc-panel-title {
  margin: 2px 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.loc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.loc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: 500 13px/1.3 var(--sans);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.loc-row:hover { background: rgba(253, 185, 19, 0.18); }
.loc-row.is-active { background: var(--grey); color: #fff; }
.loc-num {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}
.loc-row.is-approx .loc-num {
  background: #fff;
  color: var(--grey);
  border: 1.5px dashed #8d8d8d;
}
.loc-label { flex: 1 1 auto; min-width: 0; }
.loc-approx-tag {
  flex: 0 0 auto;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.loc-row.is-active .loc-approx-tag { color: rgba(255, 255, 255, 0.7); }

/* ---------- chip scroller (mobile) ---------- */
.loc-chips {
  position: absolute;
  z-index: 850;
  left: 0; right: 0; bottom: 0;
  display: none;
  gap: 8px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, transparent, rgba(25, 25, 25, 0.22));
}
.loc-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px 7px 7px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: var(--paper-glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-1);
  font: 600 12px/1 var(--sans);
  color: var(--ink);
  cursor: pointer;
}
.chip-num {
  display: grid;
  place-items: center;
  min-width: 22px; height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
}
.chip.is-approx .chip-num {
  background: #fff;
  color: var(--grey);
  border: 1.5px dashed #8d8d8d;
}
.chip.is-active { background: var(--grey); border-color: var(--grey); color: #fff; }

/* ---------- intro card ---------- */
.intro-veil[hidden] { display: none; }
.intro-veil {
  position: absolute;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 28, 28, 0.34);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.intro-card {
  max-width: 440px;
  padding: 24px 26px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-2);
  border-top: 4px solid var(--accent);
}
.intro-card h2 { margin: 0 0 8px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.intro-card p { margin: 0 0 18px; font-size: 14px; line-height: 1.55; color: var(--ink-soft); }
.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 11px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 700 14px/1 var(--sans);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(160, 118, 8, 0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn-primary:hover { background: var(--accent-deep); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(160, 118, 8, 0.45); }

/* ---------- photosphere overlay ---------- */
.viewer-shell {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #161616;
  animation: viewer-in 0.22s ease-out;
}
/* `hidden` alone is overridden by the rules above — force it closed. */
.viewer-shell[hidden] { display: none; }
@keyframes viewer-in { from { opacity: 0; transform: scale(0.988); } }

#panorama { position: absolute; inset: 0; }

.viewer-bar {
  position: absolute;
  z-index: 20;
  top: 12px; left: 12px; right: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 14px;
  background: var(--dark-glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
}
.vp-num {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  min-width: 30px; height: 30px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}
.viewer-meta { flex: 1 1 auto; min-width: 0; }
.viewer-meta h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viewer-meta p {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viewer-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background 0.12s ease;
}
.viewer-close:hover { background: rgba(255, 255, 255, 0.12); }
.viewer-close svg { width: 20px; height: 20px; }

.vp-step {
  position: absolute;
  z-index: 20;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--dark-glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}
.vp-step:hover { background: rgba(65, 65, 65, 0.92); transform: translateY(-50%) scale(1.07); }
.vp-step svg { width: 22px; height: 22px; }
.vp-prev { left: 14px; }
.vp-next { right: 14px; }

.vp-hint {
  position: absolute;
  z-index: 20;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--dark-glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.vp-hint.is-on { opacity: 1; }

/* focus ring reads better in yellow on the dark viewer */
.viewer-shell :focus-visible { outline-color: var(--accent); }

/* brand Pannellum's loader + controls */
.pnlm-load-box {
  background: var(--dark-glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  font-family: var(--sans);
}
.pnlm-load-box p { font-size: 13px; color: #fff; }
.pnlm-lbar { border-color: rgba(255, 255, 255, 0.4); border-radius: 4px; }
.pnlm-lbar-fill { background: var(--accent); }
.pnlm-lmsg { font-family: var(--mono); font-size: 11px; color: rgba(255, 255, 255, 0.75); }
.pnlm-controls-container { top: auto; left: 16px; bottom: 20px; }

/* calibrate-mode readout (?calibrate=1) */
.calibrate-tip {
  position: fixed;
  left: 12px; bottom: 12px;
  z-index: 2000;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--dark-glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font: 600 11px/1.4 var(--mono);
  max-width: min(92vw, 720px);
  word-break: break-all;
}

/* ---------- embed mode (?embed=1) ---------- */
body.is-embed .topbar { display: none; }
body.is-embed .intro-veil { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .tagline { display: none; }
}
@media (max-width: 480px) {
  .brand-sub-prefix { display: none; }
}
@media (max-width: 760px) {
  .loc-panel { display: none; }
  .loc-chips { display: flex; }
  .leaflet-bottom .leaflet-control-attribution { margin-bottom: 64px; }
  .viewer-bar { top: 10px; left: 10px; right: 10px; gap: 10px; }
  .vp-step { top: auto; bottom: calc(24px + env(safe-area-inset-bottom)); transform: none; }
  .vp-step:hover { transform: scale(1.07); }
  .vp-prev { left: 16px; }
  .vp-next { right: 16px; }
  .vp-hint { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .pnlm-controls-container { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
