/* =============================================================================
   COOKIE CONSENT BANNER
   Scoped to .store-cookie-bar — all rules prefixed store-cookie-
   z-index 400: above sticky ATC (300) and mobile nav (200), below drawers (9998+)
   ============================================================================= */

/* --- Bar wrapper ----------------------------------------------------------- */

.store-cookie-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 400;
  background: var(--color-charcoal);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  /* Slide-up reveal — driven by .is-visible class */
  transform: translateY(100%);
  transition: transform 350ms ease;
  /* Safe-area padding for notched/home-bar phones */
  padding-block-end: max(clamp(1rem, 3vw, 1.5rem), env(safe-area-inset-bottom));
}

.store-cookie-bar.is-visible {
  transform: translateY(0);
}

/* --- Inner layout ---------------------------------------------------------- */
/* Mobile-first: single column (text above, buttons below) */

.store-cookie-bar__inner {
  max-width: min(var(--container-max, 1440px), 100%);
  margin-inline: auto;
  padding: clamp(1rem, 3vw, 1.5rem) var(--gutter, clamp(1rem, 4vw, 3rem));
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .store-cookie-bar__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: clamp(1.5rem, 3vw, 3rem);
  }
}

/* --- Text block ------------------------------------------------------------ */

.store-cookie-bar__text {
  flex: 1;
}

.store-cookie-bar__title {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
  color: var(--color-white);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.25rem;
}

.store-cookie-bar__desc {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
  line-height: 1.5;
}

.store-cookie-bar__desc a {
  color: var(--color-gold);
  text-underline-offset: 3px;
}

.store-cookie-bar__desc a:hover {
  color: var(--color-gold-dark);
}

/* --- Action buttons -------------------------------------------------------- */

.store-cookie-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  flex-shrink: 0;
}

/* Astra resets — Astra injects border/box-shadow onto all <button> elements */
.store-cookie-bar__actions .store-btn-primary,
.store-cookie-bar__actions .store-btn-ghost {
  border-radius: 2px !important; /* override Astra's border-radius reset */
  box-shadow: none !important;   /* override Astra's button box-shadow */
}

/* Ghost button on dark background: override the default charcoal color */
.store-cookie-bar__actions .store-btn-ghost {
  color: rgba(255, 255, 255, 0.75);
}

.store-cookie-bar__actions .store-btn-ghost:hover,
.store-cookie-bar__actions .store-btn-ghost:focus-visible {
  color: var(--color-gold-light); /* !important not needed — scoped selector wins */
}

/* --- Expandable preferences panel ----------------------------------------- */

.store-cookie-prefs {
  overflow: hidden;
  max-height: 0;
  /* max-height animation via JS — toggled with inline style or class */
  transition: max-height 350ms ease, opacity 350ms ease;
  opacity: 0;
  border-top: 0 solid rgba(255, 255, 255, 0.1);
}

.store-cookie-prefs.is-open {
  max-height: 400px; /* large enough for 3 toggles */
  opacity: 1;
  border-top-width: 1px;
  padding-top: 1rem;
}

.store-cookie-prefs__list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

/* --- Individual toggle row ------------------------------------------------- */

.store-cookie-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.store-cookie-toggle__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.store-cookie-toggle__name {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
  color: var(--color-white);
}

.store-cookie-toggle__desc {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.4;
}

/* Toggle switch visual */
.store-cookie-toggle__switch-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.store-cookie-toggle__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.store-cookie-toggle__track {
  display: inline-block;
  position: relative;
  width: 2.75rem;   /* 44px */
  height: 1.5rem;   /* 24px */
  border-radius: 999px;
  background: var(--color-light-gray);
  transition: background 200ms ease;
  cursor: pointer;
}

.store-cookie-toggle__track::after {
  content: '';
  position: absolute;
  top: 0.1875rem;  /* 3px */
  left: 0.1875rem;
  width: 1.125rem; /* 18px */
  height: 1.125rem;
  border-radius: 50%;
  background: var(--color-white);
  transition: transform 200ms ease;
}

.store-cookie-toggle__input:checked + .store-cookie-toggle__track {
  background: var(--color-gold);
}

.store-cookie-toggle__input:checked + .store-cookie-toggle__track::after {
  transform: translateX(1.25rem); /* 20px */
}

/* Disabled (Necessary) state */
.store-cookie-toggle__input:disabled + .store-cookie-toggle__track {
  background: var(--color-gold);
  opacity: 0.6;
  cursor: not-allowed;
}

/* Focus ring on the track when input is focused */
.store-cookie-toggle__input:focus-visible + .store-cookie-toggle__track {
  outline: 2px solid var(--color-gold);
  outline-offset: 3px;
}

/* --- Save preferences button ----------------------------------------------- */

.store-cookie-prefs__footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.75rem;
}

/* --- Reduced-motion: replace transform with opacity ----------------------- */

@media (prefers-reduced-motion: reduce) {
  .store-cookie-bar {
    transform: none;
    opacity: 0;
    transition: opacity 350ms ease;
  }

  .store-cookie-bar.is-visible {
    transform: none;
    opacity: 1;
  }

  .store-cookie-prefs {
    transition: opacity 350ms ease;
  }

  .store-cookie-toggle__track,
  .store-cookie-toggle__track::after {
    transition: none;
  }
}
