:root {
  color-scheme: dark light;

  /* Theme tokens (light defaults) */
  --bg:           #f3f5f9;   /* softer than pure white */
  --bg-accent:    radial-gradient(1200px 800px at 20% -10%, #f4f7fb, #eef2f7 45%, #e9edf3 100%);
  --ink:          #0f172a;   /* slate-900 */
  --muted-ink:    rgba(15, 23, 42, .70);
  --surface:      #f0f3f8;   /* off-white surface */
  --surface-2:    #eceff4;   /* input surface */
  --border:       #d8dee7;   /* softer than #cbd5e1 */
  --focus:        rgba(8, 145, 178, .22);
  --primary:      #0e7490;   /* dimmed cyan (less glare) */
  --primary-ink:  #ffffff;
  --hi-bg:        rgba(14, 116, 144, .08);
  --hi-border:    rgba(14, 116, 144, .35);

  /* Typography & radii */
  --radius: 1rem;
  --radius-sm: .75rem;

  /* Layout helpers */
  --header-height: 64px;
}

/* Dark theme overrides (unchanged feel) */
body.dark {
  --bg:        #0b1220;
  --bg-accent: radial-gradient(1200px 800px at 20% -10%, #0b1324, #0b1220 35%, #070a12 100%);
  --ink:       #e5e7eb;
  --muted-ink: rgba(229, 231, 235, .75);
  --surface:   rgba(15,23,42,.60);
  --surface-2: rgba(30,41,59,.70);
  --border:    #1f2937;
  --focus:     rgba(34, 211, 238, .30);
  --primary:   #0891b2;
  --primary-ink:#ffffff;
  --hi-bg:     rgba(34,211,238,.08);
  --hi-border: rgba(34,211,238,.50);
}

/* Light theme background (softer than pure white) */
body.light { background: var(--bg-accent); color: var(--ink);
--bg:           #02e4e8;   /* softer than pure white */
 --surface:   #d0e3f8; /* was #fbfcfe */
  --surface-2: #eceff4; /* was #f7f9fc */ }
body.dark  { background: var(--bg-accent); color: var(--ink); }

/* --- Global responsiveness & safety --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  transition: background-color .2s ease, color .2s ease, background-image .2s ease;
  min-height: 100svh; /* modern mobile vh */
  overflow-x: hidden; /* kill horizontal scroll on narrow screens */
  padding-top: env(safe-area-inset-top); /* notch-safe */
}
img, video, canvas, svg { max-width: 100%; height: auto; display: block; }
:where(p, h1, h2, h3, h4, h5, h6, .card, .section){ overflow-wrap: anywhere; }

/* Layout utilities */
.max-w-6xl { max-width: 72rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-6 { padding: 1.5rem; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.flex { display: flex; min-width: 0; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-4 { gap: 1rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.space-y-3 > * + * { margin-top: .75rem; }

/* Cards & emphasis */
.card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1rem;
  background: var(--surface);
  /* subtle lift in light mode to separate surfaces without glare */
  box-shadow: 0 1px 2px rgba(2, 6, 23, .04), 0 2px 6px rgba(2, 6, 23, .06);
}
.hi {
  border-color: var(--hi-border) !important;
  background: var(--hi-bg) !important;
}
.hi .value { color: var(--primary); }

/* Buttons */
.btn {
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
  touch-action: manipulation;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
}
.btn-primary:hover { filter: brightness(1.04); }

/* Inputs */
.input, .select {
  width: 100%;
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
  outline: none;
  border: 1px solid var(--border);
  box-sizing: border-box;
  background: var(--surface-2);
  color: var(--ink);
}
.input:focus, .select:focus {
  box-shadow: 0 0 0 3px var(--focus);
  border-color: var(--primary);
}

/* Text helpers */
.muted { font-size: 12px; color: var(--muted-ink); }

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

/* Tablets and down: ease to 2-up */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}

/* Small phones: 1-up; hide verbose footers; full-width buttons */
@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .card .foot { display: none; }
  .btn { width: 100%; }
  .p-6 { padding: 1rem; } /* tighter gutters on tiny screens */
}

/* (Legacy) safety for older breakpoints — fixed to avoid overriding 640px rule */
@media (min-width: 641px) and (max-width: 768px) {
  .grid-3, .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Utilities */
.inline-input { display:flex; gap:.5rem; align-items:center; }
.link { text-decoration: none; color: inherit; }
.link:hover { text-decoration: underline; }

/* Optional section wrapper */
.section { padding: 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
/* ===== Alive, but classy ===== */

/* Smooth hover micro-interactions */
.card {
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease, background-color .25s ease;
}
body.dark .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(2, 6, 23, .35);
}
body.light .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
}

/* Buttons: subtle press + focus ring already handled by :focus styles */
.btn { transition: transform .08s ease, filter .2s ease; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:hover { filter: brightness(1.04); }

/* Hero image: gentle bobbing so the page breathes */
.hero-img {
  display: block;
  max-width: 100%;
  height: auto;
  animation: floatY 5s ease-in-out infinite;
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.15));
}

/* Highlighted metric cards keep a living accent glow */
.card.hi {
  position: relative;
  box-shadow: 0 0 0 rgba(34,211,238,0);
  animation: hiPulse 6s ease-in-out infinite;
}

/* Scroll-reveal: elements appear as you scroll */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Accent underline for section headings (adds motion without clutter) */
.section h2,
.section h3 {
  position: relative;
}
.section h2::after,
.section h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 42px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #22d3ee 0%, #06b6d4 100%);
  opacity: .9;
  animation: barGlow 5.5s ease-in-out infinite;
}

/* Keyframes */
@keyframes floatY {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-6px); }
}

