/* Ritualyté CMP — mobile first. Hoja inferior compacta; desktop tarjeta. */

.rit-consent-root,
.rit-consent-root *,
.rit-consent-root *::before,
.rit-consent-root *::after {
  box-sizing: border-box;
}

.rit-consent-root {
  --rit-gold: #bea77b;
  --rit-gold-hi: #d4c4a0;
  --rit-gold-lo: #7a6640;
  --rit-ink: #1a1a1a;
  --rit-muted: #5c5c5c;
  --rit-line: #e8e4dc;
  --rit-pad: clamp(0.75rem, 3.2vw, 1.15rem);
  --rit-outer: clamp(0.75rem, 3vw, 1.25rem);
  --rit-radius: 1rem;
  --rit-touch: 2.75rem;
  --rit-close-bg: #efe6d2;
  --rit-banner-max: min(85vh, calc(100dvh - (2 * var(--rit-outer))));

  position: fixed;
  z-index: 999999;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: clamp(0.875rem, 0.82rem + 0.35vw, 0.9375rem);
  line-height: 1.45;
  color: var(--rit-ink);
  pointer-events: none;
}

.rit-consent-banner {
  pointer-events: auto;
  position: absolute;
  z-index: 2;
  top: auto;
  left: max(var(--rit-outer), env(safe-area-inset-left, 0px));
  right: max(var(--rit-outer), env(safe-area-inset-right, 0px));
  bottom: max(var(--rit-outer), env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: var(--rit-banner-max);
  min-height: 0;
  overflow: hidden;
  background: #fff;
  color: var(--rit-ink);
  border: 1px solid var(--rit-line);
  border-radius: var(--rit-radius);
  box-shadow: 0 -0.5rem 2rem rgba(0, 0, 0, 0.18);
  container-type: inline-size;
  container-name: rit-consent;
}

.rit-consent-handle {
  display: flex;
  justify-content: center;
  padding: 0.45rem 0 0.15rem;
  flex: none;
}

.rit-consent-handle::before {
  content: "";
  width: 2.5rem;
  height: 0.28rem;
  border-radius: 999px;
  background: #d4d0c8;
}

.rit-consent-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex: none;
  padding: var(--rit-pad);
  padding-right: calc(var(--rit-pad) + var(--rit-touch));
  text-align: center;
}

.rit-consent-title {
  min-width: 0;
  width: 100%;
  font-size: clamp(1rem, 0.95rem + 0.4vw, 1.125rem);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  outline: none;
}

.rit-consent-close {
  position: absolute;
  top: 50%;
  right: var(--rit-pad);
  transform: translateY(-50%);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--rit-touch);
  height: var(--rit-touch);
  margin: 0;
  padding: 0;
  border: 2px solid var(--rit-gold-lo);
  border-radius: 0.5rem;
  background: #e8d9b8;
  color: #5c4c30;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
  cursor: pointer;
}

.rit-consent-close svg {
  width: 0.9rem;
  height: 1rem;
}

.rit-consent-close:hover,
.rit-consent-close:focus-visible {
  background: #e4d4b4;
  border-color: var(--rit-gold-lo);
  color: #1a1a1a;
}

.rit-consent-close:focus-visible {
  outline: 2px solid var(--rit-gold);
  outline-offset: 2px;
}

.rit-consent-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 var(--rit-pad) var(--rit-pad);
}

.rit-consent-message,
.rit-consent-cat-body p,
.rit-consent-services p,
.rit-consent-services li {
  margin: 0 0 0.65em;
  color: var(--rit-muted);
}

.rit-consent-message {
  text-align: center;
  text-wrap: pretty;
}

.rit-consent-message:last-child,
.rit-consent-cat-body p:last-child {
  margin-bottom: 0;
}

.rit-consent-categories {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.rit-consent-cat {
  border: 1px solid var(--rit-line);
  border-radius: 0.65rem;
  background: #faf8f4;
}

.rit-consent-cat > summary {
  list-style: none;
  cursor: pointer;
}

.rit-consent-cat > summary::-webkit-details-marker {
  display: none;
}

.rit-consent-cat-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--rit-touch);
  padding: 0.35rem 0.7rem;
}

.rit-consent-cat-title {
  min-width: 0;
  font-weight: 650;
}

.rit-consent-always {
  font-size: 0.75rem;
  color: #666;
  white-space: nowrap;
}

.rit-consent-chevron {
  display: inline-flex;
  color: #666;
  transition: transform 0.15s ease;
}

.rit-consent-cat[open] .rit-consent-chevron {
  transform: rotate(180deg);
}

.rit-consent-cat-body {
  padding: 0 0.7rem 0.7rem;
  font-size: 0.8125rem;
}

.rit-consent-switch {
  position: relative;
  display: inline-flex;
  width: 2.5rem;
  height: 1.5rem;
  flex: none;
}

.rit-consent-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.rit-consent-switch label {
  display: block;
  width: 2.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: #cfcfcf;
  cursor: pointer;
  position: relative;
}

.rit-consent-switch label::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}

.rit-consent-switch input:checked + label {
  background: var(--rit-gold);
}

.rit-consent-switch input:checked + label::after {
  transform: translateX(1rem);
}

.rit-consent-switch input:focus-visible + label {
  outline: 2px solid var(--rit-gold);
  outline-offset: 2px;
}

