/* ═══════════════════════════════════════════════════════════════════════
   AL DURR — الدر · cosmetics store
   One stylesheet, cascade-layered. RTL/LTR handled with logical properties,
   so the same rules serve Arabic and English. Light + dark themes.
   ═══════════════════════════════════════════════════════════════════════ */
@layer reset, tokens, base, layout, components, utilities;

/* ── reset ─────────────────────────────────────────────────────────────── */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; }
  body { min-height: 100svh; line-height: 1.6; -webkit-font-smoothing: antialiased; }
  img, svg, video { display: block; max-width: 100%; height: auto; }
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; background: none; border: none; }
  a { color: inherit; text-decoration: none; }
  ul { list-style: none; padding: 0; }
  :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
}

/* ── tokens ────────────────────────────────────────────────────────────── */
@layer tokens {
  :root {
    /* brand palette — pearl, wine, gold */
    --ivory:    #FBF8F4;
    --pearl:    #F2EAE1;
    --wine:     #7A2E43;
    --wine-deep:#5E2234;
    --gold:     #C29B4A;
    --gold-soft:#E7D6AE;
    --ink:      #2A2320;
    --muted:    #7C6F67;

    /* semantic — light theme (default) */
    --bg:        var(--ivory);
    --surface:   #FFFFFF;
    --surface-2: var(--pearl);
    --text:      var(--ink);
    /* AA fix (SENTRY): the pearl --muted #7C6F67 is only 4.08:1 on --surface-2,
       under the 4.5:1 text floor (About section .muted). Darkened, same warm taupe
       hue, still clearly "soft" vs --text. Verified: 4.96:1 on surface-2 (#F2EAE1),
       5.58:1 on --bg ivory (#FBF8F4), 5.91:1 on white (#FFFFFF). */
    --text-soft: #6E6259;
    --primary:   var(--wine);
    --primary-ink:#FFFFFF;
    --accent:    var(--gold);
    --line:      #E7DED4;
    /* --line is a ~1.3:1 hairline — fine for decorative dividers/cards, but below
       the WCAG 1.4.11 3:1 floor for a control's own boundary. --line-strong is the
       dedicated form-control border: #9A8B76 = 3.32:1 on the white input surface. */
    --line-strong: #9A8B76;
    --focus:     var(--wine);
    --danger:    #B23A3A;
    --ok:        #2E7D5B;
    /* Admin status-pill text — each pill background is a color-mix() tint composited
       over --surface (white in light). The old hardcoded blue/gold failed AA, and
       --primary/--ok are too light as text on their own light tints, so pill ink is
       pinned here and re-tuned per theme. Ratios are text vs the composited tint. */
    --pill-new-text:       var(--primary); /* 6.95:1 on wine 16% tint */
    --pill-confirmed-text: #1d4ed8;        /* 5.44:1 on blue 18% tint */
    --pill-shipped-text:   #6f5610;        /* 5.77:1 on gold 22% tint */
    --pill-delivered-text: #1f6b49;        /* 5.08:1 on green 18% tint */
    --pill-cancelled-text: var(--danger);  /* 4.63:1 on danger 16% tint */
    --shadow:    0 1px 2px rgba(42,35,32,.06), 0 8px 24px -12px rgba(42,35,32,.18);
    --shadow-lg: 0 12px 40px -12px rgba(42,35,32,.28);

    /* scale */
    --step--1: clamp(.82rem, .8rem + .1vw, .9rem);
    --step-0:  clamp(1rem, .96rem + .2vw, 1.08rem);
    --step-1:  clamp(1.2rem, 1.1rem + .5vw, 1.45rem);
    --step-2:  clamp(1.55rem, 1.35rem + 1vw, 2.1rem);
    --step-3:  clamp(2.1rem, 1.7rem + 2vw, 3.2rem);

    --radius:   14px;
    --radius-s: 9px;
    --gap:      clamp(1rem, .8rem + 1vw, 1.5rem);
    --pad-x:    clamp(1rem, .4rem + 2.5vw, 2.5rem);
    --wrap:     1200px;

    --font-ar: "Tajawal", "Tajawal Fallback", "Tajawal Fallback Android", "Segoe UI", system-ui, sans-serif;
    --font-en: "Poppins", "Poppins Fallback", "Poppins Fallback Android", "Segoe UI", system-ui, sans-serif;
    --font-display: "Cormorant Garamond", "Cormorant Garamond Fallback", "Tajawal", serif;
    --ease: cubic-bezier(.22, 1, .36, 1);
  }

  :root[data-theme="dark"] {
    --bg:        #171213;
    --surface:   #211A1C;
    --surface-2: #2A2124;
    --text:      #F3EBE6;
    --text-soft: #B7A79F;
    --primary:   #C9738C;
    --primary-ink:#1A1113;
    --accent:    #D9B75F;
    --line:      #3A2E31;
    /* Stronger control boundary for dark: #7A6A64 = 3.31:1 on --surface (#211A1C). */
    --line-strong: #7A6A64;
    --focus:     #E7B3C3;
    /* Dark overrides — the light hues fail AA on the dim ground (danger ~3.1:1,
       ok ~3.7:1 as text). These clear it: danger 7.40:1, ok 8.31:1 on --bg. */
    --danger:    #E8898B;
    --ok:        #5FC08D;
    /* Pill tints now ride on the dim --surface, so readable ink flips light.
       new/confirmed/shipped are pinned; delivered/cancelled inherit the dark
       --ok/--danger (which already clear 4.5:1 on their own tints). */
    --pill-new-text:       #de8ea4;   /* 5.54:1 */
    --pill-confirmed-text: #7ea8ff;   /* 5.82:1 */
    --pill-shipped-text:   #e0be6f;   /* 5.95:1 */
    --pill-delivered-text: var(--ok); /* 5.49:1 */
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 10px 30px -12px rgba(0,0,0,.6);
    --shadow-lg: 0 16px 50px -12px rgba(0,0,0,.7);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg:#171213; --surface:#211A1C; --surface-2:#2A2124; --text:#F3EBE6;
      --text-soft:#B7A79F; --primary:#C9738C; --primary-ink:#1A1113; --accent:#D9B75F;
      --line:#3A2E31; --line-strong:#7A6A64; --focus:#E7B3C3;
      /* Dark overrides — must stay in sync with the [data-theme="dark"] block above. */
      --danger:#E8898B; --ok:#5FC08D;
      --pill-new-text:#de8ea4; --pill-confirmed-text:#7ea8ff; --pill-shipped-text:#e0be6f;
      --pill-delivered-text:var(--ok);
      --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -12px rgba(0,0,0,.6);
      --shadow-lg: 0 16px 50px -12px rgba(0,0,0,.7);
    }
  }
}

/* ── base ──────────────────────────────────────────────────────────────── */
@layer base {
  html { scroll-behavior: smooth; }
  /* The copy lives in i18n.js and is written in by ui.js. Until then the
     headings and labels are empty and the direction may be wrong, so the
     first paint would be a blank page that jumps into place (measured CLS
     0.3–0.8). Hold it invisible instead; ui.js drops data-i18n-wait, and the
     delayed animation reveals the page anyway if scripts never run. */
  html[data-i18n-wait] body { visibility: hidden; animation: i18n-reveal 0s 2.5s forwards; }
  @keyframes i18n-reveal { to { visibility: visible; } }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ar);
    font-size: var(--step-0);
  }
  html[lang="en"] body { font-family: var(--font-en); }

  h1, h2, h3 { line-height: 1.15; font-weight: 700; }
  h1 { font-size: var(--step-3); }
  h2 { font-size: var(--step-2); }
  h3 { font-size: var(--step-1); }

  .display { font-family: var(--font-display); font-weight: 600; letter-spacing: .01em; }
  html[lang="ar"] .display { font-family: var(--font-ar); }

  ::selection { background: var(--gold-soft); color: var(--ink); }

  .skip-link {
    position: absolute; inset-inline-start: 1rem; inset-block-start: -4rem;
    background: var(--primary); color: var(--primary-ink);
    padding: .6rem 1rem; border-radius: var(--radius-s); z-index: 100;
    transition: inset-block-start .2s var(--ease);
  }
  .skip-link:focus { inset-block-start: 1rem; }
}

/* ── layout ────────────────────────────────────────────────────────────── */
@layer layout {
  .wrap { width: min(var(--wrap), 100% - 2 * var(--pad-x)); margin-inline: auto; }
  .stack > * + * { margin-block-start: var(--gap); }
  main { display: block; }
  .section { padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem); }
}

