/*
 * theme.css — SIGNAL's design tokens, v2.
 *
 * MOOD SHIFT (2026-09-26): the console used to read as a terminal — phosphor
 * green on near-black, flat corners, one thing moving. The brief now asks for
 * the opposite feeling: Instagram's confident, social-native colour and
 * Snapchat's playful snap, built into a dark "creative studio" screen that
 * never quite sits still. Corners round out, shadows glow instead of sitting
 * flat, and the brand is a hot-pink → violet gradient instead of a single
 * flat hue. Opens in dark mode (:root is the dark set); html[data-theme="light"]
 * is the alternate for anyone who switches.
 */

:root {
  color-scheme: dark;

  --canvas: #0e0b16;
  --surface: #1b1524;
  --surface-2: #251c33;
  --border: #352a44;
  --border-strong: #4d3d61;
  --ink: #f5eef9;
  --muted: #ab9dba;

  --accent: #ff2f7e;
  --accent-hover: #ff155f;
  --accent-ink: #1a0410;
  --accent-text: #ff6aa3;
  --accent-strong: #ffd23f;
  --accent-soft: #3a1a2e;
  --accent-border: #6b2b52;

  --success: #2dd9a3;
  --success-ink: #04241b;
  --success-soft: #123328;
  --success-strong: #5ce9c1;

  --warning: #ffb454;
  --warning-ink: #2a1a04;
  --warning-soft: #3a2510;
  --warning-strong: #ffc57a;

  --danger: #ff4d6a;
  --danger-ink: #2a0611;
  --danger-soft: #351320;
  --danger-strong: #ff86a0;

  --chart-1: #ff2f7e;
  --chart-2: #7c5cff;
  --chart-3: #ffd23f;
  --chart-4: #ff4d6a;
  --chart-5: #4fd1ff;
  --chart-6: #ab9dba;

  /* Signal's own tokens — the gradient the brand is built from, and the
     Snapchat-yellow spark used for tiny bursts of delight. */
  --x-violet: #7c5cff;
  --x-yellow: #ffe600;
  --x-glow: rgba(255, 47, 126, 0.35);
  --x-glow-violet: rgba(124, 92, 255, 0.3);
  --x-gradient-brand: linear-gradient(135deg, var(--accent) 0%, var(--x-violet) 55%, var(--accent-strong) 100%);
  --x-gradient-text: linear-gradient(90deg, var(--accent-text), var(--x-violet), var(--accent-strong), var(--accent-text));

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display-weight: 700;
  --display-tracking: -0.015em;
  --eyebrow-tracking: 0.08em;

  --radius-btn: 999px;
  --radius-card: 20px;
  --radius-input: 14px;
  --border-w: 1px;
  --border-strong-w: 1.5px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 34px -10px var(--x-glow);
  --shadow-raised: 0 26px 60px rgba(0, 0, 0, 0.6), 0 10px 26px -6px var(--x-glow-violet);
  --shadow-btn: 0 6px 18px -4px var(--x-glow);
  --caps: none;
  --caps-tracking: 0.02em;
  --btn-weight: 700;
  --card-pad: 1.5rem;
  --measure: 68ch;
}

html[data-theme="light"] {
  color-scheme: light;

  --canvas: #fdf3f8;
  --surface: #ffffff;
  --surface-2: #fbe7f1;
  --border: #f3d3e4;
  --border-strong: #e2a9c8;
  --ink: #241329;
  --muted: #7c6484;

  --accent: #e0116f;
  --accent-hover: #c20e5f;
  --accent-ink: #ffffff;
  --accent-text: #c20e5f;
  --accent-strong: #a6157a;
  --accent-soft: #fbe0ee;
  --accent-border: #f0a8cf;

  --success: #0f9d68;
  --success-ink: #ffffff;
  --success-soft: #dcf3e8;
  --success-strong: #0b7a51;

  --warning: #b45309;
  --warning-ink: #ffffff;
  --warning-soft: #f6e5cf;
  --warning-strong: #93440a;

  --danger: #d1264f;
  --danger-ink: #ffffff;
  --danger-soft: #fbdee6;
  --danger-strong: #a41f3f;

  --chart-1: #e0116f;
  --chart-2: #6d4fc4;
  --chart-3: #b45309;
  --chart-4: #d1264f;
  --chart-5: #0e7fa6;
  --chart-6: #7c6484;

  --x-violet: #6d4fc4;
  --x-yellow: #f5c400;
  --x-glow: rgba(224, 17, 111, 0.16);
  --x-glow-violet: rgba(109, 79, 196, 0.16);
  --x-gradient-brand: linear-gradient(135deg, var(--accent) 0%, var(--x-violet) 55%, var(--accent-strong) 100%);
  --x-gradient-text: linear-gradient(90deg, var(--accent-text), var(--x-violet), var(--accent-strong), var(--accent-text));

  --shadow-card: 0 1px 2px rgba(36, 19, 41, 0.06), 0 10px 26px -8px var(--x-glow);
  --shadow-raised: 0 26px 54px rgba(36, 19, 41, 0.18);
  --shadow-btn: 0 8px 18px -4px var(--x-glow);
}

/*
 * app.css — Signal's own studio chrome: the side rail, the marquee ticker,
 * the gradient glow the whole screen sits on, the phone-frame mocks, and the
 * small bursts of motion app.js triggers (a spark on share, a tilt on a
 * template card, a ring that never quite stops turning). Tokens only.
 */

/* ---- Studio ground --------------------------------------------------------
   Two soft, slow-drifting colour blooms behind everything, the immersive-
   studio wash instead of a flat ground. Fixed so it never scrolls with the
   page, and far enough back that text always sits on plain --canvas. */
