/* base.css — reset, design tokens, type, buttons, activity indicator. Tokens are
   Hub's (zz.markdowns/STYLEGUIDE.md §2) with Messenger's indigo #4b548b as the accent.
   First slice of the cascade; index.html links the rest in order. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: light;

  /* Surfaces: page -> card -> inset, one step apart so every card reads. */
  --bg:        #f5f5f7;
  --surface:   #ffffff;
  --surface-2: #f5f5f7;
  --surface-3: #ebebf0;

  --label:   #1d1d1f;
  --label-2: #6e6e73;
  --label-3: #a1a1a6;

  /* Messenger indigo #4b548b. --accent is for text, icons and focus;
     --accent-fill is what white text sits on (buttons, the bubble). Dark mode
     lightens both, since #4b548b on near-black is only 2.4:1; white on its
     fill stays above 5:1. */
  --accent:       #4b548b;
  --accent-hover: #3d4574;
  --accent-light: rgba(75, 84, 139, 0.12);
  --accent-fill:  #4b548b;
  --accent-fill-hover: #3d4574;

  --green:       #248a3d;
  --green-fill:  #34c759;
  --green-light: rgba(52, 199, 89, 0.14);

  --red:        #d70015;
  --red-light:  rgba(215, 0, 21, 0.10);

  --border:   rgba(0, 0, 0, 0.08);
  --border-2: rgba(0, 0, 0, 0.05);
  
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 24px; --r-full: 980px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.11);

  --nav-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #000000;
  --surface:   #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;

  --label:   #f5f5f7;
  --label-2: #a1a1a6;
  --label-3: #6e6e73;

  --accent:       #9aa3dd;
  --accent-hover: #b3bae8;
  --accent-light: rgba(154, 163, 221, 0.18);
  --accent-fill:  #5c66a6;
  --accent-fill-hover: #6a74b3;

  --green:       #30d158;
  --green-fill:  #30d158;
  --green-light: rgba(48, 209, 88, 0.18);

  --red:        #ff453a;
  --red-light:  rgba(255, 69, 58, 0.16);

  --border:   rgba(255, 255, 255, 0.10);
  --border-2: rgba(255, 255, 255, 0.07);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
}

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

@keyframes fadeUp  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.47;
  letter-spacing: -0.01em;
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;   /* :active states give the feedback instead */
  min-height: 100vh;
  transition: background-color 0.4s ease, color 0.3s ease;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ── Splash / activity indicator ───────────────────────────────────── */
.splash { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
/* Apple's spinner: eight rounded spokes, each fading as the next lights.
   Sized by font-size (it is 1em square); icons.js activity() makes the markup. */
.activity { position: relative; display: inline-block; flex-shrink: 0; width: 1em; height: 1em; font-size: 28px; }
.activity i {
  position: absolute; left: 45%; top: 0; width: 10%; height: 28%; border-radius: 1em;
  background: var(--label-2); transform-origin: 50% 178.6%;   /* the spoke turns around the square's centre */
  transform: rotate(calc(var(--i) * 45deg));
  animation: spoke .8s linear infinite; animation-delay: calc(var(--i) * .1s - .8s);
}
@keyframes spoke { from { opacity: 1; } to { opacity: .15; } }
@media (prefers-reduced-motion: reduce) { .activity i { animation-duration: 2.4s !important; } }   /* calmer, but still alive */

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: var(--r-full); border: 1px solid transparent;
  font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap; user-select: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent-fill); color: #fff; }
.btn--primary:hover { background: var(--accent-fill-hover); }
.btn--ghost { background: none; color: var(--label-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--label); }
.btn--secondary { background: var(--surface-3); color: var(--label); }
.btn--secondary:hover { background: var(--border); }
.btn--danger { color: var(--red); }
.btn--danger:hover { background: var(--red-light); color: var(--red); }
.btn--full { width: 100%; }
.btn--sm { padding: 6px 14px; font-size: 13px; }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn:disabled { opacity: 0.5; cursor: default; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: none; border: none; color: var(--label-2); cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--surface-2); color: var(--label); }
.icon-btn--danger:hover { background: var(--red-light); color: var(--red); }

/* ── Cards: background step + border + shadow, always all three ─────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
}

.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--label-2);
}
.muted { color: var(--label-2); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-md);
  background: var(--red-light); color: var(--red); font-size: 14px; font-weight: 500;
}
