/*
 * Storefront base — a small reset that lives INSIDE `.rvx-storefront` only.
 * Themes reset buttons, inputs and headings in wildly different ways; this
 * neutralises those within our roots so the token utilities render the same
 * everywhere, without touching anything outside ReviewX markup.
 * Specificity stays at (0,1,1) so every scoped utility (0,2,0) wins.
 */
.rvx-storefront {
  /* Merchant colours — overwritten on the root from widget settings. */
  --rvx-sf-brand: rgb(var(--rvx-c-brand));
  --rvx-sf-brand-fg: rgb(var(--rvx-c-brand-fg));
  --rvx-sf-star: rgb(var(--rvx-c-star));

  font-family: var(--rvx-font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: rgb(var(--rvx-c-fg));
  -webkit-font-smoothing: antialiased;
  text-align: start;
}
/* Dark mode (resources/js/color-mode.js sets the attribute): the dark tokens come from
   tokens.css; this tells the browser to draw form controls and scrollbars dark too. */
.rvx-storefront[data-rvx-mode='dark'] {
  color-scheme: dark;
}
/* A fixed mode (theme="dark" on a light page, "Always light" on a dark one) brings its own
   backdrop, so the reviews stay readable whatever the page behind them
   (data-rvx-backdrop, set by resources/js/color-mode.js). */
.rvx-storefront[data-rvx-backdrop] {
  background-color: rgb(var(--rvx-c-canvas));
  border-radius: var(--rvx-radius-panel);
  padding: 16px;
}
@media (min-width: 640px) {
  .rvx-storefront[data-rvx-backdrop] {
    padding: 24px;
  }
}
/* The inline rating badge stays a badge. */
.rvx-storefront.rvx-review-star-count[data-rvx-backdrop] {
  width: fit-content;
  max-width: 100%;
  padding: 6px 12px;
  border-radius: var(--rvx-radius-pill);
}
.rvx-storefront[data-rvx-mode='dark'],
.rvx-storefront[data-rvx-mode='dark'] * {
  --tw-ring-offset-color: rgb(var(--rvx-c-surface));
}
.rvx-storefront,
.rvx-storefront *,
.rvx-storefront *::before,
.rvx-storefront *::after {
  box-sizing: border-box;

  /* Tailwind's variable defaults. They normally come with `@tailwind base`, which
     the storefront leaves out (its preflight would reset the theme). Without them
     every transform utility (rotate, translate, scale), `tabular-nums` and `ring`
     compose an invalid value and silently do nothing — e.g. the dislike thumb
     rendered as a second thumbs-up. */
  --tw-translate-x: 0;
  --tw-translate-y: 0;
  --tw-rotate: 0;
  --tw-skew-x: 0;
  --tw-skew-y: 0;
  --tw-scale-x: 1;
  --tw-scale-y: 1;
  --tw-ordinal:  ;
  --tw-slashed-zero:  ;
  --tw-numeric-figure:  ;
  --tw-numeric-spacing:  ;
  --tw-numeric-fraction:  ;
  --tw-ring-inset:  ;
  --tw-ring-offset-width: 0px;
  --tw-ring-offset-color: #fff;
  --tw-ring-color: rgb(59 130 246 / 0.5);
  --tw-ring-offset-shadow: 0 0 #0000;
  --tw-ring-shadow: 0 0 #0000;
  --tw-shadow: 0 0 #0000;
  --tw-shadow-colored: 0 0 #0000;
}
.rvx-storefront :is(h1, h2, h3, h4, h5, h6, p, ul, ol, li, figure, blockquote, fieldset) {
  margin: 0;
  padding: 0;
}
.rvx-storefront :is(h1, h2, h3, h4, h5, h6) {
  font-family: inherit;
  font-weight: 600;
  line-height: 1.3;
  color: inherit;
  letter-spacing: normal;
  text-transform: none;
}
.rvx-storefront :is(ul, ol) {
  list-style: none;
}
/* Fieldsets are plain groups; a floated legend keeps it out of the border notch. */
.rvx-storefront fieldset {
  border: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
}
.rvx-storefront legend {
  float: inline-start;
  width: 100%;
  padding: 0;
  margin: 0;
}
.rvx-storefront legend + * {
  clear: both;
}
.rvx-storefront button {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  line-height: inherit;
  color: inherit;
  letter-spacing: normal;
  text-transform: none;
  text-shadow: none;
  box-shadow: none;
  border-radius: 0;
  cursor: pointer;
}
.rvx-storefront :is(input, textarea, select) {
  font: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0;
  box-shadow: none;
  max-width: 100%;
}
.rvx-storefront textarea {
  resize: vertical;
}
/* Checkboxes / radios: custom-drawn so they match across themes (brand-tinted). */
.rvx-storefront :is(input[type='checkbox'], input[type='radio']) {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: none;
  display: inline-grid !important;
  place-content: center;
  border: 1.5px solid rgb(var(--rvx-c-line-strong)) !important;
  background: rgb(var(--rvx-c-surface)) !important;
  box-shadow: none !important;
  cursor: pointer;
  vertical-align: middle;
  transition: border-color var(--rvx-duration-fast) var(--rvx-ease-standard), background-color var(--rvx-duration-fast) var(--rvx-ease-standard), box-shadow var(--rvx-duration-fast) var(--rvx-ease-standard);
}
.rvx-storefront input[type='checkbox'] {
  border-radius: 5px !important;
}
.rvx-storefront input[type='radio'] {
  border-radius: 50% !important;
}
.rvx-storefront :is(input[type='checkbox'], input[type='radio'])::before {
  content: '';
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform var(--rvx-duration-fast) var(--rvx-ease-emphasized);
}
.rvx-storefront input[type='checkbox']::before {
  background: var(--rvx-sf-brand-fg);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center / 12px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center / 12px no-repeat;
  width: 12px;
  height: 12px;
}
.rvx-storefront input[type='radio']::before {
  border-radius: 50%;
  background: var(--rvx-sf-brand-fg);
  width: 8px;
  height: 8px;
}
.rvx-storefront :is(input[type='checkbox'], input[type='radio']):hover {
  border-color: var(--rvx-sf-brand) !important;
}
.rvx-storefront :is(input[type='checkbox'], input[type='radio']):checked {
  border-color: var(--rvx-sf-brand) !important;
  background: var(--rvx-sf-brand) !important;
}
.rvx-storefront :is(input[type='checkbox'], input[type='radio']):checked::before {
  transform: scale(1);
}
.rvx-storefront :is(input[type='checkbox'], input[type='radio']):focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rvx-sf-brand) 25%, transparent) !important;
}
.rvx-storefront :is(input[type='checkbox'], input[type='radio'])[aria-invalid='true'] {
  border-color: rgb(var(--rvx-c-danger)) !important;
}
.rvx-storefront label {
  display: inline;
  margin: 0;
  font-weight: inherit;
  cursor: pointer;
}
.rvx-storefront :is(img, video) {
  display: block;
  max-width: 100%;
  height: auto;
  border: 0;
}
.rvx-storefront svg {
  display: block;
  flex: none;
}
/* Themes underline links with high-specificity rules (`.entry-content a`); inside
   ReviewX markup links are buttons/cards, so opt in to underlines with .rvx-link. */
