/* ===== 2026 motion layer — liquid fluid hero, liquid-glass, scroll-driven reveals =====
   Progressive enhancement on top of site.css. Everything here is decorative:
   disabled under prefers-reduced-motion, and every effect sits behind a feature query. */

@property --sheen-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --fx-hue { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

:root {
  /* fluid palette (read by motion.js) — tints of the existing navy / gold / teal */
  --fx-bg: #f7f5ef;
  --fx-a: #b9cde6;
  --fx-b: #ead7a6;
  --fx-c: #a6d6cd;
  --fx-mix: 0.85;
  --glass-bg: rgba(255, 255, 255, 0.58);
  --glass-edge: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 12px 32px -12px rgba(18, 41, 76, 0.25);
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-spring: linear(0, 0.4 8%, 0.82 18%, 1.04 30%, 1.05 38%, 1 52%, 0.99 70%, 1);
}
[data-theme="dark"] {
  --fx-bg: #0d1420;
  --fx-a: #1b3a66;
  --fx-b: #165a62;
  --fx-c: #3e3170;
  --fx-mix: 0.7;
  --glass-bg: rgba(19, 28, 43, 0.55);
  --glass-edge: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 14px 36px -14px rgba(0, 0, 0, 0.7);
}

/* cross-page continuity: header persists, content cross-fades (MPA view transitions) */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.28s; animation-timing-function: var(--ease-out); }

/* ---------- liquid-glass header ---------- */
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .site-header {
    background: color-mix(in srgb, var(--header-bg) 62%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.7);
    backdrop-filter: blur(18px) saturate(1.7);
    box-shadow: 0 1px 0 var(--glass-edge) inset;
  }
}

/* ---------- fluid hero ---------- */
.hero-fluid {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--fx-bg); border-bottom: 0;
  padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(3.5rem, 8vw, 6rem);
}
.fluid-canvas, .fluid-fallback { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.fluid-canvas { opacity: 0; transition: opacity 1.1s ease; }
.hero-fluid.is-live .fluid-canvas { opacity: 1; }
.fluid-fallback {
  background:
    radial-gradient(60% 80% at 12% 10%, color-mix(in srgb, var(--fx-a) 80%, transparent), transparent 70%),
    radial-gradient(50% 70% at 88% 20%, color-mix(in srgb, var(--fx-b) 80%, transparent), transparent 70%),
    radial-gradient(55% 70% at 55% 100%, color-mix(in srgb, var(--fx-c) 80%, transparent), transparent 70%);
  transition: opacity 1.1s ease;
}
.hero-fluid.is-live .fluid-fallback { opacity: 0; }
/* soft seam so the fluid melts into the page instead of ending on a hard line */
.hero-fluid::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 90px; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--bg));
}
.hero-fluid .hero-inner { position: relative; z-index: 2; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 1.1rem;
  padding: 6px 14px 6px 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--navy);
  background: var(--glass-bg); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
[data-theme="dark"] .eyebrow { color: var(--ink); }
.eyebrow .pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success-ink);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success-ink) 60%, transparent);
  animation: pulse-ring 2.4s ease-out infinite;
}

.hero-fluid h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); letter-spacing: -0.015em; max-width: 820px; }
.hero-fluid h1 em {
  font-style: italic; color: var(--navy);
  background: linear-gradient(100deg, var(--navy) 0%, #2e7d86 45%, var(--navy) 90%);
  background-size: 220% 100%; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; animation: ink-flow 9s ease-in-out infinite alternate;
}
[data-theme="dark"] .hero-fluid h1 em {
  background-image: linear-gradient(100deg, #cfe0f7 0%, #7fd1c7 45%, #cfe0f7 90%);
}
/* forced-colors (Windows high-contrast) strips background images, which would
   leave this gradient-clipped text fully transparent and invisible. */
@media (forced-colors: active) {
  .hero-fluid h1 em { -webkit-text-fill-color: CanvasText; color: CanvasText; background: none; animation: none; }
}

/* hero stats as liquid-glass chips */
.hero-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.6rem; }
.stat-chip {
  position: relative; display: flex; flex-direction: column; min-width: 150px; padding: 12px 18px;
  border-radius: 16px; background: var(--glass-bg); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5);
}
.stat-chip strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-chip span { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); font-weight: 700; }

