/* Bridge — design-system tokens and component classes. This file is the source of truth for the system's look; retune it here and see readme.md. */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Noto+Sans+Arabic:wght@400..700&display=swap');

:root {
  --color-bg: #ffffff;
  --color-surface: #f0efee;
  --color-text: #201e1d;
  --color-accent: #003da7;
  --color-accent-2: #2a5fbe;
  --color-divider: color-mix(in srgb, #201e1d 20%, transparent);

  /* Focus — its own role, not the accent. A brand whose accent is warm (SHIFT's
     oxide) would otherwise ring every field in what reads as an error colour. */
  --color-focus: #003da7;

  /* Signal — counts, badges and alerts. Deliberately outside the blue accent so a
     bag count never reads as the primary action. Warm, so it separates on this ground. */
  --color-signal-100: #fbe8dc;
  --color-signal-300: #f0b48a;
  --color-signal-500: #d2601b;
  --color-signal-700: #963f0c;
  --color-signal: var(--color-signal-500);
  --color-signal-ink: #ffffff;

  /* Radius — panels, cards and images stay square (--radius-sm/md/lg = 0).
     Interactive furniture is the exception, and it is not all one value:
     buttons take a slightly softer corner than inputs, and counts/pills go
     fully round. --radius-control is kept as an alias for older markup. */
  --radius-button: 4px;
  --radius-input: 3px;
  --radius-badge: 999px;
  --radius-pill: 999px;
  --radius-control: var(--radius-button);

  /* Logo ink — pure black, one step darker than body text on purpose. */
  --color-logo: #000000;

  /* Tonal ramps — generated in OKLCH on one shared lightness scale, so the
     same step of any role matches the others in visual value. */
  --color-neutral-100: #f8f4f4;
  --color-neutral-200: #eae7e7;
  --color-neutral-300: #d7d3d3;
  --color-neutral-400: #bab6b6;
  --color-neutral-500: #9b9797;
  --color-neutral-600: #7d7979;
  --color-neutral-700: #605d5d;
  --color-neutral-800: #444141;
  --color-neutral-900: #2d2b2b;

  --color-accent-100: #eff3fb;
  --color-accent-200: #d6e0f4;
  --color-accent-300: #b0c4e9;
  --color-accent-400: #7593d6;
  --color-accent-500: #2a5fbe;
  --color-accent-600: #00429f;
  --color-accent-700: #00337c;
  --color-accent-800: #002458;
  --color-accent-900: #001a3c;

  --font-heading: "Fraunces", Georgia, serif;
  --font-heading-weight: 800;
  --font-body: "Fraunces", Georgia, serif;

  --space-1: 4.0px;
  --space-2: 8.0px;
  --space-3: 12.0px;
  --space-4: 16.0px;
  --space-6: 24.0px;
  --space-8: 32.0px;

  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;

  /* Elevation — derived from the ground: soft ink-tinted shadows on a
     light theme, a hairline edge + ambient darkness on a dark one. */
  --shadow-sm: 0 1px 2px color-mix(in srgb, #2d2b2b 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2d2b2b 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2d2b2b 22%, transparent);
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: var(--font-heading-weight); }

.grayscale{filter:grayscale(1) contrast(1.08)}

/* ══════════════════════════════════════════════════════════════════════════
   Components — built with the tokens above. Plain CSS
   on plain HTML: no JavaScript, no build step. Each class is documented in
   readme.md and demonstrated in foundations/ and components/.
   ══════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.55; font-weight: 400; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-2);
}
h1 { font-size: 42px; }
h2 { font-size: 32px; }
h3 { font-size: 25px; }
h4 { font-size: 20px; }
h5 { font-size: 16px; }
h6 { font-size: 13px; }
h6 { letter-spacing: 0.08em; text-transform: uppercase; }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
figure { margin: 0; }
figcaption {
  font-size: 11px; margin-top: var(--space-1);
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* — buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2; color: var(--color-text); /* matches the .input's 14px —
     the pair sits side by side in sign-up rows */
  background: transparent; border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}
.btn svg { display: block; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
/* Hover/active always restate `color`. Buttons are often anchors, and a page's
   `a:hover` rule would otherwise repaint the label — that was the blue text on
   hover in the crossover CTA. Fills are also darkened rather than lightened so
   label contrast rises on hover instead of falling. */
.btn-primary { background: var(--color-accent); color: var(--color-bg); }
.btn-primary:hover { background: var(--color-accent-700); color: var(--color-bg); }
.btn-primary:active { background: var(--color-accent-800); color: var(--color-bg); }
.btn-secondary { border-color: var(--color-divider); color: var(--color-text); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 8%, transparent); color: var(--color-text); border-color: var(--color-text); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 15%, transparent); color: var(--color-text); }
.btn-ghost { color: var(--color-accent); padding-inline: var(--space-1); }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 12%, transparent); color: var(--color-accent-800); }
.btn-ghost:active { background: color-mix(in srgb, var(--color-accent) 20%, transparent); color: var(--color-accent-900); }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-block { width: 100%; margin-top: var(--space-2); justify-content: flex-start; text-align: start; }

