/* Enhancement layer: performance, responsive, SEO/UX microinteractions.
   Loaded after the reference CSS so it can adapt without replacing the design. */

:root {
  --enh-ink: var(--white-ink, #24231f);
  --enh-muted: var(--white-muted, #77746a);
  --enh-line: var(--white-line, #dcd9d1);
  --enh-bg: var(--white-card-bg, #faf9f5);
  --enh-ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- Smooth scrolling ---------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}
body { -webkit-tap-highlight-color: transparent; }
a, button, input, summary { touch-action: manipulation; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Responsive / multi-resolution ---------- */
img, picture, video, canvas, svg { max-width: 100%; }
img[loading="lazy"] { content-visibility: auto; }
img[fetchpriority="high"] { content-visibility: visible; }

.storefront-footer { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }

@media (max-width: 380px) {
  .storefront-header { gap: 8px; }
  .storefront-nav { gap: 10px; font-size: 12px; }
  .storefront-header-actions { gap: 6px; }
  .storefront-header-actions button { padding: 7px 9px; font-size: 11px; }
  .storefront-header-actions button span { display: none; }
}
@media (min-width: 1600px) {
  .white-home, .storefront-shell > main, .storefront-shell > div { max-width: 1440px; margin-inline: auto; }
}
@media (hover: none) {
  .white-product-card:hover { transform: none !important; }
}

/* ---------- Language switch (existing header control) ---------- */
.white-language-switch {
  white-space: nowrap;
  cursor: pointer;
}
.white-language-switch:focus-visible,
.enh-top:focus-visible,
.enh-pagination button:focus-visible,
.enh-keywords a:focus-visible,
.enh-faq summary:focus-visible {
  outline: 2px solid var(--enh-ink);
  outline-offset: 3px;
}

/* ---------- Reveal on scroll (only when JS is active) ---------- */
.enh-ready .white-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .65s var(--enh-ease), transform .65s var(--enh-ease);
}
.enh-ready .white-reveal.in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .enh-ready .white-reveal { opacity: 1; transform: none; }
}

/* ---------- Microinteractions ---------- */
.white-product-card {
  transition: transform .28s var(--enh-ease), box-shadow .28s var(--enh-ease), opacity .22s ease;
  will-change: transform;
}
@media (hover: hover) {
  .white-product-card:hover { transform: translateY(-5px); box-shadow: 0 18px 40px -28px rgba(0, 0, 0, .45); }
}
.white-product-card.is-hidden { display: none !important; }
.white-product-card.is-entering { animation: enh-card-in .4s var(--enh-ease) both; }
@keyframes enh-card-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

button, .white-button, .white-jelly-chip { position: relative; overflow: hidden; }
.enh-ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: .16;
  transform: scale(0);
  pointer-events: none;
  animation: enh-ripple .55s ease-out forwards;
}
@keyframes enh-ripple { to { transform: scale(2.6); opacity: 0; } }

.toast { z-index: 10010; }

/* ---------- Scroll progress ---------- */
.enh-progress {
  position: fixed;
  inset: 0 auto auto 0;
  height: 3px;
  width: 0;
  z-index: 10005;
  pointer-events: none;
  background: linear-gradient(90deg, #24231f, #a8a294);
  transition: width .08s linear;
}

/* ---------- Back to top ---------- */
.enh-top {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 10004;
  width: 44px;
  height: 44px;
  border: 1px solid var(--enh-line);
  border-radius: 50%;
  background: rgba(250, 249, 245, .92);
  backdrop-filter: blur(10px);
  color: var(--enh-ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s var(--enh-ease), background .2s;
  box-shadow: 0 10px 30px -20px rgba(0, 0, 0, .6);
}
.enh-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.enh-top:hover { background: #fff; transform: translateY(-3px); }

/* ---------- AJAX search suggestions / intent clusters ---------- */
.enh-search-wrap { position: relative; }
.enh-suggest {
  position: absolute;
  z-index: 10003;
  top: calc(100% + 10px);
  right: 0;
  width: min(420px, calc(100vw - 32px));
  max-height: min(70vh, 460px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--enh-line);
  border-radius: 12px;
  background: rgba(252, 251, 248, .97);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px -28px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s var(--enh-ease);
}
.enh-suggest.is-open { opacity: 1; transform: none; pointer-events: auto; }
.enh-suggest__head {
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--enh-muted);
  padding: 2px 6px 8px;
}
.enh-suggest__cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 6px 10px;
}
.enh-suggest__cluster button {
  border: 1px solid var(--enh-line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font: inherit;
  font-size: 11px;
  color: var(--enh-ink);
  cursor: pointer;
}
.enh-suggest__cluster button:hover { border-color: var(--enh-ink); }
.enh-suggest__group + .enh-suggest__group { margin-top: 10px; }
.enh-suggest__label {
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--enh-muted);
  padding: 6px 6px 4px;
  border-top: 1px solid var(--enh-line);
}
.enh-suggest__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--enh-ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.enh-suggest__item:hover, .enh-suggest__item:focus-visible { background: rgba(0, 0, 0, .05); }
.enh-suggest__item small { color: var(--enh-muted); font-size: 11px; white-space: nowrap; }
.enh-suggest__empty { padding: 14px 8px; font-size: 12px; color: var(--enh-muted); }
.enh-suggest__loading { padding: 14px 8px; font-size: 12px; color: var(--enh-muted); }
.enh-suggest__loading::after { content: '…'; animation: enh-blink 1s steps(2) infinite; }
@keyframes enh-blink { 50% { opacity: .25; } }

/* ---------- Pagination ---------- */
.enh-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 30px 0 8px;
}
.enh-pagination button {
  min-width: 38px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--enh-line);
  border-radius: 999px;
  background: transparent;
  color: var(--enh-ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.enh-pagination button:hover { border-color: var(--enh-ink); transform: translateY(-2px); }
.enh-pagination button[aria-current="page"] { background: var(--enh-ink); border-color: var(--enh-ink); color: var(--enh-bg); }
.enh-pagination button:disabled { opacity: .35; cursor: default; transform: none; }
.enh-pagination__info { width: 100%; text-align: center; font-size: 11px; color: var(--enh-muted); }

/* ---------- SEO footer: organic keywords + AEO FAQ ---------- */
.enhance-seo-footer {
  border-top: 1px solid var(--enh-line);
  margin-top: 28px;
  padding-top: 22px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--enh-muted);
}
.enh-keywords strong,
.enh-faq summary { color: var(--enh-ink); font-weight: 600; }
.enh-keywords { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 12px; }
.enh-keywords a {
  color: var(--enh-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.enh-keywords a:hover { color: var(--enh-ink); border-bottom-color: currentColor; }
.enh-faq { margin-top: 14px; }
.enh-faq summary { cursor: pointer; list-style: none; }
.enh-faq summary::-webkit-details-marker { display: none; }
.enh-faq summary::after { content: ' +'; font-weight: 400; }
.enh-faq[open] summary::after { content: ' −'; }
.enh-faq__body { padding-top: 8px; display: grid; gap: 8px; }
.enh-faq__item h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--enh-ink); }
.enh-faq__item p { margin: 2px 0 0; }
.enh-footer-note { margin-top: 14px; font-size: 11px; }

/* ---------- Exit intent popup ---------- */
.enh-exit {
  position: fixed;
  inset: 0;
  z-index: 10009;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 20, 18, .42);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
}
.enh-exit.is-open { opacity: 1; pointer-events: auto; }
.enh-exit__card {
  position: relative;
  width: min(440px, 100%);
  padding: 34px 30px 28px;
  border: 1px solid var(--enh-line);
  border-radius: 16px;
  background: var(--enh-bg);
  box-shadow: 0 30px 90px -35px rgba(0, 0, 0, .7);
  transform: translateY(18px) scale(.98);
  transition: transform .32s var(--enh-ease);
}
.enh-exit.is-open .enh-exit__card { transform: none; }
.enh-exit__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--enh-muted);
  font-size: 20px;
  cursor: pointer;
}
.enh-exit__close:hover { background: rgba(0, 0, 0, .06); }
.enh-exit__eyebrow { font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--enh-muted); }
.enh-exit__card h2 {
  margin: 10px 0 10px;
  font-family: var(--white-serif, Georgia, serif);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -.03em;
  color: var(--enh-ink);
}
.enh-exit__card p { font-size: 13px; line-height: 1.8; color: var(--enh-muted); }
.enh-exit__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.enh-exit__actions a,
.enh-exit__actions button {
  flex: 1 1 auto;
  text-align: center;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--enh-ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}
.enh-exit__primary { background: var(--enh-ink); color: var(--enh-bg); }
.enh-exit__secondary { background: transparent; color: var(--enh-ink); }

/* ---------- Toast fallback (when legacy UI is absent) ---------- */
.enh-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 10011;
  transform: translate(-50%, 14px);
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--enh-ink);
  color: var(--enh-bg);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.enh-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
