/* ==========================================================================
   Flossie's Cards storefront (WP10), ported from the front-page mock.
   EDIT COLOURS HERE ONLY: every colour is a token in the :root block below; no other rule
   in this file holds a colour (the test FrameTest::colours_only_in_root_tokens checks it).
   Sections follow the mock: 0a fonts (WP12), 0 tokens, 1 base, 2 top bar, 3 header, 5 buttons, 6 category nav,
   7 intro strip, 8 toolbar, 9 layout + sidebar, 10 grid + card, 11 pagination, 12 card page,
   13 related, 14 phone menu dialog, 15 footer, 17 responsive, then 18 storefront additions and 19 the footer's legal row.
   ========================================================================== */
/* ---------- 0a. Fonts (WP12): Quattrocento Sans, self-hosted from /fonts (SIL Open Font Licence, public/fonts/OFL.txt),
   the three faces the mock uses (regular, italic, bold), latin and latin-ext subsets as Google Fonts cuts them,
   font-display: swap so text never waits for the files. No font or stylesheet is loaded from another host. ---------- */
@font-face {
  font-family: "Quattrocento Sans"; font-style: italic; font-weight: 400; font-display: swap;   /* latin-ext */
  src: url("/fonts/quattrocento-sans-400i-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Quattrocento Sans"; font-style: italic; font-weight: 400; font-display: swap;   /* latin */
  src: url("/fonts/quattrocento-sans-400i-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Quattrocento Sans"; font-style: normal; font-weight: 400; font-display: swap;   /* latin-ext */
  src: url("/fonts/quattrocento-sans-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Quattrocento Sans"; font-style: normal; font-weight: 400; font-display: swap;   /* latin */
  src: url("/fonts/quattrocento-sans-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Quattrocento Sans"; font-style: normal; font-weight: 700; font-display: swap;   /* latin-ext */
  src: url("/fonts/quattrocento-sans-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Quattrocento Sans"; font-style: normal; font-weight: 700; font-display: swap;   /* latin */
  src: url("/fonts/quattrocento-sans-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ===== Colours: edit here only (R1, light-brown palette) ===== */
  /* page + surfaces */
  --color-page-bg:          #FBF8F3;  /* warm near-white page background; product cards sit straight on it (no box) */
  --color-surface:          #FFFFFF;  /* white: header rows (through --color-header-bg), dropdown menus, the phone
                                         menu dialog, the sort select, outline and sub-category buttons, the
                                         phone "Categories" box */
  --color-surface-alt:      #F4ECE0;  /* intro strip, photo loading fill, "no results" box, tiles, the staff banner */
  --color-header-bg:        var(--color-surface);  /* logo + basket row and the category nav row */
  --color-footer-bg:        #EDE3D4;  /* footer band */
  /* light-brown accents: DECORATIVE ONLY (lines, underlines, hover fills), never text */
  --color-kraft:            #C8A77D;  /* kraft paper: section-heading underlines, underline under the current nav item,
                                         top edge of dropdown menus, footer rule */
  --color-latte:            #E8D9C4;  /* hover fill: dropdown menu items, sub-category buttons, pager, outline
                                         buttons. (The sidebar's current item is bold, not filled.) */
  /* text */
  --color-text:             #4A3B2F;  /* body text, product names, nav items, sidebar rows */
  --color-heading:          #5A3D29;  /* darker brown: headings, prices, current item (breadcrumb, sidebar, menus), footer line */
  --color-text-muted:       #6F5E50;  /* breadcrumb links, result count, sidebar counts, stock line, SKU, small print, chevrons */
  --color-link:             #7A5536;  /* links, outline-button text */
  --color-link-hover:       #5A3D29;  /* links, icons and nav items on hover */
  /* lines */
  --color-border:           #E6DACB;  /* hairline dividers (decorative): nav row edges, sidebar rows, product details,
                                         line above Related products, menu panel */
  --color-border-strong:    #9A8068;  /* control outlines (need 3:1): sort select, pager, outline and sub-category
                                         buttons, phone "Categories" box */
  /* icons */
  --color-icon:             #7A5536;  /* icons: Instagram + Facebook in the header, the footer AND the phone menu panel
                                         (the top bar's own icons use --color-topbar-text), menu button, basket bag. To colour the footer
                                         icons separately, give `.footer-col .social a` its own token */
  /* green top bar (R1). The reference green is #90B163 (--color-green-ref below), but white text on
     it is only 2.43:1 (AA needs 4.5:1), so the bar uses a deeper green of the same hue: white 4.66:1.
     CLIENT DECISION (README "Things to fine-tune" 1; both versions side by side in
     screenshots/topbar-green-compare-1280.png and -390.png). For the exact reference colour,
     change the values of the two lines below: --color-topbar-bg becomes var(--color-green-ref)
     and --color-topbar-text becomes var(--color-text-on-green-ref). The bar's focus ring follows
     the bar text by itself. The filled basket bag keeps the deeper green unless --color-badge-bg
     changes too (see COMMON TWEAKS). */
  --color-topbar-bg:        #617D3B;  /* top bar */
  --color-topbar-text:      #FFFFFF;  /* top-bar links, email and social icons */
  --color-green-ref:        #90B163;  /* the exact reference green: only used if you switch to it (above) */
  /* buttons */
  --color-button-bg:        #7A5536;  /* filled buttons (later packages), current page in the pager. For green buttons like the reference: COMMON TWEAKS */
  --color-button-bg-hover:  #5A3D29;
  --color-button-text:      #FFFFFF;
  /* badges + states */
  --color-badge-bg:         #617D3B;  /* basket bag once it holds items (later packages); same green as the top bar */
  --color-badge-text:       #FFFFFF;  /* the item count inside the filled bag */
  --color-stock-out-bg:     #4A3B2F;  /* "Out of stock" badge on a card photo */
  --color-stock-out-text:   #FFFFFF;
  --color-stock-low:        #A3472A;  /* "Only 3 left in stock" */
  --color-error:            #B20000;  /* error messages (later packages) */
  --color-logo-placeholder: #77695D;  /* the dashed outline AND the word "logo" in the empty logo box */
  --color-focus:            #2E5E8C;  /* keyboard focus ring (also round a whole product card) */
  --color-focus-on-dark:    #FFFFFF;  /* focus ring on dark surfaces (the top bar's ring uses --color-topbar-text) */
  --color-overlay:          rgba(58, 40, 26, 0.55);   /* dims the page behind the phone menu */
  --shadow-header:          0 2px 10px rgba(90, 61, 41, 0.10);  /* under the header while it is stuck to the top */
  --shadow-dropdown:        0 8px 24px rgba(90, 61, 41, 0.16);  /* dropdown menus, dialogs */
  /* added for the final mock (only used if you switch to them, see COMMON TWEAKS) */
  --color-green-dark:       #4E6630;  /* hover colour for GREEN buttons (white text 6.43:1) */
  --color-text-on-green-ref:#1F2A12;  /* dark text for the exact reference green, on the bar or the basket bag (6.19:1) */
  --texture-page:           none;     /* optional paper texture on the page background: none = off.
                                         Example that follows the palette (paste in place of none):
                                         radial-gradient(color-mix(in srgb, var(--color-kraft) 22%, transparent) 1px, transparent 1.5px) 0 0 / 7px 7px */

  /* ===== Type ===== */
  --font-body:      "Quattrocento Sans", "Helvetica Neue", Arial, sans-serif;
  --fs-xs:          0.75rem;    /* 12px  badges */
  --fs-topbar:      0.8125rem;  /* 13px  top bar links (uppercase) */
  --fs-nav:         0.8125rem;  /* 13px  category nav (uppercase) */
  --fs-meta:        0.8125rem;  /* 13px  "SKU: ... Category: ..." line, result count on phones (added) */
  --fs-sm:          0.875rem;   /* 14px  breadcrumb, result count, sub-category rows, footer */
  --fs-card:        0.9375rem;  /* 15px  product name in the grid, sidebar top-level rows */
  --fs-caps-heading:0.9375rem;  /* 15px  PRODUCT CATEGORIES, RELATED PRODUCTS (uppercase, bold) */
  --fs-base:        1rem;       /* 16px  body, description, grid price */
  --fs-price-lg:    1.375rem;   /* 22px  price in the product view */
  --fs-h1:          1.625rem;   /* 26px  intro-strip heading, category name */
  --fs-product-h1:  1.75rem;    /* 28px  product name in the product view */
  --lh-body:        1.6;
  --tracking-caps:  0.08em;     /* letter-spacing for uppercase labels */
  --tracking-nav:   0.06em;     /* tighter for the nav so 7 categories fit on one line */

  /* ===== Spacing (added): one scale for padding, margins and gaps ===== */
  --space-1:        4px;
  --space-2:        8px;
  --space-3:        12px;
  --space-4:        16px;
  --space-5:        20px;
  --space-6:        24px;
  --space-7:        32px;
  --space-8:        48px;
  --space-9:        64px;
  --section-space:  56px;       /* above "Related products" */
  --grid-row-gap:   var(--grid-gap);  /* vertical space between rows of cards; set e.g. 40px for an airier grid */
  --hairline:       1px;        /* dividers and borders */

  /* ===== Layout ===== */
  --container-max:  1200px;     /* content width; side gutters below */
  --gutter:         15px;       /* 16px on phones (see section 3) */
  --topbar-h:       40px;       /* reference 40px */
  --header-h:       120px;      /* reference 123px */
  --nav-h:          40px;       /* reference 39px */
  --logo-w:         220px;      /* empty logo box, desktop */
  --logo-h:         80px;
  --grid-gap:       30px;       /* 16px on phones */
  --radius:         0;          /* reference: square buttons and inputs */
  --radius-pill:    999px;      /* badges */
  --tap:            44px;       /* minimum touch target */
  /* added for the final mock */
  --grid-cols:      3;          /* product cards per row (2 below 850px) */
  --sidebar-w:      25%;        /* sidebar column, reference ~25% (293px at 1280) */
  --related-cols:   5;          /* related-product card width = 1/5 of the row (up to 5 related per product) */
  --header-h-stuck: 64px;       /* logo row height while the header is stuck to the top */
  --logo-w-stuck:   140px;      /* logo box while the header is stuck */
  --logo-h-stuck:   44px;
}

/* ==========================================================================
   CONTENTS
     0  Tokens (above): EDIT COLOURS HERE, then type, spacing, layout sizes
     1  Base and utilities
     2  Green top bar
     3  Header row: socials, empty logo box, basket link; sticky header
     5  Buttons
     6  Category nav row and its dropdowns
     7  Intro strip (home only)
     8  Breadcrumb row: breadcrumb, result count, sort select
     9  Shop layout and sidebar category tree
    10  Category heading, sub-category links, product grid and product card
    11  Pagination
    12  Card page (big photo + summary)
    13  Related products
    14  Dialog: phone menu panel
    15  Footer
    17  Responsive (tablet < 1100px, < 850px, phones < 600px)
    18  Storefront additions (tiles, delivery line, stock line, sort form, single-column pages)
    19  Footer additions (WP12); 20 touch targets on phones (WP16)

   COMMON TWEAKS (all in section 0 unless said otherwise)
     - colours ............... the colour block; nothing else in the file holds a colour
     - exact reference green . set --color-topbar-bg to var(--color-green-ref) AND
                               --color-topbar-text to var(--color-text-on-green-ref) (white on it fails AA).
                               Both versions side by side: screenshots/topbar-green-compare-*.png.
                               The filled basket bag stays the deeper green; to match it, also set
                               --color-badge-bg to var(--color-green-ref) and --color-badge-text to
                               var(--color-text-on-green-ref) (the bag's edge is then 2.4:1 on white)
     - green buttons ......... set --color-button-bg to var(--color-topbar-bg) and
                               --color-button-bg-hover to var(--color-green-dark)
     - font .................. --font-body (Quattrocento Sans self-hosted from /fonts, section 0a; OFL)
     - text sizes ............ the --fs-* tokens (phone sizes: section 17)
     - spacing ............... --space-1 ... --space-9, --section-space, --grid-gap, --grid-row-gap
     - cards per row ......... --grid-cols (and in section 17 for tablets and phones)
     - sidebar width ......... --sidebar-w
     - logo box size ......... --logo-w / --logo-h (sticky header: --logo-w-stuck / --logo-h-stuck)
     - square or rounded ..... --radius (0 = square, like the reference)
     - paper texture ......... --texture-page (none = off)
     - sticky header on/off .. STICKY_HEADER in public/js/header.js
   ========================================================================== */

/* ---------- 1. Base and utilities ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h-stuck) + var(--nav-h) + var(--space-4)); /* the sticky header never hides a focused item */
}
body {
  margin: 0;
  font-family: var(--font-body); font-size: var(--fs-base); line-height: var(--lh-body);
  color: var(--color-text); background-color: var(--color-page-bg); background-image: var(--texture-page);
}
body:has(dialog[open]) { overflow: hidden; }          /* no page scroll behind an open dialog */
img { display: block; max-width: 100%; }
a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-link-hover); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { color: var(--color-heading); font-weight: 400; line-height: 1.25; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }               /* headings focused by the script after navigation are not controls */
[hidden] { display: none !important; }
.container { width: 100%; max-width: var(--container-max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: var(--space-2); top: -100px; z-index: 100; padding: var(--space-2) var(--space-3); background: var(--color-surface); }
.skip-link:focus { top: var(--space-2); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); padding: 0; border: 0; background: none; color: var(--color-icon);
}
[data-icon] { display: inline-flex; }

/* ---------- 2. Green top bar (R1) ----------
   Left: settings.topBarLinks. Right: envelope + EMAIL. No telephone number.
   For the exact reference green see COMMON TWEAKS above. */
.top-bar { background: var(--color-topbar-bg); color: var(--color-topbar-text); font-size: var(--fs-topbar); }
.top-bar a { color: var(--color-topbar-text); }
.top-bar a:hover { color: var(--color-topbar-text); text-decoration: underline; }
.top-bar :focus-visible { outline-color: var(--color-topbar-text); outline-offset: -3px; } /* ring = bar text colour, so it stays visible if the bar colour changes */
.top-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: var(--topbar-h); }
.top-links { display: flex; align-items: center; margin: 0; padding: 0; list-style: none; text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.top-links li { display: flex; align-items: center; }
.top-links li + li::before { content: ""; width: var(--hairline); height: 14px; background: currentColor; opacity: .5; } /* thin divider, like the reference */
.top-links a { display: block; padding: 0 var(--space-3); line-height: var(--topbar-h); }
.top-links li:first-child a { padding-left: 0; }
.top-email { display: inline-flex; align-items: center; gap: var(--space-2); line-height: var(--topbar-h); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.social.top-social { display: none; }                  /* phones only, see section 17 */
.top-bar .social a { color: var(--color-topbar-text); }

/* ---------- 3. Header row: socials | empty logo | basket link ---------- */
.site-header { position: relative; z-index: 30; }
.header-wrapper { background: var(--color-header-bg); }   /* the part that sticks: logo row + nav row */
.header-main { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-4); min-height: var(--header-h); }
.header-left { display: flex; align-items: center; justify-self: start; margin-left: calc(-1 * var(--space-3)); } /* lines the first glyph up with the content edge */
.header-right { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-6); justify-self: end; }
.menu-toggle { display: none; }                        /* shown below 1100px */

/* Social icons (R2): Instagram + Facebook only, 20px glyphs in 44px hit areas */
.social { display: flex; align-items: center; }
.social a { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); color: var(--color-icon); }
.social a:hover { color: var(--color-link-hover); }

/* Empty logo placeholder (R14): dashed box with the grey word "logo", nothing else.
   Size: --logo-w / --logo-h. When the logo is designed, put an <img> inside this link. */
.logo-placeholder {
  display: flex; align-items: center; justify-content: center;
  width: var(--logo-w); height: var(--logo-h);
  border: 2px dashed var(--color-logo-placeholder); color: var(--color-logo-placeholder);
  font-size: var(--fs-xs); letter-spacing: var(--tracking-caps);
}
.logo-placeholder:hover { color: var(--color-logo-placeholder); }

/* Basket link: "BASKET" + bag outline with the item count inside (reference style). The basket itself is a later package. */
.basket { position: relative; }
.basket-toggle {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-width: var(--tap); min-height: var(--tap); padding: 0 0 0 6px;
  border: 0; background: none; color: var(--color-text);
  font-size: var(--fs-nav); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps);
}
.basket-toggle:hover { color: var(--color-link-hover); }
.basket-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 24px; margin-top: 7px; padding: 0 5px;
  border: 2px solid var(--color-icon); border-radius: 0 0 5px 5px; color: var(--color-icon);
  transition: background-color .2s, color .2s;
}
.basket-icon::before {                                  /* the bag handle */
  content: ""; position: absolute; left: 50%; bottom: 100%; width: 12px; height: 8px; margin-left: -6px;
  border: 2px solid var(--color-icon); border-bottom: 0; border-radius: 6px 6px 0 0;
}
.basket-count { font-size: var(--fs-xs); font-weight: 700; line-height: 1; letter-spacing: 0; }

/* Sticky header (the mock's section 3): once the whole header has scrolled out of view, header.js adds
   .is-stuck and the logo row + nav row are fixed to the top, shorter (--header-h-stuck), sliding in with a
   transform. The header keeps its height in the page, so nothing jumps. Switch off in public/js/header.js. */
.site-header.is-stuck .header-wrapper {
  position: fixed; top: 0; left: 0; right: 0;
  box-shadow: var(--shadow-header); animation: header-slide-in .3s ease-out;
}
.site-header.is-stuck .header-main { min-height: var(--header-h-stuck); }
.site-header.is-stuck .logo-placeholder { width: var(--logo-w-stuck); height: var(--logo-h-stuck); }
@keyframes header-slide-in { from { transform: translateY(-100%); } }

/* ---------- 5. Buttons (square, uppercase, like the reference) ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap); padding: 0 var(--space-6);
  border: var(--hairline) solid var(--color-button-bg); border-radius: var(--radius);
  background: var(--color-button-bg); color: var(--color-button-text);
  font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps);
}
.button:hover { background: var(--color-button-bg-hover); border-color: var(--color-button-bg-hover); color: var(--color-button-text); }
.button.is-outline { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-link); }
.button.is-outline:hover { background: var(--color-latte); color: var(--color-text); }
.button:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 6. Category nav row (R4) ----------
   Built from SHOP.categories (top level in sort_order). Each item: a link plus a
   chevron button that opens its sub-category dropdown (also opens on mouse hover). */
.nav-row { background: var(--color-header-bg); border-top: var(--hairline) solid var(--color-border); border-bottom: var(--hairline) solid var(--color-border); }
.main-nav > ul { display: flex; justify-content: center; height: var(--nav-h); margin: 0; padding: 0; list-style: none; }
.main-nav > ul > li { position: relative; display: flex; align-items: stretch; }
.nav-top-link {
  display: flex; align-items: center; padding-left: var(--space-2); white-space: nowrap;
  font-size: var(--fs-nav); text-transform: uppercase; letter-spacing: var(--tracking-nav); color: var(--color-text);
}
.nav-chevron {
  display: flex; align-items: center; justify-content: center; width: 24px; margin-right: 2px; padding: 0;
  border: 0; background: none; color: var(--color-text-muted);
}
.nav-chevron svg { transition: transform .2s; }
.nav-item:hover > .nav-top-link, .nav-item.is-open > .nav-top-link { color: var(--color-link-hover); }
.nav-item.is-open > .nav-chevron svg { transform: rotate(180deg); }
.nav-item.is-current::after {                          /* 2px kraft underline under the current top-level item */
  content: ""; position: absolute; left: var(--space-2); right: 6px; bottom: -1px; height: 2px; background: var(--color-kraft);
}
.main-nav :focus-visible { outline-offset: -2px; }
.sub-menu {
  display: none; position: absolute; top: 100%; left: 0; z-index: 40; min-width: 220px;
  margin: 0; padding: var(--space-2) 0; list-style: none;
  background: var(--color-surface); box-shadow: var(--shadow-dropdown); border-top: 2px solid var(--color-kraft);
}
.nav-item.is-open > .sub-menu { display: block; }
.main-nav > ul > li:nth-last-child(-n+2) > .sub-menu { left: auto; right: 0; } /* keep the last dropdowns on screen */
.sub-menu a { display: flex; align-items: center; min-height: 40px; padding: 0 var(--space-5); color: var(--color-text); font-size: var(--fs-sm); white-space: nowrap; }
.sub-menu a:hover { background: var(--color-latte); color: var(--color-text); }
.sub-menu a[aria-current="page"] { color: var(--color-heading); font-weight: 700; }
/* Third level (the data model allows 3): listed in the same dropdown, indented under its sub-category */
.sub-menu-children { margin: 0; padding: 0; list-style: none; }
.sub-menu-children a { min-height: 34px; padding-left: calc(var(--space-5) + var(--space-4)); }
.sub-menu-children .sub-menu-children a { padding-left: calc(var(--space-5) + 2 * var(--space-4)); }

/* ---------- 7. Intro strip (home view only, at most 120px tall) ---------- */
.intro-strip { background: var(--color-surface-alt); }
.intro-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); padding-top: var(--space-5); padding-bottom: var(--space-5); }
.intro-title { margin: 0; font-size: var(--fs-h1); }
.intro-text { margin: var(--space-1) 0 0; }
.intro-link { flex: none; }

