/* ==========================================================================
   CALIMARIUS — CALIFORNIA TRAVEL GUIDE
   Minimalist & Architectural Design System
   Tone of the California State Highway Sign (Route 929)
   ========================================================================== */

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

:root {
  /* Core Highway Sign Palette */
  --c-highway-green: #006A4E;
  --c-highway-green-bright: #00875A;
  --c-highway-green-deep: #063B2C;
  --c-highway-green-dark: #04251B;
  --c-highway-green-tint: rgba(0, 106, 78, 0.15);

  /* Backgrounds & Surfaces */
  --c-bg-main: #06110D;
  --c-bg-surface: rgba(6, 25, 18, 0.96);
  --c-bg-card: rgba(8, 31, 23, 0.97);
  --c-bg-card-hover: rgba(11, 39, 29, 0.98);
  --c-bg-elevated: #12382B;
  --c-paper: #ECE7DA;
  --c-paper-ink: #14221B;
  --c-paper-muted: #526158;

  /* Editorial & Highway Sign Contrast */
  --c-sign-white: #FFFFFF;
  --c-sign-border: rgba(255, 255, 255, 0.12);
  --c-sign-border-bright: rgba(255, 255, 255, 0.25);
  --c-text-primary: #FFFFFF;
  --c-text-secondary: #9DB5A9;
  --c-text-muted: #648175;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Space Grotesk', -apple-system, monospace;

  /* Radii - restrained, sign-inspired corners */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;

  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.35s cubic-bezier(0.16, 1, 0.3, 1);

  --container-max: 1360px;
  --header-height: 80px;
}

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

html {
  font-size: 16px;
  background-color: var(--c-bg-main);
  color: var(--c-text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  position: relative;
  background-color: transparent;
  color: var(--c-text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Minimalist Grain */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--c-text-primary);
}

.font-mono {
  font-family: var(--font-mono);
}

p {
  color: var(--c-text-secondary);
  font-weight: 400;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: transparent;
}

/* Layout Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1.5rem, 5vw, 3.5rem);
  padding-right: clamp(1.5rem, 5vw, 3.5rem);
}

.section-spacing {
  padding-top: clamp(5rem, 9vw, 8rem);
  padding-bottom: clamp(5rem, 9vw, 8rem);
  position: relative;
}

/* Highway Badges & Tags */
.highway-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.85rem;
  background: var(--c-highway-green);
  border: 1.5px solid var(--c-sign-white);
  border-radius: 6px;
  color: var(--c-sign-white);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.highway-badge-small {
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  border-width: 1px;
}

.highway-badge .route-number {
  background: var(--c-sign-white);
  color: var(--c-highway-green);
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  font-weight: 800;
  font-size: 0.72rem;
}

.minimal-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-text-secondary);
  margin-bottom: 0.85rem;
}

.minimal-tag svg {
  color: var(--c-highway-green-bright);
}


/* ==========================================================================
   Navigation Bar
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 99999;
  background: transparent;
  transition: background 0.3s ease, height 0.3s ease;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: none;
}

.site-header.scrolled {
  height: 70px;
}

.nav-container {
  height: 100%;
  width: calc(100% - 2rem);
  max-width: 1320px;
  margin: 0 auto;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(4, 37, 27, 0.56));
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-top: none;
  border-radius: 0 0 22px 22px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.28);
  transition: height 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
  pointer-events: auto;
}

.site-header.scrolled .nav-container {
  background: linear-gradient(135deg, rgba(9, 31, 24, 0.88), rgba(4, 37, 27, 0.94));
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.38);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo-img {
  height: 42px;
  width: auto;
  border-radius: 6px;
  transition: transform var(--transition-fast);
}

.brand-wrapper:hover .brand-logo-img {
  transform: scale(1.03);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--c-sign-white);
  line-height: 1;
}

.brand-subtitle {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--c-text-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem;
  list-style: none;
}

.nav-link {
  font-family: var(--font-sans);
  padding: 0.65rem clamp(0.55rem, 0.8vw, 0.85rem);
  border-radius: 11px;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.nav-link:hover {
  color: var(--c-sign-white);
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.nav-link.active {
  color: var(--c-sign-white);
  background: var(--c-highway-green);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-audio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: var(--c-bg-surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--c-sign-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--c-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-audio-toggle:hover {
  background: var(--c-bg-card);
  color: var(--c-sign-white);
  border-color: var(--c-sign-border-bright);
}

.btn-audio-toggle.playing {
  background: var(--c-highway-green-deep);
  border-color: var(--c-highway-green-bright);
  color: var(--c-sign-white);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.65rem 1.4rem;
  background: var(--c-highway-green);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--c-sign-white);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background: var(--c-highway-green-bright);
  border-color: var(--c-sign-white);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.65rem 1.4rem;
  background: rgba(10, 28, 22, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--c-sign-border-bright);
  color: var(--c-sign-white);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--c-bg-card);
  border-color: var(--c-sign-white);
}

/* Mobile Menu Toggle */
.mobile-nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
}

