/* ══════════════════════════════════════════════════════════════
   ZERAPPS — public site design system
   Built to the ZerElektronik specification (v1.0):
   white ground, ink type, orange as punctuation only, Barlow /
   Barlow Condensed, hairline borders, no shadows, no gradients,
   no images. Used by index.html, intro-assets/*.html.
   ══════════════════════════════════════════════════════════════ */

/* ─── Tokens ─── */
:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #FAFAFA;
  --ink: #111111;
  --text: #111111;
  --text-2: #666666;
  --text-3: #999999;
  --line: #E5E5E5;
  --line-strong: #D0D0D0;
  --accent: #E8763A;
  --accent-tint: rgba(232, 118, 58, 0.05);
  --accent-line: rgba(232, 118, 58, 0.35);
  --on-ink: #FFFFFF;

  /* spacing scale — 4px base */
  --s-2xs: 4px;  --s-xs: 8px;  --s-sm: 12px; --s-md: 16px;
  --s-lg: 24px;  --s-xl: 32px; --s-2xl: 48px; --s-3xl: 64px; --s-4xl: 96px;

  /* radii — kept tight, industrial */
  --r-sm: 2px; --r-md: 4px; --r-lg: 8px; --r-xl: 10px;
}

[data-theme="dark"] {
  --bg: #111111;
  --surface: #111111;
  --surface-2: #171717;
  --ink: #FFFFFF;
  --text: #FFFFFF;
  --text-2: rgba(255, 255, 255, 0.6);
  --text-3: rgba(255, 255, 255, 0.45);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --accent: #E8763A;
  --accent-tint: rgba(232, 118, 58, 0.09);
  --accent-line: rgba(232, 118, 58, 0.45);
  --on-ink: #111111;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Barlow', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }

a { color: inherit; }

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

/* ─── Layout ─── */
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--s-xl);
}
.content { padding: var(--s-3xl) 0 var(--s-4xl); }
.narrow { max-width: 720px; margin: 0 auto; }
.section { margin-bottom: var(--s-3xl); }
.section-sm { margin-bottom: var(--s-2xl); }
.stack-sm > * + * { margin-top: var(--s-sm); }
.stack > * + * { margin-top: var(--s-md); }

.rule { border: none; border-top: 1px solid var(--line); margin: 0; }

/* ─── Typography ─── */
h1, h2, h3, h4, .display {
  font-family: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  font-weight: 600;
  color: var(--text);
}
.display { font-size: clamp(40px, 5.4vw, 60px); line-height: 1.0; letter-spacing: -0.005em; }
h1 { font-size: clamp(32px, 4vw, 44px); line-height: 1.05; }
h2 { font-size: 30px; line-height: 1.15; }
h3 { font-size: 20px; line-height: 1.2; }
h4 { font-size: 17px; line-height: 1.25; }

p { color: var(--text); }
.lede { font-size: 17px; line-height: 1.55; color: var(--text-2); }
.body-muted { color: var(--text-2); }
.small { font-size: 13px; font-weight: 500; line-height: 1.5; color: var(--text-2); }
.micro { font-size: 12px; font-weight: 500; line-height: 1.4; color: var(--text-3); }
.tnum { font-variant-numeric: tabular-nums; }

/* Eyebrow — sentence case Barlow, never tracked-out caps */
.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: var(--s-sm);
}
.eyebrow.center { justify-content: center; }

/* Category marker — the only way category is indicated */
.marker {
  width: 8px; height: 8px; flex-shrink: 0;
  background: var(--accent);
  border-radius: var(--r-sm);
}