/* ---------- 8. Breadcrumb row (R5) + result count and sort (R7) ---------- */
.shop-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-4); padding-top: var(--space-5); padding-bottom: var(--space-5); }
.breadcrumb ol { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); color: var(--color-text-muted); }
.breadcrumb li + li::before { content: "/"; margin: 0 var(--space-2); }
.breadcrumb a { display: inline-flex; align-items: center; min-height: 24px; color: var(--color-text-muted); }   /* 24 px, WCAG 2.2's floor for a target (WP16) */
.breadcrumb a:hover { color: var(--color-link-hover); }
.breadcrumb [aria-current="page"] { color: var(--color-heading); font-weight: 700; }
.is-product-view .breadcrumb ol { text-transform: uppercase; letter-spacing: var(--tracking-caps); } /* reference product page */
.toolbar-right { display: flex; align-items: center; gap: var(--space-4); }
.result-count { margin: 0; font-size: var(--fs-sm); color: var(--color-text-muted); }
.select-wrap { position: relative; display: inline-block; max-width: 100%; }
.select-wrap::after {                                   /* the select's chevron, drawn with borders */
  content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; pointer-events: none;
  border-right: 2px solid var(--color-text-muted); border-bottom: 2px solid var(--color-text-muted);
  transform: translateY(-70%) rotate(45deg);
}
select.orderby {
  -webkit-appearance: none; appearance: none; max-width: 100%; height: 36px; padding: 0 38px 0 var(--space-3);
  border: var(--hairline) solid var(--color-border-strong); border-radius: var(--radius);
  background: var(--color-surface); color: var(--color-text); font-size: var(--fs-sm);
}
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-size: var(--fs-sm); }