.rvx-storefront a {
  color: inherit;
}
.rvx-storefront a:not(.rvx-link),
.rvx-storefront a:not(.rvx-link):hover,
.rvx-storefront a:not(.rvx-link):focus {
  text-decoration: none !important;
  box-shadow: none !important;
}
.rvx-storefront a.rvx-link {
  color: rgb(var(--rvx-c-fg-link));
  text-decoration: underline;
  text-underline-offset: 2px;
}
.rvx-storefront [x-cloak] {
  display: none !important;
}
.rvx-storefront :focus {
  outline: none;
}
.rvx-storefront :focus-visible {
  outline: 2px solid rgb(var(--rvx-c-line-focus));
  outline-offset: 2px;
  border-radius: 4px;
}
.rvx-storefront table,
.rvx-storefront td,
.rvx-storefront th {
  border: 0;
  background: transparent;
  padding: 0;
}

/*
 * Form controls. Themes style `input[type=text]` with selectors like
 * `.woocommerce input[type="text"]` (0,2,1) which out-rank scoped utilities
 * (0,2,0), so the control look is pinned here with !important. Tokens only.
 */
.rvx-storefront .rvx-input {
  display: block !important;
  width: 100% !important;
  min-height: var(--rvx-control-h-md) !important;
  padding: 9px 12px !important;
  border: 1px solid rgb(var(--rvx-c-line-strong)) !important;
  border-radius: var(--rvx-radius-control) !important;
  background: rgb(var(--rvx-c-surface)) !important;
  color: rgb(var(--rvx-c-fg)) !important;
  font: inherit !important;
  font-size: 14px !important;
  line-height: 20px !important;
  box-shadow: none !important;
  outline: none !important;
  transition: border-color var(--rvx-duration-fast) var(--rvx-ease-standard), box-shadow var(--rvx-duration-fast) var(--rvx-ease-standard);
}
.rvx-storefront .rvx-input::placeholder {
  color: rgb(var(--rvx-c-fg-disabled));
  opacity: 1;
}
.rvx-storefront .rvx-input:focus,
.rvx-storefront .rvx-input:focus-visible {
  border-color: var(--rvx-sf-brand) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rvx-sf-brand) 20%, transparent) !important;
  outline: none !important;
}
.rvx-storefront .rvx-input[aria-invalid='true'] {
  border-color: rgb(var(--rvx-c-danger)) !important;
}
.rvx-storefront .rvx-input[aria-invalid='true']:focus {
  box-shadow: 0 0 0 3px rgb(var(--rvx-c-danger) / 0.2) !important;
}
.rvx-storefront textarea.rvx-input {
  min-height: 120px !important;
  resize: vertical !important;
}
.rvx-storefront .rvx-input--short {
  width: 120px !important;
}

