/* ===========================================================
   REZTXEDITOR — shared tokens & chrome
   Design source: Stitch "ReztXeditor Workbench" spec (see DESIGN.md).
   Default: light, professional workbench palette.
   Toggle to dark via [data-theme="dark"] on <html> (see js/nav.js).
   Type: Space Grotesk (display) / Inter (body) / JetBrains Mono (code, data)
   =========================================================== */

:root {
  /* color — light (default) */
  --ink-0: #FAFAFA;   /* deepest surface / code bg — editor-bg-light */
  --ink-1: #F7F7F7;   /* page bg — canvas-neutral */
  --ink-2: #FFFFFF;   /* panel */
  --ink-3: #F4F4F5;   /* panel raised / control bg */
  --line:  #E4E4E7;   /* borders — border-subtle */
  --line-strong: #D4D4D8; /* border-strong, for editor chrome dividers */
  --text-0: #14110A;  /* primary text — secondary-dark ink */
  --text-1: #52525B;  /* secondary text */
  --text-2: #8A8A93;  /* muted text */
  --amber:  #D97706;  /* primary accent — brand amber */
  --amber-ink: #14110A;
  --wire:   #3B82F6;  /* tertiary accent — code tokens, links */
  --good:   #16A34A;
  --bad:    #DC2626;
  --shadow: 0 1px 2px rgba(20,17,10,0.06);

  --f-display: "Space Grotesk", "Segoe UI", sans-serif;
  --f-body: "Inter", "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --step-0: clamp(0.9rem, 0.85rem + 0.2vw, 1rem);
  --step-1: clamp(1.1rem, 1rem + 0.4vw, 1.25rem);
  --step-2: clamp(1.4rem, 1.2rem + 1vw, 1.9rem);
  --step-3: clamp(2rem, 1.5rem + 2.2vw, 3.2rem);

  --radius: 6px;
  --radius-lg: 10px;
}

[data-theme="dark"] {
  --ink-0: #18181B;   /* editor-bg-dark */
  --ink-1: #18181B;
  --ink-2: #1F1F23;
  --ink-3: #27272A;
  --line:  #27272A;   /* border-strong (dark) */
  --line-strong: #3A3A40;
  --text-0: #F4F4F5;  /* terminal-text-dark */
  --text-1: #A1A1AA;
  --text-2: #71717A;
  --amber:  #D97706;
  --amber-ink: #14110A;
  --wire:   #60A5FA;
  --good:   #34D399;
  --bad:    #F87171;
  --shadow: 0 1px 2px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
  background: var(--ink-1);
  color: var(--text-0);
  font-family: var(--f-body);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 150ms ease, color 150ms ease;
}

img { max-width: 100%; display: block; }
a { color: var(--wire); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

code, .mono { font-family: var(--f-mono); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

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

/* ---------- layout shell ---------- */
.shell { max-width: 1180px; margin: 0 auto; padding: 0 28px; }

/* ---------- top nav ---------- */
.topnav {
  border-bottom: 1px solid var(--line);
  background: var(--ink-2);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topnav .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-0);
}
.brand:hover { text-decoration: none; }
.brand .mark { width: 26px; height: 26px; flex: none; display: block; }

.navlinks {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 0.95rem;
  flex: 1;
}
.navlinks a { color: var(--text-1); }
.navlinks a.current { color: var(--text-0); }
.navlinks a:hover { color: var(--text-0); text-decoration: none; }

.navtoggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 40px; height: 40px;
  color: var(--text-0);
}

.theme-toggle {
  border: 1px solid var(--line);
  background: var(--ink-3);
  color: var(--text-1);
  border-radius: var(--radius);
  width: 36px; height: 36px;
  cursor: pointer;
  font-size: 0.95rem;
  flex: none;
}
.theme-toggle:hover { color: var(--text-0); }

@media (max-width: 720px) {
  .navlinks {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--ink-2);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 8px 28px 18px;
  }
  .navlinks.open { display: flex; }
  .navlinks a { padding: 10px 0; width: 100%; }
  .navtoggle { display: block; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--ink-3);
  color: var(--text-0);
  font-family: var(--f-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 9px 16px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.btn:hover { border-color: var(--text-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--amber-ink);
  font-weight: 600;
}
.btn-primary:hover { background: #e6ad48; border-color: #e6ad48; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-1); }
.btn-ghost:hover { color: var(--text-0); border-color: var(--line); }

.btn-danger { color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-icon { padding: 5px 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  padding: 4px 12px;
  font-size: 0.8rem;
  color: var(--text-1);
  white-space: nowrap;
}

select, input[type="text"], input[type="number"] {
  font-family: var(--f-body);
  color: var(--text-0);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 34px 0 44px;
  color: var(--text-2);
  font-size: 0.85rem;
}
.footer .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}
.footer a { color: var(--text-1); }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 10px;
}
