/* ═══════════════════════════════════════════════════════════════════
   بالِ — reset + shared primitives.  Loads after theme.css.
   -------------------------------------------------------------------
   These classes were previously duplicated inline in every page. Several
   of them are also EMITTED BY THE RUNTIME JS, so their names are load-
   bearing and must not be renamed:

       .btn .btn.primary .btn.quiet .btn.lg     ← landing.js, account-widget
       .chip .chip.terra                        ← landing.js (first specialty)
       .t-card .photo[data-tint] .body .creds .chips .foot   ← landing.js
       .city-row .city-name .city-count         ← landing.js
       .avatar[data-tint]                       ← several components
       .terra (as a text-highlight span)        ← landing.js signed-in hero

   See theme.css for why the old token NAMES survive as aliases.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--display);      /* Fraunces — the humane register */
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
  /* --text, NOT --ink. --ink is a literal dark colour; on a dark surface
     (the admin shell, .on-dark cards) that is dark-on-dark and the heading
     disappears. --text is semantic and every dark scope remaps it to cream. */
  color: var(--text);
}
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

/* ── Brand lockup — Arabic only. There is no Latin "BaLi". ────────── */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.wordmark img.mark      { height: 30px; width: auto; }
.wordmark img.wordmark-ar { height: 26px; width: auto; }

/* ── Eyebrow ───────────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--mono);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.16em;
  font-weight: 500;
  color: var(--forest);
}

/* ── Buttons ───────────────────────────────────────────────────────
   EVERY clickable thing is Forest. Kelly (2.63:1) and Mint (1.40:1) are
   decorative and can never carry a label. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: var(--forest);
  color: #fff;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out);
  text-decoration: none;
}
.btn:hover { background: var(--forest-deep); transform: translateY(-1px); }
.btn.primary { background: var(--forest); color: #fff; box-shadow: var(--shadow-brand); }
.btn.primary:hover { background: var(--forest-deep); }
.btn.ghost {
  background: transparent;
  color: var(--forest);
  border-color: var(--g32);
}
.btn.ghost:hover { background: var(--g10); border-color: var(--forest); }
.btn.quiet {
  background: transparent;
  color: var(--forest);
  border: none;
  padding: 12px 14px;
}
.btn.quiet:hover { background: rgba(1,93,103,0.07); }
.btn.lg { padding: 16px 30px; font-size: 15px; }
.btn.sm { padding: 8px 14px; font-size: 12.5px; }

/* CRISIS + DESTRUCTIVE ONLY. Nowhere else, ever. */
.btn.crisis, .btn.danger {
  background: var(--clay);
  color: #fff;
  box-shadow: 0 10px 30px -12px rgba(158,66,48,0.45);
}
.btn.crisis:hover, .btn.danger:hover { background: var(--clay-deep); }

/* Spotlight CTA — the promoted "See full directory". Sheen retained. */
.btn.spotlight {
  background: linear-gradient(135deg, var(--forest) 0%, var(--ink) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 16px 32px;
  border-radius: var(--r-pill);
  box-shadow: 0 10px 28px -10px rgba(1,93,103,0.45),
              inset 0 1px 0 rgba(255,255,255,0.14);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out);
}
.btn.spotlight::before {
  content: "";
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.20) 50%, transparent 100%);
  transform: skewX(-20deg);
  transition: left 700ms var(--ease-out);
  pointer-events: none;
}
.btn.spotlight:hover { transform: translateY(-2px); }
.btn.spotlight:hover::before { left: 130%; }
.btn.spotlight .spotlight-arrow { display: inline-block; transition: transform var(--t-base) var(--ease-out); }
.btn.spotlight:hover .spotlight-arrow { transform: translateX(4px); }
.preview-cta-row { display: flex; justify-content: flex-start; margin-top: 28px; scroll-margin-top: 96px; }

/* ── Form controls ─────────────────────────────────────────────────
   The one gap the UX-0 audit found in this primitive set: six pages
   each carried their own input styling (five different radii, two
   focus colours). This is the single copy they converge on. The admin
   shell keeps its own dark-surface variants in admin.css — same class
   names, different ground.
   Focus follows the brand contract: interactive = Forest. */
.input, .textarea, .select,
input.input, textarea.textarea, select.select {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  line-height: 1.45;
  transition: border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(1,93,103,0.10);
}
.input[disabled], .textarea[disabled], .select[disabled] {
  background: var(--cream-deep);
  color: var(--muted);
  cursor: not-allowed;
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--clay-soft);
}
.textarea { min-height: 96px; resize: vertical; }

.field { margin-bottom: 16px; }
.field-label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 6px;
}
.field-hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.field-error { font-size: 12.5px; color: var(--clay); margin-top: 5px; }