/* ---------- 9. Shop layout: 25% sidebar + content column (R6) ---------- */
.shop-layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); column-gap: var(--grid-gap); align-items: start; padding-bottom: var(--space-9); }
.is-product-view .shop-layout { grid-template-columns: minmax(0, 1fr); }
.is-product-view .sidebar { display: none; }
.sidebar-toggle { display: none; }                      /* phones/tablets: "Categories: <current>" disclosure */
.widget-title, .section-title {
  margin: 0 0 var(--space-3); color: var(--color-heading);
  font-size: var(--fs-caps-heading); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps);
}
.widget-title::after, .section-title::after {          /* short 30x3px underline (green on the reference, kraft here) */
  content: ""; display: block; width: 30px; height: 3px; margin-top: 10px; background: var(--color-kraft);
}
.category-tree, .category-tree ul { margin: 0; padding: 0; list-style: none; }
.category-tree > li + li { border-top: var(--hairline) solid var(--color-border); }
.cat-row { display: flex; align-items: center; justify-content: space-between; min-height: var(--tap); }
.cat-row > a { flex: 1; padding: 9px 0; color: var(--color-text); font-size: var(--fs-card); line-height: 1.35; }
.category-tree a:hover { color: var(--color-link-hover); }
.category-tree a[aria-current="page"] { color: var(--color-heading); font-weight: 700; }
.count { color: var(--color-text-muted); font-size: var(--fs-sm); font-weight: 400; }
.cat-toggle {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: var(--tap); height: var(--tap); margin-right: -14px; padding: 0;
  border: 0; background: none; color: var(--color-text-muted);
}
.cat-toggle svg { transition: transform .2s; }
.cat-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.category-tree .children { padding: 0 0 10px 15px; }
.category-tree .children a { display: block; padding: 6px 0; color: var(--color-text); font-size: var(--fs-sm); line-height: 1.4; }
/* Third level (the data model allows 3): a sub-category with its own children gets a row with a chevron,
   and its list is indented another 15px */
