:root {
  --bg: #f7f2ea;        /* linen */
  --surface: #fffdf9;
  --ink: #2b2219;       /* espresso */
  --ink-hover: #45372b;
  --muted: #74675a;
  --line: #e6dccf;
  --line-strong: #d6c8b6;
  --accent: #a7772a;    /* qahwa gold */
  --accent-soft: #f2e5cb;
  --live: #3e7a4f;      /* cardamom */
  --fail: #b23a2a;
  --font: "Alexandria", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(1.25rem, 5vw, 3.5rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font: 340 1.0625rem/1.65 var(--font); -webkit-text-size-adjust: 100%; }
html:lang(ar) { line-height: 1.85; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
h1, h2, h3 { margin: 0; font-weight: 560; text-wrap: balance; }
h1 { font-size: clamp(2.4rem, 5.2vw, 3.75rem); line-height: 1.12; }
h2 { font-size: clamp(1.45rem, 2.4vw, 1.8rem); line-height: 1.25; }
h3 { font-size: 1.0625rem; font-weight: 520; line-height: 1.4; }
:lang(en) h1 { letter-spacing: -0.03em; }
:lang(en) h2 { letter-spacing: -0.015em; }
:lang(ar) h1 { line-height: 1.4; }
:lang(ar) h2 { line-height: 1.5; }
p { margin: 0; max-width: 36em; text-wrap: pretty; }
a { color: inherit; text-underline-offset: 0.25em; text-decoration-thickness: 1px; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: currentColor; }
code { font-family: var(--mono); font-size: 0.86em; direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }

.wrap { width: 100%; max-width: 70rem; margin: 0 auto; padding-inline: var(--gutter); }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.4rem; }
.top nav { display: flex; align-items: center; gap: 0.25rem; }
.logo { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 600; font-size: 1.25rem; text-decoration: none; direction: ltr; }
.mark { position: relative; width: 1.35rem; height: 1.35rem; border-radius: 0.4rem; background: var(--ink); }
.mark::after { content: ""; position: absolute; top: 0.3rem; right: 0.3rem; width: 0.38rem; height: 0.38rem; border-radius: 50%; background: var(--accent); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: inherit; font-weight: 480; line-height: 1.25; white-space: nowrap;
  padding: 0.8rem 1.45rem; border: 1px solid transparent; border-radius: 999px;
  background: var(--ink); color: var(--surface); text-decoration: none; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--ink-hover); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface); border-color: var(--muted); }
.btn.link { background: transparent; color: var(--ink); padding-inline: 0.85rem; }
.btn.link:hover { background: rgb(43 34 25 / 0.06); }
.btn.danger { background: transparent; color: var(--fail); padding-inline: 0.85rem; }
.btn.danger:hover { background: rgb(178 58 42 / 0.08); }
.btn.small { padding: 0.55rem 1.05rem; font-size: 0.9375rem; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.lang-btn { font-weight: 450; }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; }

/* status */
.status { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.9375rem; font-weight: 450; color: var(--muted); white-space: nowrap; }
.status::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--line-strong); }
.status[data-state="done"] { color: var(--live); }
.status[data-state="done"]::before { background: var(--live); box-shadow: 0 0 0 3px rgb(62 122 79 / 0.15); }
.status[data-state="running"], .status[data-state="uploading"] { color: var(--accent); }
.status[data-state="running"]::before, .status[data-state="uploading"]::before { background: var(--accent); }
.status[data-state="error"] { color: var(--fail); }
.status[data-state="error"]::before { background: var(--fail); }

/* forms */
.field { display: grid; gap: 0.45rem; }
.field label { font-weight: 480; }
.hint { font-size: 0.875rem; color: var(--muted); text-wrap: pretty; }
input[type="text"], input[type="tel"], input[type="password"] {
  font: inherit; width: 100%; padding: 0.75rem 0.95rem; color: var(--ink);
  background: #fff; border: 1px solid var(--line-strong); border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgb(167 119 42 / 0.18); }
input::placeholder { color: #a99b8c; }
input[type="tel"] { direction: ltr; }
[dir="rtl"] input[type="tel"] { text-align: right; }
.alert { color: var(--fail); font-weight: 450; }
.alert:empty { display: none; }

/* code */
.cmd {
  display: block; direction: ltr; text-align: left; font-family: var(--mono); font-size: 0.875rem; line-height: 1.65;
  padding: 0.85rem 1.1rem; background: var(--ink); color: var(--accent-soft); border-radius: 12px; overflow-x: auto; white-space: pre;
}

.foot { border-top: 1px solid var(--line); margin-top: clamp(4rem, 9vw, 7rem); }
.foot .wrap { display: flex; justify-content: space-between; gap: 1rem; padding-block: 1.75rem; color: var(--muted); font-size: 0.9375rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
