:root {
  --surge-accent: #183F2C;
  --surge-accent-rgb: 58, 93, 122;
  --surge-accent-dark: #243b50;
  --surge-accent-light: #e5edf3;
  --surge-ink: #101820;
  --surge-muted: #65717b;
  --surge-surface: #ffffff;
  --surge-line: rgba(16, 24, 32, 0.12);
  --surge-radius: 8px;
  --surge-ease: cubic-bezier(.22, 1, .36, 1);
  --surge-shadow: 0 16px 42px rgba(16, 24, 32, 0.1);
}

@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%, #8ea8bc 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);
  background-image: linear-gradient(110deg, transparent 0%, transparent 38%, rgba(255, 255, 255, 0.2) 48%, transparent 58%, transparent 100%);
  background-size: 240% 100%;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms var(--surge-ease), box-shadow 160ms var(--surge-ease), background-color 160ms var(--surge-ease);
}

.surge-motion-button:hover {
  transform: translateY(-1px);
  background-color: var(--surge-accent-dark);
  box-shadow: 0 12px 28px rgba(var(--surge-accent-rgb), 0.22);
  animation: surgeShimmer 1.1s ease;
}

.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 10px 26px rgba(16, 24, 32, 0.055);
  transition: transform 180ms var(--surge-ease), border-color 180ms var(--surge-ease), box-shadow 180ms var(--surge-ease);
}

.surge-motion-card:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--surge-accent-rgb), 0.34);
  box-shadow: 0 18px 42px rgba(16, 24, 32, 0.1), 0 0 0 3px rgba(var(--surge-accent-rgb), 0.08);
}

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

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

.surge-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 460ms var(--surge-ease), transform 460ms var(--surge-ease), border-color 460ms var(--surge-ease), box-shadow 460ms var(--surge-ease);
}

.surge-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.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: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.surge-ticker__track span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  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: 999px;
  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: 100;
  width: min(420px, 100vw);
  transform: translateX(104%);
  background: var(--surge-surface);
  border-left: 1px solid var(--surge-line);
  box-shadow: -24px 0 48px rgba(16, 24, 32, 0.16);
  transition: transform 360ms var(--surge-ease);
}

[data-surge-drawer][aria-hidden="false"] {
  transform: translateX(0);
}

.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, #ffffff, var(--surge-accent-light));
  box-shadow: 0 18px 46px rgba(16, 24, 32, 0.1);
}

.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;
    transition-duration: 0.01ms !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;
  }
}