/* NOTE: no overflow-x here — setting only overflow-x on body forces the UA to
   promote overflow-y to auto (CSS Overflow §3), which turns body into its own
   scroll container and breaks .rail's position: sticky against the viewport.
   Horizontal containment is handled by .ticker (overflow + contain) and the
   width-clamped primitives instead. */
body {
  position: relative;
  background-color: var(--canvas);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(38rem 28rem at 8% -8%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 60%),
    radial-gradient(34rem 30rem at 96% 12%, color-mix(in srgb, var(--x-violet) 18%, transparent), transparent 60%);
  animation: bloom-drift 22s ease-in-out infinite alternate;
}
html.reduced-motion body::before { animation: none; }

@keyframes bloom-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-1.5%, 1.5%, 0) scale(1.06); }
}

/* Gradient headline / label text — the brand gradient poured into type. */
.text-gradient {
  background: var(--x-gradient-text);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient-pan 6s linear infinite;
}
html.reduced-motion .text-gradient { animation: none; background-position: 0% center; }

/* ---- Side rail -------------------------------------------------------------
   The app's whole navigation: icons always, labels from sm up. */
.rail {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  height: 100vh;
  width: 4.75rem;
  flex: none;
  flex-direction: column;
  border-right: var(--border-w, 1px) solid var(--border);
  background: var(--surface);
}
@media (min-width: 640px) {
  .rail { width: 15rem; }
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.15rem 1rem;
  border-bottom: var(--border-w, 1px) solid var(--border);
  color: var(--ink);
  text-decoration: none;
}
.rail-brand:hover { text-decoration: none; }
.rail-brand .rail-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: var(--x-gradient-brand);
  color: var(--accent-ink);
  flex-shrink: 0;
  box-shadow: var(--shadow-btn);
}
.rail-brand .rail-label { font-size: 1.05rem; font-weight: 700; letter-spacing: var(--display-tracking, -0.01em); }

.rail-item {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-btn, 999px);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 200ms var(--ease), color 200ms var(--ease), transform 200ms var(--ease);
}
.rail-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; transform: translateX(2px); }
.rail-item.is-active { background: var(--x-gradient-brand); color: var(--accent-ink); box-shadow: var(--shadow-btn); }
.rail-item .icon { flex-shrink: 0; }

.rail-label { display: none; white-space: nowrap; }
@media (min-width: 640px) {
  .rail-label { display: inline; }
}

.rail-foot {
  margin-top: auto;
  padding: 0.75rem;
  border-top: var(--border-w, 1px) solid var(--border);
}

/* ---- Ticker ----------------------------------------------------------------
   The marquee: a slow, constant strip of signals. Fades at both edges so it
   reads as a feed with no visible seam. The live dot pulses in the brand glow. */
.ticker {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  contain: layout paint;
  -webkit-mask-image: linear-gradient(to right, transparent, black 28px, black calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, transparent, black 28px, black calc(100% - 28px), transparent);
}
.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker-scroll 30s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-set {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 2.25rem;
  padding-right: 2.25rem;
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink);
}
.ticker-item .ticker-bullet {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--x-gradient-brand);
  flex-shrink: 0;
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.live-dot {
  position: relative;
  display: inline-flex;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  animation: pulse-dot 1.8s ease-in-out infinite;
}
html.reduced-motion .live-dot { animation: none; }

/* ---- Sparkline --------------------------------------------------------------- */
.spark { display: block; overflow: visible; }

/* ---- Phone frame ------------------------------------------------------------
   The recurring device on the page: a vertical reel frame. A slow gradient
   ring turns around it, like a story about to be watched. */
.phone-frame {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius-card, 20px) + 6px);
  background: var(--surface-2);
  padding: 3px;
  background-image: var(--x-gradient-brand);
  transition: transform 300ms var(--ease-out);
}
.phone-frame > * { border-radius: calc(var(--radius-card, 20px) + 3px); }
.phone-frame::before {
  content: "";
  position: absolute;
  inset: -30%;
  z-index: 0;
  background: conic-gradient(from 0deg, var(--accent), var(--x-violet), var(--accent-strong), var(--accent));
  animation: spin-slow 7s linear infinite;
}
html.reduced-motion .phone-frame::before { animation: none; }
.phone-frame > .phone-frame-label,
.phone-frame > .timeline {
  position: relative;
  z-index: 1;
  background: var(--surface-2);
}
.phone-frame:hover { transform: translateY(-4px) rotate(-1deg); }

@keyframes spin-slow { to { transform: rotate(360deg); } }

.phone-frame-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--border-w, 1px) solid var(--border);
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 1rem 1rem 1.6rem;
}
.timeline-row { position: relative; display: flex; flex-direction: column; gap: 0.1rem; }
.timeline-row::before {
  content: "";
  position: absolute;
  left: -1.2rem;
  top: 0.3rem;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--x-gradient-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.timeline-time { font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600; color: var(--accent-text); }
.timeline-label { font-size: 0.8125rem; color: var(--ink); }

/* ---- Confetti spark (2026-09-26) --------------------------------------------
   A one-shot burst of coloured dots app.js spawns from a point, for the
   share / track / apply moments this app wants to feel like a small win. */
.spark-particle {
  position: fixed;
  z-index: 90;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  pointer-events: none;
  animation: spark-fly 700ms ease-out forwards;
}
@keyframes spark-fly {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to   { transform: var(--spark-to, translate(0, -40px) scale(0.3)); opacity: 0; }
}
