/* ═══════════════════════════════════════════════════════════════════
   Even Tenor — Animation Suite
   Shared base styles for the "Before → After" section animations.

   Each animation HTML file imports this file plus its own scoped
   stylesheet for mechanics specific to that pair.

   Design tokens live at :root. Change them here, all six animations
   re-theme in one shot.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* ── Palette ─────────────────────────────────────────── */
  --et-paper:        #f4f0e9;
  --et-paper-deep:   #ece6da;
  --et-surface:      #ffffff;
  --et-ink:          #1a1612;
  --et-ink-2:        #4a4239;
  --et-ink-soft:     #8c8275;
  --et-line:         #d6cfc3;
  --et-line-soft:    #e6e0d3;

  /* ── Accent (the "after" color) ──────────────────────── */
  --et-accent:       #14554f;
  --et-accent-soft:  rgba(20, 85, 79, 0.10);
  --et-accent-glow:  rgba(20, 85, 79, 0.22);

  /* ── Warning (the "before" color) ────────────────────── */
  --et-warn:         #b86a3a;
  --et-warn-soft:    rgba(184, 106, 58, 0.10);

  /* ── Typography ──────────────────────────────────────── */
  --et-display:      'Fraunces', Georgia, serif;
  --et-sans:         'DM Sans', system-ui, -apple-system, sans-serif;

  /* ── Motion ──────────────────────────────────────────── */
  --et-ease:         cubic-bezier(.2, .7, .2, 1);
  --et-ease-out:     cubic-bezier(.16, 1, .3, 1);
}

/* ═══════════════════════════════════════════════════════════════════
   Animation container ("stage shell")
   ═══════════════════════════════════════════════════════════════════ */

.et-anim {
  font-family: var(--et-sans);
  color: var(--et-ink);
  background: var(--et-surface);
  border: 1px solid var(--et-line);
  border-radius: 4px;
  padding: 28px 28px 36px;
  position: relative;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.02),
    0 24px 48px -24px rgba(0, 0, 0, 0.06);
  -webkit-font-smoothing: antialiased;
}

/* Naked variant: no card chrome. Used when the animation is embedded
   inside another card (e.g. .et-sc-visual on the homepage) that already
   provides background/border/padding. */
.et-anim--naked {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.et-anim--naked::before { display: none; }

.et-anim::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background-image: radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.018) 1px, transparent 0);
  background-size: 4px 4px;
  pointer-events: none;
  opacity: 0.5;
}

/* ═══════════════════════════════════════════════════════════════════
   Status bar — sits above the stage in every animation
   ═══════════════════════════════════════════════════════════════════ */

.et-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--et-line-soft);
  margin-bottom: 36px;
  flex-wrap: wrap;
  position: relative;
}

.et-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--et-ink-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
}

.et-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--et-warn);
  box-shadow: 0 0 0 0 var(--et-warn);
  transition: all 0.8s ease;
}

.et-anim[data-state="after"] .et-status__dot {
  background: var(--et-accent);
  box-shadow: 0 0 0 4px var(--et-accent-soft);
}

.et-controls { display: flex; gap: 10px; }

/* ═══════════════════════════════════════════════════════════════════
   Replay button (ghost style)
   ═══════════════════════════════════════════════════════════════════ */

.et-btn {
  font-family: var(--et-sans);
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid var(--et-line);
  background: transparent;
  color: var(--et-ink-soft);
  cursor: pointer;
  transition: all 0.25s var(--et-ease);
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.et-btn:hover {
  background: var(--et-paper);
  color: var(--et-ink);
  border-color: var(--et-ink-soft);
}

.et-btn:active { transform: translateY(1px); }

.et-btn svg { width: 12px; height: 12px; }

/* ═══════════════════════════════════════════════════════════════════
   Stage (where the animation happens)
   ═══════════════════════════════════════════════════════════════════ */

.et-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-width: 940px;
  margin: 0 auto;
}

/* Compact variant: roughly square, fits in half-page-wide containers
   like the homepage Before→After deck. */
.et-stage--compact {
  aspect-ratio: 5 / 4;
  max-width: 100%;
}

.et-stage__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

/* ═══════════════════════════════════════════════════════════════════
   Source nodes — the small pills that orbit the hub
   ═══════════════════════════════════════════════════════════════════ */

.et-node {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--et-surface);
  border: 1px solid var(--et-line);
  padding: 7px 13px 7px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--et-ink-soft);
  letter-spacing: -0.005em;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  transition: all 0.7s var(--et-ease);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  z-index: 2;
}

.et-node__icon {
  width: 14px;
  height: 14px;
  color: var(--et-ink-soft);
  transition: color 0.7s, transform 0.7s;
  flex: 0 0 14px;
}

