/* ==========================================================================
   My Zawar — base stylesheet
   Element defaults and page behaviour.
   Component classes live in components.css; utility classes come from Tailwind.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   theme.json is the source of truth — it emits --wp--preset--* custom
   properties. These aliases keep the shorthand names every rule below already
   uses, so changing a colour in the Site Editor flows through this file with
   no edits here.
   -------------------------------------------------------------------------- */
:root {
  /* Wine / oxblood — primary */
  --wine-50:  var(--wp--preset--color--wine-50);
  --wine-100: var(--wp--preset--color--wine-100);
  --wine-200: var(--wp--preset--color--wine-200);
  --wine-300: var(--wp--preset--color--wine-300);
  --wine-400: var(--wp--preset--color--wine-400);
  --wine-500: var(--wp--preset--color--wine-500);
  --wine-600: var(--wp--preset--color--wine-600);
  --wine-700: var(--wp--preset--color--wine-700);
  --wine-800: var(--wp--preset--color--wine-800);
  --wine-900: var(--wp--preset--color--wine-900);
  --wine-950: var(--wp--preset--color--wine-950);

  /* Gold — accent */
  --gold-50:  var(--wp--preset--color--gold-50);
  --gold-100: var(--wp--preset--color--gold-100);
  --gold-200: var(--wp--preset--color--gold-200);
  --gold-300: var(--wp--preset--color--gold-300);
  --gold-400: var(--wp--preset--color--gold-400);
  --gold-500: var(--wp--preset--color--gold-500);
  --gold-600: var(--wp--preset--color--gold-600);
  --gold-700: var(--wp--preset--color--gold-700);
  --gold-800: var(--wp--preset--color--gold-800);

  /* Ivory — surfaces */
  --ivory-50:  var(--wp--preset--color--ivory-50);
  --ivory-100: var(--wp--preset--color--ivory-100);
  --ivory-200: var(--wp--preset--color--ivory-200);
  --ivory-300: var(--wp--preset--color--ivory-300);
  --ivory-400: var(--wp--preset--color--ivory-400);
  --ivory-500: var(--wp--preset--color--ivory-500);

  /* Ink — text */
  --ink-300: var(--wp--preset--color--ink-300);
  --ink-400: var(--wp--preset--color--ink-400);
  --ink-500: var(--wp--preset--color--ink-500);
  --ink-600: var(--wp--preset--color--ink-600);
  --ink-700: var(--wp--preset--color--ink-700);
  --ink-800: var(--wp--preset--color--ink-800);
  --ink-900: var(--wp--preset--color--ink-900);

  /* Lines & surfaces */
  --surface:     var(--wp--preset--color--surface);
  --hairline:    var(--wp--preset--color--hairline);
  --line-strong: var(--wp--preset--color--line-strong);

  /* Typefaces */
  --font-serif: var(--wp--preset--font-family--serif);
  --font-sans:  var(--wp--preset--font-family--sans);

  /* Motion — not expressible in theme.json, kept literal */
  --ease-silk: cubic-bezier(.22, 1, .36, 1);
  --ease-std:  cubic-bezier(.4, 0, .2, 1);
  --dur-fast:  180ms;
  --dur-base:  300ms;
  --dur-image: 700ms;

  /* Elevation */
  --shadow-sm: var(--wp--preset--shadow--sm);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* Background, colour, family, size and line-height come from theme.json.
   Only the properties it cannot express are declared here. */
body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* clip (not hidden) so the sticky header keeps working */
  overflow-x: clip;
}

::selection {
  background: var(--gold-200);
  color: var(--wine-900);
}

/* --------------------------------------------------------------------------
   3. Focus
   Baseline gold focus ring. Utilities that declare their own ring outrank this
   (0,2,0 vs 0,1,1), so nothing interactive is ever left without an indicator.
   -------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   4. Scrollbars
   -------------------------------------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ivory-200); }
::-webkit-scrollbar-thumb { background: var(--ivory-500); }
::-webkit-scrollbar-thumb:hover { background: var(--gold-400); }

.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* --------------------------------------------------------------------------
   5. Scroll reveal
   -------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .8s var(--ease-silk), transform .8s var(--ease-silk);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   6. Sticky header
   -------------------------------------------------------------------------- */
#siteHeader {
  transition: background-color var(--dur-base) var(--ease-silk),
              box-shadow var(--dur-base) var(--ease-silk);
}
#siteHeader .header-inner {
  height: 64px;
  transition: height var(--dur-base) var(--ease-silk);
}
#siteHeader.is-stuck {
  background-color: rgba(252, 248, 245, .92);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}
@media (min-width: 1024px) {
  #siteHeader .header-inner { height: 96px; }
  #siteHeader.is-stuck .header-inner { height: 68px; }
}

/* The admin bar is fixed at the top for logged-in users, so the sticky header
   has to start below it or it hides underneath. */
body.admin-bar #siteHeader { top: 46px; }