.section-head { margin-bottom: var(--s-xl); }
.section-head h2 { margin-bottom: var(--s-2xs); }
.section-head p { font-size: 15px; color: var(--text-2); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-xs);
  font-family: 'Barlow Condensed', 'Barlow', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  padding: 11px 22px;
  min-height: 40px;
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--on-ink);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.08s;
}
.btn:hover { background: #2b2b2b; }
[data-theme="dark"] .btn:hover { background: #e6e6e6; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

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

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn-outline:hover { border-color: var(--accent); color: var(--text); }

.btn-lg { font-size: 15px; padding: 13px 26px; min-height: 48px; }
.btn-sm { font-size: 14px; padding: 7px 16px; min-height: 32px; }
.btn-block { width: 100%; }

/* Text link — accent shows on interaction only */
.link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.18s, color 0.18s;
}
.link:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-lg);
}
.card-lg { padding: var(--s-xl); }
.card h3, .card h4 { margin-bottom: var(--s-xs); }
.card p { font-size: 15px; color: var(--text-2); }

.grid { display: grid; gap: var(--s-md); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* Hover: a keyline draws in along the top edge — accent as motion, not paint */
.card-react { position: relative; overflow: hidden; transition: border-color 0.2s; }
.card-react::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s ease;
}
.card-react:hover::before { transform: scaleX(1); }
.card-react:hover { border-color: var(--line-strong); }

/* ─── Rows (the default way to present records) ─── */
.rows { border-top: 1px solid var(--line); }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-lg);
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  transition: background 0.16s;
}
.row:hover { background: var(--accent-tint); }
.row-main { min-width: 0; }
.row-title { font-size: 15px; font-weight: 500; color: var(--text); }
.row-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.row-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.row-value.accent { color: var(--accent); }

/* ─── Tables (specs, docs, changelog) ─── */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  padding: 8px 16px 8px 0;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
table.tbl td {
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}
table.tbl td:last-child, table.tbl th:last-child { padding-right: 0; }
table.tbl tr:hover td { background: var(--accent-tint); }

/* Two-column spec table: label left muted, value right */
table.spec { width: 100%; border-collapse: collapse; font-size: 14px; }
table.spec td { padding: 7px 0; border-bottom: 1px solid var(--line); }
table.spec td:first-child { color: var(--text-2); }
table.spec td:last-child {
  text-align: right;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ─── Stat row ─── */
.stat-row {
  display: flex;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat {
  flex: 1;
  padding: var(--s-lg) var(--s-md);
  border-left: 1px solid var(--line);
}
.stat:first-child { border-left: none; padding-left: 0; }
.stat .val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat .lbl { font-size: 13px; color: var(--text-2); margin-top: var(--s-xs); }

/* ─── Callout / note — a 2px accent edge, never a filled panel ─── */
.note {
  border-left: 2px solid var(--accent);
  background: var(--accent-tint);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--s-md) var(--s-lg);
}
.note p { font-size: 14px; color: var(--text); }
.note p + p { margin-top: var(--s-xs); }

/* ─── Status dot ─── */
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3); flex-shrink: 0;
  display: inline-block;
}
.dot.ok { background: var(--ink); }
.dot.warn { background: var(--accent); }

/* ─── Forms ─── */
.field { margin-bottom: var(--s-md); }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--s-2xs);
}
.field label .req { color: var(--accent); }
.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: 'Barlow', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 14px;
  min-height: 40px;
  outline: none;
  transition: border-color 0.18s;
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text-3); }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--accent); }
.field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
[data-theme="dark"] .field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999999' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.field select option { background: var(--surface); color: var(--text); }
.field textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.field-row { display: flex; gap: var(--s-md); }
.field-row .field { flex: 1; }
.field.invalid input,
.field.invalid select,
.field.invalid textarea { border-color: var(--accent); }

/* ─── Accordion (FAQ) ─── */
.acc { border-top: 1px solid var(--line); }
.acc-item { border-bottom: 1px solid var(--line); }
.acc-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-md);
  padding: 16px 0;
  cursor: pointer;
  user-select: none;
}
.acc-q span:first-child { font-size: 15px; font-weight: 500; color: var(--text); }
.acc-q .chev {
  flex-shrink: 0;
  width: 16px; height: 16px;
  color: var(--text-3);
  transition: transform 0.25s, color 0.25s;
}
.acc-item.open .acc-q .chev { transform: rotate(180deg); color: var(--accent); }
.acc-a { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.acc-item.open .acc-a { max-height: 460px; }
.acc-a-inner {
  padding: 0 0 18px;
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.65;
  max-width: 62ch;
}
.acc-a-inner a { color: var(--text); border-bottom: 1px solid var(--line); text-decoration: none; }
.acc-a-inner a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Minimal page head (used while the navbar is hidden) ─── */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-md);
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

