/* ================================================================
   css/pages/colorado-deep-dive.css — Colorado Deep Dive specific styles
   Depends on: css/site-theme.css, css/layout.css
   ================================================================ */

/* ----------------------------------------------------------------
   Tab navigation
   ---------------------------------------------------------------- */
.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--sp4);
  padding-bottom: 0;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted) !important;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  margin-bottom: -2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tab-btn:hover {
  background: var(--accent-dim);
  color: var(--accent) !important;
  border-color: color-mix(in srgb, var(--accent) 20%, transparent);
}

.tab-btn[aria-selected="true"] {
  background: var(--card);
  color: var(--accent) !important;
  border-color: var(--border) var(--border) var(--card);
  border-bottom: 2px solid var(--card);
  position: relative;
  bottom: -2px;
}

.tab-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ----------------------------------------------------------------
   Tab panels
   ---------------------------------------------------------------- */
.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
  animation: fadeInPanel 0.15s ease;
}

@keyframes fadeInPanel {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------------
   Section padding inside panels
   ---------------------------------------------------------------- */
.panel-section {
  margin-bottom: var(--sp5);
}

.panel-section:last-child {
  margin-bottom: 0;
}

/* ----------------------------------------------------------------
   Controls group (selects, filters)
   ---------------------------------------------------------------- */
.controls-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp2);
  align-items: flex-end;
  margin-bottom: var(--sp4);
}

.controls-group label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
}

.controls-group select {
  max-width: 300px;
}

/* ----------------------------------------------------------------
   Chart cards height
   ---------------------------------------------------------------- */
.chart-card {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg);
}

.chart-card-map {
  overflow: visible;
}

.chart-header {
  padding: var(--sp3) var(--sp4) var(--sp2);
}

.chart-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  color: var(--text) !important;
}

.chart-subtitle {
  font-size: 0.82rem;
  color: var(--muted) !important;
  margin: 0;
}

.chart-body {
  padding: var(--sp3) var(--sp4) var(--sp4);
}

.chart-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp3);
  margin-block: var(--sp3);
}

@media (max-width: 768px) {
  .chart-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ----------------------------------------------------------------
   Data table — responsive horizontal scroll on mobile
   ---------------------------------------------------------------- */
.data-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.data-table table {
  min-width: 520px;
}

/* ----------------------------------------------------------------
   CSV export button
   ---------------------------------------------------------------- */
.export-row {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--sp3);
}

/* ----------------------------------------------------------------
   Methodology / details accordion
   ---------------------------------------------------------------- */
.methodology-details {
  margin-top: var(--sp4);
}

.methodology-details summary {
  font-size: 0.9rem;
}

.methodology-body {
  padding: var(--sp3) var(--sp4);
  font-size: 0.88rem;
  line-height: 1.7;
}

.methodology-body p {
  font-size: 0.88rem;
  margin-bottom: var(--sp2);
}

/* ----------------------------------------------------------------
   Policy simulator sliders
   ---------------------------------------------------------------- */
.simulator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp4);
}

.simulator-controls {
  display: flex;
  flex-direction: column;
  gap: var(--sp3);
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-group input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  padding: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.slider-value {
  font-weight: 700;
  color: var(--accent) !important;
  font-size: 0.9rem;
}

.simulator-results {
  display: flex;
  flex-direction: column;
  gap: var(--sp3);
}

.before-after-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--sp3);
  align-items: center;
}

.before-after-row .arrow {
  color: var(--accent);
  font-size: 1.5rem;
  text-align: center;
}

@media (max-width: 768px) {
  .simulator-grid {
    grid-template-columns: 1fr;
  }

  .before-after-row {
    grid-template-columns: 1fr;
  }

  .before-after-row .arrow {
    transform: rotate(90deg);
  }
}

/* ----------------------------------------------------------------
   Market trends analysis text
   ---------------------------------------------------------------- */
.trends-prose {
  max-width: 80ch;
  line-height: 1.75;
}

.trends-prose h3 {
  margin-top: var(--sp4);
}

/* ----------------------------------------------------------------
   Responsive tab nav on mobile
   ---------------------------------------------------------------- */
@media (max-width: 640px) {
  .tab-nav {
    gap: 0.15rem;
  }

  .tab-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}

/* ----------------------------------------------------------------
   Intro card — page explanation + source attribution
   ---------------------------------------------------------------- */