.mobile-nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--c-sign-white);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.mobile-nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
.mobile-nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   Telemetry Status Bar
   ========================================================================== */
.live-status-bar {
  width: 100%;
  margin-top: 0;
  position: absolute;
  top: calc(var(--header-height) + 0.8rem);
  left: 0;
  background: transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: none;
  padding: 0.65rem 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  z-index: 20;
}

.live-status-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.live-status-content::-webkit-scrollbar {
  display: none;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--c-highway-green-bright);
  font-weight: 600;
}

.live-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--c-highway-green-bright);
  animation: pulseLive 2s infinite ease-in-out;
}

@keyframes pulseLive {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 10px var(--c-highway-green-bright); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.live-stat-item {
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  background: rgba(4, 24, 17, 0.48);
  color: var(--c-text-secondary);
  white-space: nowrap;
}

.live-stat-item strong {
  color: var(--c-sign-white);
}

/* Section Header Typography */
.section-header {
  margin-bottom: 3.5rem;
}

.section-header.text-center {
  text-align: center;
}

.section-header.text-center .minimal-tag {
  justify-content: center;
}

.section-title {
  font-size: clamp(2rem, 3.8vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.section-subtitle {
  font-size: clamp(0.95rem, 1.2vw, 1.15rem);
  color: var(--c-text-secondary);
  max-width: 680px;
  line-height: 1.6;
}

.section-header.text-center .section-subtitle {
  margin-left: auto;
  margin-right: auto;
}

/* Grids */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

/* SVG Minimal Stroke Icons */
.icon-svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Site Footer */
.site-footer {
  background: rgba(6, 17, 13, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--c-sign-border);
  padding: 5rem 0 2.5rem;
  margin-top: 5rem;
  position: relative;
  z-index: 10;
}

.footer-top-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: 3rem;
  margin-bottom: 4rem;
}

.footer-brand-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.footer-logo-img {
  height: 38px;
  width: auto;
  border-radius: 4px;
}

.footer-tagline {
  font-size: 0.9rem;
  color: var(--c-text-secondary);
  max-width: 320px;
  line-height: 1.6;
}

.footer-col-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-sign-white);
  margin-bottom: 1.5rem;
}

.footer-links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-links-list a {
  font-size: 0.88rem;
  color: var(--c-text-secondary);
  transition: color var(--transition-fast);
}

.footer-links-list a:hover {
  color: var(--c-highway-green-bright);
}

