/* Consent sheet. Cream paper, Fraunces title, pill buttons like .rc-btn.
   Fixed overlay: it does not shift the page. Motion stays under 200ms. */

.rc-consent {
  position: fixed;
  z-index: 80;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  font-family: "Plus Jakarta Sans", "Noto Sans", sans-serif;
  color: #1c1917;
}

.rc-consent[hidden] { display: none !important; }

/* On a phone PDP the buy bar sits on the bottom nav. Lift the sheet onto
   that bar so it does not cover Añadir. --pdp-sticky-h is measured by the
   product page; consent.js remeasures --consent-banner-h on rc:sticky-atc. */
@media (max-width: 767px) {
  body.has-sticky-atc .rc-consent {
    bottom: calc(var(--rc-bottom-nav-height, 3.5rem) + var(--pdp-sticky-h, 0px) + env(safe-area-inset-bottom, 0px));
  }

  body.has-sticky-atc .rc-consent__sheet {
    padding-bottom: 12px;
  }
}

.rc-consent__sheet {
  pointer-events: auto;
  width: 100%;
  max-height: min(336px, 39dvh);
  overscroll-behavior: contain;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  background: #faf6f1;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 32px rgba(28, 25, 23, 0.14);
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  animation: rc-consent-in 180ms ease;
}

.rc-consent__view[hidden] { display: none !important; }

.rc-consent__rule {
  width: 2.25rem;
  height: 1px;
  margin: 0 0 8px;
  background: linear-gradient(90deg, #b97e82, #c9a227);
}

.rc-consent__title {
  margin: 0 0 4px;
  font-family: Fraunces, Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: 1.15rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #1c1917;
}

.rc-consent__text {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: #453c38;
}

.rc-consent__policy-row { margin: 4px 0 8px; }

.rc-consent__policy {
  color: #5c3a3c;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  text-underline-offset: 0.15em;
}

.rc-consent__policy:hover { color: #1c1917; }

.rc-consent__actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rc-consent__actions--pair { grid-template-columns: 1fr 1fr; margin-top: 10px; }

.rc-consent__btn {
  appearance: none;
  box-sizing: border-box;
  min-height: 44px;
  width: 100%;
  margin: 0;
  padding: 0 8px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.rc-consent__btn--equal {
  background: #1c1917;
  color: #faf6f1;
  border: 1px solid #1c1917;
}

.rc-consent__btn--equal:hover { background: #453c38; }

.rc-consent__btn--ghost {
  background: transparent;
  color: #1c1917;
  border: 1px solid rgba(28, 25, 23, 0.45);
}

.rc-consent__btn--ghost:hover { border-color: #1c1917; background: rgba(28, 25, 23, 0.04); }

.rc-consent button:focus-visible,
.rc-consent a:focus-visible,
.rc-consent__switch input:focus-visible + .rc-consent__knob {
  outline: 2px solid #1c1917;
  outline-offset: 3px;
}

.rc-consent__rows { margin-top: 4px; }

.rc-consent__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 8px 0;
  border-top: 1px solid rgba(28, 25, 23, 0.09);
  cursor: pointer;
}

.rc-consent__row.is-locked { cursor: default; }

.rc-consent__copy { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }

.rc-consent__name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  color: #1c1917;
}

.rc-consent__hint {
  font-size: 0.75rem;
  line-height: 1.45;
  color: #453c38;
}

.rc-consent__state {
  flex: 0 0 auto;
  min-width: 1.4rem;
  margin-top: 2px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1c1917;
}

.rc-consent__switch {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 28px;
  margin-top: 1px;
}

.rc-consent__switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.rc-consent__switch input:disabled { cursor: not-allowed; }

.rc-consent__knob {
  display: block;
  width: 46px;
  height: 28px;
  box-sizing: border-box;
  border-radius: 999px;
  background: #f3ebe3;
  border: 1px solid #1c1917;
  position: relative;
  pointer-events: none;
}

.rc-consent__knob::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1c1917;
  transition: transform 180ms ease;
}

.rc-consent__switch input:checked + .rc-consent__knob { background: #1c1917; }

.rc-consent__switch input:checked + .rc-consent__knob::after {
  transform: translateX(18px);
  background: #faf6f1;
}

.rc-consent-reopen {
  appearance: none;
  background: none;
  border: 0;
  padding: 10px 0;
  min-height: 44px;
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: #5c3a3c;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.rc-consent-reopen:hover { color: #1c1917; }

.rc-footer .rc-consent-reopen {
  color: #c9bfb5;
}

.rc-footer .rc-consent-reopen:hover { color: #ffffff; }

.rc-consent-reopen:focus-visible {
  outline: 2px solid #1c1917;
  outline-offset: 3px;
}

.rc-footer .rc-consent-reopen:focus-visible {
  outline-color: #ffffff;
}

.rc-consent-reopen-row {
  margin: 0;
  text-align: center;
}

/* Lift the chat off the sheet on small screens. The parallel front PR may
   also key off html.consent-banner-open and --consent-banner-h. */
@media (max-width: 768px) {
  html.consent-banner-open #rc-chat-facade,
  html.consent-banner-open .rc-chat-facade {
    bottom: calc(var(--consent-banner-h, 0px) + 12px) !important;
    z-index: 9991 !important;
  }
}

@media (min-width: 769px) {
  .rc-consent {
    justify-content: flex-start;
    padding: 0 0 20px 20px;
  }

  .rc-consent__sheet {
    width: min(400px, calc(100% - 40px));
    max-height: min(420px, 70dvh);
    border-radius: 18px;
    padding: 16px 18px 16px;
    box-shadow: 0 16px 40px rgba(28, 25, 23, 0.16);
  }

  .rc-consent__btn { font-size: 0.8125rem; }
}

@media (prefers-reduced-motion: reduce) {
  .rc-consent__sheet { animation: none; }
  .rc-consent__knob::after { transition: none; }
}

@keyframes rc-consent-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
