/* Forge shared chassis — Inter (body) + Geist (display/optional) + Instrument Serif (display).
   Each subscriber overrides --accent, --accent-soft, --accent-ink in its own stylesheet. */

:root {
  --bg-page: #FAF8F5;
  --bg-elev: #ffffff;
  --bg-sunken: #f3efe8;

  --ink-1: #1a1a2e;
  --ink-2: #4a4a5e;
  --ink-3: #7a7a8a;
  --ink-4: #a4a4b2;

  --line: #ebe7e0;
  --line-2: #d8d3ca;

  --accent: #4F46E5;
  --accent-soft: #ECEBFB;
  --accent-ink: #2E2A8A;

  --ok: #1f7a4d;
  --ok-soft: #e3f3eb;
  --warn: #b25e10;
  --warn-soft: #fbeede;
  --bad: #a3261c;
  --bad-soft: #fbe6e3;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --shadow-sm: 0 1px 2px rgba(26,26,46,0.06), 0 0 0 1px rgba(26,26,46,0.04);
  --shadow-md: 0 4px 12px rgba(26,26,46,0.08), 0 0 0 1px rgba(26,26,46,0.05);
  --shadow-lg: 0 12px 40px rgba(26,26,46,0.12), 0 0 0 1px rgba(26,26,46,0.05);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-display: "Instrument Serif", Georgia, serif;
  --font-mono: "Geist Mono", ui-monospace, Menlo, monospace;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg-page: #0f0f17;
  --bg-elev: #1a1a26;
  --bg-sunken: #15151f;

  --ink-1: #f0eee8;
  --ink-2: #b8b6b0;
  --ink-3: #7a7886;
  --ink-4: #5a5868;

  --line: #2a2a38;
  --line-2: #3a3a4a;

  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.14);
  --warn: #f5b056;
  --warn-soft: rgba(245, 176, 86, 0.14);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.14);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);

  color-scheme: dark;
}

/* ── Reset / base ───────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--ink-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  min-height: 100vh;
  transition: background 0.2s ease, color 0.2s ease;
}
button, input, textarea, select { font-family: inherit; }
button { cursor: pointer; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

[hidden] { display: none !important; }

/* Off-screen but still focusable & in the tab order — for inputs styled by a visible
   proxy (custom drop zone / template cards). Do NOT use `hidden`/display:none here:
   that drops the control from the tab order and makes it keyboard-inoperable. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
/* Surface keyboard focus on the visible proxy while the real input is focused. */
.upload-zone:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); }
.tpl-card:focus-within    { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Buttons ─────────────────────────────────────────────────────
   .btn-primary uses --accent, which each subscriber overrides. */
.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; letter-spacing: -0.005em;
  line-height: 1; white-space: nowrap; text-decoration: none;
  color: inherit;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  flex-shrink: 0;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 16px 26px; font-size: 15px; border-radius: 12px; }
.btn-xl { padding: 18px 32px; font-size: 17px; border-radius: 12px; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-primary:hover { filter: brightness(0.94); }

.btn-ghost {
  background: transparent; color: var(--ink-1);
  border: 1px solid var(--line-2);
}
.btn-ghost:hover { background: var(--bg-sunken); }

.btn-outline {
  background: transparent; color: var(--ink-1);
  border: 1px solid var(--line-2);
}
.btn-outline:hover { background: var(--bg-elev); border-color: var(--ink-3); }

.btn-link {
  background: transparent; color: var(--ink-2); border: 0;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--line-2);
  padding: 8px 4px; font-size: 14px;
}
.btn-link:hover { color: var(--ink-1); text-decoration-color: var(--ink-3); }

/* ── Form controls ──────────────────────────────────────────────── */
.input, .select, .textarea,
input[type="text"], input[type="email"], input[type="number"],
input[type="search"], input[type="url"], input[type="tel"],
select, textarea {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-1);
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { resize: vertical; min-height: 96px; }
.input:focus, .select:focus, .textarea:focus,
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Theme toggle (icon-button used in nav) ─────────────────────── */
.theme-toggle {
  width: 34px; height: 34px; padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-1);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg-sunken); border-color: var(--ink-3); color: var(--ink-1); }

/* ── Card / panel / eyebrow ─────────────────────────────────────── */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.eyebrow-plain {
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-3);
}
