/* ==========================================================================
   DECOLONISE — TASTE-SKILL + SCROLL-CRAFT DESIGN SYSTEM
   Skills: leonxlnx/taste-skill + nateherkai/scroll-craft (filmic-one-shot)
   Design Read: Civic Architecture & Filmic Investigative Scrollytelling
   Dials: DESIGN_VARIANCE=9 | MOTION_INTENSITY=7 | VISUAL_DENSITY=5
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap');

:root {
  --surface-paper: #F5F4EE;
  --surface-card: #FFFFFF;
  --surface-ink: #0B0F19;
  --surface-ink-elevated: #111827;
  --border-hairline: #E2DFD5;
  --accent-vermilion: #EA580C;
  --accent-emerald: #059669;
  --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
  --scroll-progress: 0;
  --header-h: 4.25rem;
}

@media (min-width: 1024px) {
  :root {
    --header-h: 5.5rem;
  }
}

html {
  background-color: var(--surface-paper);
  color: #0F172A;
  scrollbar-gutter: stable;
  scroll-padding-top: calc(var(--header-h) + 0.75rem);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  background-color: var(--surface-paper) !important;
  background-image:
    radial-gradient(rgba(15, 23, 42, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Editorial Serif Accent */
.font-editorial {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* Mandatory Tabular Numerals for Fiscal, Timecode & Civic Data */
.font-mono,
.tabular-nums,
table,
td,
th,
input[type="range"] {
  font-variant-numeric: tabular-nums;
}

/* Architectural Blueprint Backdrops for Interactive SVG Canvases */
.taste-blueprint-dark {
  background-color: #0B111E;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.07) 1px, transparent 1px);
  background-size: 28px 28px;
}

.taste-blueprint-light {
  background-color: #F8FAFC;
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ==========================================================================
   SCROLL-CRAFT + GOOGLE MODERN WEB GUIDANCE: FLUID VIEWPORT PINNED STAGES
   - Uses dynamic viewport height (100dvh) + flex min-h-0 so pinned stages
     never clip or lose content on 720px–1440px desktop screens
   - Uses compositor CSS Scroll-Driven Animations (@supports animation-timeline)
   - Gracefully unpins on short viewports (<620px), mobile, or Manual Mode
   ========================================================================== */

@media (min-width: 1024px) and (min-height: 620px) {
  .scrollcraft-track-6 {
    min-height: calc(100dvh + 5 * 56dvh);
    position: relative;
  }

  .scrollcraft-track-5 {
    min-height: calc(100dvh + 4 * 56dvh);
    position: relative;
  }

  .scrollcraft-track-4 {
    min-height: calc(100dvh + 3 * 56dvh);
    position: relative;
  }

  .scrollcraft-sticky-stage {
    position: sticky;
    top: calc(var(--header-h, 5.5rem) + 0.5rem);
    height: calc(100dvh - var(--header-h, 5.5rem) - 1rem);
    max-height: 920px;
    display: flex;
    flex-direction: column;
    z-index: 20;
    container-type: inline-size;
  }
}

/* Internal scrollable side panels never hijack page scroll momentum */
.stage-scroll-panel {
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

/* Native Popover API / Dropdown Switcher Polish */
.city-switcher-popover {
  overscroll-behavior: contain;
  transition: opacity 0.16s var(--ease-out-expo), transform 0.16s var(--ease-out-expo);
}

@supports (selector(:popover-open)) {
  [popover].city-switcher-popover {
    margin: 0;
    inset: auto;
  }
}

/* When user toggles Manual Mode, release extra scroll height so page flows normally */
.scrollcraft-manual-mode .scrollcraft-track-6,
.scrollcraft-manual-mode .scrollcraft-track-4,
.scrollcraft-manual-mode .scrollcraft-track-5 {
  min-height: auto !important;
}

.scrollcraft-manual-mode .scrollcraft-sticky-stage {
  position: relative !important;
  top: 0 !important;
  height: auto !important;
  max-height: none !important;
}

/* Filmic Feeling-Curve Progress Bar (Fallback + Compositor Scroll-Driven Upgrade) */
.scrollcraft-progress-bar {
  background: linear-gradient(90deg, #EF4444 0%, #EA580C 38%, #F59E0B 65%, #10B981 100%);
  transition: width 0.08s linear;
}

@keyframes scrollcraftCompositorProgress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@supports (animation-timeline: scroll()) {
  .scrollcraft-progress-bar {
    width: 100% !important;
    transform-origin: 0 50%;
    transition: none;
    will-change: transform;
    animation: scrollcraftCompositorProgress linear both;
    animation-timeline: scroll(root block);
  }
}

/* Interactive SVG Street Hotspots & Governance Shapes */
.street-hotspot {
  cursor: pointer;
  transition: transform 0.28s var(--ease-out-expo), filter 0.28s var(--ease-out-expo), opacity 0.25s ease;
  transform-box: fill-box;
  transform-origin: center;
}

.street-hotspot:hover {
  transform: translateY(-3px) scale(1.02);
  filter: drop-shadow(0 8px 16px rgba(234, 88, 12, 0.32));
}

.street-hotspot-active {
  filter: drop-shadow(0 0 18px rgba(249, 115, 22, 0.55));
}

/* Animated SVG Flow Paths (Tax Siphon & Command Wires) */
@keyframes dashFlowUp {
  to {
    stroke-dashoffset: -36;
  }
}

@keyframes dashFlowDown {
  to {
    stroke-dashoffset: 36;
  }
}

@keyframes pulseHalo {
  0%, 100% {
    opacity: 0.35;
    transform: scale(0.96);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.06);
  }
}

@keyframes reticleSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.svg-flow-up {
  stroke-dasharray: 8 10;
  animation: dashFlowUp 1.3s linear infinite;
}

.svg-flow-down {
  stroke-dasharray: 8 10;
  animation: dashFlowDown 1.3s linear infinite;
}

.svg-pulse-halo {
  transform-box: fill-box;
  transform-origin: center;
  animation: pulseHalo 2.2s ease-in-out infinite;
}

.svg-reticle-spin {
  transform-box: fill-box;
  transform-origin: center;
  animation: reticleSpin 14s linear infinite;
}

/* ==========================================================================
   SCROLL-CRAFT SIGNATURE MOVE: CIVIC X-RAY REWIRE CURTAIN & SCRUBBER
   ========================================================================== */
.xray-range-slider {
  width: 100%;
  height: 8px;
  border-radius: 9999px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(148, 163, 184, 0.28);
  cursor: ew-resize;
}

.xray-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  background: #10B981;
  border: 3px solid #FFFFFF;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.35), 0 6px 16px rgba(2, 6, 23, 0.65);
  cursor: ew-resize;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.xray-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.12);
  background: #34D399;
}

.xray-range-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  background: #10B981;
  border: 3px solid #FFFFFF;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.35), 0 6px 16px rgba(2, 6, 23, 0.65);
  cursor: ew-resize;
}

/* Refined Card Elevation Across All Pages */
main > section,
main .scrollcraft-stage-card {
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.03),
    0 14px 36px -12px rgba(15, 23, 42, 0.08);
}

/* Respect Reduced Motion (Mandatory Scroll-Craft Design Floor) */
@media (prefers-reduced-motion: reduce) {
  .svg-flow-up,
  .svg-flow-down,
  .svg-pulse-halo,
  .svg-reticle-spin,
  .street-hotspot {
    animation: none !important;
    transition: none !important;
  }

  .scrollcraft-track-6,
  .scrollcraft-track-4,
  .scrollcraft-track-5 {
    min-height: auto !important;
  }

  .scrollcraft-sticky-stage {
    position: relative !important;
    top: 0 !important;
    height: auto !important;
    max-height: none !important;
  }
}