/* ── Chips ─────────────────────────────────────────────────────────
   .chip.terra is emitted by landing.js for the first specialty. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--cream-deep);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--rule);
  white-space: nowrap;
}
.chip.terra { background: var(--g10); border-color: var(--g24); color: var(--forest); }
.chip.olive { background: var(--g16); border-color: var(--g24); color: var(--forest); }
.chip.navy  { background: var(--cream-deep); border-color: var(--rule); color: var(--ink); }

/* ── State primitives ──────────────────────────────────────────────
   One vocabulary for "nothing here", "it worked" and "it failed"
   (UX-1 — previously nine empty-state class names and three unrelated
   error treatments, some of which still rendered in the pre-rebrand
   palette via stale aliases). Loading states use skeleton.js.
   The admin shell overrides these on its dark ground in admin.css. */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}
.empty-state .em-title { font-family: var(--display); font-size: 16px; color: var(--ink); margin-bottom: 6px; }

.banner { padding: 12px 14px; border-radius: var(--r-md); font-size: 13px; line-height: 1.5; }
.banner[hidden] { display: none; }
.banner.error { background: var(--clay-tint); border: 1px solid var(--clay-soft); color: var(--clay-deep); }
.banner.ok    { background: var(--grow-tint); border: 1px solid var(--grow); color: var(--olive-deep); }
.banner.warn  { background: var(--amber-tint); border: 1px solid var(--amber); color: var(--amber); }
.banner ul { margin: 8px 0 0; padding-inline-start: 18px; }
.banner li { margin: 2px 0; }

/* Status pills — semantic, not per-feature. Pages map their domain
   states onto ok / warn / crit / info instead of inventing colours. */
.status-pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--cream-deep);
  color: var(--muted);
}
.status-pill.ok   { background: var(--grow-tint); color: var(--olive-deep); }
.status-pill.warn { background: var(--amber-tint); color: var(--amber); }
.status-pill.crit { background: var(--clay-tint); color: var(--clay-deep); }
.status-pill.info { background: var(--g10); color: var(--forest); }

/* ── Auth gate (UX-2) ──────────────────────────────────────────────
   /bali/authgate.js tags <html data-auth-pending> at first paint when
   a token exists. Anything marked data-auth-swap (chrome that renders
   a guest/placeholder state and is rewritten once /api/auth/me
   resolves) stays invisible — layout intact — until the component
   that owns it removes the tag. Signed-out visitors never get the
   tag, so this rule never applies to them. */
html[data-auth-pending] [data-auth-swap] { visibility: hidden; }

/* ── Back link — THE way back out of a sub-page (UX-2) ─────────────
   One vocabulary: "← Back to <destination>". Quiz steps keep their
   Back/Continue button pair (that's wizard chrome, not navigation). */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--t-small);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease-out);
}
.back-link:hover { color: var(--forest); }

/* ── Surfaces ──────────────────────────────────────────────────────── */
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}
.hairline { height: 1px; background: var(--rule); border: 0; margin: 0; }

.img-slot {
  background:
    repeating-linear-gradient(135deg, rgba(1,93,103,0.05) 0 1px, transparent 1px 12px),
    var(--cream-deep);
  border: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
}

/* ── Avatars — data-tint values are emitted by the JS ─────────────── */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--g16);
  color: var(--forest);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.avatar[data-tint="navy"]  { background: var(--g16); color: var(--ink); }
.avatar[data-tint="olive"] { background: var(--g24); color: var(--forest); }
.avatar[data-tint="terra"] { background: var(--g10); color: var(--forest); }
.avatar[data-tint="slate"] { background: var(--cream-deep); color: var(--muted); }

/* ── .terra as a text highlight — emitted by landing.js in the
      signed-in hero ("Welcome back, <span class='terra'>Name</span>") ── */
.terra { color: var(--forest); }

/* ── Arabic set inside Latin copy ──────────────────────────────────
   Fraunces and Inter have NO Arabic glyphs. The brand name is Arabic-
   only, so every inline بالِ in English/French copy must be tagged, or
   it silently falls back to a system font and looks nothing like the
   wordmark. */
.ar-name {
  font-family: var(--arabic);
  font-weight: 800;
  font-size: 0.94em;   /* Cairo runs large next to Fraunces/Inter */
  letter-spacing: 0;
}

/* ── Optical sizing of the mark ────────────────────────────────────
   The full mark carries three "thought" puffs at 100/70/45% opacity.
   That ramp is the idea at 120px and it is MUD at 32px — the two faded
   puffs become specks. So there are two marks:

     /brand/mark.svg        full ramp  — hero, print, ≥64px
     /brand/mark-small.svg  one solid puff — nav, footer, favicon, <64px

   Optical sizing, not a compromise: the identity is the two-shape
   silhouette, and that is what has to survive the shrink. */
.wordmark img.mark { height: 30px; width: auto; }

/* ── Kill the legacy wordmark bullet ───────────────────────────────
   25 pages define `.wordmark::before` — a small dot that stood in for a
   logo back when the wordmark was just the word "BaLi" in type. Now that
   the wordmark IS an image lockup (mark + بالِ), the dot is a stray
   artefact floating to its left.

   Scoped with :has(img) so the admin sidebar — whose wordmark is still
   live text ("بالِ · Admin") — keeps its bullet, which is intentional
   there. One rule instead of 25 edits. */
.wordmark:has(img)::before {
  content: none !important;
  display: none !important;
}