/* Star input: no transforms (they read as the icon jumping), no theme focus dots on mouse clicks. */
.rvx-storefront .rvx-star-input__star {
  transition: filter var(--rvx-duration-fast) var(--rvx-ease-standard);
}
.rvx-storefront .rvx-star-input__star:hover {
  filter: brightness(1.08) drop-shadow(0 1px 1px rgb(0 0 0 / 0.12));
}
.rvx-storefront .rvx-star-input__star:focus:not(:focus-visible),
.rvx-storefront button:focus:not(:focus-visible) {
  outline: none !important;
  box-shadow: none !important;
}
.rvx-storefront .rvx-star-input__star:focus-visible {
  outline: 2px solid rgb(var(--rvx-c-line-focus)) !important;
  outline-offset: 1px !important;
}

/* Hidden-but-accessible (screen readers). */
.rvx-storefront .rvx-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;
}

/* Masonry layout (CSS columns; grid/list are utilities). */
.rvx-storefront .rvx-masonry-layout {
  columns: 3 300px;
  column-gap: 16px;
}
.rvx-storefront .rvx-masonry-layout > * {
  break-inside: avoid;
  margin-bottom: 16px;
}

/* Motion respect. */
@media (prefers-reduced-motion: reduce) {
  .rvx-storefront * {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}

/* Custom scrollbar for modal bodies. */
.rvx-storefront .rvx-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.rvx-storefront .rvx-scrollbar::-webkit-scrollbar-thumb {
  background: rgb(var(--rvx-c-line-strong));
  border-radius: 4px;
}
