/* ============================================================
   Store shell — header, nav, footer, footer meta, payment marks
   (issue #2899, PRD #2895, step E4).

   This CSS used to sit in <style> tags inside the views
   (parts/header, parts/nav, parts/footer, partials/_footer_meta,
   partials/_payment_marks). It moved here unchanged, with two rules:

   1. Tokens only. No colour is typed here. The --shell-* tokens
      are set on :root by the shared head (storefront_shell_tokens()
      in app/helpers/storefront_head.php). The store colour comes in
      through var(--accent).
   2. This file is the LAST stylesheet of every page
      (storefront_head_plan()). The old <style> tags came after every
      sheet too, so the cascade did not change: a theme sheet still
      needs (0,2,0) to restyle a (0,1,0) rule here, and the phone bar
      rules below still win with (0,2,1).

   Layout per variant reads the <body> attributes data-header and
   data-footer (ThemeEngine parts), never a theme key.
   ============================================================ */

/* ---------- Header part (views/storefront/parts/header/standard.php) ---------- */
/* ===== Storefront shell header (issue #80) ===== */
.sf-shell-header{position:sticky;top:0;z-index:100;background:var(--shell-surface);border-bottom:1px solid var(--shell-line)}
.sf-header-row{display:flex;align-items:center;gap:20px;padding:12px 0}
.sf-wordmark{flex-shrink:0;font-size:22px;font-weight:800;letter-spacing:-.01em;text-decoration:none;color:var(--accent);white-space:nowrap}
/* Store logo (issue #667). Sits where the wordmark sits. max-height keeps a
   big upload from stretching the header; object-fit keeps it undistorted. */
.sf-logo-link{flex-shrink:0;display:flex;align-items:center;text-decoration:none}
.sf-logo{display:block;max-height:40px;max-width:180px;width:auto;object-fit:contain}
.sf-search-pill{flex:1;max-width:560px;display:flex;align-items:center;gap:8px;position:relative;background:var(--shell-fill);border:1px solid transparent;border-radius:999px;padding:0 16px;height:44px;transition:border-color .15s}
.sf-search-pill:focus-within{border-color:var(--field-focus-border,var(--shell-ink));background:var(--shell-surface)}
.sf-search-ic{flex-shrink:0;color:var(--shell-hint)}
.sf-search-input{flex:1;border:none;background:transparent;outline:none;font-family:inherit;font-size:14px;color:var(--shell-ink);height:100%}
.sf-search-input::placeholder{color:var(--shell-hint)}
.sf-suggestions{position:absolute;top:calc(100% + 8px);inset-inline-start:0;inset-inline-end:0;background:var(--shell-surface);border:1px solid var(--shell-line);border-radius:12px;box-shadow:0 10px 30px -8px var(--shell-shadow);z-index:60;overflow:hidden}
.sf-actions{flex-shrink:0;display:flex;align-items:center;gap:8px;margin-inline-start:auto}
.sf-action{display:flex;flex-direction:column;align-items:center;gap:3px;min-width:56px;padding:4px 6px;text-decoration:none;color:var(--shell-ink);font-size:11px;font-weight:600;border-radius:10px;transition:color .15s,background .15s}
.sf-action:hover{color:var(--accent);background:var(--shell-wash)}
.sf-cart-ic{position:relative;display:inline-flex}
.sf-cart-badge{position:absolute;top:-6px;inset-inline-end:-8px;min-width:17px;height:17px;padding:0 4px;display:flex;align-items:center;justify-content:center;background:var(--accent);color:var(--shell-on-accent);border-radius:999px;font-size:10px;font-weight:700;line-height:1}
/* #1282: an empty cart leaves the badge with no text. Hide it, so it is not
   a coloured dot. (omnimart.css says the same; this file must too.) */