.category-tree .children .children { padding-bottom: var(--space-1); }

/* ---------- 10. Category heading, sub-category links, product grid and card (R8) ----------
   3 per row (--grid-cols), square photos, centred name, bold price.
   Names are shown in full (no line limit), as on the reference: long names such as "Pack of 5 Mini
   Christmas Cards | ..." differ only in their last words. Prices still line up across a row because
   .price-wrapper is pushed to the bottom of each card. */
.shop-main:focus { outline: none; }
.category-head { margin: 0 0 var(--space-6); }
.page-title { margin: 0 0 var(--space-2); font-size: var(--fs-h1); }
.term-description { max-width: 70ch; margin: 0; }
.term-description p { margin: 0; }
/* Sub-category links under a top-level category (built from the data), square like the reference buttons */
.subcat-links { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-4) 0 0; padding: 0; list-style: none; }
.subcat-links a {
  display: inline-flex; align-items: center; gap: var(--space-1); min-height: 36px; padding: 0 var(--space-3);
  border: var(--hairline) solid var(--color-border-strong); border-radius: var(--radius);
  background: var(--color-surface); color: var(--color-text); font-size: var(--fs-sm);
}
.subcat-links a:hover { background: var(--color-latte); color: var(--color-text); }
ul.products { display: grid; grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr)); gap: var(--grid-row-gap) var(--grid-gap); margin: 0; padding: 0; list-style: none; }
.product-card { position: relative; display: flex; flex-direction: column; text-align: center; } /* column: prices line up across a row */
.card-image { position: relative; overflow: hidden; background: var(--color-surface-alt); }
.card-image img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; transition: transform .5s ease; } /* height:auto keeps it square */
.product-card:hover .card-image img { transform: scale(1.05); }
.badge-out-of-stock {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 10px var(--space-4); pointer-events: none;
  background: var(--color-stock-out-bg); color: var(--color-stock-out-text); white-space: nowrap;
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps);
}
.box-text { display: flex; flex: 1; flex-direction: column; padding: var(--space-3) var(--space-1) 0; }
.product-card .product-title { margin: 0 0 var(--space-1); font-size: var(--fs-card); line-height: 1.35; }
.product-card .product-title a { color: var(--color-text); }   /* wraps onto as many lines as the name needs */
.product-card .product-title a:hover { color: var(--color-link-hover); }
.price-wrapper { margin-top: auto; }                     /* pushes the price to the bottom of the card */
.product-card .price { color: var(--color-heading); font-weight: 700; }
/* Keyboard focus on the name rings the whole card (photo, name and price) where :has() is supported */
@supports selector(:has(a)) {
  .product-card .product-title a:focus-visible { outline: none; }
  .product-card:has(.product-title a:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: 6px; }
}
.no-results { margin: 0; padding: var(--space-4); background: var(--color-surface-alt); }