/* staged entrance (plays once) */
.hero-fluid .hero-inner > * { animation: rise-in 0.8s var(--ease-out) both; }
.hero-fluid .hero-inner > :nth-child(2) { animation-delay: 0.07s; }
.hero-fluid .hero-inner > :nth-child(3) { animation-delay: 0.14s; }
.hero-fluid .hero-inner > :nth-child(4) { animation-delay: 0.21s; }
.hero-fluid .hero-inner > :nth-child(5) { animation-delay: 0.28s; }

/* ---------- buttons: pointer-tracked specular highlight ---------- */
[data-theme="dark"] .btn-ghost { color: var(--ink); border-color: var(--line); background: var(--glass-bg); }
[data-theme="dark"] .btn-ghost:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
[data-theme="dark"] .brand-mark { color: #7fb0ea; }
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  transition: transform 0.35s var(--ease-spring), box-shadow 0.3s ease, background 0.2s ease, color 0.2s ease;
}
.btn::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0;
  background: radial-gradient(120px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.45), transparent 70%);
  transition: opacity 0.25s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -8px rgba(18, 41, 76, 0.45); }
.btn:hover::after { opacity: 1; }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary { background: linear-gradient(180deg, #24508a, var(--navy-dark)); }
.btn:focus-visible, .petition-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- petition cards: sheen border + specular light ---------- */
.petition-card {
  position: relative; isolation: isolate;
  transition: transform 0.4s var(--ease-spring), box-shadow 0.3s ease, border-color 0.25s ease;
}
.petition-card::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; z-index: -1; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--sheen-angle), transparent 0 55%, var(--gold) 70%, #5fbfb3 82%, var(--navy) 92%, transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 0.35s ease;
}
.petition-card::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit; opacity: 0;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--fx-a) 55%, transparent), transparent 70%);
  transition: opacity 0.3s ease;
}
.petition-card:hover { transform: translateY(-5px); box-shadow: 0 22px 40px -22px rgba(18, 41, 76, 0.5); border-color: transparent; }
.petition-card:hover::before { opacity: 1; animation: sheen-spin 3.2s linear infinite; }
.petition-card:hover::after { opacity: 1; }
.card-category { transition: background 0.25s ease, color 0.25s ease; }
.petition-card:hover .card-category { background: var(--navy); color: #fff; }

/* ---------- scroll-driven reveals (no JS; falls back to static) ---------- */
/* .sign-panel is excluded: it's the conversion-critical content and must
   never render at partial opacity just because it sits mid-viewport at load. */
@supports (animation-timeline: view()) {
  .petition-card, .reps-widget, .supporters, .rep-card {
    /* backwards (not both): once the entry animation completes, the
       animation stops holding `transform`, so .petition-card:hover's
       translateY can take effect again instead of being dead code. */
    animation: reveal-up linear backwards;
    animation-timeline: view();
    animation-range: entry 0% entry 20%;
  }
}

/* ---------- liquid milestone meter (petition page) ---------- */
.liquid-meter {
  position: relative; margin: 1.2rem 0 1.6rem; padding: 16px 18px; border-radius: 18px;
  background: var(--glass-bg); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow); overflow: hidden;
}
.lm-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 10px; }
.lm-head strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.lm-track { position: relative; height: 22px; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--navy) 12%, transparent); }
.lm-fill { position: absolute; inset: 0 auto 0 0; width: var(--pct, 0%); min-width: 22px; border-radius: 999px; overflow: hidden;
  background: linear-gradient(90deg, #1c3f6e, #2f7f8a); transition: width 1.2s var(--ease-out); }
.lm-shine { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%); background-size: 200% 100%; animation: shine 3.4s ease-in-out infinite; }

/* ---------- keyframes ---------- */
@keyframes rise-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes reveal-up { from { opacity: 0; transform: translateY(26px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes ink-flow { to { background-position: 100% 0; } }
@keyframes sheen-spin { to { --sheen-angle: 360deg; } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success-ink) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 9px transparent; } }
@keyframes shine { 0% { background-position: 150% 0; } 100% { background-position: -50% 0; } }

@media (max-width: 640px) {
  .hero-fluid { padding: 2.2rem 0 3rem; }
  .stat-chip { flex: 1 1 140px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-fluid .hero-inner > *, .hero-fluid h1 em, .eyebrow .pulse, .petition-card, .sign-panel, .reps-widget,
  .supporters, .rep-card, .fluid-canvas, .fluid-fallback, .lm-shine, .petition-card:hover::before {
    animation: none !important;
  }
  .btn, .petition-card, .lm-fill { transition: none; }
  .btn:hover, .petition-card:hover { transform: none; }
  @view-transition { navigation: none; }
}