/* — forms — */
.field > label {
  display: block; font-size: 12px; margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.input {
  width: 100%; min-height: 36px; padding: 6px 10px; font: inherit;
  font-size: 14px; color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-focus); outline-offset: 0; }
textarea.input { min-height: 90px; resize: vertical; }
.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.radio input, .seg-opt input {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.radio .dot {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--color-divider);
}
.radio:hover .dot { border-color: var(--color-accent); }
.radio input:checked + .dot {
  border-color: var(--color-accent); background: var(--color-accent);
  box-shadow: inset 0 0 0 4px var(--color-bg);
}
.radio input:focus-visible + .dot { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.seg {
  display: flex; flex-wrap: wrap; overflow: hidden;
  width: max-content; max-width: 100%;
  gap: 1px; background: var(--color-divider);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.seg-opt {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  flex: 1 1 auto; min-width: 0;
  padding: 7px 12px; font-size: 13px; cursor: pointer;
  background: var(--color-bg);
}
.seg-opt:has(input:checked) { background: var(--color-accent); color: var(--color-bg); }
.seg-opt:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: -2px; }

/* — cards — */
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface);
}
.card-kicker { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent); }
.card-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 17px; line-height: 1.2;
}
.card-body { margin: 0; font-size: 13px; opacity: 0.8; flex: 1; }
.card-meta {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}
.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }
.elev-lg { box-shadow: var(--shadow-lg); }

/* — tags — */
.tag {
  display: inline-flex; align-items: center; font-size: 11px;
  letter-spacing: 0.02em; padding: 3px 10px;
  border-radius: calc(var(--radius-md) * 0.75);
}
.tag-accent { background: var(--color-accent-100); color: var(--color-accent-800); }
.tag-neutral { background: var(--color-neutral-100); color: var(--color-neutral-800); }
.tag-quiet { background: color-mix(in srgb, var(--color-text) 8%, transparent); color: var(--color-text); }
.tag-solid { background: var(--color-text); color: var(--color-bg); }
/* kept as an alias so older markup still renders — no stroke, same fill as quiet */
.tag-outline { background: color-mix(in srgb, var(--color-text) 8%, transparent); color: var(--color-text); }

/* — card tag — the same tag, positioned over product imagery — */
.tag-on-image {
  position: absolute; inset-inline-start: 10px; top: 10px;
}

/* — badge — counts and status ovals. One component, three tones. Sits on the
   signal role, never the accent, so a bag count never reads as an action. — */
.badge {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-family: var(--font-heading); font-weight: 700;
  font-size: 11px; line-height: 1; font-variant-numeric: tabular-nums;
  border-radius: var(--radius-badge);
  background: var(--color-signal); color: var(--color-signal-ink);
}
.badge-quiet { background: color-mix(in srgb, var(--color-text) 12%, transparent); color: var(--color-text); }
.badge-outline { background: transparent; color: var(--color-text); box-shadow: inset 0 0 0 1px var(--color-divider); }
.badge-sm { min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
/* pinned to the top-end corner of an icon button */
.badge-pin { position: absolute; top: 3px; inset-inline-end: 1px; }

/* — alert — inline notification. Rule on the leading edge, tinted ground. — */
.alert {
  display: flex; align-items: flex-start; gap: var(--space-2);
  padding: var(--space-3) var(--space-3);
  border-inline-start: 2px solid var(--color-text);
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
  font-size: 13px; line-height: 1.45; color: var(--color-neutral-900);
}
.alert-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 13px; }
.alert-body { margin: 0; font-size: 13px; }
.alert svg { flex: none; margin-top: 1px; }
.alert-error { border-color: var(--color-signal-700); background: var(--color-signal-100); }
.alert-success { border-color: var(--color-accent); background: var(--color-accent-100); }
.alert-info { border-color: var(--color-neutral-700); background: var(--color-neutral-100); }
.alert-warning { border-color: var(--color-signal-500); background: var(--color-signal-100); }