/* ---------- 11. Pagination (12 per page) ---------- */
.pagination ul { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin: var(--space-8) 0 0; padding: 0; list-style: none; }
.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 6px;
  border: var(--hairline) solid var(--color-border-strong); color: var(--color-text); font-size: var(--fs-sm); font-weight: 700;
}
.pagination a:hover { background: var(--color-latte); }
.pagination [aria-current="page"] { background: var(--color-button-bg); border-color: var(--color-button-bg); color: var(--color-button-text); }

/* ---------- 12. Card page (R8): two equal columns like the reference product page ---------- */
.pv-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--grid-gap); align-items: start; }
.pv-image { background: var(--color-surface-alt); }
.pv-image img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.pv-summary { padding-top: 10px; text-align: center; }
.pv-summary .product-title { margin: 0 0 var(--space-3); font-size: var(--fs-product-h1); }
.pv-summary .price { margin: 0 0 var(--space-4); color: var(--color-heading); font-size: var(--fs-price-lg); font-weight: 700; }
.product-description { max-width: 46ch; margin: 0 auto var(--space-4); }
.product-description p { margin: 0; }
.stock { margin: 0 0 var(--space-5); color: var(--color-text-muted); font-size: var(--fs-sm); }
.stock.is-low { color: var(--color-stock-low); font-weight: 700; }
.stock.is-out { color: var(--color-text); font-weight: 700; }
.product-meta { margin: var(--space-5) 0 0; padding-top: var(--space-4); border-top: var(--hairline) solid var(--color-border); color: var(--color-text-muted); font-size: var(--fs-meta); }