.intro-card {
  padding: 1rem 1.25rem;
  background: var(--bg2, #e4ecf4);
  border: 1px solid var(--border, rgba(13, 31, 53, .12));
  border-radius: var(--radius-lg, 16px);
  margin-bottom: var(--sp4, 1.25rem);
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text, #0d1f35);
}

.intro-card p {
  margin: 0 0 0.5rem;
}

.intro-card p:last-child {
  margin-bottom: 0;
}

/* ----------------------------------------------------------------
   Small data-source attribution line
   ---------------------------------------------------------------- */
.data-sources-small {
  font-size: 11px;
  opacity: 0.75;
  line-height: 1.5;
}

.data-sources-small a {
  color: var(--link, var(--accent));
  text-decoration: none;
}

.data-sources-small a:hover {
  text-decoration: underline;
}
.page-hero {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent, #0a7e74) 15%, var(--bg, #f0f4f8)) 0%,
    var(--bg, #f0f4f8) 60%);
  border-radius: var(--radius-lg, 16px);
  padding: 2rem 2rem 1.5rem;
  margin-bottom: 1.5rem;
}

.page-hero .pill {
  display: inline-block;
  background: color-mix(in srgb, var(--accent, #0a7e74) 15%, transparent);
  color: var(--accent, #0a7e74);
  border: 1px solid color-mix(in srgb, var(--accent, #0a7e74) 30%, transparent);
  border-radius: 999px;
  padding: 3px 14px;
  font-size: var(--tiny);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.page-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.page-hero .hero-subtitle {
  font-size: 1rem;
  color: var(--muted, #476080);
  line-height: 1.6;
  max-width: 70ch;
  margin-bottom: 0;
}

/* ----------------------------------------------------------------
   Data freshness badge
   ---------------------------------------------------------------- */
.freshness-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--muted, #476080);
  background: var(--bg2, #e4ecf4);
  border: 1px solid var(--border, rgba(13, 31, 53, .12));
  border-radius: 999px;
  padding: 2px 10px;
  vertical-align: middle;
}

.freshness-badge::before {
  content: '🕐';
  font-size: 0.7rem;
}

/* ----------------------------------------------------------------
   Card hover micro-interactions
   ---------------------------------------------------------------- */
.kpi-card,
.chart-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card.is-hovered,
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .10);
}

.chart-card.is-hovered,
.chart-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, .08);
}

/* ----------------------------------------------------------------
   Loading overlay (managed by ui-interactions.js)
   ---------------------------------------------------------------- */
.ui-relative {
  position: relative;
}

.ui-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: color-mix(in srgb, var(--card, #fff) 85%, transparent);
  backdrop-filter: blur(4px);
  border-radius: inherit;
  z-index: 10;
}

.ui-spinner {
  display: inline-block;
  width: 1.75rem;
  height: 1.75rem;
  border: 3px solid var(--border, rgba(13, 31, 53, .12));
  border-top-color: var(--accent, #0a7e74);
  border-radius: 50%;
  animation: ui-spin 0.7s linear infinite;
}

@keyframes ui-spin {
  to { transform: rotate(360deg); }
}

.ui-loading-msg {
  font-size: 0.85rem;
  color: var(--muted, #476080);
}

/* ----------------------------------------------------------------
   Tab help / guide section
   ---------------------------------------------------------------- */
.tab-guide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: var(--sp4, 1.25rem);
  padding: 1.25rem;
  background: var(--bg2, #e4ecf4);
  border: 1px solid var(--border, rgba(13, 31, 53, .12));
  border-radius: var(--radius-lg, 16px);
}

.tab-guide-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.tab-guide-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.tab-guide-title {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  color: var(--text, #0d1f35);
}

.tab-guide-desc {
  font-size: 0.8rem;
  color: var(--muted, #476080);
  line-height: 1.5;
  margin: 0;
}


/* ----------------------------------------------------------------
   Map container sizing (Leaflet requires explicit height)
   ---------------------------------------------------------------- */
#coMap{
  height: 560px;
  min-height: 580px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.06);
}
@media (max-width: 900px){
  #coMap{ height: 440px; min-height: 440px; }
}

/* Improve readability for tables and long content blocks */
.data-table table{
  width: 100%;
  border-collapse: collapse;
}
.data-table th,
.data-table td{
  padding: .55rem .6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
  font-size: .9rem;
  line-height: 1.25;
}
.data-table th{
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.06);
  color: var(--text-strong, var(--text));
  font-weight: 700;
}

/* Small, readable attribution text */
.data-sources-small{
  font-size: 11px;
  color: var(--muted);
  opacity: .82;
}