.et-node__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--et-ink-soft);
  opacity: 0.45;
  transition: all 0.7s;
}

.et-anim[data-state="after"] .et-node {
  color: var(--et-ink);
  border-color: var(--et-accent);
}

.et-anim[data-state="after"] .et-node .et-node__icon { color: var(--et-accent); }

.et-anim[data-state="after"] .et-node .et-node__dot {
  background: var(--et-accent);
  opacity: 1;
  box-shadow: 0 0 0 3px var(--et-accent-soft);
}

/* "Ping" pulse fired when a particle arrives at the hub */
.et-node.is-pinged .et-node__dot { animation: et-ping 0.6s ease-out; }
@keyframes et-ping {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.8); }
  100% { transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════════════
   Hub — the central element each animation can use (or hide)
   ═══════════════════════════════════════════════════════════════════ */

.et-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 3;
}

.et-hub__ring {
  width: 128px;
  height: 128px;
  border: 1.5px solid var(--et-line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--et-surface);
  transition: all 0.9s var(--et-ease);
}

/* Smaller hub inside the compact stage */
.et-stage--compact .et-hub__ring { width: 88px; height: 88px; }
.et-stage--compact .et-hub__icon { width: 28px; height: 28px; }
.et-stage--compact .et-hub__label { font-size: 18px; margin-top: 14px; }
.et-stage--compact .et-hub__sublabel { font-size: 9.5px; }

.et-hub__ring::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid var(--et-accent);
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.9s, transform 0.9s;
}

.et-anim[data-state="after"] .et-hub__ring {
  border-color: var(--et-accent);
  background: var(--et-accent);
  box-shadow:
    0 14px 40px -8px var(--et-accent-glow),
    inset 0 0 0 6px rgba(255, 255, 255, 0.06);
}

.et-anim[data-state="after"] .et-hub__ring::after {
  opacity: 0.4;
  transform: scale(1);
  animation: et-hubpulse 3.4s ease-in-out infinite;
}

@keyframes et-hubpulse {
  0%, 100% { transform: scale(1);    opacity: 0.35; }
  50%      { transform: scale(1.08); opacity: 0.12; }
}

.et-hub__ring.is-hit { animation: et-hubhit 0.55s ease-out; }
@keyframes et-hubhit {
  0%   { box-shadow: 0 0 0 0 var(--et-accent-soft); }
  50%  { box-shadow: 0 0 0 16px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.et-hub__icon {
  color: var(--et-ink-soft);
  transition: color 0.9s, transform 0.9s var(--et-ease);
  width: 38px;
  height: 38px;
}

.et-anim[data-state="after"] .et-hub__icon {
  color: var(--et-paper);
  transform: scale(1.06);
}

.et-hub__label {
  margin-top: 20px;
  font-family: var(--et-display);
  font-size: 22px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.025em;
  color: var(--et-ink);
  font-variation-settings: "opsz" 22, "SOFT" 60;
  transition: color 0.7s;
}

.et-hub__sublabel {
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--et-ink-soft);
  transition: color 0.7s;
}

.et-anim[data-state="after"] .et-hub__sublabel { color: var(--et-accent); }

/* ═══════════════════════════════════════════════════════════════════
   Connector paths — gray/dashed before, accent solid after
   ═══════════════════════════════════════════════════════════════════ */

.et-conn {
  fill: none;
  stroke: var(--et-line);
  stroke-width: 1;
  stroke-dasharray: 3 6;
  opacity: 0.55;
  transition: stroke 1s ease, stroke-dasharray 1s ease, opacity 1s ease;
}

.et-anim[data-state="after"] .et-conn {
  stroke: var(--et-accent);
  stroke-dasharray: 0;
  opacity: 0.28;
}

.et-particle { pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════════
   Bottom metric chip — slides up when state flips to "after"
   ═══════════════════════════════════════════════════════════════════ */

.et-metric {
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%) translateY(6px);
  background: var(--et-ink);
  color: var(--et-paper);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 7px 14px;
  border-radius: 999px;
  opacity: 0;
  transition: all 0.7s var(--et-ease) 0.5s;
  white-space: nowrap;
}

.et-anim[data-state="after"] .et-metric {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════
   Reduced motion
   ═══════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .et-anim *,
  .et-anim *::before,
  .et-anim *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   Small screens
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  .et-anim       { padding: 20px 18px 28px; }
  .et-stage      { aspect-ratio: 4 / 5; }
  .et-node       { font-size: 11px; padding: 5px 10px 5px 7px; }
  .et-node__icon { width: 12px; height: 12px; flex-basis: 12px; }
  .et-hub__ring  { width: 100px; height: 100px; }
  .et-hub__icon  { width: 32px; height: 32px; }
  .et-hub__label { font-size: 18px; }
}
