/* ==========================================================================
   Monolith theme tokens
   Ported from the Monolith launcher's theme.css per THEME_SPEC §3-§6.
   Values are the spec's verbatim values except typography, which is scaled
   up from the launcher's 13.5px app density to a web-appropriate base
   (§12.3) while keeping the same relative scale.
   ========================================================================== */

/* §4 — self-hosted variable font. font-display: swap rather than the app's
   `block`, per the spec's note for websites. */
@font-face {
  font-family: "Inter Variable";
  src: url("fonts/InterVariable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---- §3 AMOLED base ---- */
  --bg: #000000;
  --panel: rgba(14, 16, 22, 0.52);
  --panel-hover: rgba(22, 25, 33, 0.6);
  --panel-strong: rgba(8, 9, 13, 0.82); /* modals, menus, toasts */
  --input-bg: rgba(6, 7, 10, 0.92); /* inputs are near-opaque, not glassy */
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.16);

  /* ---- §3 Text ---- */
  --text: #f2f4f8;
  --text-dim: #98a0af;
  --text-faint: #5c6270;

  /* ---- §3 RGB triad — the signature accent system ---- */
  --red: #ff3d55;
  --green: #2ee66e;
  --blue: #3f8cff;
  --red-soft: rgba(255, 61, 85, 0.16);
  --green-soft: rgba(46, 230, 110, 0.14);
  --blue-soft: rgba(63, 140, 255, 0.16);

  --rgb-gradient: linear-gradient(
    90deg,
    var(--red) 0%,
    var(--green) 50%,
    var(--blue) 100%
  );

  --glow-blue: 0 0 16px rgba(63, 140, 255, 0.35);
  --glow-red: 0 0 16px rgba(255, 61, 85, 0.4);
  --glow-green: 0 0 16px rgba(46, 230, 110, 0.35);

  /* Lighter red for destructive *text* on dark surfaces (§3) — raw --red
     doesn't hold contrast as type. */
  --red-text: #ff8496;

  /* One-off accent: the curated-content / "Online" brand yellow (§3) */
  --yellow: #f2c94c;

  /* ---- §5 Radii ---- */
  --radius: 10px;
  --radius-sm: 7px; /* inputs, small buttons */
  --radius-modal: 14px;
  --radius-pill: 999px;

  /* ---- §5 Spacing ----
     The launcher authored spacing ad hoc in px; the spec recommends
     tightening that into a real scale when porting. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  /* ---- §5 Glass ---- */
  /* saturate() alongside blur is what keeps content behind glass vivid
     instead of washed out. */
  --glass-blur: blur(20px) saturate(1.35);

  /* ---- §6 Motion ---- */
  --ease: cubic-bezier(0.33, 0, 0.2, 1);
  --t-fast: 130ms; /* hover / press feedback */
  --t-med: 180ms; /* state / layout changes */

  /* ---- §4 Typography ---- */
  --font-sans: "Inter Variable", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --fs-micro: 11px;
  --fs-meta: 12.5px;
  --fs-body: 15px; /* scaled from the app's 13.5px */
  --fs-btn: 14px;
  --fs-btn-sm: 13px;
  --fs-label: 12px; /* section labels */
  --fs-title: 19px; /* view titles */
  --fs-modal-title: 17px;
}

/* ==========================================================================
   §6 Keyframes — everything is built from fade / slide / rise-with-scale
   ========================================================================== */

@keyframes mono-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes mono-slide-in {
  from {
    opacity: 0;
    transform: translateX(26px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes mono-slide-back {
  from {
    opacity: 0;
    transform: translateX(-26px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes mono-drop {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mono-rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mono-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes mono-rgb-slide {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

@keyframes mono-indeterminate {
  0% {
    left: -40%;
  }
  100% {
    left: 100%;
  }
}

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

.anim-fade-in {
  animation: mono-fade-in var(--t-med) var(--ease) both;
}

.anim-rise {
  animation: mono-rise var(--t-med) var(--ease) both;
}

.anim-drop {
  animation: mono-drop var(--t-med) var(--ease) both;
}

.anim-slide-in {
  animation: mono-slide-in var(--t-med) var(--ease) both;
}

/* ==========================================================================
   §6 Reduced motion
   `.reduce-motion` is set on <body> from a matchMedia listener (§12.7), so
   one class strips every animation without threading a flag anywhere.
   ========================================================================== */

.reduce-motion .anim-fade-in,
.reduce-motion .anim-rise,
.reduce-motion .anim-drop,
.reduce-motion .anim-slide-in {
  animation: none !important;
}

.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  transition-duration: 0.01ms !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
}

/* Safety net for visitors with JS disabled — the class above is normally
   applied by the matchMedia listener in ui.ts. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ==========================================================================
   §5 Glass surface primitives
   ========================================================================== */

.glass {
  background: var(--panel);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Needs to read over busy content */
.glass-strong {
  background: var(--panel-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
