/* base.css
   Reset, design tokens, motion, splash and buttons.

   Part of the Teleport stylesheet, split by concern. index.html links these
   in source order; keep that order, the cascade depends on it. */

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

:root {
  color-scheme: light;
  --bg:        #f4f4f7;
  --bg-2:      #ededf2;
  --surface:   #ffffff;
  --surface-2: #f7f7fa;

  --label:   #17171c;
  --label-2: #5f5f6b;
  --label-3: #9a9aa6;

  /* Teleport red. The app icon's ground colour, and the only brand hue here. */
  --accent:       #ff5757;
  --accent-hover: #f23f43;
  --accent-deep:  #d92f36;
  --accent-light: rgba(255, 87, 87, 0.11);

  /* Grade tones. Deliberately not the accent — the board's four tiers have to
     read as a scale of their own, distinct from the brand colour that frames
     them, or "Need Better" would look like every other red on the page. */
  --green:       #1f9d55;
  --green-light: rgba(31, 157, 85, 0.13);
  --gold:        #b8860b;
  --gold-light:  rgba(184, 134, 11, 0.15);
  --slate:       #64748b;
  --slate-light: rgba(100, 116, 139, 0.14);
  --red:         #dc2626;
  --red-light:   rgba(220, 38, 38, 0.12);

  --border:      rgba(20, 20, 35, 0.09);
  --border-2:    rgba(20, 20, 35, 0.06);

  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-full: 999px;

  --shadow-sm: 0 1px 2px rgba(15,15,30,0.04), 0 1px 3px rgba(15,15,30,0.05);
  --shadow-md: 0 4px 16px rgba(15,15,30,0.07), 0 2px 4px rgba(15,15,30,0.04);
  --shadow-lg: 0 12px 44px rgba(15,15,30,0.12), 0 4px 12px rgba(15,15,30,0.06);

  --nav-h: 60px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
}

/* Dark mode is opt-in via [data-theme="dark"] on <html>, toggled from the nav and
   persisted to localStorage under the shared ftbl-theme key (see js/theme.js). A
   tiny inline script in index.html sets the attribute before first paint —
   falling back to the OS preference on a first visit — so there is no flash of
   the wrong theme. Brand and grade hues stay identical across themes; only
   surface, label and border tokens get dark values, plus the -light tint alphas,
   bumped up so pills stay legible against a dark surface. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:        #131318;
  --bg-2:      #18181e;
  --surface:   #1e1e26;
  --surface-2: #26262f;

  --label:   #f2f2f6;
  --label-2: #a9a9b4;
  --label-3: #75757f;

  --accent-light: rgba(255, 87, 87, 0.18);

  --green-light: rgba(31, 157, 85, 0.20);
  /* Gold lifts in dark mode — the light-theme value is too muddy on a dark
     surface to read as its own tier next to slate. */
  --gold:        #d9a441;
  --gold-light:  rgba(217, 164, 65, 0.20);
  --slate:       #94a3b8;
  --slate-light: rgba(148, 163, 184, 0.20);
  --red:         #f4635c;
  --red-light:   rgba(244, 99, 92, 0.20);

  --border:   rgba(255, 255, 255, 0.11);
  --border-2: rgba(255, 255, 255, 0.07);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.45), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 44px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.35);
}

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

@keyframes spin    { to { transform: rotate(360deg); } }
@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: scale(1); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }

html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
/* The same warm wash every ftbl.studio app carries, tinted to Teleport's red. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 40% at 12% -8%, rgba(255,87,87,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 92% -6%, rgba(255,138,101,0.10) 0%, transparent 58%);
}
input, select, textarea, button { font-family: var(--font); }
a { color: inherit; text-decoration: none; }

/* Visible focus for keyboard users, invisible for mouse users. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── Splash ─────────────────────────────────────────────────────────── */
.splash { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.splash-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 550; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.08s, border-color 0.15s;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); box-shadow: 0 4px 14px rgba(255,87,87,0.32); }
.btn--secondary { background: var(--surface); color: var(--label); border-color: var(--border); }
.btn--secondary:hover { background: var(--surface-2); }
.btn--ghost { background: none; color: var(--label-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--label); }
.btn--danger { background: var(--red-light); color: var(--red); }
.btn--danger:hover { background: var(--red); color: #fff; }
.btn--sm { padding: 5px 11px; font-size: 12.5px; }
.btn--full { width: 100%; }

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

/* ── Pills, dots and badges ─────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  padding: 2.5px 9px; border-radius: var(--r-full); white-space: nowrap; flex-shrink: 0;
}
.pill--green  { background: var(--green-light);  color: var(--green);  }
.pill--gold   { background: var(--gold-light);   color: var(--gold);   }
.pill--slate  { background: var(--slate-light);  color: var(--slate);  }
.pill--red    { background: var(--red-light);    color: var(--red);    }
.pill--accent { background: var(--accent-light); color: var(--accent-deep); }
.pill--ungraded {
  background: transparent; color: var(--label-3);
  border: 1px dashed var(--border); padding: 1.5px 8px;
}
:root[data-theme="dark"] .pill--accent { color: var(--accent); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dot--green { background: var(--green); }
.dot--gold  { background: var(--gold);  }
.dot--slate { background: var(--slate); }
.dot--red   { background: var(--red);   }

/* ── Empty states ───────────────────────────────────────────────────── */
.empty { text-align: center; color: var(--label-2); padding: 30px 16px; font-size: 13px; }
.empty-strong { font-weight: 600; color: var(--label); margin-bottom: 3px; }

/* A whole-page empty state, for a board or a team with nothing on it yet. */
.blank {
  text-align: center; padding: 64px 24px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-xl); box-shadow: var(--shadow-sm);
}
.blank-ic {
  width: 64px; height: 64px; border-radius: 19px; margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #ff8a80 0%, var(--accent) 54%, var(--accent-deep) 100%);
  color: #fff; box-shadow: 0 8px 26px rgba(255,87,87,0.34), inset 0 1px 0 rgba(255,255,255,0.28);
  position: relative; overflow: hidden;
}
.blank-ic svg { width: 28px; height: 28px; position: relative; z-index: 1; }
.blank-ic::after { content: ''; position: absolute; inset: 0; background: linear-gradient(175deg, rgba(255,255,255,0.26), transparent 48%); }
.blank-title { font-size: 19px; font-weight: 720; letter-spacing: -0.02em; }
.blank-sub { font-size: 13.5px; color: var(--label-2); line-height: 1.55; margin: 7px auto 0; max-width: 420px; }
.blank-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* ── Save hint ──────────────────────────────────────────────────────── */
.save-hint { font-size: 11.5px; color: var(--label-3); font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.save-hint.saved { color: var(--green); }