@media (min-width: 783px) {
  body.admin-bar #siteHeader { top: 32px; }
}

/* Drawers are fixed to the viewport and need the same treatment. Only the ones
   pinned to the top move; a full-height side drawer already clears the bar. */
body.admin-bar .mz-panel--top { top: 46px; }

@media (min-width: 783px) {
  body.admin-bar .mz-panel--top { top: 32px; }
}

body.admin-bar .mz-panel--left,
body.admin-bar .mz-panel--right {
  top: 46px;
  height: calc(100% - 46px);
}

@media (min-width: 783px) {
  body.admin-bar .mz-panel--left,
  body.admin-bar .mz-panel--right {
    top: 32px;
    height: calc(100% - 32px);
  }
}

/* --------------------------------------------------------------------------
   7. Nav underline
   -------------------------------------------------------------------------- */
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  height: 1.5px;
  width: 0;
  background: var(--gold-500);
  transition: width var(--dur-base) var(--ease-silk);
}
.nav-link:hover::after,
.nav-link:focus-visible::after,
.nav-link[aria-current="page"]::after { width: 100%; }

/* --------------------------------------------------------------------------
   8. Mega menu
   -------------------------------------------------------------------------- */
.mega,
.mz-mega {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .25s var(--ease-silk),
              transform .25s var(--ease-silk),
              visibility .25s;
}
.mega.is-open,
.mz-mega.is-open { opacity: 1; visibility: visible; transform: none; }

/* --------------------------------------------------------------------------
   9. Marquee
   -------------------------------------------------------------------------- */
.marquee-track {
  display: flex;
  width: max-content;
  will-change: transform;
}
.marquee:hover .marquee-track { animation-play-state: paused; }

/* Left → right scroll (mirrors Tailwind animate-marquee; kept here so it always runs) */
@keyframes mz-marquee-ltr {
  from { transform: translateX(-50%); }
  to   { transform: translateX(0); }
}
.marquee-track.animate-marquee {
  animation: mz-marquee-ltr 34s linear infinite;
}

/* --------------------------------------------------------------------------
   10. Scrims
   Hand-tuned stops so ivory text clears AA over the brightest product
   photography, and so the promo photo has no hard seam where it meets wine.
   -------------------------------------------------------------------------- */
.tile-scrim,
.tile-scrim-lg,
.promo-scrim { position: absolute; inset: 0; }

.tile-scrim {
  background-image: linear-gradient(to top,
    rgba(34, 6, 12, .94) 0%, rgba(34, 6, 12, .78) 26%,
    rgba(34, 6, 12, .34) 54%, rgba(34, 6, 12, 0) 82%);
}
.tile-scrim-lg {
  background-image: linear-gradient(to top,
    rgba(34, 6, 12, .92) 0%, rgba(34, 6, 12, .62) 32%,
    rgba(34, 6, 12, .20) 62%, rgba(34, 6, 12, 0) 86%);
}
.promo-scrim {
  background-image: linear-gradient(270deg,
    rgba(51, 14, 22, 0) 0%, rgba(51, 14, 22, .45) 26%, #330E16 46%);
}

/* --------------------------------------------------------------------------
   11. Gold corner brackets (bento tiles)
   -------------------------------------------------------------------------- */
.bracket::before,
.bracket::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  opacity: 0;
  transition: opacity .4s var(--ease-silk), transform .4s var(--ease-silk);
}
.bracket::before {
  top: 14px; left: 14px;
  border-top: 1px solid var(--gold-400);
  border-left: 1px solid var(--gold-400);
  transform: translate(6px, 6px);
}
.bracket::after {
  bottom: 14px; right: 14px;
  border-bottom: 1px solid var(--gold-400);
  border-right: 1px solid var(--gold-400);
  transform: translate(-6px, -6px);
}
.group:hover .bracket::before,
.group:hover .bracket::after,
.group:focus-within .bracket::before,
.group:focus-within .bracket::after { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   12. Drawers & overlays
   -------------------------------------------------------------------------- */
.panel { transition: transform .5s var(--ease-silk); }
.backdrop { transition: opacity .4s var(--ease-silk), visibility .4s; }
.backdrop.is-open { opacity: 1; visibility: visible; }

/* Block-editor drawers. The Site Editor strips data-* attributes from a Group
   block, so panels are keyed on a class instead; .mz-panel--left/right/top say
   which edge the drawer slides in from. */
.mz-panel {
  transition: transform .5s var(--ease-silk), visibility .5s;
}

.mz-panel.is-open {
  transform: none;
  visibility: visible;
}

/* --------------------------------------------------------------------------
   13. Details / summary
   -------------------------------------------------------------------------- */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
/* Footer columns sit on wine, so they need the light-on-dark summary, and they
   only behave as accordions below md — above it the toggle is inert and the
   marker is hidden. */
.mz-footer-col > summary {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-300);
}

