/* heypulse.io · shared design tokens (redesign 2026)
 *
 * The ONLY place colours live. Every page that themes links this file first
 * (index, contact, delete-account, download, privacy, terms, profile, post,
 * organisers, group-invite, /discover, and the backend's /e/{slug} template by
 * absolute URL). site.css without this file renders unstyled: serif font and
 * both wordmarks showing. backend/tests/test_web_pages_browser.py checks it. Values are the redesign tokens from
 * design-reference/docs/PULSE_REDESIGN_PROMPT.md §3.
 *
 * Theme: <html data-theme="system | light | dark">, set before first paint by
 * the inline script in each page's <head> from localStorage "hp-theme", and
 * changed by the theme button (assets/theme.js).
 *   - light  → the :root values below
 *   - dark   → [data-theme="dark"]
 *   - system → follows prefers-color-scheme (also the no-JS fallback, when
 *              data-theme isn't set at all)
 * The dark values are written twice (explicit dark + system dark): keep the
 * two blocks identical.
 */

/* ---------- Palette and light theme ---------- */
:root {
  color-scheme: light;

  /* palette (same in both themes) */
  --red: #EE4543;          /* buttons, big type, icons, dark-mode red text */
  --red-deep: #C92F2D;     /* small red text in light mode; small white-on-red badges (5.35:1) */
  --yellow: #E4AD23;
  --blue: #508ABC;
  --success: #3DBB6A;
  --white: #FFFFFF;
  --black: #1A1A1A;
  --grad: linear-gradient(135deg, #EE4543 0%, #EC6A3A 45%, #E4AD23 100%);
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* light theme */
  --bg: #FFFFFF;
  --sf: #F6F7F9;          /* surface */
  --ink: #1A1A1A;
  --social: var(--ink);  /* C&B #79: footer social icons: ink in light, white in dark */
  --mute: #6E6E73;
  --line: #E3E4E8;
  --stroke: #D4D5DA;
  --red-text: var(--red-deep); /* small red text: 5.35:1 on white, 4.99:1 on surface */
  --acc: var(--red-text); /* kicker / accent text */
  --hi: var(--red);       /* featured card outline */
  --card-bg: var(--sf);   /* cards are filled in light */
  --card-border: 1.5px solid transparent;
  --plus-bg: var(--grad);
  --plus-ink: var(--white);
  --band: #1A1A1A;        /* organiser band (dark in both themes) */
  --band-ink: #F6F7F9;
  --band-mute: #A1A1A6;
  --band-line: #38383C;
  --shadow: rgba(0, 0, 0, .12);
  --veil: rgba(255, 255, 255, .85); /* translucent sticky header */

  /* light values for surfaces that stay white in both themes (stat card) */
  --fixed-sf: #F6F7F9;
  --fixed-line: #E3E4E8;
  --fixed-mute: #6E6E73;

  /* per-theme component switches */
  --show-light: block;    /* .theme-light images (wordmark) */
  --show-dark: none;      /* .theme-dark images */
  --menu-on-bg: var(--sf);            /* current / hovered mobile-menu item */
  --menu-on-ring: none;
  --phone-frame: var(--black);        /* phone mockup bezel */
  --glow: .18;
  --panel-bg: var(--sf);              /* form panel: filled in light */
  --panel-border: 0;
  --follow-bg: var(--sf);             /* "follow +" pill on the mockups */
  --follow-ink: var(--ink);
  --follow-line: var(--line);
}

/* ---------- Dark theme: chosen ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1A1A1A;
  --sf: #232325;
  --ink: #F6F7F9;
  --social: var(--white);
  --mute: #A1A1A6;
  --line: #38383C;
  --stroke: #F6F7F9;
  --red-text: var(--red); /* 4.61:1 on dark bg */
  --acc: var(--yellow);
  --hi: var(--yellow);
  --card-bg: transparent; /* cards are outlined in dark */
  --card-border: 1.5px solid #F6F7F9;
  --plus-bg: #F6F7F9;
  --plus-ink: #1A1A1A;
  --band: #232325;
  --shadow: rgba(0, 0, 0, .4);
  --veil: rgba(26, 26, 26, .85);
  --show-light: none;
  --show-dark: block;
  --menu-on-bg: transparent; /* red on the #232325 surface is 4.16:1: outline, not fill */
  --menu-on-ring: inset 0 0 0 1.5px var(--line);
  --phone-frame: var(--sf);
  --glow: .25;
  --panel-bg: transparent;   /* outlined on bg in dark, so red asterisks stay at 4.61:1 */
  --panel-border: var(--card-border);
  --follow-bg: var(--yellow);
  --follow-ink: var(--black);
  --follow-line: var(--yellow);
}

/* ---------- Dark theme: system (and no-JS fallback) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1A1A1A;
    --sf: #232325;
    --ink: #F6F7F9;
    --social: var(--white);
    --mute: #A1A1A6;
    --line: #38383C;
    --stroke: #F6F7F9;
    --red-text: var(--red);
    --acc: var(--yellow);
    --hi: var(--yellow);
    --card-bg: transparent;
    --card-border: 1.5px solid #F6F7F9;
    --plus-bg: #F6F7F9;
    --plus-ink: #1A1A1A;
    --band: #232325;
    --shadow: rgba(0, 0, 0, .4);
    --veil: rgba(26, 26, 26, .85);
    --show-light: none;
    --show-dark: block;
    --menu-on-bg: transparent;
    --menu-on-ring: inset 0 0 0 1.5px var(--line);
    --phone-frame: var(--sf);
    --glow: .25;
    --panel-bg: transparent;
    --panel-border: var(--card-border);
    --follow-bg: var(--yellow);
    --follow-ink: var(--black);
    --follow-line: var(--yellow);
  }
}

/* ---------- Theme button (assets/theme.js) ---------- */
/* Shows the icon for the current mode: system = half-filled circle, light = sun, dark = moon. */
.theme-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 44px; height: 44px; padding: 0; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--line); background: transparent; color: var(--ink);
  font: inherit;
}
.theme-btn svg { width: 22px; height: 22px; flex: none; }
.theme-btn .ti { display: none; }
:root[data-theme="system"] .theme-btn .ti-system,
:root[data-theme="light"] .theme-btn .ti-light,
:root[data-theme="dark"] .theme-btn .ti-dark { display: block; }
:root:not([data-theme]) .theme-btn { display: none; } /* no JS: the button can't work */
.theme-btn:hover { border-color: var(--stroke); }
