/* ===== Tokens ===== */
:root {
  --bg: #f8f6f0;
  --ink: #1f1d18;
  --ink-2: #5f5a4f;
  --ink-3: #938c7d;
  --line: rgba(31, 29, 24, 0.12);
  --surface: #fffdf8;
  --glass-top: var(--surface);
  --glass-bottom: var(--surface);
  --glass-inset: rgba(31, 29, 24, 0.045);
  --nav-top: transparent;
  --rim-hi: transparent;
  --rim-lo: transparent;
  --sheen: transparent;
  --shadow: none;
  --accent: 143 107 18;
  --safe: 47 138 76;
  --danger: 200 64 47;
  --idle: 143 141 134;
  --r-xl: 14px;
  --r-lg: 12px;
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311;
    --ink: #ece8de;
    --ink-2: #aaa395;
    --ink-3: #787266;
    --line: rgba(236, 232, 222, 0.12);
    --surface: #1c1b18;
    --glass-inset: rgba(236, 232, 222, 0.06);
    --accent: 212 174 90;
    --safe: 92 194 130;
    --danger: 240 112 95;
    --idle: 119 117 110;
      color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141311;
  --ink: #ece8de;
  --ink-2: #aaa395;
  --ink-3: #787266;
  --line: rgba(236, 232, 222, 0.12);
  --surface: #1c1b18;
  --glass-inset: rgba(236, 232, 222, 0.06);
  --accent: 212 174 90;
  --safe: 92 194 130;
  --danger: 240 112 95;
  --idle: 119 117 110;
    color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ===== Panels =====
   .glass is the old name: now a plain card with a hairline border (v1.2). */
.glass {
  position: relative;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: var(--r-xl);
}

/* ===== Nav ===== */
.home { flex: none; display: block; width: 32px; height: 32px; margin-inline-start: -10px; border-radius: 50%; overflow: hidden;
}
.home img { display: block; width: 100%; height: 100%; }
.credit { font-size: 14.5px; color: var(--ink-2); margin-top: 14px; }
.credit b { color: var(--ink); font-weight: 600; }
.nav {
  display: flex; align-items: center; gap: 4px;
  width: min(1040px, calc(100% - 40px));
  margin: 0 auto;
  padding-top: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 18px; font-weight: 500; text-decoration: none; }
.brand-mark { width: 24px; height: 24px; }
.brand-mark path:first-child { fill: rgb(var(--accent)); }
.brand-mark .check { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.nav nav { display: flex; gap: 2px; margin-inline-start: auto; }
.nav nav a {
  text-decoration: none; font-size: 15px; color: var(--ink-2);
  padding: 6px 10px; border-radius: 8px;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.nav nav a:hover { color: var(--ink); }
.theme-toggle {
  width: 34px; height: 34px; border-radius: 8px; border: 0; display: grid; place-items: center;
  background: none; color: var(--ink-2);
  transition: background 0.2s, color 0.2s;
}
.theme-toggle:hover { background: var(--glass-inset); color: var(--ink); }
.theme-toggle svg { width: 17px; height: 17px; fill: currentColor; }

/* ===== Layout ===== */
main { width: min(1040px, calc(100% - 40px)); margin: 0 auto; }
.hero { padding: 72px 0 40px; text-align: center; }
.eyebrow {
  display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-2); margin-bottom: 18px;
}
h1 { font-size: clamp(2.1rem, 4vw, 2.9rem); line-height: 1.15; font-weight: 500; letter-spacing: -0.015em; }
.lede { max-width: 640px; margin: 22px auto 0; font-family: var(--serif); font-size: clamp(1.1rem, 1.8vw, 1.25rem); color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 760px; margin: 40px auto 0; }
.tile { padding: 18px 16px; border-radius: var(--r-lg); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--ink-2); text-align: center; line-height: 1.35; }

/* ===== Demo ===== */
.demo { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: stretch; padding: 8px 0 24px; }
.panel { padding: 24px; }
.panel-title { display: block; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 12px; }
textarea {
  width: 100%; min-height: 190px; resize: vertical;
  padding: 16px 18px;
  border: 0; outline: none;
  border-radius: 10px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  transition: box-shadow 0.3s var(--ease);
}
textarea::placeholder { color: var(--ink-3); }
textarea:focus { box-shadow: inset 0 0 0 1px rgb(var(--accent)); }
.input-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.hint { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  border: 0; border-radius: 8px; padding: 9px 16px;
  font-weight: 500; font-size: 15px;
  transition: background 0.2s, box-shadow 0.2s, filter 0.2s;
}
.btn.primary {
  color: var(--bg);
  background: var(--ink);
}
.btn:hover { filter: brightness(0.92); }
.btn:active { opacity: 0.8; }
.btn:focus-visible, .chip:focus-visible, .seg button:focus-visible, .theme-toggle:focus-visible, .nav a:focus-visible {
  outline: 2px solid rgb(var(--accent)); outline-offset: 2px;
}
.btn[disabled] { filter: saturate(0.4) opacity(0.7); pointer-events: none; }
.btn[hidden] { display: none; }
.result .dl { align-self: flex-start; margin-top: -6px; }
kbd { font: 500 11px var(--font); padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, 0.18); }

