/* Storefront component rules — consume the theme TOKENS; never edit
   per brand. Tokens files: theme/tokens-<name>.css. */

/* ---- Base ---------------------------------------------------------------- */
body { background: var(--brand-cream); color: var(--brand-ink); font-family: var(--brand-font-body); }

/* Small uppercase section labels ("Step 1 · Review", card headings…) */
.eyebrow { letter-spacing: .22em; text-transform: uppercase; font-size: .68rem;
           color: var(--brand-terra); font-weight: 500; }

/* Catalog card images use the global photo aspect ratio with a soft tint */
.card-img { aspect-ratio: var(--brand-img-aspect); object-fit: cover; width: 100%; background: var(--brand-sand); }
/* Catalog/product cards: skip rendering work for offscreen cards. The
   filtering JS rebuilds the whole grid on every keystroke; with 300+ cards
   content-visibility keeps layout/paint confined to the viewport. The
   intrinsic size estimate (square photo + text block) avoids scrollbar
   jumpiness; `auto` reuses the last rendered size once seen. */
.cal-card { content-visibility: auto; contain-intrinsic-size: auto 380px;
            background: var(--brand-panel, #fff); }

/* Photo loading indicator: wrap an <img> in .img-load and a spinner shows
   behind it until the image content paints over it (an unloaded <img> is
   transparent). shop.js adds .loaded once the image fires load/error, so
   the spinner stops animating; without JS it still hides under the photo.
   Badges (discount/package/availability) sit above the image via z-index. */
.img-load { position: relative; }
.img-load::after {
  content: ''; position: absolute; inset: 0; z-index: 2;
  width: 32px; height: 32px; margin: auto;
  border-radius: 50%;
  border: 3px solid rgba(38, 34, 30, .15);
  border-top-color: var(--brand-terra);
  animation: vp-spin .8s linear infinite;
}
.img-load > img { position: relative; z-index: 1; }
.img-load > .badge { z-index: 3; }
.img-load.loaded::after { display: none; }
/* Lightbox image box: keep a minimum size so the spinner has room while
   the (initially empty) image resolves. */
.img-load.lb-img-box { min-width: 200px; min-height: 200px; }
@keyframes vp-spin { to { transform: rotate(360deg); } }

/* EVERY photo on the site (cards, gallery mains + thumbs, wishlist rows,
   autocomplete results) uses --brand-img-aspect. `height: auto !important`
   neutralises fixed-height utility classes (h-11, h-16, h-24 …) so the
   ratio always wins; widths still come from the utility classes. */
img { aspect-ratio: var(--brand-img-aspect); height: auto !important; object-fit: cover; }

/* Brand images (header logo) opt out of the photo aspect treatment: fixed
   WIDTH via utility classes, natural height follows. (Height utilities still
   lose to the `!important` above, so size logos by width.) */

/* Tiny uppercase status pills (discount −20%, "Package", availability) */
.badge { font-size: .65rem; letter-spacing: .08em; text-transform: uppercase;
         padding: .2rem .5rem; border-radius: 9999px; }

/* Form inputs/selects on the storefront (the staff area has its own
   .input). Native controls ignore the theme — this makes every field
   follow the tokens, which dark themes depend on. */
.input { background: var(--brand-panel, #fff); color: var(--brand-ink, #222);
         border: 1px solid var(--brand-sand-deep, #ccc); border-radius: .5rem;
         padding: .45rem .7rem; font-size: .9rem; outline: none; }
.input:focus { border-color: var(--brand-terra); }

/* ---- Buttons ------------------------------------------------------------- */
.btn-primary { background: var(--brand-terra); color: var(--brand-on-accent, #fff); padding: .7rem 1.6rem;
               border-radius: var(--brand-btn-radius); font-size: .85rem;
               letter-spacing: .12em; text-transform: uppercase; transition: background .2s; }
.btn-primary:hover { background: var(--brand-terradark); }
.btn-outline { border: 1px solid var(--brand-ink); color: var(--brand-ink); padding: .7rem 1.6rem;
               border-radius: var(--brand-btn-radius); font-size: .85rem;
               letter-spacing: .12em; text-transform: uppercase; }

/* <details> accordions on product/info pages */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ---- Tags: small rounded filter chips ------------------------------------ */
.chip { font-size: .75rem; padding: .3rem .8rem; border-radius: 9999px;
        border: 1px solid var(--brand-sand-deep); color: var(--brand-muted); }
.chip.active { background: var(--brand-ink); color: var(--brand-cream); border-color: var(--brand-ink); }

/* Colour tags render as a plain swatch; the name lives in the tooltip. */
.chip-colour { display: inline-block; width: 1.75rem; height: 1.75rem;
               border-radius: 9999px; border: 1px solid var(--brand-sand-deep); }
.chip-colour.active { outline: 2px solid var(--brand-terra); outline-offset: 2px; }

/* ---- Site header -------------------------------------------------------------
   The Tailwind Play CDN SILENTLY DROPS any `bg-<color>/<opacity>` utility
   whose colour is a CSS variable (cream/sand/ink…): it cannot parse the hex
   inside var(--brand-cream), so the whole declaration is discarded. The header
   and search box were therefore fully transparent — the "blurred band" was
   just backdrop-blur over whatever scrolled beneath. Define the frosted
   fills here; they follow the active theme. First declaration is the
   no-color-mix fallback (older browsers get solid cream). */
header.site-header { background-color: var(--brand-nav-bg, var(--brand-cream));
                     background-color: var(--brand-nav-bg, color-mix(in srgb, var(--brand-cream) 90%, transparent));
                     border-color: var(--brand-nav-border, var(--brand-sand));
                     color: var(--brand-nav-ink, var(--brand-ink)); }
header.site-header .logo-img { filter: var(--brand-nav-logo-filter, none); }
header.site-header input[type="search"] {
  background-color: var(--brand-nav-field-bg,
    color-mix(in srgb, var(--brand-sand) 70%, transparent));
  color: var(--brand-nav-ink, var(--brand-ink)); }
/* Category links sit on the header chrome — they follow the nav ink when a
   theme sets nav overrides, and are unchanged otherwise. */
header.site-header .cat-link { color: var(--brand-nav-ink, var(--brand-ink)); }
header.site-header .cat-link:hover { border-color: var(--brand-nav-active-bg, var(--brand-gold)); }
header.site-header .cat-link.active { color: var(--brand-terra); }
/* The hamburger bars are ink-on-cream by default — on dark nav chrome
   they must follow the nav ink or they disappear. */
header.site-header .site-topnav-toggle span {
  background: var(--brand-nav-ink, var(--brand-ink)); }
/* Popup panels (site nav dropdown, flyouts, hamburger menu) keep the
   light panel surface even on dark chrome, so their links stay ink —
   without this they inherit the header's light nav ink and vanish. */
header.site-header .drop, header.site-header .flyout {
  color: var(--brand-ink); }

/* Solid accent surfaces carry their own text colour: --brand-ink flips
   with the theme, so text on --brand-gold needs --brand-on-gold and text
   on --brand-terra needs --brand-on-accent (light themes set white; dark
   themes set their deep background colour). */
.bg-gold  { color: var(--brand-on-gold, var(--brand-ink)); }
.bg-terra { color: var(--brand-on-accent, #fff); }

/* ---- Categories: serif underlined links (deliberately distinct from tags) - */
.cat-link { font-family: var(--brand-font-display); font-size: 1.15rem; font-weight: 600;
            letter-spacing: .04em; padding: .5rem .4rem; white-space: nowrap; min-height: 44px;
            display: inline-flex; align-items: center;
            color: var(--brand-ink); border-bottom: 2px solid transparent; }
.cat-link:hover { border-color: var(--brand-gold); }
.cat-link.active { border-color: var(--brand-terra); color: var(--brand-terra); }

/* ---- Nested hover dropdown navigation ------------------------------------ */
.cat-has-drop { position: relative; }
/* Chevron that expands a parent's subcategories inline (mobile expanded
   nav only — desktop keeps the hover dropdown). */
.cat-tw { display: none; }

/* ---- Category page: breadcrumb-area subcategory browser ------------------ */
/* The current category's breadcrumb crumb doubles as the toggle (count +
   chevron) for a vertical subcategory list; entries with children expand
   inline (indented) via their own chevron. */
.subcat-crumb { font: inherit; color: var(--brand-ink); font-weight: 500;
    background: none; border: none; cursor: pointer; padding: 0; }
.subcat-crumb:hover { color: var(--brand-terradark); }
.subcat-crumb .chev { display: inline-block; transition: transform .2s ease; color: var(--brand-gold); }
.subcat-crumb[aria-expanded="true"] .chev { transform: rotate(90deg); }
.subcat-list { max-width: 26rem; border: 1px solid var(--brand-sand); border-radius: .75rem;
    background: var(--brand-panel); padding: .35rem; margin-bottom: .5rem; }
.subcat-row { display: flex; flex-wrap: wrap; align-items: center; }
.subcat-row > .cat-link { font-size: 1rem; padding: .4rem .55rem; flex: 1; min-width: 8rem; }
.subcat-tw { padding: .25rem .55rem; font-size: .75rem; color: var(--brand-gold);
    background: transparent; border: none; cursor: pointer; }
.subcat-tw .chev { display: inline-block; transition: transform .2s ease; }
.subcat-tw[aria-expanded="true"] .chev { transform: rotate(90deg); }
.subcat-kids { flex-basis: 100%; padding: .1rem .35rem .35rem 1.4rem; }
.subcat-kids > .cat-link { display: block; font-size: .95rem; padding: .3rem .55rem; }
.drop, .flyout { position: absolute; background: var(--brand-panel);
                 border: 1px solid var(--brand-sand); border-radius: .9rem;
                 box-shadow: var(--brand-drop-shadow); padding: .5rem; min-width: 13rem; z-index: 45;
                 opacity: 0; transform: translateY(6px); pointer-events: none;
                 transition: opacity .18s ease, transform .18s ease; }
.drop { top: 100%; left: 0; }
.flyout { top: -.55rem; left: calc(100% - .4rem); }
.cat-has-drop.open > .drop, .drop-item.open > .flyout {
  opacity: 1; transform: translateY(0); pointer-events: auto; }
.drop-item { position: relative; }
.drop-item > a, .flyout > a { display: block; padding: .5rem .8rem; border-radius: .6rem;
    color: var(--brand-ink); }
                              font-size: .9rem; white-space: nowrap; }
.drop-item > a:hover, .flyout > a:hover { background: var(--brand-cream); color: var(--brand-terradark); }
.drop-item.has-flyout > a::after { content: '›'; float: right; color: var(--brand-gold); margin-left: 1.5rem; }

@media (min-width: 768px) {
    .sticky-if-desktop {
        position: sticky;
    }
    /* Graceful compact collapse (see the scroll handler in base.html):
       the logo row's padding animates so the sticky header's height —
       and therefore the page below it — glides instead of jumping. The
       category nav's wrap -> nowrap part is animated from JS. */
    .site-header > div:first-child { transition: padding .18s ease; }
    /* Applied while JS measures header/nav heights: kills every
       transition so offsetHeight reads the target size, not a
       mid-animation value. */
    .measure-freeze, .measure-freeze * { transition: none !important; }
}

/* Smaller, tighter category nav spacing */
.site-nav { gap: .75rem 1.25rem; padding-bottom: .25rem; }
.site-nav .cat-link { padding: .4rem .3rem; }

/* Mobile-only expanders: hidden on desktop */
.tag-group-toggle { display: none; }
.cat-nav-toggle { display: none; }

/* Compact filter style (Settings → Shop → Filter style): one chip row;
   a facet chip pops its options down. <details>/<summary> keeps this
   keyboard-accessible and JS-free; catalog.js re-renders the same shape. */
.tag-filters-compact .tag-drop { position: relative; }
.tag-filters-compact .tag-drop > summary {
  list-style: none; cursor: pointer; user-select: none;
}
.tag-filters-compact .tag-drop > summary::-webkit-details-marker {
  display: none;
}
.tag-filters-compact .tag-drop[open] > summary {
  border-color: var(--brand-terra, #c96a3b);
}
/* Facets with an active selection: highlighted summary + count badge. */
.tag-filters-compact .tag-drop.has-active > summary {
  background: var(--brand-terra, #c96a3b);
  border-color: var(--brand-terra, #c96a3b);
  color: #fff;
}
.tag-filters-compact .tag-count {
  display: inline-block;
  margin-left: .35rem;
  padding: 0 .4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .28);
  font-size: .68rem;
  font-weight: 700;
  line-height: 1.25;
}
.tag-filters-compact .tag-drop-panel {
  position: absolute; z-index: 40; top: calc(100% + .35rem); left: 0;
  display: flex; flex-wrap: wrap; gap: .4rem; max-width: min(320px, 80vw);
  padding: .6rem; background: var(--brand-paper, #fff);
  border: 1px solid var(--brand-sand, #e4ded6); border-radius: .75rem;
  box-shadow: 0 12px 32px rgba(30, 25, 20, .18);
}

/* Desktop: collapse header to a compact single-line category bar on scroll */
@media (min-width: 768px) {
  .site-header-compact .site-logo { font-size: 1.5rem; }
  .site-header-compact > div:first-child { padding-top: .5rem; padding-bottom: .5rem; }
  .site-header-compact .site-nav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
  .site-header-compact .site-nav::-webkit-scrollbar { display: none; }
  .site-header-compact .site-nav .cat-link { font-size: 1rem; padding: .35rem .25rem; }
  /* The compact nav clips overflow children, so dropdowns are teleported to a
     fixed layer (#compact-drop-layer) via JS. Hide the in-nav original. */
  .site-header-compact .cat-has-drop > .drop { display: none !important; }
  #compact-drop-layer { position: fixed; z-index: 60; pointer-events: none; }
  #compact-drop-layer .drop {
    position: static !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    display: block !important;
  }
  #compact-drop-layer .flyout { z-index: 61; }
}

/* Mobile: edge-safe dropdowns */
@media (max-width: 767px) {
    .cat-has-drop { position: static; }
    .cat-has-drop > .drop {
        position: fixed; left: 1rem; right: 1rem; top: auto;
        max-width: none; max-height: 70vh; overflow-y: auto;
    }
    .drop-item { position: static; }
    .drop-item > .flyout {
        position: static; opacity: 1; transform: none; pointer-events: auto;
        box-shadow: none; border: none; padding-left: .75rem; min-width: auto;
        display: none;
    }
    .drop-item.open > .flyout { display: block; }
    .drop-item.has-flyout > a::after { content: '›'; transform: rotate(90deg); display: inline-block; margin-left: .5rem; }

    /* Mobile categories nav: collapsed behind a toggle, expanded on tap */
    .cat-nav-toggle { display: flex; align-items: center; justify-content: space-between;
        width: 100%; max-width: 72rem; margin: 0 auto; padding: .5rem 1rem;
        font-size: .85rem; color: var(--brand-nav-muted, var(--brand-muted)); background: transparent;
        border: none; border-top: 1px solid var(--brand-nav-border, var(--brand-sand)); cursor: pointer; }
    .cat-nav-toggle .chev { transition: transform .2s ease; }
    .site-header.nav-open .cat-nav-toggle .chev { transform: rotate(180deg); }
    /* Collapsed behind the toggle. The list is an OVERLAY panel anchored
       under the header (the header anchors it), revealed by transform +
       opacity — compositor-only, smooth in every engine (Safari tears when
       height animates inside the sticky header). The nav-open visibility
       delay keeps the closed panel pointer-proof until slide-up ends. */
    .site-header { position: relative; }
    .site-nav { position: absolute; top: 100%; left: 0; right: 0;
        display: flex !important; flex-direction: column; align-items: stretch; gap: 0;
        background: var(--brand-nav-bg, var(--brand-panel, #fff));
        border-bottom: 1px solid var(--brand-nav-border, var(--brand-sand));
        color: var(--brand-nav-ink, var(--brand-ink));
        box-shadow: 0 18px 36px rgba(38, 34, 30, .14);
        max-height: 70vh; overflow-y: auto;
        transform: translateY(-.75rem); opacity: 0; visibility: hidden;
        transition: transform .28s ease, opacity .22s ease,
                    visibility 0s linear .28s; }
    .site-header.nav-open .site-nav { transform: none; opacity: 1; visibility: visible;
        transition: transform .28s ease, opacity .22s ease; }

    /* Expanded list: full-width vertical rows; each parent has a chevron
       that reveals its subcategories indented beneath it (sub-subcategories
       expand the same way via .drop-item rules above). */
    .site-header.nav-open .site-nav > .cat-link,
    .site-header.nav-open .cat-has-drop { padding: .15rem 0; }
    .site-header.nav-open .cat-has-drop > a { display: inline; }
    .site-header.nav-open .cat-has-drop > .cat-tw {
        display: inline-flex; align-items: center; margin-left: .35rem;
        padding: .15rem .45rem; font-size: .8rem; color: var(--brand-gold);
        background: transparent; border: none; cursor: pointer; }
    .site-header.nav-open .cat-has-drop > .cat-tw .chev { display: inline-block; transition: transform .2s ease; }
    .site-header.nav-open .cat-has-drop.open > .cat-tw .chev { transform: rotate(90deg); }
    .site-header.nav-open .cat-has-drop > .drop {
        position: static; left: auto; right: auto; max-width: none; max-height: none;
        overflow: visible; display: none; box-shadow: none; border: none;
        padding: .15rem 0 .15rem 1.1rem; background: transparent; }
    .site-header.nav-open .cat-has-drop.open > .drop { display: block; }
    .site-header.nav-open .drop-item > a { padding: .35rem .5rem; }
    .site-header.nav-open .drop-item.has-flyout > a::after { margin-left: .6rem; }
    /* The expanded overlay may be dark nav chrome while the dropdown rows
       stay transparent — their links follow the nav colours then. */
    .site-header.nav-open .site-nav .drop-item > a,
    .site-header.nav-open .site-nav .flyout > a {
        color: var(--brand-nav-ink, var(--brand-ink)); }
    .site-header.nav-open .site-nav .drop-item > a:hover,
    .site-header.nav-open .site-nav .flyout > a:hover {
        background: var(--brand-nav-hover-bg, var(--brand-cream));
        color: var(--brand-nav-ink, var(--brand-terradark)); }

    /* Mobile tag filters: each group collapses independently */
    .tag-group.m-collapsed .chip-idle { display: none; }
    .tag-group.m-has-idle .tag-group-toggle { display: inline; }
    .tag-group-toggle { font-size: .75rem; color: var(--brand-terra); background: transparent;
        border: none; padding: .2rem .3rem; cursor: pointer;
        text-decoration: underline; text-underline-offset: 2px; }
}

/* ---- Wishlist "added" feedback: pop animation on badges and summary chips -- */
@keyframes wl-pop {
    0%   { transform: scale(.5); opacity: 0; }
    60%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}
.wl-pop { animation: wl-pop .35s ease-out; }

.site-topnav {
    /* Not sticky on purpose: when scrolling, the shop's own .site-header
       (search, wishlist, categories) takes over as the sticky bar. */
    position: relative;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--brand-sand-deep);
    padding: .25rem 4vw;
}
/* Popup menu (toggled by JS) */
.site-topnav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    z-index: 70;   /* above the category dropdowns (45/60) inside the header */
    min-width: 220px;
    flex-direction: column;
    background: var(--brand-panel, #fff);
    border: 1px solid var(--brand-sand-deep);
    border-radius: .75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    padding: .4rem;
}

.catalog-date-pop {
    position: absolute;
    top: calc(100% + .5rem);
    left: 0;
    z-index: 55;
    width: min(20rem, calc(100vw - 2rem));
    padding: .5rem;
    background: var(--brand-panel);
    border: 1px solid var(--brand-sand);
    border-radius: .75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.catalog-date-pop .vp-cal { width: 100%; max-width: 100%; }
@media (max-width: 767px) {
    .catalog-date-pop {
        position: fixed;
        left: 1rem;
        right: 1rem;
        top: 4.5rem;
        width: auto;
        max-height: calc(100vh - 6rem);
        overflow: auto;
    }
}

/* ---- Inline-style migration utilities (shop) ------------------------------ */
.img-aspect { aspect-ratio: var(--brand-img-aspect); }
.u-gap-verify { column-gap: 2.5rem; row-gap: .75rem; }
.cal-day.off-pick { cursor: pointer; }
.cal-day.off-pick:hover { outline: 2px dashed var(--brand-terra); outline-offset: -2px; }
/* "white panel" utility routed through the panel token: every light theme's
   panel IS white (no visual change there), and dark themes stop leaking
   raw white surfaces through templates that use the utility. */
.bg-white { background-color: var(--brand-panel, #fff); }
/* ---- Inline-style migration utilities (were style="..." attributes) ------- */
.demo-staff-pill { background: var(--brand-terra); color: var(--brand-on-accent, #fff); }
.deposit-refund { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand-ok, #166534) 45%, transparent); }
.deposit-refund-title { color: var(--brand-ok, #166534); }
.deposit-refund-text { color: color-mix(in srgb, var(--brand-ok, #166534) 80%, var(--brand-ink, #222)); }

/* Inline sprite icons (copy/check on the customer booking page): tailwind's
   preflight makes svg a block element, which would drop the icon onto its
   own line inside inline labels — keep icon + text together. */
.navicon { width: 1rem; height: 1rem; display: inline-block;
           vertical-align: -.15em; }