.rit-consent-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rit-consent-services ul {
  margin: 0 0 0.75em;
  padding-left: 1.1em;
}

.rit-consent-textbtn {
  border: 0;
  background: none;
  padding: 0.35rem 0;
  min-height: var(--rit-touch);
  color: var(--rit-gold-lo);
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
}

.rit-consent-footer {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: var(--rit-pad);
  border-top: 1px solid #eee;
  background: #fff;
}

.rit-consent-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.25rem 0.85rem;
  width: 100%;
  text-align: center;
}

.rit-consent-link {
  color: var(--rit-gold-lo);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  font-size: 0.8125rem;
  padding: 0.35rem 0;
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rit-consent-link:hover,
.rit-consent-link:focus-visible,
.rit-consent-textbtn:hover,
.rit-consent-textbtn:focus-visible {
  color: #5c4c30;
}

.rit-consent-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  width: 100%;
}

.rit-consent-root .rit-consent-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--rit-touch);
  border-radius: 0.55rem;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  font-style: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-transform: uppercase;
  padding: 0.55em 0.9em;
  cursor: pointer;
  border: 1px solid transparent;
  background-image: none;
  box-shadow: none;
}

.rit-consent-root .rit-consent-btn--accept {
  background: var(--rit-gold);
  color: #111;
  border-color: var(--rit-gold);
}

.rit-consent-root .rit-consent-btn--accept:hover,
.rit-consent-root .rit-consent-btn--accept:focus-visible {
  background: var(--rit-gold-hi);
}

.rit-consent-root .rit-consent-btn--deny,
.rit-consent-root .rit-consent-btn--prefs,
.rit-consent-root .rit-consent-btn--save {
  background: #fff;
  color: var(--rit-ink);
  border-color: #d0ccc4;
}

.rit-consent-root .rit-consent-btn--deny:hover,
.rit-consent-root .rit-consent-btn--prefs:hover,
.rit-consent-root .rit-consent-btn--save:hover,
.rit-consent-root .rit-consent-btn--deny:focus-visible,
.rit-consent-root .rit-consent-btn--prefs:focus-visible,
.rit-consent-root .rit-consent-btn--save:focus-visible {
  border-color: var(--rit-gold);
  color: #111;
}

.rit-consent-root .rit-consent-btn:focus-visible {
  outline: 2px solid var(--rit-gold);
  outline-offset: 2px;
}

.rit-consent-btn[hidden],
.rit-consent-categories[hidden],
.rit-consent-services[hidden],
.rit-consent-banner[hidden],
.rit-consent-fab[hidden] {
  display: none !important;
}

.rit-consent-fab {
  pointer-events: auto;
  position: absolute;
  z-index: 1;
  right: max(var(--rit-outer), env(safe-area-inset-right, 0px));
  bottom: max(var(--rit-outer), env(safe-area-inset-bottom, 0px));
  left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--rit-touch);
  height: var(--rit-touch);
  margin: 0;
  padding: 0;
  border: 1px solid var(--rit-gold-lo);
  border-radius: 999px;
  background: var(--rit-gold);
  color: #1a1a1a;
  box-shadow: 0 0.35rem 1.15rem rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.rit-consent-fab svg {
  width: 1.25rem;
  height: 1.25rem;
}

.rit-consent-fab:hover,
.rit-consent-fab:focus-visible {
  background: var(--rit-gold-hi);
}

.rit-consent-fab:focus-visible {
  outline: 2px solid var(--rit-gold-lo);
  outline-offset: 3px;
}

@container rit-consent (min-width: 20rem) {
  .rit-consent-actions {
    grid-template-columns: 1fr 1fr;
  }

  .rit-consent-btn--prefs,
  .rit-consent-btn--save {
    grid-column: 1 / -1;
  }
}

@media (min-width: 640px) {
  .rit-consent-banner {
    top: auto;
    left: auto;
    right: max(var(--rit-outer), env(safe-area-inset-right, 0px));
    bottom: max(var(--rit-outer), env(safe-area-inset-bottom, 0px));
    width: min(26.5rem, calc(100vw - (2 * var(--rit-outer))));
    max-height: min(85vh, calc(100dvh - (2 * var(--rit-outer))), 40rem);
    border-radius: 0.85rem;
    box-shadow: 0 0.75rem 2.5rem rgba(0, 0, 0, 0.2);
  }

  .rit-consent-handle {
    display: none;
  }

  .rit-consent-fab {
    right: max(var(--rit-outer), env(safe-area-inset-right, 0px));
    bottom: max(var(--rit-outer), env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 1024px) {
  .rit-consent-banner {
    width: min(28rem, calc(100vw - (2 * var(--rit-outer))));
  }
}

@media (max-height: 28rem) {
  .rit-consent-banner {
    top: auto;
    left: max(var(--rit-outer), env(safe-area-inset-left, 0px));
    right: max(var(--rit-outer), env(safe-area-inset-right, 0px));
    bottom: max(var(--rit-outer), env(safe-area-inset-bottom, 0px));
    width: auto;
    height: auto;
    max-height: var(--rit-banner-max);
    border-radius: 0.75rem;
  }

  .rit-consent-handle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rit-consent-chevron,
  .rit-consent-switch label::after {
    transition: none;
  }
}
