/*
 * ST-UDIO | Moncees Framework: Consent
 * Banner and settings for consent.js: personal note bottom right.
 */

/* --- Root --------------------------------------------------------- */
.cb {
  --cb-gap: var(--_primitives---space--6);
  --cb-pad: var(--_primitives---space--5);
  --cb-line: var(--_theme---main--border);
  --cb-muted: var(--_theme---main--text-card-muted);
  --cb-shadow:
    0 0 0 1px var(--cb-line),
    0 30px 60px -18px rgb(17 17 23 / 0.18),
    0 60px 120px -40px rgb(17 17 23 / 0.16);
  position: fixed;
  inset: auto 0 0 0;
  z-index: 9999;
  pointer-events: none;
  color: var(--_theme---main--text);
  font-family: var(--_typography---font--body);
}

html.u-mode-dark .cb {
  --cb-shadow:
    0 0 0 1px var(--cb-line),
    0 30px 60px -18px rgb(0 0 0 / 0.5),
    0 60px 120px -40px rgb(0 0 0 / 0.45);
}

.cb p,
.cb h2 {
  margin: 0;
}

/* --- Panel -------------------------------------------------------- */
.cb_panel {
  position: fixed;
  box-sizing: border-box;
  display: grid;
  gap: var(--_primitives---space--4);
  max-height: calc(100svh - 2 * var(--cb-gap));
  padding: var(--cb-pad);
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: var(--_primitives---radius--3xl);
  background: var(--_theme---main--card);
  box-shadow: var(--cb-shadow);
  pointer-events: auto;
  outline: none;
}

.cb[data-cb-state="closed"] .cb_panel,
.cb:not([data-cb-state]) .cb_panel {
  display: none;
}

.cb[data-cb-state="banner"] .cb_panel,
.cb[data-cb-state="details"] .cb_panel {
  animation: cb-in 0.6s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}

@keyframes cb-in {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: none; }
}

/* --- Head --------------------------------------------------------- */
.cb_head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: var(--_primitives---space--3);
  row-gap: var(--_primitives---space--1);
}

.cb_kicker {
  grid-column: 1;
  color: var(--cb-muted);
  font-size: 0.8125rem;
  font-weight: var(--_typography---weight--medium);
  letter-spacing: var(--_typography---tracking--wider);
  line-height: 1.2;
  text-transform: uppercase;
}

.cb_title {
  grid-column: 1;
  font-family: var(--_typography---font--heading);
  font-size: var(--_typography---text--lg);
  font-weight: var(--_typography---weight--medium);
  letter-spacing: -0.02em;
  line-height: var(--_typography---leading--snug);
}

.cb_close {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--cb-line);
  border-radius: var(--_primitives---radius--lg);
  background: transparent;
  color: var(--_theme---main--text);
  cursor: pointer;
}

.cb_close[hidden] {
  display: none;
}

.cb_close svg {
  width: 0.75rem;
  height: 0.75rem;
}

/* --- Text --------------------------------------------------------- */
.cb_text {
  font-size: var(--_typography---text--sm);
  line-height: var(--_typography---leading--relaxed);
  text-wrap: pretty;
}

/* --- Details ------------------------------------------------------ */
.cb_details {
  display: grid;
  gap: var(--_primitives---space--2);
}

.cb_details[hidden] {
  display: none;
}

.cb_cat {
  display: grid;
  gap: var(--_primitives---space--2);
  padding: var(--_primitives---space--4);
  border: 1px solid var(--cb-line);
  border-radius: var(--_primitives---radius--xl);
}

.cb_cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--_primitives---space--3);
}

.cb_cat-title {
  font-size: var(--_typography---text--sm);
  font-weight: var(--_typography---weight--medium);
}

.cb_cat-text {
  color: var(--cb-muted);
  font-size: var(--_typography---text--sm);
  line-height: var(--_typography---leading--relaxed);
  overflow-wrap: anywhere;
}

.cb_always {
  color: var(--cb-muted);
  font-size: 0.8125rem;
  font-weight: var(--_typography---weight--medium);
  white-space: nowrap;
}

/* --- Switch ------------------------------------------------------- */
.cb_switch {
  position: relative;
  flex: none;
  width: 2.75rem;
  height: 1.625rem;
  padding: 0;
  border: 0;
  border-radius: var(--_primitives---radius--full);
  background: var(--_theme---main--card-muted);
  cursor: pointer;
  transition: background-color 0.25s ease;
}