/* ---------- 13. Related products (R9): up to 5 cards from SHOP.related ----------
   Each card is 1/--related-cols of the row wide; a shorter row is centred, so 3 related
   products do not leave two empty columns. Phones: a strip that scrolls sideways (section 17). */
.related-products { margin-top: var(--section-space); padding-top: var(--space-7); border-top: var(--hairline) solid var(--color-border); }
.related-products ul.products { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-5); }
.related-products .product-card { flex: 0 0 calc((100% - (var(--related-cols) - 1) * var(--space-5)) / var(--related-cols)); }
.related-products .section-title { text-align: center; }          /* centred over the centred row */
.related-products .section-title::after { margin-left: auto; margin-right: auto; }
.related-products .product-card .product-title { font-size: var(--fs-sm); }

/* ---------- 14. Dialog: the phone menu panel (from the left) ---------- */
dialog { padding: 0; border: 0; background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-dropdown); }
dialog::backdrop { background: var(--color-overlay); }
.dialog-close {
  display: flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0;
  border: 0; background: none; color: var(--color-text);
}
.menu-panel { inset: 0 auto 0 0; width: min(330px, 86vw); max-width: none; height: 100%; max-height: none; margin: 0; overflow-y: auto; }
.mp-head { display: flex; justify-content: flex-end; padding: 6px; border-bottom: var(--hairline) solid var(--color-border); }
.mp-body { padding: var(--space-4) var(--space-5) var(--space-7); }
.mp-links { margin: var(--space-6) 0 var(--space-2); padding: var(--space-3) 0 0; border-top: var(--hairline) solid var(--color-border); list-style: none; }
.mp-links a { display: flex; align-items: center; min-height: var(--tap); color: var(--color-text); font-size: var(--fs-nav); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.mp-social { margin-left: calc(-1 * var(--space-3)); }

/* ---------- 15. Footer (R12): the last line is settings.footerLine ---------- */
.site-footer { padding: var(--space-8) 0 var(--space-6); background: var(--color-footer-bg); font-size: var(--fs-sm); }
.footer-widgets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--grid-gap); }
.footer-col ul { margin: 0; padding: 0; list-style: none; }
.footer-col li a { display: inline-block; padding: 3px 0; }
.footer-col .social { margin-left: calc(-1 * var(--space-3)); }
.footer-email { display: inline-flex; align-items: center; gap: var(--space-2); }
.absolute-footer { margin-top: 36px; text-align: center; }
.absolute-footer::before { content: ""; display: block; margin-bottom: var(--space-6); border-top: var(--hairline) solid var(--color-kraft); } /* rule lines up with the content edge */
.copyright { margin: 0 0 6px; color: var(--color-text-muted); }
.footer-line { margin: 0; color: var(--color-heading); letter-spacing: var(--tracking-caps); }