/* ── components ────────────────────────────────────────────────────────── */
@layer components {

  /* header */
  .site-header {
    position: sticky; inset-block-start: 0; z-index: 40;
    background: color-mix(in oklab, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-block-end: 1px solid var(--line);
    /* Rests flat; JS toggles .is-scrolled to lift it off the page on scroll. */
    transition: box-shadow .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease);
  }
  .site-header.is-scrolled {
    box-shadow: var(--shadow);
    /* Hairline firms up as elevation appears so the header reads as a layer. */
    border-block-end-color: color-mix(in oklab, var(--line) 55%, var(--text));
    background: color-mix(in oklab, var(--bg) 94%, transparent);
  }
  .site-header__bar {
    display: flex; align-items: center; gap: var(--gap);
    min-height: 68px; padding-block: .5rem;
  }
  .brand { display: flex; align-items: center; gap: .6rem; margin-inline-end: auto; }
  .brand__mark { width: 40px; height: 40px; flex: none; }
  .brand__name { font-family: var(--font-display); font-size: var(--step-1); font-weight: 700; color: var(--primary); line-height: 1; }
  html[lang="ar"] .brand__name { font-family: var(--font-ar); }
  .brand__sub { font-size: .68rem; color: var(--text-soft); letter-spacing: .04em; }
  .nav { display: none; gap: 1.4rem; }
  .nav a { color: var(--text-soft); font-weight: 500; padding-block: .3rem; border-block-end: 2px solid transparent; }
  .nav a:hover { color: var(--text); border-color: var(--accent); }
  @media (min-width: 720px) { .nav { display: flex; } }

  .icon-btn {
    position: relative; display: grid; place-items: center;
    min-width: 44px; min-height: 44px; border-radius: var(--radius-s);
    color: var(--text); transition: background .2s var(--ease);
  }
  .icon-btn:hover { background: var(--surface-2); }
  .icon-btn svg { width: 22px; height: 22px; }
  .cart-badge {
    position: absolute; inset-block-start: 4px; inset-inline-end: 4px;
    min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
    background: var(--primary); color: var(--primary-ink);
    font-size: .68rem; font-weight: 700; display: grid; place-items: center;
  }
  .cart-badge[hidden] { display: none; }

  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 46px; padding: 0 1.3rem; border-radius: 999px; font-weight: 600;
    background: var(--primary); color: var(--primary-ink);
    transition: transform .12s var(--ease), box-shadow .2s var(--ease), background .2s;
    box-shadow: var(--shadow);
  }
  .btn:hover { transform: translateY(-1px); }
  .btn:active { transform: translateY(0); }
  .btn--ghost { background: transparent; color: var(--text); box-shadow: none; border: 1.5px solid var(--line); }
  .btn--ghost:hover { border-color: var(--primary); color: var(--primary); }
  .btn--gold { background: var(--accent); color: #23180a; }
  .btn--block { width: 100%; }
  /* aria-disabled: the sidecart's checkout link under the minimum order is
     still a focusable link (it explains itself on click), but must not look live. */
  .btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
  .btn--sm { min-height: 38px; padding: 0 .9rem; font-size: var(--step--1); }

  .lang-pill {
    min-width: 44px; min-height: 44px; padding-inline: .5rem; border-radius: 999px;
    border: 1.5px solid var(--line); font-weight: 700; color: var(--text);
  }
  .lang-pill:hover { border-color: var(--primary); color: var(--primary); }

  /* hero */
  .hero {
    position: relative; overflow: clip;
    background:
      radial-gradient(120% 120% at 100% 0, color-mix(in oklab, var(--accent) 22%, transparent), transparent 55%),
      linear-gradient(160deg, var(--surface-2), var(--bg));
    border-block-end: 1px solid var(--line);
  }
  .hero__grid { display: grid; gap: var(--gap); align-items: center; padding-block: clamp(2.5rem, 1rem + 6vw, 6rem); }
  @media (min-width: 860px) { .hero__grid { grid-template-columns: 1.1fr .9fr; } }
  .hero__kicker {
    display: inline-flex; align-items: center; gap: .5rem; font-size: var(--step--1);
    font-weight: 600; color: var(--primary); letter-spacing: .06em;
    background: color-mix(in oklab, var(--primary) 12%, transparent);
    padding: .35rem .8rem; border-radius: 999px;
  }
  /* Dark: rose-wine on its own 12% tint over a card measured 4.36:1; a touch of
     --text lifts it past AA without leaving the brand hue. */
  :root[data-theme="dark"] .hero__kicker { color: color-mix(in oklab, var(--primary) 78%, var(--text)); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero__kicker { color: color-mix(in oklab, var(--primary) 78%, var(--text)); } }
  .hero__title { margin-block: .6rem; max-inline-size: 15ch; }
  .hero__title b { color: var(--primary); }
  .hero__text { color: var(--text-soft); max-inline-size: 44ch; font-size: var(--step-1); }
  .hero__art {
    aspect-ratio: 4 / 3; border-radius: calc(var(--radius) * 2);
    background:
      radial-gradient(circle at 30% 30%, var(--gold-soft), transparent 60%),
      linear-gradient(140deg, var(--primary), var(--wine-deep));
    box-shadow: var(--shadow-lg); position: relative; overflow: clip;
  }
  .hero__art::after {
    content: "الدُّر"; position: absolute; inset: 0; display: grid; place-items: center;
    font-family: var(--font-ar); font-size: clamp(3rem, 8vw, 6rem); font-weight: 700;
    color: color-mix(in oklab, #fff 82%, transparent);
  }

  /* toolbar (filter/search/sort) */
  .toolbar { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; }
  .chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-inline-end: auto; }
  .chip {
    min-height: 40px; padding: 0 1rem; border-radius: 999px;
    border: 1.5px solid var(--line); color: var(--text-soft); font-weight: 600; font-size: var(--step--1);
    transition: .15s var(--ease);
  }
  .chip:hover { border-color: var(--primary); color: var(--text); }
  .chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

  .field { display: grid; gap: .35rem; }
  .field > span { font-weight: 600; font-size: var(--step--1); }
  .input, .select, .textarea {
    width: 100%; min-height: 46px; padding: .6rem .85rem;
    background: var(--surface); color: var(--text);
    /* A control's own boundary must clear 3:1 (WCAG 1.4.11), so inputs use
       --line-strong, not the decorative --line hairline. */
    border: 1.5px solid var(--line-strong); border-radius: var(--radius-s);
    transition: border-color .15s var(--ease);
  }
  .input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
  .textarea { min-height: 96px; resize: vertical; }
  .input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
  .search { position: relative; min-width: min(260px, 100%); }
  .search .input { padding-inline-start: 2.4rem; }
  .search svg { position: absolute; inset-inline-start: .7rem; inset-block-start: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-soft); pointer-events: none; }
  .err-text { color: var(--danger); font-size: var(--step--1); min-height: 1.2em; }

  /* product grid */
  .grid-products {
    display: grid; gap: var(--gap);
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  }
  .card {
    display: flex; flex-direction: column; overflow: clip;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); transition: transform .18s var(--ease), box-shadow .2s var(--ease);
  }
  .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
  .card__media {
    aspect-ratio: 1; position: relative; display: grid; place-items: center;
    background: linear-gradient(140deg, var(--surface-2), color-mix(in oklab, var(--accent) 14%, var(--surface)));
    overflow: clip;
  }
  /* .card__media already clips (overflow: clip) so the zoom stays framed. */
  .card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s var(--ease); }
  .card:hover .card__media img { transform: scale(1.04); }
  .card__ph { font-family: var(--font-display); font-size: 2.4rem; color: color-mix(in oklab, var(--primary) 55%, transparent); }
  .card__badge {
    position: absolute; inset-block-start: .6rem; inset-inline-start: .6rem;
    background: var(--ink); color: #fff; font-size: .7rem; font-weight: 700;
    padding: .2rem .55rem; border-radius: 999px;
  }
  .card__body { display: flex; flex-direction: column; gap: .35rem; padding: .9rem 1rem 1.1rem; flex: 1; }
  .card__title { font-weight: 700; font-size: var(--step-0); }
  .card__desc { color: var(--text-soft); font-size: var(--step--1); flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .card__foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-block-start: .4rem; }
  .card__price { font-weight: 800; color: var(--primary); font-size: var(--step-1); }
  .card__price--muted { color: var(--text-soft); }

  /* cart drawer */
  .drawer-backdrop {
    position: fixed; inset: 0; background: rgba(20,14,16,.5); z-index: 60;
    opacity: 0; visibility: hidden; transition: opacity .25s var(--ease), visibility .25s;
  }
  .drawer-backdrop[data-open="true"] { opacity: 1; visibility: visible; }
  .drawer {
    position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 61;
    width: min(420px, 100%); background: var(--surface);
    display: flex; flex-direction: column;
    /* Closed offset is a variable so the direction rule below only sets the
       offset — never a competing transform. That keeps the "open" rule from
       being out-specified in RTL, which previously trapped the drawer off-screen. */
    --x-closed: 100%;
    transform: translateX(var(--x-closed)); transition: transform .32s var(--ease), visibility 0s .32s;
    /* Off-screen is not enough: its buttons stayed in the Tab order (focus
       vanished into an invisible drawer). Hidden once the slide-out ends. */
    visibility: hidden;
    box-shadow: var(--shadow-lg); will-change: transform;
  }
  html[dir="rtl"] .drawer { --x-closed: -100%; }
  .drawer[data-open="true"] { transform: translateX(0); visibility: visible; transition: transform .32s var(--ease); }
  .drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-block-end: 1px solid var(--line); }
  .drawer__body { flex: 1; overflow-y: auto; padding: 1rem 1.2rem; }
  .drawer__foot { border-block-start: 1px solid var(--line); padding: 1.1rem 1.2rem; display: grid; gap: .8rem; background: var(--surface); }

  .line { display: grid; grid-template-columns: 56px 1fr auto; gap: .8rem; align-items: center; padding-block: .8rem; border-block-end: 1px solid var(--line); }
  .line__thumb { width: 56px; height: 56px; border-radius: var(--radius-s); overflow: clip; display: grid; place-items: center; background: var(--surface-2); color: var(--primary); font-family: var(--font-display); }
  .line__thumb img { width: 100%; height: 100%; object-fit: cover; }
  .line__name { font-weight: 600; font-size: var(--step--1); }
  .line__price { color: var(--text-soft); font-size: var(--step--1); }
  .qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; }
  .qty button { width: 32px; height: 32px; display: grid; place-items: center; font-size: 1.1rem; color: var(--text); }
  .qty output { min-width: 1.6ch; text-align: center; font-weight: 700; }
  .link-danger { color: var(--danger); font-size: var(--step--1); font-weight: 600; }

  .summ { display: grid; gap: .4rem; }
  .summ__row { display: flex; justify-content: space-between; color: var(--text-soft); }
  .summ__row--total { color: var(--text); font-weight: 800; font-size: var(--step-1); padding-block-start: .5rem; border-block-start: 1px dashed var(--line); }

  /* empty / status */
  .placeholder { text-align: center; color: var(--text-soft); padding-block: 3rem; }
  .spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-block-start-color: var(--primary); margin-inline: auto; animation: spin .8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* banner */
  .banner { background: var(--gold-soft); color: #3a2c0d; text-align: center; font-weight: 600; font-size: var(--step--1); padding: .5rem 1rem; }
  /* The "we are not taking orders" strip. Reads as a stop, not a promotion,
     so it is never mistaken for the gold announcement banner above it. */
  .banner--stop { background: color-mix(in oklab, var(--danger) 14%, var(--bg)); color: var(--danger); }
  /* Dark: the gold banner dims to a gold-tinted card; the stop strip keeps its red
     meaning with a lighter red (--danger itself is ~3:1 on the dark ground). */
  html[data-theme="dark"] .banner:not(.banner--stop) { background: color-mix(in oklab, var(--accent) 30%, var(--surface)); color: var(--text); }
  html[data-theme="dark"] .banner--stop { background: color-mix(in oklab, var(--danger) 22%, var(--bg)); color: #F2B8B8; }
  @media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .banner:not(.banner--stop) { background: color-mix(in oklab, var(--accent) 30%, var(--surface)); color: var(--text); }
    html:not([data-theme="light"]) .banner--stop { background: color-mix(in oklab, var(--danger) 22%, var(--bg)); color: #F2B8B8; }
  }

  /* checkout layout */
  .checkout-grid { display: grid; gap: var(--gap); align-items: start; }
  @media (min-width: 880px) { .checkout-grid { grid-template-columns: 1.2fr .8fr; } }
  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.2rem, .8rem + 1.5vw, 2rem); box-shadow: var(--shadow); }
  .panel--sticky { position: sticky; inset-block-start: 84px; }
  .form-grid { display: grid; gap: 1rem; }
  @media (min-width: 560px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .col-span { grid-column: 1 / -1; } }
  .cod-badge { display: flex; align-items: center; gap: .6rem; background: color-mix(in oklab, var(--ok) 12%, transparent); color: var(--ok); border-radius: var(--radius-s); padding: .7rem .9rem; font-weight: 600; font-size: var(--step--1); }

  /* footer */
  .site-footer { border-block-start: 1px solid var(--line); background: var(--surface-2); }
  .site-footer__in { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; padding-block: 1.6rem; color: var(--text-soft); font-size: var(--step--1); }

  /* toast */
  .toast {
    position: fixed; inset-block-end: 1.2rem; inset-inline: 0; margin-inline: auto; width: max-content; max-width: 90vw; z-index: 80;
    background: var(--ink); color: #fff; padding: .7rem 1.1rem; box-shadow: var(--shadow-lg);
    /* Pill on one line, a rounded card when it wraps; a very long product
       name is cut at three lines instead of covering the cart's checkout button. */
    border-radius: 1.4rem;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; overflow-wrap: anywhere;
    opacity: 0; transform: translateY(12px); transition: .25s var(--ease); pointer-events: none;
  }
  .toast[data-show="true"] { opacity: 1; transform: translateY(0); }

  /* admin */
  .admin-shell { min-height: 100svh; display: grid; grid-template-rows: auto 1fr; }
  .login-wrap { min-height: 100svh; display: grid; place-items: center; padding: var(--pad-x); }
  .login-card { width: min(400px, 100%); }
  .tabs { display: flex; gap: .5rem; border-block-end: 1px solid var(--line); margin-block-end: 1.5rem; }
  .tab { padding: .7rem 1.1rem; font-weight: 700; color: var(--text-soft); border-block-end: 3px solid transparent; margin-block-end: -1px; }
  .tab[aria-selected="true"] { color: var(--primary); border-color: var(--primary); }
  .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  table { width: 100%; border-collapse: collapse; min-width: 640px; }
  th, td { text-align: start; padding: .8rem 1rem; border-block-end: 1px solid var(--line); vertical-align: middle; }
  th { font-size: var(--step--1); color: var(--text-soft); font-weight: 700; background: var(--surface-2); position: sticky; inset-block-start: 0; }
  tbody tr:last-child td { border-block-end: none; }
  .pill { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
  .pill--new { background: color-mix(in oklab, var(--primary) 16%, transparent); color: var(--pill-new-text); }
  .pill--confirmed { background: color-mix(in oklab, #3b82f6 18%, transparent); color: var(--pill-confirmed-text); }
  .pill--shipped { background: color-mix(in oklab, var(--accent) 22%, transparent); color: var(--pill-shipped-text); }
  .pill--delivered { background: color-mix(in oklab, var(--ok) 18%, transparent); color: var(--pill-delivered-text); }
  .pill--cancelled { background: color-mix(in oklab, var(--danger) 16%, transparent); color: var(--pill-cancelled-text); }

  /* modal */
  .modal-backdrop { position: fixed; inset: 0; background: rgba(20,14,16,.55); display: grid; place-items: center; padding: var(--pad-x); z-index: 70; opacity: 0; visibility: hidden; transition: .2s var(--ease); }
  .modal-backdrop[data-open="true"] { opacity: 1; visibility: visible; }
  .modal { width: min(560px, 100%); max-height: 90svh; overflow-y: auto; }
  .thumb-sm { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
  .row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

  /* ── skeleton loaders ──────────────────────────────────────────────────
     Calm, on-brand placeholder shown while products fetch. The shimmer sweep
     is a single moving gradient (compositor-cheap) and, because it rides on
     `animation`, the reduced-motion reset freezes it to a static tint. */
  @keyframes skShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
  .card--skeleton { pointer-events: none; user-select: none; }
  .sk {
    --sk-base: var(--surface-2);
    --sk-hi: color-mix(in oklab, var(--surface) 72%, var(--surface-2));
    background: linear-gradient(100deg, var(--sk-base) 30%, var(--sk-hi) 50%, var(--sk-base) 70%) var(--sk-base);
    background-size: 200% 100%;
    animation: skShimmer 1.5s linear infinite;
  }
  .card__media.sk { border-radius: 0; } /* fill the square; the card clips corners */
  .sk-line { height: .78rem; border-radius: 999px; }
  .sk-line--sm { height: .66rem; inline-size: 60%; }
  .sk-line--price { height: 1.15rem; inline-size: 42%; margin-block-start: .4rem; }

  /* ── add-to-cart success ───────────────────────────────────────────────
     Brief affirmative state. The ink is --primary-ink (white in light, near-black
     in dark) because it flips with the theme: dark --ok is a bright #5FC08D where
     white text would sink to ~2.2:1, so the added state takes dark ink there
     (8.3:1) while staying white on the darker light-theme green (5.0:1).
     Colour swap reuses the .btn transition, so it eases and reduced-motion
     snaps it — both acceptable. */
  .btn.is-added {
    background: var(--ok); color: var(--primary-ink);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--ok) 22%, transparent), var(--shadow);
  }
  .btn.is-added:hover { transform: none; }

  /* ── cart badge pop ────────────────────────────────────────────────────
     Overshoot-and-settle to draw the eye to a count change. */
  @keyframes badgePop { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 70% { transform: scale(.92); } 100% { transform: scale(1); } }
  .cart-badge { transform-origin: center; }
  .cart-badge.bump { animation: badgePop .4s var(--ease); }

  /* ── interaction polish ────────────────────────────────────────────────
     Consistent, restrained press feedback across the tappable primitives. */
  .icon-btn { transition: background .2s var(--ease), transform .12s var(--ease); }
  .icon-btn:active { transform: scale(.94); }
  .chip:active, .lang-pill:active { transform: translateY(1px); }
  .nav a { transition: color .15s var(--ease), border-color .15s var(--ease); }
  .link-danger { border-radius: 4px; transition: color .15s var(--ease); }
  .link-danger:hover { color: color-mix(in oklab, var(--danger) 78%, var(--text)); }
  .qty button { border-radius: 999px; transition: background .15s var(--ease), color .15s var(--ease); }
  .qty button:hover { background: var(--surface-2); color: var(--primary); }

  /* ── empty-cart placeholder ────────────────────────────────────────────
     Centre it, hold a comfortable measure, and crown it with a soft pearl
     token medallion so an empty drawer still feels composed, not broken. */
  .placeholder { display: grid; place-items: center; gap: .5rem; max-inline-size: 34ch; margin-inline: auto; line-height: 1.5; }
  .drawer__body .placeholder::before {
    content: ""; inline-size: 64px; block-size: 64px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--gold-soft), color-mix(in oklab, var(--primary) 24%, transparent));
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--primary) 20%, transparent);
    margin-block-end: .3rem;
  }

  /* ── numeric alignment ─────────────────────────────────────────────────
     Tabular figures keep prices from jittering as quantities change. */
  .card__price, .summ__row, .summ__row--total, .line__price { font-variant-numeric: tabular-nums; }
  .summ__row--total { margin-block-start: .1rem; }

  /* ── long-content safety (320px → 2560px, 200% zoom) ────────────────────
     Let grid/flex children shrink and break words so nothing clips or
     forces horizontal scroll. */
  .card__body, .line { min-inline-size: 0; }
  .line > * { min-inline-size: 0; }
  .card__title, .line__name, .hero__title, .hero__text, .qv__title, .summ__row { overflow-wrap: anywhere; }
}