.sf-cart-badge:empty,.bottom-nav-cart-badge:empty,.cart-count-badge:empty{display:none}
@media(max-width:768px){
  /* ===== Short pinned bar on phones (issue #1805) =====
     Before: the whole <header> held 3 stacked rows — brand + icons, a
     full-width search row, and the category pill rail. That is 130-190px of
     the first phone screen, 20-28% of it, on product, cart and checkout.
     It also never really pinned: see the `body` note below.
     Now the header box steps out of the layout, so only the top row pins
     (one ~56px row) and the pill rail scrolls away with the page.

     The rules below use the `header.sf-shell-header` prefix on purpose. A
     store theme styles this shell with `[data-store-theme="x"] .sf-…`, which
     is (0,2,0), and some themes stack the top row into a column. Adding the
     element name makes these rules (0,2,1), so the short phone bar wins on
     every theme. Colors and radius are left to the themes.
     The class is written twice in the rule below for the same reason: the
     header itself only has one class, so `header.sf-shell-header` alone is
     (0,1,1) and would LOSE to a theme rule. */
  header.sf-shell-header.sf-shell-header{display:contents}

  /* `position:sticky` needs a real scrolling ancestor. The shared storefront
     CSS sets `body{overflow-x:hidden}`, which turns <body> into a scroll box
     that never scrolls, so nothing directly inside <body> can ever pin.
     `clip` cuts sideways overflow the same way without making a scroll box.
     A browser that does not know `clip` drops this line and keeps `hidden`,
     so it simply gets an unpinned header — nothing breaks. */
  body{overflow-x:clip}

  /* The pinned bar. Sticky keeps its own space in the page, so no content can
     end up hidden underneath it — no magic offset to keep in sync. */
  header.sf-shell-header .sf-header-row{
    position:sticky;top:0;z-index:100;
    flex-direction:row;flex-wrap:nowrap;align-items:center;
    gap:8px;padding:6px 0;min-height:56px;max-height:60px;
    border-block-start:0;border-block-end:1px solid var(--shell-hairline)
  }
  /* Low specificity on purpose: this takes the header color, which is where
     the themes set it, but a theme that colors the row itself still wins. */
  .sf-header-row{background:inherit}

  /* One row means one order on every theme: brand, search, then the actions. */
  header.sf-shell-header .sf-wordmark,
  header.sf-shell-header .sf-logo-link{order:1}
  header.sf-shell-header .sf-search-pill{order:2}
  header.sf-shell-header .sf-actions{order:3}

  /* A long store name is cut short. It must never push the page sideways. */
  header.sf-shell-header .sf-wordmark{
    font-size:17px;flex:0 0 auto;width:auto;min-width:0;max-width:30%;
    overflow:hidden;text-overflow:ellipsis;white-space:nowrap
  }
  .sf-logo{max-height:30px;max-width:104px}

  /* Search shares the row now instead of taking a row of its own. `flex:1 1 0`
     means it takes what is left and gives space back first, so a short store
     name is never cut short. It grows and the brand steps aside while typing. */
  header.sf-shell-header .sf-search-pill{
    flex:1 1 0;min-width:0;max-width:none;padding:0 12px;
    height:var(--sf-tap, 44px)
  }
  /* An <input> refuses to shrink under its own default width unless it is
     told to. Without this it spills out of the pill and lands on top of the
     action icons on a narrow screen. */
  header.sf-shell-header .sf-search-input{min-width:0}
  header.sf-shell-header .sf-header-row:focus-within .sf-wordmark,
  header.sf-shell-header .sf-header-row:focus-within .sf-logo{
    max-width:0;padding:0;border:0;opacity:0
  }

  /* Icon-only actions, one tap size each, so all three stay easy to press.
     --sf-tap is the shared 44px touch target token from mobile.css. */
  header.sf-shell-header .sf-actions{gap:0;margin-inline-start:0}
  header.sf-shell-header .sf-action{
    min-width:var(--sf-tap, 44px);min-height:var(--sf-tap, 44px);
    justify-content:center;padding:0;gap:0;font-size:0
  }
  .sf-action svg{width:22px;height:22px}

  /* The pill rail is the bottom edge of the header area now, so it carries
     the hairline the header used to draw. */
  .sf-cat-pills{border-block-end:1px solid var(--shell-hairline-soft)}
}