/* ---------- 17. Responsive ---------- */
/* Below 1100px the nav row no longer fits: a menu button opens the same category tree */
@media (max-width: 1099.98px) {
  html { scroll-padding-top: calc(var(--header-h-stuck) + var(--space-4)); }
  .nav-row { display: none; }
  .menu-toggle { display: inline-flex; }
}
@media (max-width: 999.98px) {
  :root { --related-cols: 3; }
}
/* Below 850px: sidebar becomes a "Categories: <current>" button above a 2-up grid */
@media (max-width: 849.98px) {
  :root { --grid-gap: 16px; --grid-cols: 2; }
  .shop-layout { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-4); }
  .sidebar-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); width: 100%; min-height: var(--tap); padding: 0 var(--space-4);
    border: var(--hairline) solid var(--color-border-strong); background: var(--color-surface); color: var(--color-text);
    font-size: var(--fs-sm); text-align: left;
  }
  .sidebar-toggle-text { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
  .sidebar-toggle-label { flex: none; font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); }
  .sidebar-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-muted); }
  .sidebar-toggle svg { transition: transform .2s; }
  .sidebar-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  html.js .sidebar:not(.is-expanded) .widget { display: none; }
  .sidebar .widget { padding: var(--space-1) var(--space-4) var(--space-2); border: var(--hairline) solid var(--color-border-strong); border-top: 0; background: var(--color-surface); }
  .sidebar .widget-title { display: none; }
  .cat-toggle { margin-right: -10px; }
  .pv-columns { grid-template-columns: minmax(0, 1fr); }
  .intro-inner { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  .footer-widgets { gap: var(--space-6); }
}
/* Phones (checked at 390px) */
@media (max-width: 599.98px) {
  :root {
    --gutter: 16px; --header-h: 64px; --logo-w: 120px; --logo-h: 44px;
    --header-h-stuck: 56px; --logo-w-stuck: 110px; --logo-h-stuck: 40px;
    --fs-h1: 1.25rem; --fs-product-h1: 1.5rem;
  }
  .top-links { display: none; }                         /* text links move into the menu panel */
  .social.top-social { display: flex; margin-left: calc(-1 * var(--space-3)); }
  .top-bar-inner { min-height: var(--tap); }
  .top-email { min-height: var(--tap); }                /* 44px tap target */
  .header-main { gap: var(--space-2); }
  .header-left .social { display: none; }               /* socials sit in the green bar instead */
  .basket-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .basket-toggle { padding: 0; }                        /* 44x44 tap target round the bag */
  .shop-toolbar { padding-top: 14px; padding-bottom: 14px; }
  /* result count on its own line, then the sort select across the full width, so the longest
     label ("Sort by price: high to low") always fits, down to 320px */
  .toolbar-right { flex-wrap: wrap; width: 100%; gap: var(--space-2); }
  .result-count { flex: 1 1 100%; font-size: var(--fs-meta); }   /* 13px */
  .select-wrap { flex: 1 1 100%; }
  select.orderby { width: 100%; height: var(--tap); padding-right: var(--space-7); }  /* 44px, like the Categories box below */
  .select-wrap::after { right: var(--space-4); }
  /* intro strip: tagline + link only, so the cards start high on the screen */
  .intro-inner { gap: var(--space-2); padding-top: 14px; padding-bottom: var(--space-4); }
  .intro-text { display: none; }
  .intro-link { min-height: var(--tap); padding: 0 var(--space-4); font-size: var(--fs-xs); }   /* 44 px on phones (WP16) */
  .pagination a, .pagination span { min-width: var(--tap); height: var(--tap); }
  .footer-widgets { grid-template-columns: minmax(0, 1fr); }       /* footer columns stack on phones */
  /* related products: one row that scrolls sideways inside its own box (never the page) */
  .related-products ul.products {
    flex-wrap: nowrap; justify-content: flex-start; gap: var(--space-4);
    overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; padding-bottom: var(--space-3);
  }
  .related-products .product-card { flex: 0 0 calc((100% - var(--space-4)) / 2.25); scroll-snap-align: start; }
  .related-products .section-title { text-align: left; }           /* the strip starts at the left edge */
  .related-products .section-title::after { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 18. Storefront additions (WP10) ---------- */
/* Announcement in the top bar (settings.announcement_text) */
.top-announcement { margin: 0; flex: 1; text-align: center; font-size: var(--fs-topbar); }
.top-announcement.is-paused { font-weight: 700; }
/* "+ delivery from £X" under a price; the link goes to the Delivery Information page */
.delivery-from { display: block; margin-top: 2px; color: var(--color-text-muted); font-size: var(--fs-sm); font-weight: 400; }
.delivery-from a { color: var(--color-text-muted); text-decoration: underline; text-underline-offset: 2px; }
.delivery-from a:hover { color: var(--color-link-hover); }
.pv-summary .delivery-from { margin: calc(-1 * var(--space-3)) 0 var(--space-4); }
/* "Only N left" on a card */
.stock-low { display: block; margin-top: 2px; color: var(--color-stock-low); font-size: var(--fs-sm); font-weight: 700; }
/* A card without a photo yet: the surface-alt square stays, nothing else */
.no-photo { display: block; width: 100%; aspect-ratio: 1; background: var(--color-surface-alt); }
/* Home: one tile per top-level category */
.category-tiles { padding-top: var(--space-7); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--grid-gap); margin: 0; padding: 0; list-style: none; }
.tile a { display: flex; flex-direction: column; gap: var(--space-2); color: var(--color-text); text-align: center; }
.tile-image { display: block; overflow: hidden; background: var(--color-surface-alt); }
.tile-image img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; transition: transform .5s ease; }
.tile a:hover .tile-image img { transform: scale(1.05); }
.tile-name { font-size: var(--fs-card); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.tile a:hover .tile-name { color: var(--color-link-hover); }
/* Sort form: the Sort button is only for visitors without JavaScript */
.sort-form { display: flex; align-items: center; gap: var(--space-2); margin: 0; }
.sort-submit { min-height: 36px; padding: 0 var(--space-3); font-size: var(--fs-xs); }
.sort-form.is-js .sort-submit { display: none; }
/* Without JavaScript the phone disclosure button would do nothing: the tree is simply shown */
html:not(.js) .sidebar-toggle { display: none; }
/* Single-column pages: info pages, the card page, error pages */
.shop-layout.is-single { grid-template-columns: minmax(0, 1fr); }
.page-content { max-width: 70ch; }
.page-content p { margin: 0 0 var(--space-4); }
.error-page .button { margin-top: var(--space-2); }
/* The card page's summary notes */
.small-parts { max-width: 46ch; margin: 0 auto var(--space-4); color: var(--color-text-muted); font-size: var(--fs-sm); }
.staff-banner { margin: 0 0 var(--space-5); padding: 10px var(--space-4); background: var(--color-surface-alt); border-left: 3px solid var(--color-stock-low); color: var(--color-heading); font-size: var(--fs-sm); font-weight: 700; }
.product-view .related-products ul.products { margin-top: 0; }
@media (max-width: 849.98px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
}
@media (max-width: 599.98px) {
  .top-announcement:not(.is-paused) { display: none; }
  .top-bar-inner { flex-wrap: wrap; }                   /* the paused line gets its own row */
  .top-announcement.is-paused { flex-basis: 100%; }
}

/* ---------- 19. Footer additions (WP12): the legal row, the payment marks and the trader block ---------- */
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-5); margin: 0 0 var(--space-4); padding: 0; list-style: none; }
.legal-links a { display: inline-block; padding: 3px 0; }
.payment-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin: 0 0 14px; padding: 0; list-style: none; }
.payment-badges li {
  padding: 2px 9px; border: var(--hairline) solid var(--color-border-strong); border-radius: 3px;
  background: var(--color-surface); color: var(--color-text-muted); font-size: var(--fs-xs); font-weight: 700;
}
.footer-col .trader-identity { margin: 0 0 var(--space-3); }
.trader-address-pending { color: var(--color-text-muted); font-style: italic; }

/* ---------- 20. Touch targets on phones (WP16, docs/accessibility.md): below 600 px every control that is not an inline
   text link is 44 px tall (--tap); the pager, the sort select, the top bar's email link, the intro button, the menu
   panel's rows (.mp-links a) and the dialogs' close buttons (.dialog-close) already are, and the tree's links fill their
   44 px rows here. The inline text links (a card's name in the grid, "+ delivery from", the SKU line's category link, the
   trader block's email link, the crumbs at 24 px) are exempt under WCAG 2.2's 2.5.8 and spaced apart. ---------- */
@media (max-width: 599.98px) {
  .sort-submit, .subcat-links a { min-height: var(--tap); }
  .cat-row > a, .category-tree .children a { display: flex; align-items: center; gap: var(--space-1); min-height: var(--tap); padding: 0; }   /* the link itself, not only its row; the gap keeps "Name (3)" apart (review 1, B1 and B5) */
  .footer-col li a, .legal-links a, .footer-email { display: inline-flex; align-items: center; min-height: var(--tap); padding-top: 0; padding-bottom: 0; }
}