/* ── utilities ─────────────────────────────────────────────────────────── */
@layer utilities {
  .visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .center { text-align: center; }
  .muted { color: var(--text-soft); }
  .row { display: flex; align-items: center; gap: .6rem; }
  .between { justify-content: space-between; }
  .wrap-flex { flex-wrap: wrap; }
  .mt { margin-block-start: var(--gap); }
  [hidden] { display: none !important; }
}

/* ── account-free shop: sidecart, quick view, share, guest checkout ───── */
@layer components {
  /* shared bits that used to live only in admin.css */
  .switch { display: flex; align-items: center; gap: .7rem; min-block-size: 2.75rem; cursor: pointer; font-size: var(--step--1); }
  .switch input {
    appearance: none; inline-size: 2.9rem; block-size: 1.6rem; flex: none; border-radius: 999px;
    background: var(--surface-2); border: 1.5px solid var(--line-strong); position: relative; cursor: pointer;
    transition: background .2s var(--ease), border-color .2s var(--ease);
  }
  .switch input::after {
    content: ""; position: absolute; inset-block-start: 50%; inset-inline-start: .15rem;
    inline-size: 1.15rem; block-size: 1.15rem; border-radius: 50%; background: var(--surface);
    box-shadow: 0 1px 3px rgb(0 0 0 / .3); transform: translateY(-50%); transition: inset-inline-start .2s var(--ease);
  }
  .switch input:checked { background: var(--primary); border-color: var(--primary); }
  .switch input:checked::after { inset-inline-start: calc(100% - 1.3rem); }
  .field__hint { font-size: .78rem; color: var(--text-soft); font-weight: 400; }
  .cell-sub { display: block; font-size: .76rem; color: var(--text-soft); }
  .stat-line { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem .2rem; font-size: var(--step--1); }
  .stat-line + .stat-line { border-block-start: 1px solid var(--line); }
  .link { color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
  .link:disabled { color: var(--text-soft); text-decoration: none; cursor: default; }
  html.no-scroll { overflow: hidden; }

  /* catalogue + permanent sidecart */
  .shop-layout { display: grid; gap: var(--gap); align-items: start; }
  .shop-layout__main { min-inline-size: 0; }
  .sidecart { display: none; }
  @media (min-width: 70rem) {
    .shop-layout { grid-template-columns: minmax(0, 1fr) 22rem; }
    .sidecart {
      display: flex; flex-direction: column; position: sticky; inset-block-start: 84px;
      max-block-size: calc(100svh - 100px); background: var(--surface);
      border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: clip;
    }
    .sidecart:focus-visible { outline: 3px solid var(--focus); }
    .cartbar { display: none !important; }
  }
  .sidecart__head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-block-end: 1px solid var(--line); }
  .sidecart__head h2 { font-size: var(--step-1); }
  .sidecart__count:not(:empty) { background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: .78rem; min-inline-size: 1.6rem; text-align: center; padding: .1rem .5rem; border-radius: 999px; }
  .sidecart__body { overflow-y: auto; padding: .4rem 1.2rem; flex: 1; min-block-size: 6rem; }
  .sidecart__foot { border-block-start: 1px solid var(--line); padding: 1rem 1.2rem; display: grid; gap: .7rem; }
  .sidecart .placeholder { padding-block: 2rem; }
  .line__thumb { cursor: pointer; }
  .qty button[disabled] { opacity: .35; cursor: not-allowed; }
  .cart-note { font-size: .74rem; color: var(--text-soft); text-align: center; }

  .freebar { display: grid; gap: .35rem; font-size: var(--step--1); font-weight: 600; color: var(--text); }
  .freebar__track { block-size: 6px; border-radius: 999px; background: var(--surface-2); overflow: clip; }
  .freebar__track span { display: block; block-size: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: inherit; transition: inline-size .4s var(--ease); }

  /* mobile cart bar */
  .cartbar { position: fixed; inset-inline: .75rem; inset-block-end: max(.75rem, env(safe-area-inset-bottom)); z-index: 40; }
  .cartbar__btn {
    inline-size: 100%; display: flex; align-items: center; gap: .7rem; min-block-size: 54px;
    padding: 0 1rem; border-radius: 999px; background: var(--primary); color: var(--primary-ink);
    font-weight: 700; box-shadow: var(--shadow-lg);
  }
  .cartbar__count { background: var(--primary-ink); color: var(--primary); min-inline-size: 1.7rem; block-size: 1.7rem; border-radius: 999px; display: grid; place-items: center; font-size: .85rem; }
  .cartbar__total { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
  body:has(.cartbar:not([hidden])) .site-footer { padding-block-end: 5rem; }

  /* cards: media and name open the quick view */
  .card__media { inline-size: 100%; cursor: zoom-in; padding: 0; }
  .card__peek {
    position: absolute; inset-block-end: .6rem; inset-inline: .6rem; padding: .45rem; border-radius: 999px;
    background: color-mix(in oklab, var(--surface) 88%, transparent); color: var(--text);
    font-size: var(--step--1); font-weight: 700; text-align: center;
    opacity: 0; transform: translateY(6px); transition: opacity .2s var(--ease), transform .2s var(--ease);
  }
  .card:hover .card__peek, .card__media:focus-visible .card__peek { opacity: 1; transform: none; }
  @media (hover: none) { .card__peek { display: none; } }
  .card__name { text-align: start; font: inherit; color: inherit; }
  .card__name:hover { color: var(--primary); }
  .card__prices { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
  .price-was { color: var(--text-soft); font-size: var(--step--1); }
  .card__stock { color: var(--danger); font-size: .78rem; font-weight: 700; }
  .card__badge { z-index: 1; }
  .card__badge--sale { background: var(--danger); }
  .card__badge--gold { background: var(--accent); color: #23180a; }

  /* dialogs (quick view, share, phone code) */
  .qv {
    margin: auto; /* the reset zeroes margins; dialogs centre with margin:auto */
    inline-size: min(56rem, calc(100vw - 1.5rem)); max-block-size: calc(100svh - 2rem);
    border: 0; border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--text);
    box-shadow: var(--shadow-lg); overflow: auto;
  }
  .qv::backdrop { background: rgb(20 14 16 / .55); backdrop-filter: blur(2px); }
  .qv[open] { animation: qv-in .22s var(--ease); }
  @keyframes qv-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
  .qv__close { position: absolute; inset-block-start: .6rem; inset-inline-end: .6rem; z-index: 2; background: var(--surface); }
  .qv__grid { display: grid; }
  @media (min-width: 46rem) { .qv__grid { grid-template-columns: 1fr 1fr; } }
  .qv__media {
    position: relative; aspect-ratio: 1; display: grid; place-items: center;
    background: linear-gradient(140deg, var(--surface-2), color-mix(in oklab, var(--accent) 14%, var(--surface)));
  }
  .qv__media img { inline-size: 100%; block-size: 100%; object-fit: cover; }
  .qv__media .card__ph { font-size: 5rem; }
  .qv__info { padding: clamp(1.2rem, 1rem + 1.5vw, 2rem); align-content: start; }
  .qv__title { font-size: var(--step-2); line-height: 1.2; }
  .qv__price { display: flex; align-items: baseline; gap: .6rem; }
  .qv__stock { font-size: var(--step--1); font-weight: 700; color: var(--ok); }
  .qv__stock.is-low, .qv__stock.is-out { color: var(--danger); }
  .qv__perks { display: grid; gap: .35rem; font-size: var(--step--1); color: var(--text-soft); border-block-start: 1px solid var(--line); padding-block-start: .9rem; }
  .qv__perks li::before { content: "✓ "; color: var(--ok); font-weight: 800; }

  .share { inline-size: min(28rem, calc(100vw - 1.5rem)); }
  .share__in { padding: 1.6rem 1.4rem 1.4rem; }
  .share__qr { inline-size: 200px; aspect-ratio: 1; margin-inline: auto; padding: .5rem; background: #fff; border-radius: var(--radius-s); border: 1px solid var(--line); display: grid; place-items: center; }
  .share__qr svg { inline-size: 100%; block-size: 100%; }
  .share__row { display: flex; gap: .5rem; }
  .share__row .input { flex: 1; min-inline-size: 0; }

  .otp { inline-size: min(26rem, calc(100vw - 1.5rem)); }
  .otp form { padding: 1.6rem 1.4rem; }
  .otp__input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.6rem; letter-spacing: .5em; text-align: center; min-block-size: 56px; }
  .test-code { background: var(--gold-soft); color: #3a2c0d; border-radius: var(--radius-s); padding: .6rem .8rem; font-weight: 700; text-align: center; }

  /* checkout */
  .steps { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; font-size: var(--step--1); color: var(--text-soft); counter-reset: s; }
  .steps li { display: flex; align-items: center; gap: .4rem; counter-increment: s; }
  .steps li::before { content: counter(s); inline-size: 1.5rem; block-size: 1.5rem; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); font-weight: 700; font-size: .75rem; }
  .steps li + li::after { order: -1; content: ""; inline-size: 1.5rem; block-size: 1.5px; background: var(--line-strong); }
  .steps li[aria-current] { color: var(--primary); font-weight: 700; }
  /* "Basket" is the way back: give it a real touch target (was 32×21 px). */
  .steps a { display: inline-flex; align-items: center; justify-content: center; min-block-size: 44px; min-inline-size: 44px; padding-inline: .3rem; }
  .steps li[aria-current]::before { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
  .welcome { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: .7rem .9rem; margin-block-end: 1rem; border-radius: var(--radius-s); background: color-mix(in oklab, var(--ok) 10%, var(--surface)); font-size: var(--step--1); }
  .success__tick { inline-size: 3.5rem; block-size: 3.5rem; margin-inline: auto; margin-block-end: .6rem; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; font-size: 1.8rem; font-weight: 800; }
  .code-big { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.3rem; font-weight: 800; letter-spacing: .08em; color: var(--primary); }

  /* tracking */
  .track { list-style: none; padding: 0; display: grid; }
  .track__step { display: grid; grid-template-columns: 1.4rem 1fr; gap: .8rem; padding-block-end: 1rem; position: relative; color: var(--text-soft); }
  .track__step:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: calc(.7rem - 1px); inset-block: 1.3rem 0; inline-size: 2px; background: var(--line); }
  .track__dot { inline-size: 1.4rem; block-size: 1.4rem; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); }
  .track__step.is-done { color: var(--text); }
  .track__step.is-done .track__dot { background: var(--primary); border-color: var(--primary); }
  .track__step.is-done:not(:last-child)::after { background: var(--primary); }
  .track__step.is-now .track__dot { box-shadow: 0 0 0 5px color-mix(in oklab, var(--primary) 22%, transparent); }
  .recent-order { inline-size: 100%; text-align: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding-inline: .9rem; }
  .recent-order:hover { border-color: var(--primary); }

  @media (prefers-reduced-motion: reduce) {
    .qv[open] { animation: none; }
    .card__peek, .freebar__track span { transition: none; }
  }
}

/* ── Polish pass (audit fixes): phone-first sizing, targets, rhythm ────── */
@layer components {
  /* Programmatic focus targets (result panels, success view) need no ring. */
  [tabindex="-1"]:focus { outline: none; }
  html { overflow-x: clip; }

  /* Header */
  .brand__sub { font-size: .75rem; white-space: nowrap; }
  @media (max-width: 25rem) { .brand__sub { display: none; } }
  .site-header .btn { white-space: nowrap; }
  .nav a { padding-block: .65rem; }
  .cart-badge { font-size: .72rem; min-inline-size: 1.25rem; block-size: 1.25rem; inset-block-start: -2px; inset-inline-end: -4px; }

  /* Touch targets: nothing tappable under 44px */
  .btn--sm { min-height: 44px; }
  .chip { min-block-size: 44px; }
  .qty button { width: 44px; height: 44px; }
  .link-danger { padding: .55rem .4rem; margin-inline-start: -.4rem; display: inline-flex; align-items: center; min-block-size: 44px; }
  /* 1lh = the link's own line: the padding centres one line in a 44px target. */
  .link { display: inline-block; padding-block: .55rem; padding-block: max(.55rem, calc((44px - 1lh) / 2)); }
  .brand { min-block-size: 44px; }
  .nav a { display: inline-flex; justify-content: center; min-inline-size: 44px; }
  /* The product name opens the same quick view as the photo. The negative margin
     keeps the card's rhythm while the tappable band grows from 17px to ≥ 28px. */
  .card__name { padding-block: .35rem; margin-block: -.35rem; }

  /* Hero: facts instead of a decorative blob */
  .hero__title { text-wrap: balance; }
  .hero__facts {
    display: grid; gap: .9rem; list-style: none; padding: clamp(1.2rem, 1rem + 1vw, 1.8rem);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  }
  .hero__facts li { display: grid; grid-template-columns: 2.6rem 1fr; gap: .9rem; align-items: center; }
  .hero__facts svg { inline-size: 2.6rem; block-size: 2.6rem; padding: .6rem; border-radius: var(--radius-s); background: color-mix(in oklab, var(--primary) 10%, var(--surface)); color: var(--primary); }
  .hero__facts strong { display: block; font-size: var(--step-0); }
  .hero__facts span { color: var(--text-soft); font-size: var(--step--1); }
  @media (max-width: 53.9rem) { .hero__facts { display: none; } .hero { padding-block: 2rem 1rem; } }

  /* Toolbar: chips scroll on one line; search grows, sort sits beside it */
  .toolbar { display: grid; grid-template-columns: 1fr auto; gap: .75rem; }
  /* The scroller clips whatever overflows it, keyboard focus rings included
     (3px + 2px offset): pad it by 6px and pull it back out by the same amount
     so the ring shows in full without moving the chips. */
  .toolbar .chips { grid-column: 1 / -1; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: -6px; padding: 6px; scroll-padding-inline: 1rem; }
  .toolbar .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .toolbar .search { min-inline-size: 0; }
  .toolbar .field { min-width: 0 !important; }

  /* Product grid: two columns on phones */
  @media (max-width: 37.5rem) {
    .grid-products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
    .card__body { padding: .7rem .75rem .85rem; }
    .card__title { font-size: var(--step--1); }
    .card__desc { display: none; }
    .card__price { font-size: var(--step-0); }
    .card__foot { flex-direction: column; align-items: stretch; }
    .card__foot .btn { inline-size: 100%; }
  }
  .card__foot { flex-wrap: wrap; }
  .card__foot .btn { white-space: nowrap; }
  .card__prices { flex-direction: column; align-items: flex-start; gap: 0; }
  .card__badge { font-size: .75rem; }
  .card__ph, .qv__media .card__ph { inline-size: 38%; block-size: auto; color: color-mix(in oklab, var(--primary) 30%, var(--surface-2)); font-size: 0; }
  .line__thumb svg { inline-size: 60%; block-size: 60%; color: color-mix(in oklab, var(--primary) 35%, var(--surface-2)); }
  .soldout { font-size: var(--step--1); font-weight: 700; color: var(--text-soft); padding-block: .6rem; }

  /* Toast above the phone cart bar */
  body:has(.cartbar:not([hidden])) .toast { inset-block-end: calc(54px + 1.75rem + env(safe-area-inset-bottom)); }
  @media (min-width: 70rem) { body:has(.cartbar:not([hidden])) .toast { inset-block-end: 1.2rem; } }
  .cart-note { font-size: .78rem; }

  /* Forms: hints are hints, not labels */
  .field > span.field__hint, .field > span.err-text { font-weight: 400; }
  .field__hint { font-size: .8rem; }
  .cod-badge { color: #256b4c; }
  [data-theme="dark"] .cod-badge { color: #7fd1a8; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cod-badge { color: #7fd1a8; } }
  input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
  input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

  /* Checkout on phones: the order button follows the thumb */
  @media (max-width: 54.9rem) {
    .checkout-grid .panel--sticky { position: static; }
    #placeBtn { position: sticky; inset-block-end: max(.75rem, env(safe-area-inset-bottom)); z-index: 5; box-shadow: var(--shadow-lg); }
  }
  .code-big { font-family: inherit; font-variant-numeric: tabular-nums; letter-spacing: .05em; }
  .otp__input { font-family: inherit; font-variant-numeric: tabular-nums; }

  /* Share dialog: one button shape */
  #shareCopy { border-radius: 999px; flex: none; }

  /* Steps: completed steps read as done */
  .steps li.is-done::before { content: "✓"; background: var(--surface-2); color: var(--ok); border-color: var(--ok); }

  /* Quick-view perks: drawn ticks, not glyphs */
  .qv__perks li { display: flex; align-items: center; gap: .5rem; }
  .qv__perks li::before {
    content: ""; inline-size: 1rem; block-size: 1rem; flex: none; background: var(--ok);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  /* About: one alignment */
  #about .wrap { text-align: center; }
  #about .wrap > * { margin-inline: auto; }
}

/* ── Round 3 (audit) ───────────────────────────────────────────────────── */
@layer components {
  /* Checkout: fixed order bar on phones replaces the in-panel button */
  .co-bar { display: none; }
  @media (max-width: 54.9rem) {
    #placeBtn { display: none; }
    .co-bar:not([hidden]) {
      display: flex; align-items: center; gap: .9rem;
      position: fixed; inset-inline: .75rem; inset-block-end: max(.75rem, env(safe-area-inset-bottom)); z-index: 40;
      padding: .55rem .55rem .55rem 1rem; padding-inline-start: 1.1rem;
      background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-lg);
    }
    .co-bar .btn { margin-inline-start: auto; min-block-size: 48px; }
    .co-bar__total { display: grid; line-height: 1.2; }
    .co-bar__total small { color: var(--text-soft); font-size: .75rem; }
    .co-bar__total strong { font-variant-numeric: tabular-nums; }
    body:has(.co-bar:not([hidden])) main { padding-block-end: 6rem; }
    body:has(.co-bar:not([hidden])) .toast { inset-block-end: 5.5rem; }
  }

  /* Sale badge readable in both themes */
  .card__badge--sale { background: #B23A3A; color: #fff; }

  /* 12px floor */
  .cart-badge { font-size: .75rem; }
  .price-was { font-size: .8rem; }

  /* Cards: footers line up across a row */
  .card__foot { margin-block-start: auto; flex-direction: column; align-items: stretch; gap: .5rem; }
  .card__foot .btn { inline-size: 100%; }
  .card__prices { min-block-size: 2.7em; justify-content: flex-end; }
  .soldout { text-align: center; }
  .add-btn.is-in { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }

  /* Quick view: add + buy share one row under the stepper */
  .qv__buy { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
  .qv__buy .btn { flex: 1 1 8rem; }
  .qv__buy .qty { flex: none; }

  /* Phone hero: no empty band */
  @media (max-width: 45rem) { .hero { padding-block: 1.25rem .5rem; } }

  .otp { position: relative; }
}

@layer components {
  /* Empty error slots take no space; they open when a message appears. */
  .form-grid .err-text:empty { min-height: 0; }
  .form-grid { row-gap: 1.1rem; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Brand pass: announcement bar, three-zone header, pearl hero, mark,
   branded dropdowns. One continuous ground from the top bar to the grid.
   ═══════════════════════════════════════════════════════════════════════ */
@layer tokens {
  :root {
    --font-display-ar: "El Messiri", "El Messiri Fallback", "El Messiri Fallback Android", "Tajawal", serif;
    --topbar-bg: #4A1A29;
    --topbar-ink: #F6E9D7;
    --nacre-rose: #F3DDD9;
    --nacre-gold: #F1E2C4;
    --header-h: 76px;
  }
  [data-theme="dark"] { --topbar-bg: #0F0B0C; --topbar-ink: #E9D3A6; --nacre-rose: #2B1D21; --nacre-gold: #2A2219; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --topbar-bg: #0F0B0C; --topbar-ink: #E9D3A6; --nacre-rose: #2B1D21; --nacre-gold: #2A2219; }
  }
}

@layer components {
  ::selection { background: color-mix(in oklab, var(--accent) 35%, transparent); color: var(--text); }
  html { scrollbar-color: color-mix(in oklab, var(--primary) 35%, var(--surface-2)) transparent; accent-color: var(--primary); }

  /* ── Display type: El Messiri carries the Arabic voice ── */
  html[lang="ar"] .display, html[lang="ar"] .brand__name { font-family: var(--font-display-ar); font-weight: 700; }
  html[lang="ar"] .display { letter-spacing: 0; line-height: 1.25; }

  /* ── Mark ── */
  .mark { inline-size: 40px; block-size: 40px; flex: none; }
  .mark path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
  .mark__dal { stroke: var(--primary); stroke-width: 4.2; }
  .mark__damma { stroke: var(--accent); stroke-width: 2.1; }
  .brand { gap: .55rem; text-decoration: none; }
  .brand__name { font-size: 1.7rem; line-height: 1; color: var(--primary); letter-spacing: 0; }
  .brand:hover .mark__damma { stroke: var(--primary); transition: stroke .3s var(--ease); }

  /* ── Announcement bar ── */
  .topbar { background: var(--topbar-bg); color: var(--topbar-ink); font-size: .8rem; letter-spacing: .02em; }
  .topbar__in { display: grid; place-items: center; min-block-size: 36px; }
  .topbar__msg { text-align: center; transition: opacity .45s var(--ease), transform .45s var(--ease); }
  .topbar__msg.is-out { opacity: 0; transform: translateY(-4px); }
  .topbar__msg a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
  .topbar__msg svg { display: inline-block; inline-size: 14px; block-size: 14px; vertical-align: -2px; margin-inline-end: .45rem; stroke: currentColor; opacity: .8; }

  /* ── Header: nav · brand · tools ── */
  .site-header {
    background: var(--bg); border-block-end: 1px solid transparent; backdrop-filter: none;
  }
  .site-header.is-scrolled { background: color-mix(in oklab, var(--bg) 92%, transparent); backdrop-filter: blur(12px); border-block-end-color: var(--line); box-shadow: 0 8px 24px -18px rgb(42 35 32 / .35); }
  .site-header__bar { min-block-size: var(--header-h); gap: 1rem; }
  .tools { display: flex; align-items: center; gap: .15rem; }
  .tools .lang-pill { border-color: transparent; font-size: .85rem; }
  .tools .lang-pill:hover { border-color: var(--line); }
  .icon-btn svg { inline-size: 22px; block-size: 22px; }
  .icon-btn:hover { background: color-mix(in oklab, var(--primary) 8%, transparent); color: var(--primary); }
  .i-sun { display: none; }
  [data-theme="dark"] .i-sun { display: block; } [data-theme="dark"] .i-moon { display: none; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .i-sun { display: block; }
    :root:not([data-theme="light"]) .i-moon { display: none; }
  }
  .cart-badge { background: var(--primary); inset-block-start: 6px; inset-inline-end: 4px; }

  @media (min-width: 60rem) {
    .site-header__bar:has(> .nav) { display: grid; grid-template-columns: 1fr auto 1fr; }
    .site-header__bar > .nav { justify-self: start; }
    .site-header__bar:has(> .nav) .brand { justify-self: center; margin: 0; }
    .site-header__bar > .tools { justify-self: end; }
    .nav { display: flex; gap: 1.6rem; }
  }
  @media (max-width: 59.99rem) { .site-header__bar > .nav { display: none; } .site-header__bar > .tools { margin-inline-start: auto; } }
  .nav a { color: var(--text); font-size: .95rem; position: relative; border: 0; padding-block: .7rem; }
  .nav a::after {
    content: ""; position: absolute; inset-inline: 0; inset-block-end: .35rem; block-size: 1px;
    background: var(--accent); transform: scaleX(0); transform-origin: var(--from, right); transition: transform .35s var(--ease);
  }
  html[dir="ltr"] .nav a::after { --from: left; }
  .nav a:hover { color: var(--primary); }
  .nav a:hover::after { transform: scaleX(1); }

  /* ── Hero: pearl ground, continuous with the header above and the grid below ── */
  .hero { border: 0; background: none; position: relative; isolation: isolate; }
  /* The ground lives on its own layer so it can melt into the page below
     without fading the promises that sit at the hero's foot. */
  .hero::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background:
      radial-gradient(55% 60% at var(--glow-x, 22%) 40%, color-mix(in oklab, var(--nacre-gold) 85%, transparent), transparent 70%),
      radial-gradient(40% 45% at var(--rose-x, 8%) 35%, color-mix(in oklab, var(--nacre-rose) 70%, transparent), transparent 70%),
      linear-gradient(180deg, var(--bg) 0%, color-mix(in oklab, var(--surface-2) 70%, var(--bg)) 50%, var(--bg) 100%);
    -webkit-mask: linear-gradient(180deg, #000 80%, transparent); mask: linear-gradient(180deg, #000 80%, transparent);
  }
  html[dir="ltr"] .hero { --glow-x: 78%; --rose-x: 92%; }
  .hero__grid { padding-block: clamp(2rem, 1rem + 4vw, 4.5rem) clamp(1rem, .5rem + 2vw, 2rem); gap: clamp(1.5rem, 1rem + 2vw, 3rem); }
  @media (min-width: 54rem) { .hero__grid { grid-template-columns: 1.05fr .95fr; } }
  .hero__copy { display: grid; gap: 1rem; align-content: center; max-inline-size: 34rem; }
  .hero__season {
    display: flex; align-items: center; gap: .75rem; color: var(--primary);
    font-size: var(--step--1); font-weight: 600; letter-spacing: .04em;
  }
  .hero__season::before { content: ""; inline-size: 2.25rem; block-size: 1px; background: var(--accent); }
  .hero__title { font-size: clamp(2.4rem, 1.6rem + 3.6vw, 4.4rem); line-height: 1.15; margin: 0; max-inline-size: 12ch; text-wrap: balance; color: var(--text); }
  .hero__text { font-size: var(--step-1); color: var(--text-soft); max-inline-size: 36ch; line-height: 1.7; }
  .hero__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 1.25rem; margin-block-start: .5rem; }
  .hero__actions .btn { min-block-size: 52px; padding-inline: 2rem; font-size: 1.02rem; }
  .hero__link { color: var(--primary); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 6px; padding-block: .6rem; }

  .hero__art { display: grid; place-items: center; background: none; box-shadow: none; border-radius: 0; aspect-ratio: auto; overflow: visible; }
  .hero__art::after { content: none; }
  .hero__shell { inline-size: min(100%, 30rem); block-size: auto; overflow: visible; }
  .hero__shell-lines { stroke: var(--accent); stroke-width: 1.3; }
  .hero__shell-edge, .hero__shell-lip { stroke: var(--primary); stroke-width: 1.5; }
  .hero__shell-growth { stroke-opacity: .4; }
  @media (prefers-reduced-motion: no-preference) {
    .hero__shell-lines path, .hero__shell-ribs path, .hero__shell-lip {
      stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw 1.6s cubic-bezier(.16, 1, .3, 1) both;
    }
    @keyframes draw { from { stroke-dashoffset: 1; } }
    .hero__shell circle { animation: pearl-in 1.2s .5s cubic-bezier(.16, 1, .3, 1) both; transform-box: fill-box; transform-origin: center; }
    .hero__shell ellipse { animation: glow-in 1.2s .7s ease-out both; }
    @keyframes glow-in { from { opacity: 0; } }
    @keyframes pearl-in { from { opacity: 0; transform: scale(.8); } }
  }
  @media (max-width: 53.99rem) {
    .hero__grid { text-align: start; }
    .hero__art { order: -1; }
    .hero__shell { inline-size: min(68vw, 17rem); }
    .hero__title { font-size: clamp(2.1rem, 1.5rem + 4vw, 2.8rem); }
    .hero__text { font-size: var(--step-0); }
  }

  /* promises: a quiet row at the foot of the hero, not cards */
  .promise {
    list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-block: 1.1rem 1.4rem; border-block-start: 1px solid color-mix(in oklab, var(--accent) 35%, transparent);
  }
  .promise li { display: flex; align-items: center; gap: .75rem; justify-content: center; padding-inline: .75rem; }
  .promise li + li { border-inline-start: 1px solid color-mix(in oklab, var(--accent) 30%, transparent); }
  .promise svg { inline-size: 26px; block-size: 26px; flex: none; color: var(--primary); }
  .promise strong { display: block; font-size: .92rem; font-weight: 600; }
  .promise small { display: block; color: var(--text-soft); font-size: .8rem; }
  @media (max-width: 40rem) {
    .promise li { flex-direction: column; text-align: center; gap: .35rem; padding-inline: .35rem; }
    .promise small { display: none; }
    .promise strong { font-size: .8rem; line-height: 1.35; }
  }

  /* the catalogue picks up where the hero leaves off */
  #products { padding-block-start: clamp(1.5rem, 1rem + 2vw, 3rem); }
  #about { background: linear-gradient(180deg, var(--bg), var(--surface-2) 30%, var(--surface-2)); }

  /* ── Dropdowns that carry the site's design ── */
  .select {
    appearance: none; -webkit-appearance: none; cursor: pointer;
    background-color: var(--surface); color: var(--text);
    border: 1.5px solid var(--line-strong); border-radius: 999px;
    padding-block: 0; padding-inline: 1.1rem 2.6rem; min-block-size: 46px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A2E43' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-size: 16px; background-position: left 1rem center;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  }
  html[dir="ltr"] .select { background-position: right 1rem center; }
  .select:hover { border-color: var(--primary); }
  /* Transparent, not none: Windows High Contrast drops box-shadows and repaints
     outlines in the system colour, so the focus ring still shows there. */
  .select:focus-visible { outline: 2px solid transparent; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 18%, transparent); }
  .select:has(option:checked[value=""]) { color: var(--text-soft); }
  .form-grid .select, .field .select { border-radius: var(--radius-s); }

  /* Desktop: a branded picker (Chrome/Edge 135+, Safari 27+). Phones keep the
     native wheel/sheet, which is the better thumb experience for long lists. */
  @supports (appearance: base-select) {
    @media (hover: hover) and (pointer: fine) {
      .select, .select::picker(select) { appearance: base-select; }
      .select { background-image: none; padding-inline: 1.1rem 1rem; display: flex; align-items: center; gap: .6rem; }
      .select::picker-icon {
        content: ""; inline-size: 16px; block-size: 16px; margin-inline-start: auto; background: var(--primary);
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
                mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
        transition: rotate .25s var(--ease);
      }
      .select:open::picker-icon { rotate: 180deg; }
      .select::picker(select) {
        margin-block: 6px; padding: .4rem; min-inline-size: anchor-size(inline);
        max-block-size: min(22rem, 60vh); overflow-y: auto;
        background: var(--surface); color: var(--text);
        border: 1px solid var(--line); border-radius: 14px;
        box-shadow: 0 18px 40px -18px rgb(42 35 32 / .35), 0 2px 6px rgb(42 35 32 / .06);
        opacity: 0; translate: 0 -6px;
        transition: opacity .2s var(--ease), translate .2s var(--ease), display .2s allow-discrete, overlay .2s allow-discrete;
      }
      .select:open::picker(select) { opacity: 1; translate: 0 0; }
      @starting-style { .select:open::picker(select) { opacity: 0; translate: 0 -6px; } }
      .select option {
        display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-radius: 9px;
        font-size: .95rem; cursor: pointer; transition: background .15s var(--ease);
      }
      .select option:hover, .select option:focus-visible { background: color-mix(in oklab, var(--primary) 8%, var(--surface)); outline: none; }
      .select option:checked { color: var(--primary); font-weight: 600; }
      .select option::checkmark { content: ""; inline-size: 14px; block-size: 14px; order: 1; margin-inline-start: auto; background: var(--primary);
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat;
                mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat; }
      .select option[value=""] { color: var(--text-soft); }
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .topbar__msg, .select::picker(select) { transition: none; }
  }
}

@layer components {
  @media (max-width: 53.99rem) { .hero__grid { padding-block-start: .75rem; gap: 1rem; } }
}

/* ── Installable app: invitation card, iOS guide, standalone tweaks ── */
@layer components {
  .install-card {
    position: fixed; z-index: 70; inset-inline: .75rem; inset-block-end: max(.75rem, env(safe-area-inset-bottom));
    max-inline-size: 30rem; margin-inline: auto;
    display: grid; grid-template-columns: 52px 1fr auto auto; align-items: center; gap: .8rem;
    padding: .75rem .75rem .75rem 1rem; padding-inline-start: .85rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
    box-shadow: 0 18px 40px -16px rgb(42 35 32 / .4);
    opacity: 0; translate: 0 16px; transition: opacity .3s var(--ease), translate .3s var(--ease);
  }
  .install-card.is-in { opacity: 1; translate: 0 0; }
  .install-card[hidden] { display: none; }
  .install-card__icon { border-radius: 12px; box-shadow: 0 2px 8px rgb(42 35 32 / .15); }
  .install-card__text { display: grid; gap: .1rem; min-inline-size: 0; }
  .install-card__text strong { font-size: .95rem; }
  .install-card__text span { font-size: .8rem; color: var(--text-soft); line-height: 1.45; }
  .install-card__go { min-block-size: 44px; }
  .install-card__x { min-inline-size: 40px; min-block-size: 40px; color: var(--text-soft); }
  .install-card__x svg { inline-size: 18px; block-size: 18px; }
  /* sit above the phone cart bar when both are showing */
  body:has(.cartbar:not([hidden])) .install-card { inset-block-end: calc(54px + 1.75rem + env(safe-area-inset-bottom)); }
  @media (max-width: 26rem) { .install-card { grid-template-columns: 44px 1fr auto; } .install-card__icon { inline-size: 44px; block-size: 44px; } .install-card__x { grid-row: 1; grid-column: 3; } .install-card__go { grid-column: 1 / -1; } }

  .ios-guide { inline-size: min(26rem, calc(100vw - 1.5rem)); }
  .ios-guide__in { display: grid; gap: .9rem; padding: 1.8rem 1.4rem 1.4rem; text-align: center; }
  .ios-guide__icon { margin-inline: auto; border-radius: 18px; box-shadow: 0 6px 18px rgb(42 35 32 / .2); }
  .ios-guide h2 { font-size: var(--step-1); }
  .ios-steps { list-style: none; padding: 0; display: grid; gap: .6rem; text-align: start; }
  .ios-steps li { display: grid; grid-template-columns: 1.6rem 2.4rem 1fr; align-items: center; gap: .6rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .ios-steps__n { inline-size: 1.6rem; block-size: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: .8rem; }
  .ios-steps__icon { inline-size: 2.4rem; block-size: 2.4rem; display: grid; place-items: center; border-radius: 10px; background: color-mix(in oklab, #0a84ff 12%, var(--surface)); color: #0a84ff; }
  .ios-steps__icon svg { inline-size: 22px; block-size: 22px; }
  .ios-guide__arrow { display: none; }

  /* Inside the installed app: no "install" invitations, room for the notch */
  .is-app [data-install-link], .is-app .install-card { display: none !important; }
  .is-app .topbar { padding-block-start: env(safe-area-inset-top); }
}

@layer components {
  .credits { list-style: none; padding: 0; display: grid; gap: .6rem; }
  .credits li { display: grid; gap: .15rem; padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); }
  .credits li span { color: var(--text-soft); font-size: .85rem; }
  .credits a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
}

@layer components {
  /* Drawn ticks, not the "✓" character (it renders in the phone's system font). */
  .success__tick svg { inline-size: 1.9rem; block-size: 1.9rem; }
  .steps li.is-done::before {
    content: ""; border-color: var(--ok);
    background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232E7D5B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4L18 8'/%3E%3C/svg%3E") center / 68% no-repeat;
  }
  /* Phone-code dialog sits at the top on phones, so the keyboard opens below it
     instead of pushing its title and close button off screen. */
  @media (max-width: 40rem) {
    .otp { margin-block: max(.75rem, env(safe-area-inset-top)) auto; max-block-size: calc(100dvh - 1.5rem); }
    .otp form { padding-block: 1.25rem; }
  }
}

@layer components {
  /* While a field is being typed in (keyboard up), the fixed order bar steps
     aside; it returns as soon as the field loses focus. */
  @media (max-width: 54.9rem) {
    body:has(#checkoutForm :is(input, textarea, select):focus) .co-bar { display: none; }
  }
}

@layer components {
  /* The install card never hides the last buttons on the page: reserve room for it. */
  body:has(.install-card.is-in) main { padding-block-end: calc(9rem + env(safe-area-inset-bottom)); }
}

@layer utilities {
  /* Print: a shopper printing her order confirmation (reference, totals) or the
     tracking page gets the content on white paper, without the shop's floating
     bars, drawers and buttons. */
  @media print {
    :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --text-soft: #333; }
    body { background: #fff; color: #000; }
    .topbar, .site-header .tools, .site-header .nav, .site-header .btn, .lang-pill, .icon-btn,
    .cartbar, .co-bar, .drawer, .drawer-backdrop, .sidecart, .toast, .install-card, .skip-link,
    .site-footer .btn, .hero__art, .steps, dialog { display: none !important; }
    .site-header { position: static; box-shadow: none; border: 0; }
    .panel, .card { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; }
    a { color: inherit; text-decoration: none; }
    .btn { display: none; }
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   Polish round: aligned fields, one header hover language, checkout,
   cart and tracking pages.
   ═══════════════════════════════════════════════════════════════════════ */
@layer components {
  /* Fields keep their own height: a neighbour's hint never stretches them. */
  .field { align-content: start; }
  .input, .select { min-block-size: 48px; }
  .form-grid { align-items: start; }

  /* ── One hover for everything at the top of the page: the nav's gold
       underline grows under the control and its ink turns wine. ── */
  :is(.site-header, .adm__top) :is(.icon-btn, .lang-pill, .btn) { position: relative; }
  :is(.site-header, .adm__top) :is(.icon-btn, .lang-pill, .btn)::after {
    content: ""; position: absolute; inset-inline: 30%; inset-block-end: 5px; block-size: 1.5px; border-radius: 1px;
    background: var(--accent); transform: scaleX(0); transform-origin: var(--from, right);
    transition: transform .35s var(--ease);
    pointer-events: none;
  }
  html[dir="ltr"] :is(.site-header, .adm__top) :is(.icon-btn, .lang-pill, .btn) { --from: left; }
  :is(.site-header, .adm__top) :is(.icon-btn, .lang-pill, .btn):is(:hover, :focus-visible)::after { transform: scaleX(1); }
  :is(.site-header, .adm__top) :is(.icon-btn, .lang-pill):hover { background: transparent; color: var(--primary); }
  :is(.site-header, .adm__top) .btn--ghost:hover { border-color: var(--line); color: var(--primary); transform: none; }
  :is(.site-header, .adm__top) .btn--ghost::after { inset-inline: 1.1rem; inset-block-end: 9px; }
  .site-header .lang-pill::after { inset-inline: 25%; }
  @media (prefers-reduced-motion: reduce) {
    :is(.site-header, .adm__top) :is(.icon-btn, .lang-pill, .btn)::after { transition: none; }
  }

  /* ── Checkout ── */
  .checkout-grid { gap: clamp(1rem, .5rem + 2vw, 2rem); }
  @media (min-width: 55rem) { .checkout-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr); } }
  .co-main { display: grid; gap: 1rem; min-inline-size: 0; }
  .co-sec {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: clamp(1.1rem, .8rem + 1.2vw, 1.6rem); display: grid; gap: .9rem;
    box-shadow: 0 1px 2px rgb(42 35 32 / .04);
  }
  .co-sec__title { display: flex; align-items: center; gap: .6rem; font-size: var(--step-0); font-weight: 700; }
  .co-sec__title svg { inline-size: 22px; block-size: 22px; color: var(--primary); flex: none; }
  .co-sec__hint { color: var(--text-soft); font-size: .85rem; margin-block-start: -.4rem; }
  .co-sec .form-grid { gap: .85rem 1rem; }
  .textarea--short { min-block-size: 72px; }

  .pay-tile {
    display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: .8rem;
    padding: .9rem 1rem; border-radius: var(--radius-s);
    border: 1.5px solid var(--primary); background: color-mix(in oklab, var(--primary) 5%, var(--surface));
  }
  .pay-tile__radio { inline-size: 20px; block-size: 20px; border-radius: 50%; border: 2px solid var(--primary); display: grid; place-items: center; }
  .pay-tile__radio::after { content: ""; inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--primary); }
  .pay-tile__icon svg { inline-size: 26px; block-size: 26px; color: var(--primary); }
  .pay-tile strong { display: block; font-size: .95rem; }
  .pay-tile span span { display: block; color: var(--text-soft); font-size: .84rem; }

  .wa-confirm {
    display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: start;
    padding: .9rem 1rem; border-radius: var(--radius-s);
    background: color-mix(in oklab, #25d366 9%, var(--surface)); border: 1px solid color-mix(in oklab, #1f7a4d 30%, var(--line));
  }
  .wa-confirm[hidden] { display: none; }
  .wa-confirm__icon svg { inline-size: 24px; block-size: 24px; color: #1f7a4d; }
  [data-theme="dark"] .wa-confirm__icon svg { color: #6fd6a0; }
  .wa-confirm strong { display: block; font-size: .95rem; }
  .wa-confirm span span { display: block; color: var(--text-soft); font-size: .86rem; line-height: 1.6; }

  .co-summary { display: grid; gap: 1rem; align-content: start; }
  .co-summary__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
  .co-summary__head h2 { font-size: var(--step-1); }
  .co-summary__head .link { font-size: .85rem; }
  .co-items { list-style: none; padding: 0; display: grid; gap: .8rem; padding-block-end: 1rem; border-block-end: 1px solid var(--line); }
  .co-item { display: grid; grid-template-columns: 56px 1fr auto; gap: .85rem; align-items: center; }
  .co-item__thumb { position: relative; inline-size: 56px; block-size: 56px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
  .co-item__thumb img { inline-size: 100%; block-size: 100%; object-fit: cover; border-radius: inherit; }
  .co-item__ph { display: block; inline-size: 100%; block-size: 100%; }
  .co-item__qty {
    position: absolute; inset-block-start: -7px; inset-inline-end: -7px; min-inline-size: 22px; block-size: 22px; padding-inline: 5px;
    border-radius: 999px; background: var(--text-soft); color: var(--surface); font-size: .75rem; font-weight: 700; display: grid; place-items: center;
  }
  .co-item__name { font-weight: 600; font-size: .92rem; min-inline-size: 0; overflow-wrap: anywhere; }
  .co-item__name small { display: block; color: var(--text-soft); font-weight: 400; font-size: .8rem; }
  .co-item__total { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .92rem; }
  .co-note { font-size: .82rem; }
  .co-trust { list-style: none; padding: .9rem 0 0; margin: 0; border-block-start: 1px solid var(--line); display: grid; gap: .45rem; }
  .co-trust li { display: flex; align-items: center; gap: .55rem; color: var(--text-soft); font-size: .84rem; }
  .co-trust svg { inline-size: 18px; block-size: 18px; color: var(--primary); flex: none; }

  /* ── Cart lines (sidecart + drawer) ── */
  .line { grid-template-columns: 64px 1fr auto; align-items: start; gap: .85rem; padding-block: 1rem; }
  .line__thumb { inline-size: 64px; block-size: 64px; border-radius: 12px; border: 1px solid var(--line); }
  .line__info { display: grid; gap: .2rem; min-inline-size: 0; }
  .line__name { font-weight: 600; font-size: .92rem; line-height: 1.45; }
  .line__unit { color: var(--text-soft); font-size: .8rem; font-variant-numeric: tabular-nums; }
  .line__ctrl { display: flex; align-items: center; gap: .4rem; margin-block-start: .35rem; }
  .line__price { font-weight: 700; font-size: .95rem; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .line__rm {
    inline-size: 44px; block-size: 44px; display: grid; place-items: center; border-radius: 50%;
    color: var(--text-soft); transition: color .2s var(--ease), background .2s var(--ease);
  }
  .line__rm svg { inline-size: 19px; block-size: 19px; }
  .line__rm:hover { color: var(--danger); background: color-mix(in oklab, var(--danger) 8%, transparent); }
  .line .qty { border-radius: 999px; }

  .cart-empty { display: grid; justify-items: center; text-align: center; gap: .5rem; padding: 2.2rem 1rem; }
  .cart-empty__icon svg { inline-size: 64px; block-size: 64px; color: color-mix(in oklab, var(--primary) 45%, var(--surface-2)); }
  .cart-empty__title { font-weight: 700; font-size: 1rem; margin-block-start: .3rem; }
  .cart-empty__hint { color: var(--text-soft); font-size: .86rem; max-inline-size: 26ch; }
  .cart-empty .btn { margin-block-start: .6rem; }

  /* ── Tracking ── */
  .track-page { max-inline-size: 48rem; }
  .track-page__head { display: grid; justify-items: start; gap: .35rem; }
  .track-page__icon { inline-size: 52px; block-size: 52px; border-radius: 16px; display: grid; place-items: center; background: color-mix(in oklab, var(--primary) 10%, var(--surface)); color: var(--primary); margin-block-end: .4rem; }
  .track-page__icon svg { inline-size: 28px; block-size: 28px; }
  .track-form { display: grid; gap: .85rem 1rem; align-items: end; }
  @media (min-width: 40rem) { .track-form { grid-template-columns: 1fr 1fr auto; } }
  .track-form__go { min-block-size: 48px; }
  .track-form__err { grid-column: 1 / -1; margin: 0; }
  .track-form__err:empty { display: none; }

  .track-result { display: grid; gap: 1.1rem; }
  .tr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
  .tr-head__label { color: var(--text-soft); font-size: .8rem; }
  .tr-head__ref { font-size: var(--step-2); font-variant-numeric: tabular-nums; letter-spacing: .03em; color: var(--primary); line-height: 1.2; }
  .tr-status { display: grid; grid-template-columns: auto 1fr; gap: .9rem; align-items: center; padding: 1rem 1.1rem; border-radius: var(--radius-s); background: var(--surface-2); }
  .tr-status__icon { inline-size: 46px; block-size: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--primary); }
  .tr-status__icon svg { inline-size: 24px; block-size: 24px; }
  .tr-status strong { display: block; font-size: 1.02rem; }
  .tr-status span span { display: block; color: var(--text-soft); font-size: .88rem; }
  .tr-status--delivered .tr-status__icon { color: var(--ok); }
  .tr-status--cancelled .tr-status__icon { color: var(--danger); }
  .tr-sub { font-size: .92rem; color: var(--text-soft); font-weight: 600; margin-block-end: -.4rem; }
  .tr-help { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; padding-block-start: 1rem; border-block-start: 1px solid var(--line); color: var(--text-soft); font-size: .86rem; }
  .tr-help .btn svg { inline-size: 18px; block-size: 18px; }

  /* Horizontal progress on wider screens */
  @media (min-width: 40rem) {
    .track { grid-template-columns: repeat(4, 1fr); text-align: center; }
    .track__step { grid-template-columns: 1fr; justify-items: center; gap: .55rem; padding: 0; }
    .track__step:not(:last-child)::after {
      inset-inline-start: calc(50% + 1rem); inset-inline-end: calc(-50% + 1rem);
      inset-block: .7rem auto; inline-size: auto; block-size: 2px;
    }
  }
}

@layer components {
  /* Checkout opens on the task: less air above, a calmer title. */
  main.section:has(#checkoutForm) { padding-block-start: clamp(1rem, .5rem + 1.5vw, 2rem); }
  main.section:has(#checkoutForm) h1.display { font-size: var(--step-2); }
  .co-summary .err-text:empty, .co-summary .co-note[hidden] { display: none; }
}

/* ── Header controls: no pills or outlines. Text and icons sit plain, like the
      nav links, and share one hover: ink turns wine and a gold line grows
      under the word (or a short line under an icon). ── */
@layer components {
  :is(.site-header, .adm__top) :is(.lang-pill, .btn--ghost, .btn--sm.btn--ghost) {
    border: 0; border-radius: 0; background: transparent; box-shadow: none;
    min-block-size: 44px; padding-inline: .55rem; font-weight: 600; color: var(--text);
    transform: none;
  }
  :is(.site-header, .adm__top) :is(.icon-btn, .lang-pill, .btn--ghost) {
    background: transparent; border-radius: 0; color: var(--text);
    transition: color .25s var(--ease);
  }
  :is(.site-header, .adm__top) :is(.icon-btn, .lang-pill, .btn--ghost):hover,
  :is(.site-header, .adm__top) :is(.icon-btn, .lang-pill, .btn--ghost):focus-visible {
    background: transparent; color: var(--primary); border-color: transparent; transform: none;
  }

  /* the line: under the word for text controls … */
  :is(.site-header, .adm__top) :is(.lang-pill, .btn--ghost)::after {
    inset-inline: .55rem; inset-block-end: 8px; block-size: 1.5px;
  }
  /* … a short centred stroke under an icon */
  :is(.site-header, .adm__top) .icon-btn::after {
    inset-inline: calc(50% - 9px); inset-block-end: 5px; block-size: 1.5px;
  }
  /* the line grows from the reading start on both sides of the language switch */
  :is(.site-header, .adm__top) :is(.icon-btn, .lang-pill, .btn--ghost)::after { transform-origin: var(--from, right); }

  /* keyboard focus keeps a clear ring, drawn close and soft */
  :is(.site-header, .adm__top) :is(.icon-btn, .lang-pill, .btn--ghost):focus-visible {
    outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px;
  }

  /* even spacing in the tools cluster once the pills are gone */
  .tools { gap: .1rem; }
  .site-header__bar > .lang-pill, .site-header__bar > .btn--ghost { margin-inline-start: 0; }
}

@layer components {
  /* One size for the language switch on every page. */
  :is(.site-header, .adm__top) .lang-pill, .tools .lang-pill { font-size: .9rem; letter-spacing: .02em; }
}