/* — progress stepper — checkout and multi-step flows — */
.stepper { display: flex; align-items: flex-start; width: 100%; margin: 0; padding: 0; list-style: none; }
.stepper-step { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); padding-inline-end: var(--space-3); }
.stepper-step:last-child { flex: 0 0 auto; padding-inline-end: 0; }
.stepper-rail { display: flex; align-items: center; gap: var(--space-2); }
.stepper-mark {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 12px; line-height: 1;
  border: 1.5px solid var(--color-divider); background: var(--color-bg);
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.stepper-line { flex: 1; min-width: 16px; height: 1.5px; background: var(--color-divider); }
.stepper-step:last-child .stepper-line { display: none; }
.stepper-label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: color-mix(in srgb, var(--color-text) 55%, transparent); white-space: nowrap; overflow: visible; text-overflow: clip; }
.stepper-step[data-state="done"] .stepper-mark { border-color: var(--color-accent); color: var(--color-accent); }
.stepper-step[data-state="done"] .stepper-line { background: var(--color-accent); }
.stepper-step[data-state="done"] .stepper-label { color: color-mix(in srgb, var(--color-text) 75%, transparent); }
.stepper-step[data-state="current"] .stepper-mark { border-color: var(--color-accent); background: var(--color-accent); color: var(--color-bg); }
.stepper-step[data-state="current"] .stepper-label { color: var(--color-text); font-weight: 700; }

/* — quantity stepper — bag rows — */
.qty { display: inline-flex; width: max-content; align-self: start; flex: none; align-items: stretch; background: var(--color-bg); border: 1px solid var(--color-divider); border-radius: var(--radius-control); overflow: hidden; }
.qty button { appearance: none; background: transparent; border: 0; cursor: pointer; font: inherit; color: var(--color-text); width: 40px; min-height: 40px; display: grid; place-items: center; }
.qty button:hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 8%, transparent); }
.qty button:disabled { opacity: 0.3; cursor: not-allowed; }
.qty-value {
  min-width: 46px; display: grid; place-items: center;
  border-inline: 1px solid var(--color-divider);
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; font-variant-numeric: tabular-nums;
}

/* — navigation — */
.nav {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
}
.nav-brand {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 18px; margin-inline-end: auto;
}
.nav a { color: inherit; text-decoration: none; font-size: 14px; }
.nav a:hover, .nav a[aria-current='page'] { color: var(--color-accent); }

/* — tables — */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: start; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  padding: var(--space-2); border-bottom: 2px solid var(--color-divider);
}
.table td {
  padding: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
}
.table tbody tr:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }

/* — dialog — */
.dialog-backdrop {
  position: fixed; inset: 0; display: grid; place-items: center;
  padding: var(--space-4);
  background: color-mix(in srgb, var(--color-neutral-900) 50%, transparent);
}
.dialog {
  width: min(440px, 100%); display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-lg);
}
.dialog-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 20px;
}
.dialog-body { font-size: 14px; opacity: 0.85; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }



/* Interactive furniture takes a radius; everything else stays square. */
.btn, .qty { border-radius: var(--radius-button); }
.input, .seg { border-radius: var(--radius-input); }
.seg-opt:first-child { border-top-left-radius: var(--radius-input); border-bottom-left-radius: var(--radius-input); }
.seg-opt:last-child { border-top-right-radius: var(--radius-input); border-bottom-right-radius: var(--radius-input); }


/* ===== RIGHT-TO-LEFT ===== Arabic swaps the type stack; layout mirrors via
   logical properties, so no per-component overrides are needed. */
html[dir="rtl"], [dir="rtl"] {
  --font-heading: "Amiri", "Noto Sans Arabic", Georgia, serif;
  --font-body: "Noto Sans Arabic", "Amiri", system-ui, sans-serif;
}
/* Latin islands inside an RTL page keep the brand face — custom properties
   inherit past a dir change, so they need an explicit reset. */
[dir="rtl"] [dir="ltr"] {
  --font-heading: "Fraunces", Georgia, serif;
  --font-body: "Fraunces", Georgia, serif;
}
/* the lockup never mirrors: mark left of wordmark in every language */
[dir="rtl"] .nav-brand, [dir="rtl"] .brand-lockup {
  direction: ltr;
  /* the wordmark hugs the reader's edge. `direction: ltr` on this box flips
     which side its own logical properties resolve to, so the auto margin and
     inline padding are restated in the ROW's direction below. */
  padding-inline: 0;
  --font-heading: "Fraunces", Georgia, serif;
  --font-body: "Fraunces", Georgia, serif;
  font-family: "Fraunces", Georgia, serif;
}
/* `.nav-brand` carries `margin-inline-end: auto` to push the utilities right.
   With `direction: ltr` forced on that box, the logical margin resolves to
   margin-right — the START side of an RTL flex row — which pushed the wordmark
   inboard. Restate it against the row's real direction. */
[dir="rtl"] .nav-brand { margin-inline-end: 0; margin-right: 0; margin-left: auto; }
[dir="rtl"] .btn { white-space: nowrap; }
[dir="rtl"] { letter-spacing: 0 !important; }
[dir="rtl"] .btn, [dir="rtl"] .input { letter-spacing: 0; }
/* a trailing arrow in a labelled button points the way the reader travels */
[dir="rtl"] .btn:not(.btn-icon) > svg:last-child:not(:first-child) { transform: scaleX(-1); }