@keyframes hiPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(34,211,238,0.12); }
  50%      { box-shadow: 0 0 24px rgba(34,211,238,0.24); }
}

@keyframes barGlow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(34,211,238,0.0)); }
  50%      { filter: drop-shadow(0 2px 6px rgba(34,211,238,0.45)); }
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
  .hero-img,
  .card.hi,
  .section h2::after,
  .section h3::after {
    animation: none !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
/* Reveal-on-scroll opt-in */
.revealable {
  opacity: .001;
  transform: translateY(10px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal-visible {
  opacity: 1;
  transform: none;
}

/* Footer must never be hidden (override any previous rule) */
footer.footer.section {
  opacity: 1 !important;
  transform: none !important;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .revealable {
    opacity: 1 !important;
    transform: none !important;
  }
}
/* === Alive/flash chips === */
.flash-layer {
  position: relative;
  height: 196px;      /* room under buttons for chips */
  margin-top: .8rem;
  overflow: visible; /* allow float outside container a bit */
}
@media (max-width: 480px){
  .flash-layer { height: 140px; } /* prevent overflow on tiny phones */
}

.flash-card {
  position: absolute;
  padding: .45rem .7rem;
  border-radius: .75rem;
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .2px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 12px) scale(.92);
  border: 1px solid rgba(255,255,255,.08);
  animation: flash-in 2.8s ease-out forwards;
  box-shadow:
    0 6px 18px rgba(0,0,0,.18),
    inset 0 1px 0 rgba(255,255,255,.06);
  background: var(--bg, linear-gradient(135deg,#14b8a6,#06b6d4));
  color: var(--fg, #071521);
  backdrop-filter: blur(2px);
}

/* Slightly different surface for light vs dark */
body.dark .flash-card { border-color: rgba(34,211,238,.28); color: #0b1220; }
body.light .flash-card {
  border-color: rgba(2,6,23,.06);
  box-shadow:
    0 8px 20px rgba(2,6,23,.08),
    inset 0 1px 0 rgba(2,6,23,.05);
}

/* Glow pulse ring */
.flash-card::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 1rem;
  background: radial-gradient(40% 40% at 50% 50%, rgba(34,211,238,.35), transparent 60%);
  opacity: .0;
  animation: flash-glow 2.8s ease-out forwards;
  pointer-events: none;
}

/* Animations */
@keyframes flash-in {
  0%   { opacity: 0; transform: translate(-50%, 14px) scale(.92); }
  12%  { opacity: 1; transform: translate(-50%, 0)    scale(1.00); }
  70%  { opacity: .98; transform: translate(-50%, -4px) scale(1.02); }
  100% { opacity: 0; transform: translate(-50%, -12px) scale(.98); }
}
@keyframes flash-glow {
  0%   { opacity: .0; }
  20%  { opacity: .28; }
  60%  { opacity: .15; }
  100% { opacity: 0; }
}

/* Optional: subtle hover scale for hero image to add life */
.hero-img {
  display: block;
  max-width: 100%;
  height: auto;
  transition: transform .6s cubic-bezier(.2,.7,.2,1), filter .6s;
}
.hero-img:hover { transform: translateY(-2px) scale(1.02); }
/* Bigger buttons layout */
.grid-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.big-btn {
  padding: 1rem 1.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  text-align: center;
  display: block;
  border-radius: 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.big-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(34, 211, 238, 0.25);
}
/* Navigation wrapper */
.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Navigation links default */
.nav-links {
  display: flex;
  gap: 1rem;
}

.nav-links a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.nav-toggle {
  display: none;
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

/* Mobile styles */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.95);
    position: absolute;
    top: var(--header-height);
    right: 0;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    max-height: calc(100svh - var(--header-height) - 2rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 120;
  }

  .nav-links.show {
    display: flex;
  }
}
/* --- Header / Nav (keeps your existing design) --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100; /* above reveal sections */
  backdrop-filter: saturate(120%) blur(6px);
  border-bottom: 1px solid;
  margin-bottom: 1rem;
  padding-top: env(safe-area-inset-top);
}
body.dark .site-header { background: rgba(10,15,25,0.6); border-color:#1f2937; }
body.light .site-header { background: rgba(255,255,255,0.75); border-color:#e5e7eb; }

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: clamp(.75rem, 2.5vw, 1.5rem);
  min-height: var(--header-height);
}

.brand { font-weight: 800; text-decoration:none; color: inherit; font-size: 1.125rem; }

.main-nav { display:flex; gap:1rem; }
.main-nav a { text-decoration: none; font-weight: 600; opacity:.9; }
.main-nav a:hover,
.main-nav a.active { opacity:1; text-decoration: underline; }

.header-actions { display:flex; align-items:center; gap:.5rem; }

/* Mobile hamburger */
.nav-toggle {
  display: none;
  font-size: 1.5rem;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
}

/* Drawer + backdrop (sits above content) */
.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 120;
}
.mobile-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(82vw, 320px);
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 130; /* above backdrop */
  border-left: 1px solid;
  padding: 1rem;
  box-sizing: border-box;
  padding-top: calc(env(safe-area-inset-top) + 1rem);
  max-width: 100%;
}
body.dark .mobile-panel { background: rgba(15,23,42,.98); border-color:#1f2937; }
body.light .mobile-panel { background: rgba(255,255,255,.98); border-color:#e5e7eb; }

.mobile-panel.open { transform: translateX(0%); }
.mobile-menu { display:flex; flex-direction:column; gap:.75rem; margin-top:.5rem; }
.mobile-menu a { text-decoration: none; font-weight: 700; }

/* Mobile breakpoint: hide desktop nav, show hamburger */
@media (max-width: 768px) {
  .main-nav { display: none; }
  .nav-toggle { display: inline-block; }
}

/* Ensure reveal sections never overlap header */
.reveal { position: relative; z-index: 1; }

/* --- Mobile nav --- */
.site-header { position: relative; }
.nav-toggle {
  display: none;
  border: 1px solid;
  border-color: transparent;
  background: rgba(34,211,238,.12);
  color: inherit;
  padding: .5rem .75rem;
  border-radius: .5rem;
  cursor: pointer;
}
body.light .nav-toggle { background: rgba(2,132,199,.12); }

@media (max-width: 860px) {
  /* Hide desktop nav and show toggle */
  .nav { display: none; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }

  /* Open state: dropdown panel look */
  .nav.open {
    display: flex;
    position: absolute;
    right: 1rem;
    top: 100%;
    margin-top: .5rem;
    flex-direction: column;
    gap: .5rem;
    padding: .75rem;
    border-radius: .75rem;
    border: 1px solid;
    z-index: 150;
    max-height: calc(100svh - var(--header-height) - 1rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.dark .nav.open { background: rgba(15,23,42,.98); border-color: #1f2937; }
  body.light .nav.open { background: #ffffff; border-color: #e5e7eb; }

  .nav.open a, .nav.open .btn { width: 100%; text-align: left; }
}

/* --- Footer stacking on small screens --- */
.footer-columns .grid-2 { gap: 1rem; }
@media (max-width: 860px) {
  .footer-columns .grid-2 {
    display: grid;
    grid-template-columns: 1fr; /* stack */
  }
  /* Keep explicit order: Contact (1), Links (2), Follow Us (3) */
  .footer-columns .footer-contact { order: 1; }
  .footer-columns .footer-links { order: 2; }
  .footer-columns .footer-follow { order: 3; }

  /* Make footer links wrap nicely */
  .footer-columns .footer-links .flex { flex-wrap: wrap; gap: .5rem 1rem; }
}

/* Minor polish: dropdown link hover backgrounds */
.nav a { padding:.25rem .5rem; border-radius:.5rem; }
.nav a:hover { background: rgba(34,211,238,.08); }
body.light .nav a:hover { background: rgba(2,132,199,.08); }

/* --- Extra micro-tuning for very small phones --- */
@media (max-width: 360px){
  .text-3xl { font-size: 1.5rem; line-height: 2rem; }
  .card { padding: .75rem; border-radius: .75rem; }
  .big-btn { font-size: 1rem; padding: .875rem 1rem; }
}