/* ---------- Nav part (views/storefront/parts/nav/standard.php) ---------- */
/* ===== Storefront category pills (issue #80) ===== */
.sf-cat-pills{background:var(--shell-surface);border-top:1px solid var(--shell-line-soft)}
.sf-cat-pills-row{display:flex;align-items:center;gap:8px;padding:10px 0;overflow-x:auto;scrollbar-width:none}
.sf-cat-pills-row::-webkit-scrollbar{display:none}
.sf-cat-pill{flex-shrink:0;display:inline-flex;align-items:center;padding:7px 16px;border-radius:999px;background:var(--shell-fill);color:var(--shell-ink);font-size:13px;font-weight:600;text-decoration:none;white-space:nowrap;transition:background .15s,color .15s}
.sf-cat-pill:hover{background:var(--accent-weak);color:var(--accent)}
.sf-cat-pill.is-active{background:var(--accent);color:var(--shell-on-accent)}

/* ---------- Footer part (views/storefront/parts/footer/standard.php) ---------- */
/* ===== Storefront shell footer (issue #80) ===== */
.sf-shell-footer{background:var(--shell-surface);border-top:1px solid var(--shell-line);margin-top:48px}
.sf-footer-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:22px 0;flex-wrap:wrap}
.sf-footer-copy{margin:0;font-size:13px;color:var(--shell-muted)}
/* The icon look now lives in partials/_social_row.php (#498). The row carries
   the .sf-footer-social class, so the per-theme sheets still restyle it. */
@media(max-width:600px){.sf-footer-row{justify-content:center;text-align:center}}

/* ---------- Footer meta (views/storefront/partials/_footer_meta.php) ---------- */
/* ===== Shared footer text + policy links (issue #500) ===== */
/* Logical properties only, so the block reads the same in RTL and LTR. */
.sf-footer-meta{display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center;padding-block:4px 18px}
.sf-footer-about{margin:0;font-size:13px;line-height:1.8;color:var(--shell-muted);max-inline-size:70ch}
.sf-footer-policies{display:flex;flex-wrap:wrap;justify-content:center;gap:8px 18px;list-style:none;margin:0;padding:0}
/* ===== The store's own pages (issue #1585) ===== */
/* Same row shape as the policy links, one step darker and a little heavier:
   these are the shop's own pages, the small print is below them. */
.sf-footer-pages{display:flex;flex-wrap:wrap;justify-content:center;gap:8px 18px;list-style:none;margin:0;padding:0}
.sf-footer-pages a{font-size:14px;font-weight:500;color:var(--shell-ink-soft);text-decoration:none;transition:color .15s ease}
.sf-footer-pages a:hover,
.sf-footer-pages a:focus-visible{color:var(--accent)}
.sf-footer-pages a:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media(prefers-reduced-motion:reduce){.sf-footer-pages a{transition:none}}
.sf-footer-policies a{font-size:13px;color:var(--shell-muted);text-decoration:none;transition:color .15s ease}
.sf-footer-policies a:hover,
.sf-footer-policies a:focus-visible{color:var(--accent)}
.sf-footer-policies a:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media(prefers-reduced-motion:reduce){.sf-footer-policies a{transition:none}}
/* ===== Trader identity (issue #1525) ===== */
.sf-footer-identity{display:flex;flex-wrap:wrap;justify-content:center;gap:4px 18px;list-style:none;margin:0;padding:0;font-size:12px;color:var(--shell-muted)}
/* ===== business.sa certificate line (issue #2125) ===== */
/* One quiet line. It wraps between its parts on a narrow phone, never
   inside the number, and never scrolls sideways. */
.sf-footer-certified{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:2px 6px;margin:0;font-size:12px;line-height:1.7;color:var(--shell-grey);max-inline-size:100%}
.sf-footer-certified__icon{flex:none;inline-size:14px;block-size:14px}
.sf-footer-certified a{color:inherit;text-decoration:underline;text-underline-offset:2px;white-space:nowrap}
.sf-footer-certified a:hover,
.sf-footer-certified a:focus-visible{color:var(--accent)}
.sf-footer-certified a:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