.footer-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2rem;
  border-top: 1px solid var(--c-sign-border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--c-text-muted);
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 992px) {
  .nav-links {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background: rgba(6, 17, 13, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 2.5rem;
    gap: 1.5rem;
    transform: translateY(-150%);
    transition: transform var(--transition-normal);
    border-bottom: 1px solid var(--c-sign-border);
  }

  .nav-links.open {
    transform: translateY(0);
  }

  .mobile-nav-toggle {
    display: flex;
  }

  .footer-top-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav-container {
    gap: 0.75rem;
  }

  .brand-wrapper {
    gap: 0.65rem;
  }

  .brand-title {
    font-size: 1.05rem;
  }

  .brand-subtitle {
    font-size: 0.55rem;
  }

  .nav-actions {
    gap: 0.5rem;
  }

  .nav-actions > .btn-primary,
  .nav-actions > .btn-audio-toggle {
    display: none;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .footer-top-grid {
    grid-template-columns: 1fr;
  }
}

/* Editorial navigation: one clear CTA, everything else stays quiet. */
.nav-link {
  padding: 0.65rem clamp(0.45rem, 0.75vw, 0.78rem);
  border-bottom: 0;
  border-radius: 0;
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--c-sign-white);
  background: transparent;
  transform: none;
}

.nav-link.active {
  color: var(--c-sign-white);
  background: transparent;
  box-shadow: none;
}

.btn-audio-toggle {
  padding-inline: 0.25rem;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-color: transparent;
  border-radius: 0;
}

.btn-audio-toggle:hover,
.btn-audio-toggle.playing {
  background: transparent;
  border-color: transparent;
  color: var(--c-sign-white);
}

.btn-primary,
.btn-secondary {
  border-radius: 3px;
  box-shadow: none;
}

/* ========================================================================== 
   Responsive navigation and page rhythm
   ========================================================================== */
@media (max-width: 1280px) {
  .nav-links {
    position: fixed;
    top: calc(var(--header-height) + 0.5rem);
    left: 0.75rem;
    width: calc(100% - 1.5rem);
    max-height: calc(100svh - var(--header-height) - 1rem);
    padding: 1rem 1.25rem 1.25rem;
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 0.1rem;
    overflow-y: auto;
    background: rgba(5, 22, 16, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 2px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-1rem);
    visibility: hidden;
    transition: opacity var(--transition-normal), transform var(--transition-normal), visibility 0s linear var(--transition-normal);
  }

  .nav-links.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
    transition-delay: 0s;
  }

  .nav-links li,
  .nav-links .nav-link {
    width: 100%;
  }

  .nav-links .nav-link {
    min-height: 44px;
    padding: 0.78rem 0.2rem;
    display: flex;
    align-items: center;
  }

  .mobile-nav-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-actions > .btn-primary,
  .nav-actions > .btn-audio-toggle {
    display: none;
  }

  body.nav-open {
    overflow: hidden;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 68px;
  }

  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .section-spacing {
    padding-top: 4.35rem;
    padding-bottom: 4.35rem;
  }

  .section-header {
    margin-bottom: 2.25rem;
  }

  .section-title {
    font-size: clamp(1.9rem, 8vw, 2.55rem);
    line-height: 1.05;
  }

  .section-subtitle {
    font-size: 0.95rem;
    line-height: 1.55;
  }

  .nav-container {
    width: calc(100% - 1rem);
    padding: 0.4rem 0.7rem;
    gap: 0.65rem;
    border-radius: 0 0 15px 15px;
  }

  .site-header.scrolled {
    height: 64px;
  }

  .brand-logo-img {
    height: 38px;
  }

  .brand-wrapper {
    min-width: 0;
  }

  .brand-text {
    min-width: 0;
  }

  .brand-title {
    font-size: 0.98rem;
    letter-spacing: 0.055em;
  }

  .brand-subtitle {
    font-size: 0.5rem;
    letter-spacing: 0.09em;
  }

  .nav-links {
    top: calc(var(--header-height) + 0.35rem);
    left: 0.5rem;
    width: calc(100% - 1rem);
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .btn-primary,
  .btn-secondary,
  .filter-btn,
  .region-tab-btn,
  .preset-card-btn {
    min-height: 44px;
  }

  .site-footer {
    margin-top: 0;
    padding: 4rem 0 2rem;
  }

  .footer-top-grid {
    gap: 2.25rem;
    margin-bottom: 3rem;
  }

  .footer-col-title {
    margin-bottom: 1rem;
  }

  .footer-bottom-bar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 390px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .brand-subtitle {
    display: none;
  }
}

section[id] {
  scroll-margin-top: calc(var(--header-height) + 0.75rem);
}

@media (min-width: 641px) and (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4,
  .footer-top-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