.examples { margin-top: 22px; }
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 10px; max-width: 100%; background: var(--glass-inset); box-shadow: none; }
.seg button {
  border: 0; background: transparent; padding: 6px 13px; border-radius: 7px;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
  transition: color 0.3s var(--ease);
}
.seg button[aria-selected="true"] { color: var(--ink); }
.seg-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: 0;
  border-radius: 7px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform 0.35s var(--ease), width 0.35s var(--ease);
  z-index: 0;
}
.seg button { position: relative; z-index: 1; }
.chips { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.chip {
  text-align: start; border: 0;
  padding: 10px 13px; border-radius: 9px;
  background: var(--glass-inset);
  font-size: 14px; color: var(--ink);
  display: flex; gap: 10px; align-items: baseline;
  transition: transform 0.4s var(--spring), background 0.25s var(--ease);
  animation: chip-in 0.5s var(--spring) both;
}
.chip:hover { box-shadow: inset 0 0 0 1px var(--line); }
.chip .tag { flex: none; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); width: 78px; white-space: nowrap; }
.chip .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@keyframes chip-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } }

/* ===== Result ===== */
.result { --tint: var(--idle); display: flex; flex-direction: column; gap: 18px; transition: box-shadow 0.6s var(--ease); }
.result[data-state="safe"] { --tint: var(--safe); }
.result[data-state="injection"] { --tint: var(--danger); }
.result { background: linear-gradient(180deg, rgb(var(--tint) / 0.08), rgb(var(--tint) / 0.02)), var(--surface); }
.result[data-state="injection"], .result[data-state="safe"] { box-shadow: inset 0 0 0 1px rgb(var(--tint) / 0.45); }
.verdict { display: flex; align-items: center; gap: 14px; }
.verdict-icon {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: rgb(var(--tint) / 0.9);
  transition: background 0.5s var(--ease), box-shadow 0.5s var(--ease), transform 0.6s var(--spring);
}
.verdict-icon svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; grid-area: 1 / 1; opacity: 0; transform: scale(0.5); transition: opacity 0.3s, transform 0.5s var(--spring); }
.verdict-icon .i-idle { stroke-width: 2.4; }
.result[data-state="idle"] .i-idle, .result[data-state="loading"] .i-idle,
.result[data-state="safe"] .i-safe, .result[data-state="injection"] .i-inj { opacity: 1; transform: none; }
.result[data-state="loading"] .verdict-icon { animation: pulse 1s var(--ease) infinite; }
@keyframes pulse { 50% { transform: scale(0.88); } }
.result.pop .verdict-icon { animation: pop 0.6s var(--spring); }
@keyframes pop { 0% { transform: scale(0.6); } }
.verdict-text { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 600; letter-spacing: -0.03em; color: var(--ink); }
.result[data-state="safe"] .verdict-text { color: rgb(var(--safe)); }
.result[data-state="injection"] .verdict-text { color: rgb(var(--danger)); }
:root:not([data-theme="dark"]) .result[data-state="safe"] .verdict-text { color: #127a3a; }
:root:not([data-theme="dark"]) .result[data-state="injection"] .verdict-text { color: #c21f1f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .result[data-state="safe"] .verdict-text { color: rgb(var(--safe)); }
  :root:not([data-theme="light"]) .result[data-state="injection"] .verdict-text { color: rgb(var(--danger)); }
}
.verdict-sub { color: var(--ink-2); font-size: 15px; min-height: 3.1em; }

.gauge { margin-top: auto; }
.track {
  position: relative; height: 14px; border-radius: 999px;
  background: var(--glass-inset);
  box-shadow: inset 0 0 0 1px var(--line);
}
.fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; min-width: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgb(var(--safe)), #f2c230 70%, rgb(var(--danger)));
  background-size: var(--track-w, 400px) 100%;
  transition: width 0.9s var(--spring);
  opacity: 0;
}
.result:not([data-state="idle"]) .fill { opacity: 1; }
.tick { position: absolute; top: -8px; bottom: -8px; width: 2px; left: 95%; background: var(--ink); border-radius: 2px; opacity: 0.75; }
.tick span {
  position: absolute; bottom: calc(100% + 4px); right: -2px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
}
.scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: 10px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; }
.facts div { padding: 12px 14px; border-radius: 10px; background: var(--glass-inset); }
.facts dt { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.facts dd { margin: 2px 0 0; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ===== Sections ===== */
.section { padding: 64px 0 8px; }
.section-head { margin-bottom: 22px; }
h2 { font-size: clamp(1.5rem, 2.6vw, 1.8rem); font-weight: 500; }
.section-head p { color: var(--ink-2); margin-top: 8px; max-width: 640px; }
.arch-cta { margin-top: 18px; text-decoration: none; }

.table-panel { padding: 8px 8px 18px; }
.table-scroll { overflow-x: auto; border-radius: 22px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
th, td { padding: 12px 10px; text-align: start; white-space: nowrap; }
thead th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); }
thead .group-row th[colspan] { text-align: center; color: var(--ink-2); padding-bottom: 2px; }
tbody tr { border-top: 1px solid var(--line); transition: background 0.25s var(--ease); }
tbody tr:hover { background: var(--glass-inset); }
tbody tr.shipped { background: rgb(var(--accent) / 0.12); }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
.model-name { display: block; font-weight: 600; }
.kind { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--glass-inset); color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.03em; }
tr.shipped .kind { background: rgb(var(--accent) / 0.9); color: #fff; }
.pct { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; min-width: 78px; }
.pct .bar { flex: 1; height: 6px; border-radius: 999px; background: var(--glass-inset); overflow: hidden; min-width: 28px; }
.pct .bar i { display: block; height: 100%; border-radius: inherit; }
.pct.up .bar i { background: rgb(var(--safe)); }
.pct.down .bar i { background: rgb(var(--danger)); }
.pct span { width: 38px; text-align: right; font-weight: 550; }
.footnote { font-size: 12.5px; color: var(--ink-3); padding: 12px 16px 0; line-height: 1.5; }

/* Model card: size and speed, false alarms, full evaluation */
.size-table { min-width: 720px; }
.size-table td { vertical-align: middle; }
.sz { display: flex; align-items: center; gap: 8px; min-width: 120px; font-variant-numeric: tabular-nums; }
.sz .bar { flex: 1; height: 8px; border-radius: 999px; background: var(--glass-inset); overflow: hidden; min-width: 50px; }
.sz .bar i { display: block; height: 100%; border-radius: inherit; background: rgb(var(--idle) / 0.75); }
.sz.mine .bar i { background: rgb(var(--safe)); }
.sz span { min-width: 56px; text-align: right; font-weight: 600; }
.sz.mine span { color: rgb(var(--safe)); }
:root:not([data-theme="dark"]) .sz.mine span { color: #127a3a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sz.mine span { color: rgb(var(--safe)); } }
.yn { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--glass-inset); color: var(--ink-2); }
.yn.yes { background: rgb(var(--safe) / 0.16); color: rgb(var(--safe)); }
:root:not([data-theme="dark"]) .yn.yes { color: #127a3a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .yn.yes { color: rgb(var(--safe)); } }
.fa-panel { margin-top: 18px; padding: 22px 24px; }
.fa-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.fa-head h3 { font-size: 17px; }
.fa-head span { font-size: 12.5px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.fa-sub { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.fa-bars { display: grid; gap: 10px; margin-top: 16px; }
.fa { display: grid; grid-template-columns: minmax(120px, 0.6fr) minmax(0, 2fr) 52px; gap: 12px; align-items: center; }
.fa-name { font-weight: 600; font-size: 14.5px; }
.fa-track { height: 14px; border-radius: 999px; background: var(--glass-inset); overflow: hidden; }
.fa-track i { display: block; height: 100%; border-radius: inherit; background: rgb(var(--danger) / 0.75); transition: width 0.9s var(--spring); }
.fa.mine .fa-track i { background: rgb(var(--safe)); }
.fa b { text-align: right; font-size: 16px; font-variant-numeric: tabular-nums; }
.fa.mine b, .fa.mine .fa-name { color: #127a3a; }
:root[data-theme="dark"] .fa.mine b, :root[data-theme="dark"] .fa.mine .fa-name { color: rgb(var(--safe)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fa.mine b, :root:not([data-theme="light"]) .fa.mine .fa-name { color: rgb(var(--safe)); } }
.full-eval { margin-top: 18px; padding: 0; }
.full-eval summary {
  list-style: none; cursor: pointer; padding: 16px 22px; display: flex; align-items: baseline; gap: 12px; border-radius: var(--r-xl);
}
.full-eval summary::-webkit-details-marker { display: none; }
.full-eval summary b { font-size: 16px; }
.full-eval summary span { font-size: 13px; color: var(--ink-3); }
.full-eval summary::after { content: "›"; margin-inline-start: auto; font-size: 22px; color: var(--ink-3); transition: transform 0.35s var(--spring); }
.full-eval[open] summary::after { transform: rotate(90deg); }
.full-eval summary:focus-visible { outline: 2px solid rgb(var(--accent)); outline-offset: 2px; }
.full-eval .table-scroll { margin: 0 8px; }
.full-eval .footnote { padding: 12px 22px 20px; }
@media (max-width: 640px) {
  .fa { grid-template-columns: minmax(0, 1fr) 46px; }
  .fa-track { grid-column: 1 / -1; grid-row: 2; }
}

.notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.note h3 { font-size: 17px; display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.note p { color: var(--ink-2); font-size: 15px; }
.note strong { color: var(--ink); }
.dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 4px var(--glass-inset); }
.dot.good { background: rgb(var(--safe)); } .dot.bad { background: rgb(var(--danger)); } .dot.info { background: rgb(var(--accent)); }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.step-n {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; margin-bottom: 14px;
  font-weight: 500; color: rgb(var(--accent)); box-shadow: inset 0 0 0 1px var(--line);
}
.step h3 { font-size: 18px; margin-bottom: 8px; }
.step p { color: var(--ink-2); font-size: 15px; }

.footer {
  width: min(1040px, calc(100% - 40px)); margin: 72px auto 0; padding: 22px 0 28px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 14px; color: var(--ink-3);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .demo { grid-template-columns: minmax(0, 1fr); }
  .notes, .steps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .nav nav { display: none; }
  .nav .lang-toggle { margin-inline-start: auto; }
  .hero { padding: 48px 0 28px; }
  .stats { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .seg { display: grid; width: 100%; }
  .seg button { padding: 8px 6px; font-size: 12.5px; white-space: normal; line-height: 1.2; }
  .chip .tag { display: none; }
  .facts dd { font-size: 16px; }
  kbd { display: none; }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ===== English / Arabic =====
   Pages hold both languages side by side; <html lang> (set before first paint) shows one. */
:root[lang=ar] [data-en], :root:not([lang=ar]) [data-ar] { display: none !important; }
:root[lang=ar] { --font: -apple-system, BlinkMacSystemFont, "SF Arabic", "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif; --serif: "Amiri", "Noto Naskh Arabic", serif; }
:root[lang=ar] * { letter-spacing: 0 !important; }
:root[lang=ar] body { line-height: 1.75; }
:root[lang=ar] :is(h1, h2, h3) { line-height: 1.35; }
.lang-toggle { font: 500 15px/1 var(--font); }
.lang-toggle:lang(en) { font-size: 12.5px; letter-spacing: 0.03em; }
/* Charts, meters, code and the example messages (the model reads English) keep reading left to right */
:root[dir=rtl] :is(svg, .gauge, .track, code, kbd, textarea, .chip .txt) { direction: ltr; }
:root[dir=rtl] .chip .txt { text-align: left; }
:root[dir=rtl] .flip { display: inline-block; transform: scaleX(-1); }
:root[dir=rtl] .full-eval:not([open]) summary::after { transform: scaleX(-1); }
:root[dir=rtl] :is(.stat, .facts dd, .sz span, .fa b, .pct span, .hint) { unicode-bidi: plaintext; }
