/* ============ Apantia - design tokens ============ */
:root {
  --accent: #ea580c;
  --accent-hover: #f97316;
  --accent-press: #c2410c;
  --accent-ink: #ffffff;

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 2px 6px rgba(0,0,0,.05);
  --shadow-md: 0 8px 24px -8px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg: 0 30px 60px -22px rgba(0,0,0,.40);

  --ease: cubic-bezier(.2,.7,.2,1);
  --font: "Manrope", "Montserrat", system-ui, -apple-system, sans-serif;
  --maxw: 1120px;
}

/* ---- Dark (default) ---- */
:root, [data-theme="dark"] {
  --bg: #100e0c;
  --bg-grad: radial-gradient(1200px 600px at 70% -10%, rgba(234,88,12,.10), transparent 60%);
  --surface: #1a1714;
  --surface-2: #221d19;
  --surface-3: #2a2420;
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.14);
  --text: #f6f1ea;
  --text-dim: #b6aaa0;
  --text-faint: #877c72;
  --accent-soft: rgba(234,88,12,.14);
  --accent-line: rgba(234,88,12,.30);
  --good: #34d399;
  --shadow-lg: 0 30px 70px -25px rgba(0,0,0,.7);
}

/* ---- Blue (midnight) ---- */
[data-theme="blue"] {
  --bg: #0c0b2b;
  --bg-grad: radial-gradient(1200px 600px at 70% -10%, rgba(234,88,12,.10), transparent 60%);
  --surface: #211268;
  --surface-2: #132235;
  --surface-3: #192b44;
  --border: rgba(120,160,255,.09);
  --border-strong: rgba(120,160,255,.17);
  --text: #e2eaf8;
  --text-dim: #8598b8;
  --text-faint: #526285;
  --accent-soft: rgba(234,88,12,.14);
  --accent-line: rgba(234,88,12,.30);
  --good: #34d399;
  --shadow-lg: 0 30px 70px -25px rgba(0,5,20,.80);
}

/* ---- Light ---- */
[data-theme="light"] {
  --bg: #f7f4ef;
  --bg-grad: radial-gradient(1100px 560px at 72% -12%, rgba(234,88,12,.10), transparent 58%);
  --surface: #ffffff;
  --surface-2: #f6f2ec;
  --surface-3: #efe9e1;
  --border: rgba(28,20,12,.09);
  --border-strong: rgba(28,20,12,.16);
  --text: #1c1714;
  --text-dim: #6b6058;
  --text-faint: #968b80;
  --accent-soft: rgba(234,88,12,.10);
  --accent-line: rgba(234,88,12,.28);
  --good: #059669;
  --shadow-lg: 0 30px 60px -28px rgba(120,70,30,.30);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  transition: background .4s var(--ease), color .3s var(--ease);
}
#root { min-height: 100vh; }
.app-bg {
  min-height: 100vh;
  background-image: var(--bg-grad);
}
::selection { background: var(--accent-soft); }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ============ type ============ */
.h-display { font-size: clamp(38px, 6vw, 60px); line-height: 1.02; font-weight: 800; letter-spacing: -.03em; }
.h1 { font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -.025em; line-height: 1.08; }
.h2 { font-size: clamp(22px, 2.4vw, 28px); font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.h3 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.body-lg { font-size: clamp(17px, 1.5vw, 19px); color: var(--text-dim); line-height: 1.6; }
.body { font-size: 15.5px; color: var(--text-dim); }
.small { font-size: 13.5px; color: var(--text-dim); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.eyebrow {
  font-size: 12.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}

/* ============ buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  font-weight: 650; font-size: 15px; padding: 12px 20px;
  transition: transform .12s var(--ease), background .2s var(--ease), border-color .2s, box-shadow .2s, color .2s;
  white-space: nowrap; line-height: 1;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px -6px rgba(234,88,12,.6); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 10px 26px -8px rgba(234,88,12,.65); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-soft { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-soft:hover { background: var(--surface-3); }
.btn-lg { padding: 15px 26px; font-size: 16px; }
.btn-sm { padding: 9px 15px; font-size: 13.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============ chips / pills ============ */
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 8px 14px; font-size: 13.5px; font-weight: 600;
  color: var(--text-dim);
}
.chip svg { color: var(--accent); }

/* ============ card ============ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.surface-2 { background: var(--surface-2); }

/* ============ form controls ============ */
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 13.5px; font-weight: 650; color: var(--text); }
.label .opt { color: var(--text-faint); font-weight: 500; }
.hint { font-size: 12.5px; color: var(--text-faint); }
.input, .textarea, .select {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 15px; transition: border-color .15s, box-shadow .15s, background .15s;
}
[data-theme="light"] .input, [data-theme="light"] .textarea, [data-theme="light"] .select { background: #fff; }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent-line);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
.input-prefix {
  display: flex; align-items: center; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.input-prefix .pfx { padding: 0 6px 0 14px; color: var(--text-faint); font-size: 14.5px; }
.input-prefix input { border: none; background: transparent; box-shadow: none !important; padding-left: 2px; }
.input-prefix:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px; gap: 4px; }
.seg button {
  border: none; background: transparent; color: var(--text-dim);
  padding: 8px 16px; border-radius: var(--radius-pill); font-weight: 650; font-size: 14px;
  transition: all .18s var(--ease);
}
.seg button[data-on="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ============ misc ============ */
.divider { height: 1px; background: var(--border); border: none; }
.kbd-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 14px;
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
  word-break: break-all;
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 22%, transparent); }

/* fade/slide in - base state is ALWAYS visible; motion is transform-only and
   gated to no-preference, so a frozen/non-advancing animation clock (as in some
   preview iframes) can never leave content invisible. */
@keyframes riseUp { from { transform: translateY(16px); } to { transform: none; } }
.anim-up, .anim-in { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .anim-up { animation: riseUp .55s var(--ease) both; }
}

.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.5); backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