.mz-footer-col > summary::after { color: var(--gold-400); }

@media (min-width: 768px) {
  .mz-footer-col > summary { pointer-events: none; cursor: default; }
  .mz-footer-col > summary::after { display: none; }
}

/* --------------------------------------------------------------------------
   14. Back to top
   -------------------------------------------------------------------------- */
[data-to-top].is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   15. Helpers
   -------------------------------------------------------------------------- */
.shimmer { position: relative; overflow: hidden; }
.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(194, 160, 92, .14), transparent);
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

.vertical-text { writing-mode: vertical-rl; text-orientation: mixed; }

/* Expands a small control's hit area to 44px without changing how it looks */
.tap-44 { position: relative; }
.tap-44::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

/* --------------------------------------------------------------------------
   16. Filter sidebar (PLP)
   -------------------------------------------------------------------------- */
.filter-acc > summary { list-style: none; }
.filter-acc > summary::-webkit-details-marker { display: none; }

/* Plus collapses to a minus when the group is open */
.filter-icon-bar {
  transform-origin: center;
  transition: opacity var(--dur-base) var(--ease-silk),
              transform var(--dur-base) var(--ease-silk);
}
.filter-acc[open] > summary .filter-icon-bar {
  opacity: 0;
  transform: rotate(90deg);
}

.filter-check:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFDFB' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m20 6-11 11-5-5'/%3E%3C/svg%3E");
  background-size: 12px 12px;
  background-position: center;
  background-repeat: no-repeat;
}

/* Two range inputs stacked over one drawn track. The track is inset by half a
   thumb (see .inset-x-2 in the markup) so the fill lines up with the handles. */
.price-thumb {
  pointer-events: none;
  z-index: 2;
  margin: 0;
}
.price-thumb:focus-visible { outline: none; }
.price-thumb:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(194, 160, 92, .45);
}
.price-thumb:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px rgba(194, 160, 92, .45);
}
.price-thumb::-webkit-slider-thumb {
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--wine-700);
  border: 2px solid var(--ivory-50);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.price-thumb::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--wine-700);
  border: 2px solid var(--ivory-50);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.price-thumb::-webkit-slider-runnable-track { background: transparent; height: 6px; }
.price-thumb::-moz-range-track { background: transparent; height: 6px; }

/* --------------------------------------------------------------------------
   18. Product detail (PDP)
   -------------------------------------------------------------------------- */
.gallery-thumb.is-active {
  box-shadow: 0 0 0 2px var(--wine-700);
}
.gallery-thumb img { transition: opacity var(--dur-base) var(--ease-silk); }
.gallery-thumb:not(.is-active) img { opacity: .72; }
.gallery-thumb:hover img,
.gallery-thumb:focus-visible img { opacity: 1; }

.gallery-stage { cursor: zoom-in; }
.gallery-stage.is-zooming { cursor: crosshair; }
.gallery-stage.is-zooming [data-gallery-main] {
  /* Inline transition:none is set by JS; this backs it up if a utility fights back */
  transition: none !important;
}
/* Keep the zoom lens above the badge while hovering; the zoom button stays clickable */
.gallery-stage.is-zooming .badge { pointer-events: none; }

.swatch {
  display: grid;
  place-items: center;
  height: 44px;
  width: 44px;
  border: 1px solid transparent;
  transition: border-color var(--dur-base) var(--ease-silk),
              box-shadow var(--dur-base) var(--ease-silk);
}
.swatch:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(194, 160, 92, .4);
}
.swatch.is-active {
  border-color: var(--wine-700);
  box-shadow: 0 0 0 1px var(--wine-700);
}
.swatch-disc {
  display: block;
  height: 28px;
  width: 28px;
  border-radius: 9999px;
  border: 1px solid rgba(46, 11, 19, .12);
}

.lightbox-dot {
  height: 8px;
  width: 8px;
  border-radius: 9999px;
  background: rgba(255, 253, 251, .35);
  transition: background-color var(--dur-fast) var(--ease-std),
              transform var(--dur-fast) var(--ease-std);
}
.lightbox-dot.is-active {
  background: var(--gold-500);
  transform: scale(1.25);
}
.lightbox-dot:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 3px;
}

#sizeGuide {
  transition: opacity .4s var(--ease-silk), visibility .4s;
}
#sizeGuide > div {
  transform: translateY(12px);
  transition: transform .45s var(--ease-silk);
}
#sizeGuide.opacity-100 > div { transform: none; }
@media (min-width: 640px) {
  #sizeGuide > div { transform: translateY(8px) scale(.98); }
  #sizeGuide.opacity-100 > div { transform: none; }
}

#lightbox {
  transition: opacity .35s var(--ease-silk), visibility .35s;
}

/* --------------------------------------------------------------------------
   17. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  /* Keep the assurance marquee moving; hover still pauses it */
  .marquee-track.animate-marquee {
    animation: mz-marquee-ltr 34s linear infinite !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
