/* ============================================================
   Vienna Living Cost Visualizer — CSS
   Font: Space Grotesk (display) + Inter (body)
   Palette: dark ink background, amber accent, warm off-white
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Inter:wght@300;400;500&display=swap');

:root {
  --bg:        #0e0f13;
  --surface:   #181920;
  --border:    #2a2b35;
  --text:      #e8e6df;
  --muted:     #7a7a8c;
  --accent:    #f5a623;
  --accent2:   #e05c5c;
  --in-color:  #5b9cf6;
  --out-color: #f5705b;
  --green:     #4ecb8d;
  --yellow:    #f5d76e;
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
}

/* ── HERO ─────────────────────────────────────────────────── */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0 8vw;
  background: radial-gradient(ellipse at 70% 50%, rgba(26, 27, 46, 0.45) 0%, var(--bg) 90%);
  position: relative;
  overflow: hidden;
}

#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Ccircle cx='30' cy='30' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}

.hero-video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%);
  object-fit: cover;
  z-index: 0; /* Placed behind everything inside #hero */
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 780px;
}

.hero-title, .hero-subtitle, .hero-eyebrow .hero-scroll-hint {
  
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.hero-eyebrow {
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.2rem;
}

.hero-title {
  font-family: var(--font-head);
  font-size: clamp(2.8rem, 6vw, 5.5rem);
  font-weight: 700;
  line-height: 1.05;
  max-width: 780px;
  margin-bottom: 1.5rem;
}

.hero-title em {
  font-style: normal;
  color: var(--accent);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text);
  max-width: 520px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-head);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  padding: 0.7rem 1.4rem;
  border-radius: 2px;
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
  background: transparent;
}
.hero-cta:hover { background: var(--accent); color: var(--bg); }

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  
  
  color: var(--text); 
  
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8); 
  
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 2;
}
.scroll-arrow {
  width: 30px;
  height: 50px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scrollpulse 1.2s infinite;
}
@keyframes scrollpulse {
  0%,100% { opacity: 0.5; } 50% { opacity: 1; }
}

/* ── INTERSTITIAL: OTHER FACTORS ──────────────────────────── */
#other-factors {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8vh 8vw;
  background: radial-gradient(ellipse at 30% 40%, #1a1b2e 0%, var(--bg) 70%);
  border-top: 1px solid var(--border);
}
.of-inner {
  max-width: 760px;
  text-align: left;
}
.of-eyebrow {
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.2rem;
}
.of-title {
  font-family: var(--font-head);
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.12;
  margin-bottom: 1.6rem;
}
.of-title em { font-style: normal; color: var(--accent); }
.of-lead {
  font-size: 1.15rem;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 2rem;
}
.of-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.of-reveal.revealed { opacity: 1; transform: translateY(0); }
.of-reveal p {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 1rem;
}
.of-reveal strong { color: var(--green); }
.of-small { font-size: 0.92rem !important; font-style: italic; }
.of-scroll-hint {
  margin-top: 2.5rem;
  font-size: 1.4rem;
  color: var(--muted);
  animation: scrollpulse 2s infinite;
}

/* ── SCROLLY LAYOUT ───────────────────────────────────────── */
#scrolly {
  position: relative;
  display: flex;
  gap: 0;
}

#sticky-viz {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 58%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

#viz-container {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Each viz panel */
.viz-panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  overflow: hidden;
  max-height: 100%;
}
.viz-panel.active {
  opacity: 1;
  pointer-events: all;
}

/* ── NARRATIVE STEPS ──────────────────────────────────────── */
#steps {
  width: 42%;
  padding: 0 5vw;
}

.step {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 0;
  opacity: 0.35;
  transition: opacity 0.4s;
}
.step.is-active { opacity: 1; }

.step-num {
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.8rem;
}

.step h2 {
  font-family: var(--font-head);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.9rem;
}

.step p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 0.8rem;
}

.step p strong { color: var(--text); }

.callout {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 0.9rem 1.1rem;
  border-radius: 0 4px 4px 0;
  font-size: 0.9rem;
  color: var(--text);
  margin-top: 1rem;
}
.callout .big { font-size: 1.5rem; font-weight: 700; color: var(--accent); font-family: var(--font-head); }

/* ── EXPLORER SECTION ─────────────────────────────────────── */
#explorer-section {
  padding: 6rem 8vw;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

#explorer-section h2 {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
#explorer-section .sub {
  color: var(--muted);
  margin-bottom: 2.5rem;
  font-size: 0.95rem;
}

.explorer-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  align-items: start;
}

.explorer-controls {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.control-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.control-group input[type=range] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.control-group select {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
}
.control-group select:focus { outline: 1px solid var(--accent); }

.range-val {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
  margin-top: 0.3rem;
}

.match-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.5rem;
}
.match-summary span {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--green);
  display: block;
}
.match-summary .match-list {
  margin-top: 0.5rem;
  color: var(--text);
  font-size: 0.85rem;
}

#explorer-map { width: 100%; height: 600px; }

/* ── TOOLTIP ──────────────────────────────────────────────── */
#tooltip {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 1000;
  display: none;
  min-width: 180px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#tooltip .tt-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}
#tooltip .tt-row { display: flex; justify-content: space-between; gap: 1rem; margin: 0.2rem 0; }
#tooltip .tt-label { color: var(--muted); }
#tooltip .tt-val { font-weight: 500; color: var(--text); }

/* ── CONTROLS INSIDE SCROLLY VIZ ─────────────────────────── */
.viz-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.btn-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-family: var(--font-head);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-toggle:hover, .btn-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.viz-title {
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── LEGEND ───────────────────────────────────────────────── */
.legend {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── YEAR SLIDER ──────────────────────────────────────────── */
.year-slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  width: 90%;
}
.year-slider-wrap input[type=range] {
  flex: 1;
  accent-color: var(--accent);
}
.year-label {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--accent);
  min-width: 36px;
  text-align: right;
}

/* ── FOOTER ───────────────────────────────────────────────── */
footer {
  padding: 2rem 8vw;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ── SVG DEFAULTS ─────────────────────────────────────────── */
.axis text { fill: var(--muted); font-size: 0.72rem; font-family: var(--font-body); }
.axis path, .axis line { stroke: var(--border); }
.district-path { stroke: var(--bg); stroke-width: 0.8px; cursor: pointer; transition: opacity 0.2s; }
.district-path:hover { opacity: 0.8; stroke-width: 2px; stroke: white; }
.district-path.highlighted { stroke: var(--green); stroke-width: 2px; }
.district-path.dimmed { opacity: 0.25; }

.scatter-dot { cursor: pointer; transition: r 0.15s; }
.scatter-dot:hover { stroke: white; stroke-width: 1.5px; }
.scatter-dot.linked { stroke: var(--accent); stroke-width: 2px; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 900px) {
  #scrolly { flex-direction: column; }
  #sticky-viz { width: 100%; height: 60vh; position: relative; border-right: none; border-bottom: 1px solid var(--border); }
  #steps { width: 100%; padding: 0 6vw; }
  .explorer-layout { grid-template-columns: 1fr; }
  #explorer-map { height: 340px; }
}
