/* ==========================================================================
   DandRX D2C Homepage Redesign — Custom Stylesheet
   Monochrome Luxury Clinical Aesthetic (Inspired by Rite Skincare)
   ========================================================================== */

:root {
  --bg-white: #ffffff;
  --bg-soft: #f4f4f5;
  --bg-black: #0a0a0a;
  --ink-primary: #09090b;
  --ink-muted: #52525b;
  --border-light: #e4e4e7;
  --border-dark: #27272a;
  --header-height: 68px;
  interpolate-size: allow-keywords;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 28px);
  overflow-x: clip;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink-primary);
  background-color: var(--bg-white);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.font-mono-label {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Typography wrapping per modern-web-guidance */
h1,
h2,
h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* Accessible Visually Hidden Utility */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* Focus Indicators (WCAG 2.4.7 / 1.4.11) */
:where(a, button, summary, input, select, [tabindex="0"]):focus-visible {
  outline: 2px solid #09090b;
  outline-offset: 2px;
}

.dark-surface :where(a, button, summary, input, select):focus-visible,
footer :where(a, button, input):focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* ==========================================================================
   Announcement Bar Slide & Fade Transition
   ========================================================================== */
.announcement-content {
  transition: transform 450ms cubic-bezier(0.22, 1, 0.36, 1), opacity 450ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
}

.announcement-content.is-leaving-left {
  opacity: 0;
  transform: translateX(-28px);
  transition-duration: 180ms;
}

.announcement-content.is-leaving-right {
  opacity: 0;
  transform: translateX(28px);
  transition-duration: 180ms;
}

.announcement-content.is-entering-from-right {
  opacity: 0;
  transform: translateX(28px);
  transition: none;
}

.announcement-content.is-entering-from-left {
  opacity: 0;
  transform: translateX(-28px);
  transition: none;
}

/* ==========================================================================
   Sticky Glassmorphic Header (Rite Skincare Signature)
   ========================================================================== */
.site-header {
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid rgba(9, 9, 11, 0.08);
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.9);
  border-bottom-color: rgba(9, 9, 11, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   Infinite Monochrome Marquee
   ========================================================================== */
.marquee-wrapper {
  display: flex;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}

.marquee-track {
  display: flex;
  flex-shrink: 0;
  width: max-content;
  will-change: transform;
  animation: marquee-left 28s linear infinite;
}

.marquee-wrapper:hover .marquee-track,
.marquee-wrapper:focus-within .marquee-track,
.marquee-wrapper.is-paused .marquee-track {
  animation-play-state: paused;
}

@keyframes marquee-left {
  0% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* ==========================================================================
   Native <details> Smooth Accordion Transitions
   ========================================================================== */
details.dandrx-accordion > summary {
  list-style: none;
  cursor: pointer;
}

details.dandrx-accordion > summary::-webkit-details-marker {
  display: none;
}

details.dandrx-accordion .accordion-icon {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

details.dandrx-accordion[open] .accordion-icon {
  transform: rotate(45deg);
}

@media (prefers-reduced-motion: no-preference) {
  details.dandrx-accordion::details-content {
    overflow: clip;
    contain: layout;
    transition: block-size 0.3s ease, content-visibility 0.3s allow-discrete;
  }

  details.dandrx-accordion:not([open])::details-content {
    block-size: 0;
  }

  details.dandrx-accordion[open]::details-content {
    block-size: auto;
  }
}

/* ==========================================================================
   Clinical Trial Progress Bars
   ========================================================================== */
.clinical-bar-fill {
  width: 0%;
  transition: width 1.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: width;
}

.clinical-bars .clinical-bar-row:nth-child(1) .clinical-bar-fill {
  transition-delay: 0ms;
}

.clinical-bars .clinical-bar-row:nth-child(2) .clinical-bar-fill {
  transition-delay: 180ms;
}

.clinical-bars .clinical-bar-row:nth-child(3) .clinical-bar-fill {
  transition-delay: 360ms;
}

/* ==========================================================================
   Product Buy Box Option & Offer States
   ========================================================================== */
.option-card {
  transition: border-color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.option-card[aria-pressed="true"] {
  border-color: #09090b;
  box-shadow: 0 0 0 1px #09090b;
}

.option-card[aria-pressed="false"] {
  opacity: 0.72;
}

.option-card[aria-pressed="false"]:hover {
  opacity: 1;
  border-color: #a1a1aa;
}

.offer-box {
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.offer-box[data-selected="true"] {
  border-color: #09090b;
  box-shadow: 0 0 0 1px #09090b;
  background-color: #ffffff;
}

.offer-box[data-selected="false"] {
  border-color: #e4e4e7;
  background-color: #fafafa;
}

/* Custom Radio Circle */
.custom-radio {
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  border: 1.5px solid #a1a1aa;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s ease;
}

.offer-box[data-selected="true"] .custom-radio {
  border-color: #09090b;
}

.custom-radio::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background-color: #09090b;
  transform: scale(0);
  transition: transform 0.18s ease;
}

.offer-box[data-selected="true"] .custom-radio::after {
  transform: scale(1);
}

/* ==========================================================================
   Horizontal Review Carousel Track
   ========================================================================== */
.reviews-track {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
  touch-action: pan-x pan-y;
}

.reviews-track:active {
  cursor: grabbing;
}

.reviews-track::-webkit-scrollbar {
  display: none;
}

.review-slide {
  flex: 0 0 84%;
  scroll-snap-align: start;
}

@media (min-width: 640px) {
  .review-slide {
    flex: 0 0 46%;
  }
}

@media (min-width: 1024px) {
  .review-slide {
    flex: 0 0 calc((100% - 3.75rem) / 4);
  }
}

/* ==========================================================================
   Native <dialog> Drawers & Modals (Cart, Mobile Nav, Search, Policies)
   ========================================================================== */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(9, 9, 11, 0.55);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
  opacity: 0;
  transition: opacity 0.28s ease, display 0.28s allow-discrete, overlay 0.28s allow-discrete;
}

dialog[open]::backdrop {
  opacity: 1;
}

@starting-style {
  dialog[open]::backdrop {
    opacity: 0;
  }
}

/* Slide-Over Drawers (Right for Cart, Left for Mobile Menu) */
dialog.drawer-dialog {
  margin: 0;
  padding: 0;
  border: 0;
  background: #ffffff;
  color: #09090b;
  max-width: min(440px, 100vw);
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease, display 0.32s allow-discrete, overlay 0.32s allow-discrete;
}

dialog.drawer-right {
  inset: 0 0 0 auto;
  transform: translateX(100%);
}

dialog.drawer-right[open] {
  display: flex;
  flex-direction: column;
  transform: translateX(0);
}

dialog.drawer-left {
  inset: 0 auto 0 0;
  max-width: min(360px, 88vw);
  transform: translateX(-100%);
}

dialog.drawer-left[open] {
  display: flex;
  flex-direction: column;
  transform: translateX(0);
}

@starting-style {
  dialog.drawer-right[open] {
    transform: translateX(100%);
  }
  dialog.drawer-left[open] {
    transform: translateX(-100%);
  }
}

dialog.drawer-dialog.is-closing.drawer-right {
  transform: translateX(100%);
}

dialog.drawer-dialog.is-closing.drawer-left {
  transform: translateX(-100%);
}

/* Centered Dialogs (Search & Policies) */
dialog.modal-dialog {
  margin: auto;
  padding: 0;
  border: 1px solid #e4e4e7;
  border-radius: 1rem;
  background: #ffffff;
  color: #09090b;
  width: min(580px, calc(100vw - 2rem));
  max-height: 85dvh;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.24s ease, opacity 0.24s ease, display 0.24s allow-discrete, overlay 0.24s allow-discrete;
}

dialog.modal-dialog[open] {
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0) scale(1);
}

@starting-style {
  dialog.modal-dialog[open] {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog.drawer-dialog,
  dialog.modal-dialog,
  dialog::backdrop {
    transition: none;
  }
}
