/* boxai theme: a cleaner, modern look over style.css.
   Loaded after style.css. Changes colours, type and surfaces only; layout and behaviour are unchanged. */

:root {
  --bx-bg: #f6f7f5;
  --bx-surface: #ffffff;
  --bx-ink: #0b2b2f;
  --bx-ink-2: #3d5659;
  --bx-muted: #6b7c7e;
  --bx-line: #e2e8e6;
  --bx-accent: #0b7a60;
  --bx-accent-hi: #0a6a53;
  --bx-accent-soft: #e4f3ee;
  --bx-shadow: 0 1px 2px rgba(11, 43, 47, 0.06), 0 12px 32px rgba(11, 43, 47, 0.08);
  --bx-input: #f3f6f5;
  --bx-input-line: #d3ddda;
  --bx-danger: #a31414;

  /* remap the existing tokens so the rest of the app picks up the new palette */
  --ink: var(--bx-ink);
  --ink-2: var(--bx-ink-2);
  --salt: var(--bx-bg);
  --salt-2: var(--bx-line);
  --salt-text: #ffffff;
  --page-dim: var(--bx-muted);
  --tape: #d9f0e8;
  --tape-edge: var(--bx-accent);
  --line: #2c4f54;
  --radius: 10px;
  --sans: "Instrument", "Noto Arabic", system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", "Geeza Pro", sans-serif;
  /* the old stencil display face is retired: headings use the same sans as the rest of the site */
  --stencil: "Instrument", "Cairo", "Noto Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* dark mode follows the system setting: same palette, inverted surfaces */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bx-bg: #071b1e;
    --bx-surface: #0f2a2f;
    --bx-ink: #e6f3ef;
    --bx-ink-2: #b9d3cd;
    --bx-muted: #8fb0aa;
    --bx-line: #1f4448;
    --bx-accent: #2fbf95;
    --bx-accent-hi: #56d4ab;
    --bx-accent-soft: #103a33;
    --bx-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    --bx-input: #0b2226;
    --bx-input-line: #2f5a5f;
    --bx-danger: #ff8a8a;
    --tape: #103a33;
    --tape-edge: #2fbf95;
    --line: #2f5a5f;
    --salt: var(--bx-bg);
    --salt-2: var(--bx-line);
    --page-dim: var(--bx-muted);
    color-scheme: dark;
  }
}

body {
  background: var(--bx-bg);
  color: var(--bx-ink);
  -webkit-font-smoothing: antialiased;
}

/* header: plain wordmark, no hazard stripe */
.brand::after { display: none !important; }
.wordmark {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--bx-ink);
}
.wordmark::after {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-inline-start: 0.2rem;
  border-radius: 50%;
  background: var(--bx-accent);
  vertical-align: 0.55em;
}
.lang {
  border: 1px solid var(--bx-line);
  background: var(--bx-surface);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.9375rem;
  color: var(--bx-ink);
  box-shadow: 0 1px 2px rgba(11, 43, 47, 0.05);
}
.lang:hover { border-color: var(--bx-accent); }

/* hero text */
.welcome { gap: 1.25rem; padding: 1rem 0 2rem; }
.welcome-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: start;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--bx-accent-soft);
  color: var(--bx-accent-hi);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}
.welcome h1 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.welcome-lede {
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--bx-ink-2);
  max-width: 36rem;
}

