/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Variables — light ──────────────────────────────────────────────────────── */
:root {
  --bg:         #f8f8fc;
  --surface:    #ffffff;
  --surface2:   #f4f4f8;
  --border:     #e5e5f0;
  --text:       #1a1a2e;
  --muted:      #6b7280;
  --accent:     #4f46e5;
  --accent-h:   #4338ca;
  --accent-fg:  #ffffff;
  --red:        #dc2626;
  --red-bg:     #fef2f2;
  --green:      #16a34a;
  --green-bg:   #f0fdf4;
  --radius:     12px;
  --shadow:     0 4px 20px rgba(0,0,0,0.08);
  --font-ui:    -apple-system, 'Inter', system-ui, sans-serif;
  --font-heb:   'Frank Ruhl Libre', 'Noto Serif Hebrew', Georgia, serif;
}

/* ── Dark — system ──────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  html:not([data-theme='light']) {
    --bg:       #0f0f1a;
    --surface:  #1a1a2e;
    --surface2: #212135;
    --border:   #2d2d4a;
    --text:     #f0f0f8;
    --muted:    #9090b0;
    --accent:   #6366f1;
    --accent-h: #818cf8;
    --red:      #f87171;
    --red-bg:   #1c0a0a;
    --green:    #4ade80;
    --green-bg: #052e16;
    --shadow:   0 4px 20px rgba(0,0,0,0.4);
  }
}

/* ── Dark — explicit ──────────────────────────────────────────────────────────── */
html[data-theme='dark'] {
  --bg:       #0f0f1a;
  --surface:  #1a1a2e;
  --surface2: #212135;
  --border:   #2d2d4a;
  --text:     #f0f0f8;
  --muted:    #9090b0;
  --accent:   #6366f1;
  --accent-h: #818cf8;
  --red:      #f87171;
  --red-bg:   #1c0a0a;
  --green:    #4ade80;
  --green-bg: #052e16;
  --shadow:   0 4px 20px rgba(0,0,0,0.4);
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Loading overlay (guard.js) ─────────────────────────────────────────────── */
#guard-loading {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.2s;
}
#guard-loading.fade { opacity: 0; pointer-events: none; }
.guard-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Nav ─────────────────────────────────────────────────────────────────────── */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex; align-items: center; gap: 12px;
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1rem;
  color: var(--text); text-decoration: none;
}
.nav-logo-mark {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #4f46e5, #10b981);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heb);
  font-size: 0.9rem; color: #fff; font-weight: 700;
}
.nav-logo span { background: linear-gradient(to right,#4f46e5,#10b981); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.nav-spacer { flex: 1; }
.nav-link { color: var(--muted); font-size: 0.875rem; padding: 6px 12px; border-radius: 8px; transition: background 0.15s, color 0.15s; }
.nav-link:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-user { font-size: 0.8rem; color: var(--muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Page wrapper ──────────────────────────────────────────────────────────── */
.page-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}
.page-narrow { max-width: 480px; }

/* ── Auth card ──────────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow);
}
.auth-card-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.auth-card-logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #4f46e5, #10b981);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heb); font-size: 1.1rem; color: #fff; font-weight: 700;
}
.auth-card-title { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.auth-card-sub { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.auth-heading { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.auth-sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 24px; }

/* ── Form elements ──────────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.label {
  display: block;
  font-size: 0.8rem; font-weight: 600;
  color: var(--muted); letter-spacing: 0.03em;
  margin-bottom: 6px; text-transform: uppercase;
}
.input, .select, textarea.input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.95rem;
  color: var(--text);
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none; appearance: none;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }
.input.err { border-color: var(--red); }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 36px; cursor: pointer;
}

/* ── OTP input ──────────────────────────────────────────────────────────────── */
.otp-wrap { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }
.otp-digit {
  width: 48px; height: 58px;
  text-align: center; font-size: 1.5rem; font-weight: 700;
  background: var(--surface2); border: 2px solid var(--border);
  border-radius: 10px; color: var(--text);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.otp-digit:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 0.95rem; font-weight: 600;
  padding: 10px 20px; border-radius: 9px;
  border: none; cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.12s;
  font-family: var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--accent-h); }
.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { background: var(--surface2); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-full { width: 100%; }
.btn-sm { font-size: 0.8rem; padding: 6px 14px; }

/* ── Checkbox / consent rows ─────────────────────────────────────────────────── */
.consent-section { margin: 20px 0; }
.consent-section-title { font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.consent-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; margin-bottom: 8px;
  background: var(--surface2); border-radius: 8px;
  border: 1.5px solid var(--border); cursor: pointer;
  transition: border-color 0.15s;
}
.consent-row:has(:checked) { border-color: var(--accent); }
.consent-check { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.consent-text { font-size: 0.85rem; line-height: 1.5; color: var(--text); }
.consent-text a { color: var(--accent); }

/* ── Alert ───────────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: 8px; font-size: 0.875rem;
  margin: 12px 0; display: none;
}
.alert.show { display: block; }
.alert-err { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.alert-ok  { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
.alert-info { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }

/* ── Divider ──────────────────────────────────────────────────────────────────── */
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 0.8rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Hero (landing) ──────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 72px 24px 48px;
}
.hero-badge {
  display: inline-block;
  background: rgba(79,70,229,0.1); color: var(--accent);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 12px; border-radius: 20px; margin-bottom: 20px;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.1; margin-bottom: 16px;
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(to right, #4f46e5, #10b981, #0284c7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-sub { font-size: 1.1rem; color: var(--muted); max-width: 520px; margin: 0 auto 32px; line-height: 1.7; }
.hero-ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-heb {
  font-family: var(--font-heb); font-size: 1.8rem; direction: rtl;
  color: var(--muted); margin-top: 8px; letter-spacing: 0.05em;
}

/* ── Mode cards ─────────────────────────────────────────────────────────────── */
.mode-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px; padding: 0 24px 64px;
  max-width: 960px; margin: 0 auto;
}
.mode-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 24px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.mode-card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.08); }
.mode-card-icon { font-family: var(--font-heb); font-size: 2rem; font-weight: 700; margin-bottom: 12px; color: var(--accent); }
.mode-card-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 6px; }
.mode-card-sub { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }

/* ── Benchmark ribbon ───────────────────────────────────────────────────────── */
.benchmark-ribbon {
  background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex; align-items: center; justify-content: center; gap: 32px;
  flex-wrap: wrap; margin-bottom: 48px;
}
.bm-stat { text-align: center; }
.bm-val { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.bm-label { font-size: 0.75rem; color: var(--muted); }

/* ── Legal page ─────────────────────────────────────────────────────────────── */
.legal-wrap {
  max-width: 720px; margin: 0 auto; padding: 48px 24px 80px;
}
.legal-wrap h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.legal-wrap .legal-meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 36px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.legal-wrap h2 { font-size: 1.05rem; font-weight: 700; margin: 28px 0 10px; }
.legal-wrap h3 { font-size: 0.95rem; font-weight: 600; margin: 20px 0 8px; }
.legal-wrap p { margin-bottom: 12px; line-height: 1.8; font-size: 0.95rem; }
.legal-wrap ul, .legal-wrap ol { padding-left: 20px; margin-bottom: 12px; }
.legal-wrap li { margin-bottom: 6px; line-height: 1.7; font-size: 0.95rem; }
.legal-wrap table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.875rem; }
.legal-wrap th, .legal-wrap td { text-align: left; padding: 8px 12px; border: 1px solid var(--border); }
.legal-wrap th { background: var(--surface2); font-weight: 600; }
.legal-wrap code { background: var(--surface2); padding: 1px 6px; border-radius: 4px; font-size: 0.85em; }
.legal-wrap pre { background: var(--surface2); padding: 12px 16px; border-radius: 8px; overflow-x: auto; font-size: 0.85rem; margin: 12px 0; }
.legal-breadcrumb { font-size: 0.8rem; color: var(--muted); margin-bottom: 24px; }
.legal-breadcrumb a { color: var(--muted); }
.legal-breadcrumb a:hover { color: var(--text); }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.85rem; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; align-items: center; }
