/* ─────────────────────────────────────────────
   ElbrusCloud — tokens + base
   ───────────────────────────────────────────── */

:root,
:root[data-theme="dark"] {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1c1c1c;
  --bg-elevated: #1f1f1f;

  --text-primary: #ffffff;
  --text-secondary: #b8b8b8;
  --text-muted: #6e6e6e;
  --text-faint: #4a4a4a;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-dashed: rgba(255, 255, 255, 0.12);

  --accent: #ff5e3a;
  --accent-hover: #ff7558;
  --accent-glow: rgba(255, 94, 58, 0.4);
  --accent-soft: rgba(255, 94, 58, 0.12);

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --error: #ef4444;
  --error-soft: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --radius-card: 14px;
  --radius-panel: 20px;
  --radius-button: 8px;
  --radius-input: 8px;
  --radius-pill: 9999px;
}

:root[data-theme="light"] {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f0f0;
  --bg-elevated: #ffffff;

  --text-primary: #0a0a0a;
  --text-secondary: #4a4a4a;
  --text-muted: #8e8e8e;
  --text-faint: #b5b5b5;

  --border: rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.14);
  --border-dashed: rgba(0, 0, 0, 0.12);

  --accent: #ff4520;
  --accent-hover: #e63a18;
  --accent-glow: rgba(255, 69, 32, 0.22);
  --accent-soft: rgba(255, 69, 32, 0.08);

  --success: #15803d;
  --success-soft: rgba(21, 128, 61, 0.08);
  --warning: #b45309;
  --warning-soft: rgba(180, 83, 9, 0.1);
  --error: #b91c1c;
  --error-soft: rgba(185, 28, 28, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-soft);
  color: var(--text-primary);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Focus ringy ── */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-button);
}

/* ── Reusable mono caption ── */
.mono { font-family: var(--font-mono); }
.cap-mono {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cap-mono-lg {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Animations ── */
@keyframes mam-sweep { from { transform: translateX(-100%);} to { transform: translateX(100%);}}
@keyframes shimmer-pass { from { transform: translateX(-100%);} to { transform: translateX(250%);}}
@keyframes slide-down { from { opacity: 0; transform: translateY(-6px);} to { opacity: 1; transform: translateY(0);}}
@keyframes slide-up { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: translateY(0);}}
@keyframes fade-in { from { opacity: 0;} to { opacity: 1;}}
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

.slide-down { animation: slide-down 250ms cubic-bezier(0, 0, 0.2, 1); }
.slide-up   { animation: slide-up 250ms cubic-bezier(0, 0, 0.2, 1); }
.fade-in    { animation: fade-in 300ms ease-out; }

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

/* ── Layout helpers ── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 720px) {
  .container { padding: 0 16px; }
}

/* ── Card primitive ── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

/* ── Button primitives ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-button);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  transition: background-color 180ms cubic-bezier(0.4,0,0.2,1),
              border-color 180ms cubic-bezier(0.4,0,0.2,1),
              color 180ms;
  white-space: nowrap;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-tertiary); border-color: var(--text-muted); }

.btn-quiet {
  background: transparent;
  color: var(--text-secondary);
}
.btn-quiet:hover:not(:disabled) { background: var(--bg-tertiary); color: var(--text-primary); }

.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-lg { padding: 14px 22px; font-size: 15px; }

/* ── Pill / status badge ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.pill-accent {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}
.pill-success {
  background: var(--success-soft);
  border-color: transparent;
  color: var(--success);
}
.pill-warning {
  background: var(--warning-soft);
  border-color: transparent;
  color: var(--warning);
}

/* ── Input ── */
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 180ms;
}
.input:focus {
  outline: none;
  border-color: var(--text-muted);
}
.input::placeholder { color: var(--text-muted); }

/* ── Toggle switch ── */
.toggle {
  display: inline-flex;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background 200ms;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform 200ms cubic-bezier(0.4,0,0.2,1), background 200ms;
}
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on::after { transform: translateX(16px); background: #fff; }

/* ── Page section ── */
.section { padding: 80px 0; }
@media (max-width: 720px) { .section { padding: 56px 0; } }

/* ── Hide scrollbar in horizontal scrollers ── */
.scroll-x { overflow-x: auto; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }

/* ── Subtle grid background ── */
.bg-grid {
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
}

/* ── App shell layout ── */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-main { flex: 1; }

/* ── Hero gradient (subtle, no glassmorphism, no gradient buttons) ── */
.hero-glow {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(60% 50% at 75% 30%, rgba(255, 94, 58, 0.10), transparent 70%),
    radial-gradient(40% 40% at 20% 70%, rgba(70, 200, 255, 0.05), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Loading state for hash-routed views */
.route-fade { animation: fade-in 200ms ease-out; }