/* buttons */
.cta-primary, .cta-secondary {
  min-height: 3rem;
  padding: 0 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.cta-primary {
  background: var(--bx-accent);
  color: #ffffff;
  border: 1px solid var(--bx-accent);
  box-shadow: 0 6px 18px rgba(11, 122, 96, 0.25);
}
.cta-primary:hover { background: var(--bx-accent-hi); transform: translateY(-1px); }
.cta-secondary {
  color: var(--bx-ink);
  border: 1px solid #c9d5d2;
  background: var(--bx-surface);
}
.cta-secondary:hover { border-color: var(--bx-ink); transform: translateY(-1px); }
.cta-primary:focus-visible, .cta-secondary:focus-visible { outline: 3px solid #8fd3bd; outline-offset: 3px; }

/* section headings */
.welcome-h2 {
  margin: 1.75rem 0 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
  color: var(--bx-ink);
}

/* feature cards */
.welcome-cards { gap: 1rem; }
.wcard {
  background: var(--bx-surface);
  border: 1px solid var(--bx-line);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: var(--bx-shadow);
}
.wcard-ico {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--bx-accent-soft);
  color: var(--bx-accent-hi);
  font-weight: 600;
  font-size: 0.9375rem;
}
.wcard h3 { font-family: var(--sans); font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }
.wcard p { color: var(--bx-muted); font-size: 0.9375rem; line-height: 1.5; }

/* steps: a light list with a thin rail instead of coloured bars */
.welcome-steps {
  position: relative;
  gap: 0;
  padding-inline-start: 0;
  background: var(--bx-surface);
  border: 1px solid var(--bx-line);
  border-radius: 14px;
  overflow: hidden;
}
.welcome-steps li {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--bx-line);
  border-radius: 0;
  padding: 1rem 1.25rem 1rem 3.5rem;
}
.welcome-steps li:last-child { border-bottom: 0; }
.welcome-steps li::before {
  inset-inline-start: 1rem;
  top: 1rem;
  width: 1.75rem;
  height: 1.75rem;
  background: var(--bx-accent-soft);
  color: var(--bx-accent-hi);
  font-weight: 600;
  font-size: 0.8125rem;
}
.welcome-steps b { font-weight: 600; font-size: 1rem; color: var(--bx-ink); }
.welcome-steps span { color: var(--bx-muted); font-size: 0.9375rem; }
.welcome-note { color: var(--bx-muted); font-size: 0.875rem; }

/* workspace frame: soft card, no hard offset */
.box {
  background: #0d2e33;
  border-radius: 16px;
  box-shadow: var(--bx-shadow), 0 0 0 1px rgba(11, 43, 47, 0.06);
}
.box-inner { border-radius: 16px; }
.bar { border-bottom: 1px solid #1f4448; }
.bar-btns button, .actions button { font-weight: 500; }
.run, .ghost.accent, #pubBtn {
  background: var(--bx-accent);
  color: #ffffff;
  border-color: var(--bx-accent);
}
.run:hover, .ghost.accent:hover, #pubBtn:hover { background: var(--bx-accent-hi); }
.box.is-locked .box-inner { filter: blur(4px); opacity: 0.35; }

/* login card: white, calm, readable */
.tape {
  background: var(--bx-surface);
  color: var(--bx-ink);
  border: 1px solid var(--bx-line);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
}
.tape label { color: var(--bx-ink-2); font-size: 0.875rem; }
.tape input {
  background: var(--bx-input);
  color: var(--bx-ink);
  border: 1px solid var(--bx-input-line);
  border-radius: 10px;
}
.tape input:focus { outline: 3px solid #8fd3bd; outline-offset: 0; border-color: var(--bx-accent); }
.tape button {
  background: var(--bx-accent);
  color: #ffffff;
  border-radius: 10px;
  font-weight: 600;
}
.tape button:hover { background: var(--bx-accent-hi); }
.code-error { color: var(--bx-danger); }
.gate-links a { color: var(--bx-accent-hi); }

/* keep the intro strip out of the way on the hero */
.intro::before { display: none; }

@media (min-width: 52rem) {
  .welcome { padding-top: 2rem; }
}

/* phones: a bit more breathing room, same single column */
@media (max-width: 40rem) {
  .welcome h1 { font-size: 2.5rem; }
  .welcome-cta .cta-primary, .welcome-cta .cta-secondary { flex: 1 1 100%; }
  .wcard { padding: 1rem; }
}

/* Arabic: keep Cairo for headings, drop the stencil remnants */
html[dir="rtl"] .welcome h1 { font-family: "Cairo", var(--sans); font-weight: 800; letter-spacing: 0; line-height: 1.25; }
html[dir="rtl"] .welcome-h2 { font-family: "Cairo", var(--sans); font-weight: 800; letter-spacing: 0; }
html[dir="rtl"] .wordmark::after { margin-inline-start: 0; margin-inline-end: 0.2rem; }

/* ---------- Workspace overhaul ----------
   A calmer top bar, one tidy toolbar, and pane headers that never collide with their buttons. */
.box { background: #0c2a2f; }
.bar {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #1d4448;
  background: linear-gradient(180deg, #123a40 0%, #0c2a2f 100%);
}
.bar-top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #bfe9da;
}
.status::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #3fd3a3;
  box-shadow: 0 0 0 3px rgba(63, 211, 163, 0.18);
}
.bar-btns { display: flex; gap: 0.375rem; }
.bar-btns .ghost, .act-tools .ghost {
  min-height: 2.125rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #e6f3ef;
  border-radius: 999px;
}
.bar-btns .ghost:hover, .act-tools .ghost:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.28); }
.actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.625rem 0.875rem; }
.act-main { display: flex; gap: 0.5rem; }
.act-main .run, .act-main .ghost.accent {
  min-height: 2.5rem;
  padding: 0.5rem 1.125rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9375rem;
}
.act-tools { display: flex; flex-wrap: wrap; gap: 0.375rem; }

