/* ==========================================================================
   Blissporium Design System — Reset & Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* The browser's own [hidden] { display: none } rule lives in the
   user-agent stylesheet, which loses to ANY normal-weight author rule
   regardless of specificity (origin precedence beats specificity
   between stylesheets) — so any element this reset (or any later
   component rule) gives its own `display` value stops responding to
   the `hidden` attribute entirely. Restated once, globally, so
   `el.hidden = true` always works everywhere without needing a
   `.foo[hidden] { display: none }` override added by hand every time
   a new component happens to hit this — this exact bug has already
   surfaced independently on several unrelated elements. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem; /* keep anchored sections clear of sticky header */
  /* The real fix for off-canvas fixed-position drawers (mini-cart, filter
     drawer, mobile nav) inflating document.scrollWidth even while
     translated out of view: overflow-x:hidden on body alone doesn't clip
     position:fixed descendants, since they're positioned against the
     viewport/initial containing block, not body's own box — html is the
     element that actually governs viewport-level scrollWidth. */
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

fieldset {
  border: none;
}

/* Focus visibility — accessible, on-brand */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Text selection */
::selection {
  background-color: var(--color-primary);
  color: var(--color-text);
}

/* Scrollbar (WebKit) — subtle, warm */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-background);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-background);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

/* Reduced motion — respect user preference globally */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Screen-reader-only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-tooltip);
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}
