/* ============================================================
   ReelSync — base design system
   Fonts are self-hosted (privacy-first: no third-party font CDN)
   ============================================================ */

@font-face {
  font-family: 'Montserrat';
  src: url('../assets/fonts/Montserrat.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Source Code Pro';
  src: url('../assets/fonts/SourceCodePro.ttf') format('truetype');
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: 'Merriweather';
  src: url('../assets/fonts/Merriweather.ttf') format('truetype');
  font-weight: 300 900;
  font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url('../assets/fonts/OpenSans.ttf') format('truetype');
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto Slab';
  src: url('../assets/fonts/RobotoSlab.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* palette — ReelChorus navy depth × VerseSync plum warmth */
  --bg-deep: #090917;
  --bg-navy: #0e0e24;
  --bg-card: #14142c;
  --bg-card-2: #191938;
  --bg-inset: #0b0b1d;
  --line: rgba(148, 124, 246, 0.14);
  --line-2: rgba(148, 124, 246, 0.30);
  --ink: #edeafb;
  --ink-2: #a6a3c4;
  --ink-3: #71708f;
  --violet: #8b5cf6;
  --violet-hi: #a78bfa;
  --violet-lo: #6d28d9;
  --plum: #9b59b6;
  --gold: #e8b64c;
  --good: #3ddc97;
  --bad: #ff6b6b;
  --grad-accent: linear-gradient(115deg, #6d28d9 0%, #8b5cf6 48%, #b9a5fc 100%);

  /* type */
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Montserrat', 'Inter', system-ui, sans-serif;
  --font-mono: 'Source Code Pro', ui-monospace, 'SF Mono', Menlo, monospace;

  /* shape + motion */
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --shadow-1: 0 10px 34px rgba(0, 0, 0, 0.38);
  --glow: 0 0 24px rgba(139, 92, 246, 0.35);
}

/* ---------- reset-lite ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, canvas, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
a { color: var(--violet-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.015em; }
p { overflow-wrap: break-word; }
::selection { background: rgba(139, 92, 246, 0.45); color: #fff; }

/*
 * The hidden attribute must always win. Component rules like
 * `.loaded-card { display: grid }` would otherwise override the UA default
 * and leave “hidden” cards, editors and empty states visible on screen.
 */
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--violet-hi);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #26264a;
  border-radius: 8px;
  border: 2px solid var(--bg-deep);
}
::-webkit-scrollbar-thumb:hover { background: #34345e; }

/* ---------- micro type helpers ---------- */
.mono { font-family: var(--font-mono); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--violet-hi);
}
.grad-text {
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.62rem 1.25rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease),
              background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
  user-select: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: 0 4px 18px rgba(109, 40, 217, 0.35);
}
.btn-primary:not(:disabled):hover {
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.5);
  transform: translateY(-1px);
}

.btn-ghost {
  border-color: var(--line-2);
  color: var(--ink);
  background: rgba(20, 20, 44, 0.4);
}
.btn-ghost:not(:disabled):hover {
  border-color: var(--violet);
  background: rgba(139, 92, 246, 0.12);
}

.btn-lg { padding: 0.85rem 1.7rem; font-size: 1.05rem; border-radius: 14px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.icon-btn:hover { color: var(--ink); background: rgba(139, 92, 246, 0.12); border-color: var(--line); }

/* ---------- pills / badges ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
  background: rgba(20, 20, 44, 0.55);
  color: var(--ink-2);
}
.pill i { color: var(--violet-hi); }
.pill-gold i { color: var(--gold); }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, var(--bg-card-2), var(--bg-card));
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-1);
}

/* ---------- forms ---------- */
.input, .select {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-inset);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--ink-3); }
.input:focus, .select:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='%23a6a3c4'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2.2rem;
  cursor: pointer;
}
.label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.4rem;
}

/* range (seek etc.) — filled portion set via --fill custom property */
.range {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--violet) var(--fill, 0%), #232348 var(--fill, 0%));
  outline: none;
  cursor: pointer;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--violet);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.7);
  transition: transform 0.12s;
}
.range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--violet);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.7);
}
.range:disabled { opacity: 0.35; cursor: not-allowed; }
.range:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--violet-hi); outline-offset: 2px; }

/* ---------- toasts ---------- */
.toast-wrap {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  z-index: 2000;
  max-width: min(360px, calc(100vw - 2.4rem));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--ink);
  background: rgba(20, 20, 44, 0.92);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(10px);
  cursor: pointer;
  animation: toastIn 0.3s var(--ease);
}
.toast i { margin-top: 2px; flex-shrink: 0; }
.toast-info i { color: var(--violet-hi); }
.toast-success { border-color: rgba(61, 220, 151, 0.4); }
.toast-success i { color: var(--good); }
.toast-error { border-color: rgba(255, 107, 107, 0.45); }
.toast-error i { color: var(--bad); }
.toast.out { animation: toastOut 0.25s var(--ease) forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px) scale(0.97); }
}

/* ---------- empty state ---------- */
.empty {
  border: 1.5px dashed rgba(148, 124, 246, 0.28);
  border-radius: var(--radius-m);
  padding: 1.4rem 1.2rem;
  text-align: center;
  color: var(--ink-3);
  background: rgba(11, 11, 29, 0.45);
}
.empty i {
  font-size: 1.5rem;
  color: var(--violet);
  opacity: 0.85;
  display: block;
  margin-bottom: 0.5rem;
}
.empty strong { display: block; color: var(--ink-2); font-size: 0.92rem; margin-bottom: 0.25rem; }
.empty span { font-size: 0.82rem; line-height: 1.45; display: block; }

/* ---------- shared keyframes ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulseSoft {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal:nth-child(2) { transition-delay: 0.08s; }
.reveal:nth-child(3) { transition-delay: 0.16s; }
.reveal:nth-child(4) { transition-delay: 0.24s; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .reveal { opacity: 1; transform: none; }
}