/* Pane headers: leave room so the collapse arrow never covers a button */
.outbar, .filetabs { padding-inline-end: 2.75rem; }
.pane-toggle {
  top: 0.625rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e6f3ef;
  font-size: 0.9rem;
  line-height: 1;
}
.pane-toggle:hover { background: rgba(255, 255, 255, 0.14); }
.out-tabs button, .pane-tabs button, .dev-tabs button { border-radius: 999px; }
.dev-tabs { border-radius: 999px; }

/* Light surfaces, with a clear border */
.preview, .pub-panel, .tpl-panel { border-color: #1d4448; }
.composer textarea, .composer .send { font-size: 0.9375rem; }
.composer .send { border-radius: 999px; font-weight: 600; }

@media (max-width: 56rem) {
  .bar { padding: 0.75rem 0.875rem; gap: 0.625rem; }
  .act-tools { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .act-tools::-webkit-scrollbar { display: none; }
  .act-tools .ghost { flex: 0 0 auto; }
}

/* ---------- Site-wide consistency ----------
   Headings use the sans face at a single weight; the template panels and highlights use the same accent. */
.welcome h1, .welcome-h2, .tpl-head h2, .calc-section h2 {
  font-family: var(--sans);
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.03em;
}
.tpl-group h3 { color: var(--bx-accent-hi); }
.tpl-card:hover, .starter:hover, .chip:hover { border-color: var(--bx-accent); }
.tpl-card .flag { border-color: var(--bx-accent); color: var(--bx-accent-hi); }
html[dir="rtl"] .welcome h1, html[dir="rtl"] .welcome-h2, html[dir="rtl"] .tpl-head h2 {
  font-family: "Cairo", var(--sans);
  font-weight: 800;
  letter-spacing: 0;
}

/* template cards: quiet surfaces on the dark workspace panel, not the text colour */
.tpl-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #e6f3ef;
}
.tpl-card span { color: #a9c7c1; }
.tpl-card:hover { background: rgba(255, 255, 255, 0.09); }

/* workspace panels stay dark in both colour schemes; they must not follow the light text tokens */
.tpl-panel, .pub-panel {
  background: #0c2a2f;
  color: #e6f3ef;
}
.tpl-panel .tpl-note, .pub-panel .tpl-note, .tpl-panel .hint, .pub-panel .hint { color: #b9d3cd; }
.tpl-search {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e6f3ef;
}
.tpl-search::placeholder { color: #8fb0aa; }

/* once the workspace is open the login card is gone; no ghost behind the toolbar */
.box.is-open .tape {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* ---------- Scrollbars and focus rings (from the dashboard kit, adapted) ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(127, 150, 150, 0.35); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(127, 150, 150, 0.6); }
input:focus-visible, textarea:focus-visible, select:focus-visible {
  box-shadow: 0 0 0 3px rgba(11, 122, 96, 0.18);
}

/* ---------- Tokens for the one-prompt builder (added; existing tokens unchanged) ---------- */
:root {
  --bx-radius: 14px;
  --bx-shadow-soft: 0 4px 24px rgba(11, 43, 47, 0.06);
  --bx-shadow-lift: 0 12px 40px rgba(11, 43, 47, 0.1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bx-shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.25);
    --bx-shadow-lift: 0 12px 40px rgba(0, 0, 0, 0.4);
  }
}
