/* Caipi shared foundation: tokens, reset, and cross-surface primitives.
   Loaded first by BOTH worlds — the landing/blog/legal skin (core.css) and the
   product skin (app.css). Anything every surface shares lives here so it is
   defined once and cannot drift. Skin-specific tokens/components stay in their
   own file (core.css adds --serif/--lime/--glow; app.css adds --surface/--danger
   /--sans/--nav-h/--side-w). */

:root {
  --bg: #0a0a0b;
  --ink: #ededeb;
  --dim: #8a8a86;
  --dimmer: #5a5a57;
  --line: #242427;
  --accent: #9ad814;          /* neon lime, same in both themes */
  --accent-ink: #0a0a0b;      /* text/marks on accent fills */
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 2px;
  --radius-pill: 999px;
}

:root[data-theme="light"] {
  --bg: #fafafa;
  --ink: #18181b;
  --dim: #6e6e76;
  --dimmer: #a1a1aa;
  --line: #e6e6e9;
}
/* default = auto: follow the system until the user picks a theme */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #fafafa;
    --ink: #18181b;
    --dim: #6e6e76;
    --dimmer: #a1a1aa;
    --line: #e6e6e9;
  }
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- button primitive (shared across landing + app) ----------
   One pill button, sized once. Use the element that fits: <button> for
   actions, <a class="btn"> for navigation that should look like a button. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.02em;
  border: 1px solid var(--line); background: none; color: var(--ink);
  border-radius: var(--radius-pill); padding: 0.45rem 0.9rem; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s, filter .2s, transform .12s;
}
.btn:hover { border-color: var(--dim); }
.btn-accent {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  font-weight: 600;
}
.btn-accent:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-ghost { border-color: transparent; color: var(--dim); padding-inline: 0.6rem; }
.btn-ghost:hover { color: var(--ink); border-color: transparent; }
.btn-sm { font-size: 0.75rem; padding: 0.3rem 0.72rem; }
.btn-icon { padding: 0.45rem; aspect-ratio: 1; }
.btn-icon svg { display: block; }

/* ---------- url field primitive (shared) ----------
   The "caipi.ai/<name>" underline field. Base = product size; add .lg for the
   landing hero scale. An optional .btn sits inline at the end (landing reserve). */
.urlfield {
  display: flex; align-items: center; gap: 0.4rem;
  border-bottom: 1px solid var(--line); padding-bottom: 0.6rem;
  transition: border-color .2s;
}
.urlfield:focus-within { border-color: var(--accent); }
.urlfield .host { color: var(--dimmer); }
.urlfield input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  color: var(--ink); font-family: var(--mono); caret-color: var(--accent); padding: 0 0.2rem;
}
.urlfield input::placeholder { color: var(--dimmer); }
.urlfield .btn { flex: none; }
.urlfield.lg { padding-bottom: 0.7rem; }
.urlfield.lg .host { font-size: 1.15rem; }
.urlfield.lg input { font-size: 1.15rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