.cb_switch-knob {
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--_primitives---radius--full);
  background: var(--_theme---main--card);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 0.35s var(--ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
}

.cb_switch[aria-checked="true"] {
  background: var(--_theme---main--text);
}

.cb_switch[aria-checked="true"] .cb_switch-knob {
  transform: translateX(1.125rem);
}

/* --- Actions (Button component instances) ------------------------- */
.cb_actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--_primitives---space--2);
}

.cb .cb_button {
  width: 100%;
  border: 0;
  font-family: inherit;
  font-size: var(--_typography---text--base);
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  background-color: var(--_theme---button--secondary-bg);
  color: var(--_theme---button--secondary-text);
}

.cb .cb_button .button_swap {
  background-color: var(--_theme---button--secondary-bg-hover);
  color: var(--_theme---button--secondary-text-hover);
}

.cb .cb_button {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: var(--_layout---gap--sm);
  padding: var(--_primitives---space--4) var(--_primitives---space--5);
  border-radius: var(--_primitives---radius--2xl);
  font-weight: var(--_typography---weight--medium);
  text-decoration: none;
}

.cb .cb_button .button_label-wrap {
  position: relative;
  overflow: hidden;
}

.cb .cb_button .button_label {
  transition: transform 0.4s var(--ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
}

.cb .cb_button .button_swap-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: var(--_primitives---radius--2xl);
  pointer-events: none;
}

.cb .cb_button .button_swap {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: translateY(110%);
  transition: transform 0.4s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}

.cb .cb_button:hover .button_label { transform: translateY(-110%); }
.cb .cb_button:hover .button_swap { transform: translateY(0); }

@media (max-width: 991px) {
  .cb .cb_button {
    padding: var(--_primitives---space--3) var(--_primitives---space--4);
  }
}

.cb .cb_save {
  display: none;
  grid-column: 1 / -1;
}

.cb[data-cb-state="details"] .cb_save {
  display: inline-flex;
}

/* --- Links -------------------------------------------------------- */
.cb_links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--_primitives---space--4);
}

.cb_link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--cb-muted);
  font: inherit;
  font-size: var(--_typography---text--sm);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.cb_link:hover {
  color: var(--_theme---main--text);
}

.cb[data-cb-state="details"] [data-cb-action="toggle"] {
  display: none;
}

/* --- Focus -------------------------------------------------------- */
.cb button:focus-visible,
.cb a:focus-visible {
  outline: 2px solid var(--_theme---main--text);
  outline-offset: 2px;
}

/* --- Note ---------------------------------------------------------- */
.cb .cb_panel {
  right: var(--cb-gap);
  bottom: var(--cb-gap);
  width: min(24rem, calc(100vw - 2 * var(--cb-gap)));
  gap: var(--_primitives---space--3);
  padding: var(--_primitives---space--4);
}

.cb .cb_head {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.cb_avatar {
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--_primitives---radius--full);
  object-fit: cover;
}

.cb .cb_close {
  grid-column: 3;
  grid-row: 1;
}

.cb_who {
  display: grid;
  gap: 0.125rem;
}

.cb_name {
  color: var(--cb-muted);
  font-size: 0.8125rem;
  line-height: 1.2;
}

.cb .cb_title {
  font-size: var(--_typography---text--md);
}

.cb .cb_body {
  padding: 0.7em 1em;
  border: 1px solid var(--cb-line);
  border-radius: var(--_primitives---radius--sm) var(--_primitives---radius--xl) var(--_primitives---radius--xl) var(--_primitives---radius--xl);
  background: var(--_theme---main--background);
}

html.u-mode-dark .cb .cb_body {
  background: var(--_theme---main--foreground);
}

.cb .cb_links {
  padding-left: 0.25rem;
}

/* --- Small screens ------------------------------------------------ */
@media (max-width: 767px) {
  .cb {
    --cb-gap: var(--_primitives---space--3);
    --cb-pad: var(--_primitives---space--4);
  }

  .cb_panel {
    gap: var(--_primitives---space--3);
  }

  .cb_title {
    font-size: var(--_typography---text--md);
  }
}

/* --- Motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .cb .cb_panel,
  .cb .cb_button .button_label,
  .cb .cb_button .button_swap,
  .cb_switch,
  .cb_switch-knob {
    animation: none !important;
    transition: none !important;
  }
}

.cb_id span {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