/* ---------- Dark footer (issue #2903, D-12) ----------
   Bold, Magazine and Luxury paint the footer dark. The footer meta used the
   grey shell tokens, made for a light footer: 2.2 to 3.6:1 on dark. Keyed by
   <body data-footer="dark">, never by theme key. (0,2,x), after the theme
   sheets, so it wins without the important flag. */
[data-footer="dark"] .sf-footer-pages a{color:var(--shell-on-dark)}
[data-footer="dark"] .sf-footer-policies a,
[data-footer="dark"] .sf-footer-about,
[data-footer="dark"] .sf-footer-identity,
[data-footer="dark"] .sf-footer-certified,
[data-footer="dark"] .sf-footer-copy{color:var(--shell-on-dark-soft)}
[data-footer="dark"] .sf-footer-pages a:hover,
[data-footer="dark"] .sf-footer-policies a:hover,
[data-footer="dark"] .sf-footer-certified a:hover{color:var(--shell-on-dark);text-decoration:underline}

/* ---------- Payment marks (views/storefront/partials/_payment_marks.php) ---------- */
/* ===== Footer payment marks (issue #2052) ===== */
/* Logical properties only, so the row reads the same in RTL and LTR.
   `flex-wrap` is what keeps five pills off a 360px phone's horizontal
   scrollbar: they fall onto a second row instead of pushing the page. */
.sf-pay-marks{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:8px;list-style:none;margin:0;padding:0}
.sf-pay-mark{display:inline-flex;align-items:center;gap:6px;height:28px;padding-inline:10px;border:1px solid var(--shell-mark-line);border-radius:8px;background:var(--shell-surface);color:var(--shell-muted)}
.sf-pay-mark svg{display:block}
.sf-pay-mark--bank{font-size:12px;font-weight:600;white-space:nowrap}
/* The row is CENTRED at every width, and that is on purpose: `.sf-footer-meta`
   is a centred column, and the policy links right above this row are centred
   too. A start-aligned payment row under a centred policy row reads like a
   mistake. Verified at 360 (two rows) and 1280 (one row), no sideways scroll. */

/* ---------- Header variants (issue #2899) ----------
   Keyed by <body data-header="...">, never by theme key. The theme
   sheets keep only their sizes and colours. Each rule is (0,2,0) and
   this file loads after the theme sheets, so a theme sheet that wants
   another layout must say so with a stronger selector.

   The phone bar rules above are (0,2,1): on a phone every variant is
   the same one short pinned row (issue #1805).

   The wordmark rule has no `.sf-shell-header` in front on purpose:
   the theme rules it replaces styled the footer wordmark too.

   standard        one row: brand, search, actions (the base rules)
   centered        stacked: brand, actions, search; centred nav row
   dark            the same stack (a dark theme paints it)
   nav-above-logo  the stack, with the nav row above it
   search-first    one row; the search icon is a button at the end */
[data-header="centered"] .sf-header-row,
[data-header="dark"] .sf-header-row,
[data-header="nav-above-logo"] .sf-header-row{flex-direction:column}
[data-header="centered"] .sf-wordmark,
[data-header="dark"] .sf-wordmark,
[data-header="nav-above-logo"] .sf-wordmark{order:1;width:100%;text-align:center}
[data-header="centered"] .sf-actions,
[data-header="dark"] .sf-actions,
[data-header="nav-above-logo"] .sf-actions{order:2;margin-inline-start:0}
[data-header="centered"] .sf-search-pill,
[data-header="dark"] .sf-search-pill,
[data-header="nav-above-logo"] .sf-search-pill{order:3;width:100%}
[data-header="centered"] .sf-cat-pills-row,
[data-header="dark"] .sf-cat-pills-row,
[data-header="nav-above-logo"] .sf-cat-pills-row{justify-content:center}
[data-header="nav-above-logo"] .sf-shell-header{display:flex;flex-direction:column}
[data-header="nav-above-logo"] .sf-cat-pills{order:1}
[data-header="nav-above-logo"] .sf-header-row{order:2}
[data-header="search-first"] .sf-search-pill{padding-inline:0;padding-block:0;overflow:hidden}
[data-header="search-first"] .sf-search-ic{order:2;box-sizing:content-box;align-self:stretch}
