:root {
  --surge-accent: var(--color-brand-forest-50);
  --surge-accent-rgb: 31, 81, 56;
  --surge-accent-dark: var(--color-context-20e1d9f5);
  --surge-accent-light: var(--color-context-25e1cb03);
  --surge-ink: var(--color-context-f8f94169);
  --surge-muted: var(--color-context-561bbd1e);
  --surge-surface: var(--color-surface);
  --surge-line: var(--color-context-fed31dfe);
  --surge-radius: 8px;
  --surge-ease: cubic-bezier(.22, 1, .36, 1);
  --surge-shadow: 0 16px 42px var(--color-context-b18516ac);
}

@keyframes surgeShimmer {
  0% { background-position: 120% 50%; }
  100% { background-position: -20% 50%; }
}

/* The shift is set in px by initTicker() in surge-animations.js, measured as the
   exact distance between the first chip of group 1 and the first chip of group 2.
   The old -50% only happened to be correct because the track's horizontal padding
   (14px + 14px) equalled the flex gap (28px) — change either and a -50% loop
   develops a seam. The measured value has no such dependency.
   -50% stays as the fallback for the (JS-disabled) case, where nothing animates
   anyway because .is-ready is never set. */
@keyframes surgeTicker {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(var(--surge-ticker-shift, -50%), 0, 0); }
}

@keyframes surgePulseRing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--surge-accent-rgb), 0.22); }
  50% { box-shadow: 0 0 0 8px rgba(var(--surge-accent-rgb), 0); }
}

@keyframes surgeSoftFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.surge-brand-shimmer {
  color: var(--surge-accent);
  background:
    linear-gradient(110deg, var(--surge-accent-dark) 0%, var(--surge-accent) 38%, var(--color-context-931ec956) 50%, var(--surge-accent) 62%, var(--surge-accent-dark) 100%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: surgeShimmer 3.2s ease-in-out infinite;
}

.surge-motion-button {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid var(--surge-accent);
  border-radius: var(--surge-radius);
  background-color: var(--surge-accent);
  color: var(--color-surface);
  font-weight: 800;
  text-decoration: none;
  transition: background-color 160ms var(--surge-ease);
}

.surge-motion-button:hover {
  transform: none;
  background-color: var(--surge-accent-dark);
  box-shadow: none;
  animation: none;
}

.surge-motion-button--secondary {
  background: transparent;
  color: var(--surge-accent);
}

.surge-motion-card {
  border: 1px solid var(--surge-line);
  border-radius: var(--surge-radius);
  background: var(--surge-surface);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  transition: border-color 180ms var(--surge-ease);
}

.surge-motion-card:hover {
  transform: none;
  border-color: rgba(var(--surge-accent-rgb), 0.24);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.surge-soft-float {
  animation: surgeSoftFloat 6s ease-in-out infinite;
}

.surge-status-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: var(--radius-full);
  background: var(--surge-accent);
  animation: surgePulseRing 2.4s ease-in-out infinite;
}

/* 2026-10-05: no scroll reveal. Visible at rest; only border/shadow ease on hover. */
.surge-reveal {
  opacity: 1;
  transform: none;
  transition: border-color 200ms var(--surge-ease), box-shadow 200ms var(--surge-ease);
}

.surge-reveal.is-visible.surge-motion-card {
  border-color: rgba(var(--surge-accent-rgb), 0.16);
}

.surge-ticker {
  overflow: hidden;
  border-block: 1px solid rgba(var(--surge-accent-rgb), 0.16);
  background: rgba(var(--surge-accent-rgb), 0.06);
  color: var(--surge-accent-dark);
}

.surge-ticker__track {
  width: max-content;
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 38px;
  padding-inline: 14px;
  white-space: nowrap;
}

/* ⚠️ Deliberately NOT animated until initTicker() has measured the bar and
   repeated the chips enough to fill it. Animating the authored 7 chips and then
   mutating the content underneath is what produced the visible jump/"reset".
   No JS => no .is-ready => a still, fully populated bar, which is the right
   way for this to fail. Duration is set inline by the same function so the
   speed stays constant however many repeats a wide screen needs. */
.surge-ticker__track.is-ready {
  animation: surgeTicker 38s linear infinite;
}

.surge-ticker__track span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-size-200);
  font-weight: 800;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  cursor: default;
}

.surge-ticker__track span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--surge-accent);
  box-shadow: 0 0 0 4px rgba(var(--surge-accent-rgb), 0.12);
}

.surge-carousel {
  overflow: hidden;
}

.surge-carousel__track {
  display: flex;
  gap: 16px;
  transition: transform 420ms var(--surge-ease);
  will-change: transform;
}

.surge-carousel__dot {
  width: 7px;
  height: 7px;
  border: 0;
  border-radius: var(--radius-full);
  background: rgba(var(--surge-accent-rgb), 0.24);
  transition: width 240ms var(--surge-ease), background-color 180ms var(--surge-ease);
}

.surge-carousel__dot[aria-current="true"] {
  width: 22px;
  background: var(--surge-accent);
}

[data-surge-accordion] button {
  cursor: pointer;
}

[data-surge-accordion] button::after {
  content: "+";
  margin-left: auto;
  color: var(--surge-accent);
  font-weight: 900;
  transition: transform 180ms var(--surge-ease);
}

[data-surge-accordion] button[aria-expanded="true"]::after {
  transform: rotate(45deg);
}

.surge-accordion-panel {
  display: none;
}

[data-surge-accordion] button[aria-expanded="true"] + .surge-accordion-panel {
  display: block;
}

[data-surge-drawer] {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 1000;
  width: min(440px, 100vw);
  transform: translateX(104%);
  background: var(--surge-surface);
  border-left: 1px solid var(--surge-line);
  box-shadow: none; /* shadow only while open: a closed drawer must not bleed onto the page edge */
  transition: transform 320ms var(--surge-ease), box-shadow 320ms var(--surge-ease);
}

[data-surge-drawer][aria-hidden="false"] {
  transform: translateX(0);
  box-shadow: -24px 0 54px rgba(0, 0, 0, 0.28);
}

.surge-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

.surge-drawer-backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
}

.surge-molecule-card {
  overflow: hidden;
  border: 1px solid rgba(var(--surge-accent-rgb), 0.18);
  border-radius: var(--surge-radius);
  background:
    radial-gradient(circle at 50% 42%, rgba(var(--surge-accent-rgb), 0.12), transparent 48%),
    linear-gradient(180deg, var(--color-surface), var(--surge-accent-light));
  box-shadow: 0 18px 46px var(--color-context-b18516ac);
}

.surge-molecule-card canvas {
  width: 100%;
  min-height: 340px;
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }

  [data-surge-drawer] {
    transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 320ms cubic-bezier(0.22, 1, 0.36, 1) !important;
  }

  .surge-reveal {
    opacity: 1;
    transform: none;
  }

  /* ⚠️ Must out-specify `.surge-ticker__track.is-ready` (0,2,0), which JS adds once
     the bar is measured — a bare `.surge-ticker__track` rule (0,1,0) would lose and
     the marquee would keep scrolling for people who asked it not to. */
  .surge-ticker__track,
  .surge-ticker__track.is-ready {
    animation: none;
  }
}