/* ─── Topbar ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-lg);
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 1000;
}
.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-xs);
  text-decoration: none;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}
.wordmark .sub {
  font-family: 'Barlow', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
}
.topbar-right { display: flex; align-items: center; gap: var(--s-lg); }
.topbar-links { display: flex; align-items: center; gap: var(--s-lg); white-space: nowrap; }

.nav-link {
  position: relative;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  padding: 0;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.18s;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s ease;
}
.nav-link:hover { color: var(--text); }
.nav-link:hover::after { transform: scaleX(1); }
.nav-link.active { color: var(--text); }
.nav-link.active::after { transform: scaleX(1); }

.nav-dropdown { position: relative; }
.nav-dropdown-btn { display: inline-flex; align-items: center; gap: 5px; }
.nav-dropdown-btn svg { opacity: 0.6; transition: transform 0.22s; }
.nav-dropdown.open .nav-dropdown-btn svg { transform: rotate(180deg); }
.nav-dropdown::after {
  content: '';
  position: absolute; top: 100%; left: -16px; right: -16px; height: 12px;
  display: none;
}
.nav-dropdown:hover::after, .nav-dropdown.open::after { display: block; }

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: var(--s-xs) 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
  z-index: 9999;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  border-left: 2px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.nav-dropdown-item:hover {
  color: var(--text);
  background: var(--accent-tint);
  border-left-color: var(--accent);
}
.nav-dropdown-item.active { color: var(--text); border-left-color: var(--accent); }
.nav-dropdown-item .marker { margin-left: auto; }

/* Toggles */
.lang-toggle {
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.18s;
}
.lang-toggle:hover { color: var(--accent); }

.theme-toggle {
  width: 34px; height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: transparent;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle .knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 1px;
  background: var(--text);
  transition: transform 0.22s, background 0.22s;
}
[data-theme="dark"] .theme-toggle .knob { transform: translateX(16px); background: var(--accent); }

.sign-in-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--on-ink);
  background: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-md);
  padding: 7px 16px;
  min-height: 32px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.sign-in-btn:hover { background: transparent; color: var(--text); }
.sign-in-btn.signed-in {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.sign-in-btn.signed-in:hover { border-color: var(--accent); }

.auth-dropdown { position: relative; }
.auth-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: var(--s-xs) 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
  z-index: 9999;
}
.auth-dropdown.open .auth-dropdown-menu {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0);
}
.auth-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--s-xs);
  width: 100%;
  padding: 9px 16px;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-left: 2px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.auth-dropdown-item:hover {
  color: var(--text);
  background: var(--accent-tint);
  border-left-color: var(--accent);
}

/* ─── Footer ─── */
.zer-footer {
  border-top: 1px solid var(--line);
  padding: var(--s-lg) 0 var(--s-xl);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-md);
  flex-wrap: wrap;
}
.zer-footer .fm {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.zer-footer p { font-size: 13px; color: var(--text-2); }
.zer-footer a { color: var(--text-2); text-decoration: none; border-bottom: 1px solid transparent; }
.zer-footer a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Icons ─── */
.icon { width: 20px; height: 20px; stroke-width: 1.5; color: inherit; }
.icon-lg { width: 24px; height: 24px; }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .page { padding: 0 20px; }
  .content { padding: var(--s-2xl) 0 var(--s-3xl); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar-links, .lang-toggle, .theme-toggle { display: none; }
  .stat-row { flex-wrap: wrap; }
  .stat { min-width: 50%; border-left: none; padding-left: 0; }
  .field-row { flex-direction: column; gap: 0; }
  .row { flex-direction: column; align-items: flex-start; gap: var(--s-xs); }
  h2 { font-size: 26px; }
}
