/* ==========================================================================
   CookieConsentBanner, CookiePreferencesDialog — 07 §9.6, §9.7
   ========================================================================== */

.cookie-banner {
  position: fixed;
  inset: auto 0 0 0;
  z-index: var(--z-toast);
  padding: var(--space-5) var(--gutter);
  background-color: var(--surface-dark);
  border-top: 1px solid var(--border-on-dark);
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-5) var(--space-7);
  max-width: calc(var(--container-wide) + var(--gutter) * 2);
  margin-inline: auto;
}

.cookie-banner__text {
  flex: 1 1 28rem;
  color: var(--text-on-dark-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
}

.cookie-banner__text p {
  margin: 0 0 var(--space-2);
}

.cookie-banner__text p:last-child {
  margin-bottom: 0;
}

.cookie-banner__title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  color: var(--text-on-dark);
  margin-bottom: var(--space-2);
}

.cookie-banner__actions {
  flex: 0 0 auto;
  flex-wrap: wrap;
}

/* Only the banner sits on --surface-dark — the dialog panel below is
   --surface-base, so its default .btn--secondary/.btn--text already have
   correct contrast and need no override. */
.cookie-banner__configure {
  color: var(--text-on-dark);
}

.cookie-banner__configure:hover {
  color: var(--text-on-dark);
}

.cookie-dialog {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
}

.cookie-dialog[hidden] {
  display: none;
}

.cookie-dialog__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgb(46 35 26 / 55%);
}

.cookie-dialog__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 32rem;
  max-height: calc(100vh - var(--space-8));
  overflow-y: auto;
  padding: var(--space-7);
  background-color: var(--surface-base);
  border-radius: var(--radius-card);
}

.cookie-dialog__title {
  margin: 0 0 var(--space-6);
  font-family: var(--font-display);
  font-size: var(--text-h4);
  color: var(--text-strong);
}

.cookie-dialog__category {
  padding: var(--space-5) 0;
  border-top: 1px solid var(--border-subtle);
}

.cookie-dialog__category:last-of-type {
  border-bottom: 1px solid var(--border-subtle);
}

.cookie-dialog__category p {
  margin: var(--space-2) 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
}

.cookie-dialog__category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.cookie-dialog__category-name {
  font-weight: 600;
  color: var(--text-strong);
}

.cookie-dialog__always-on {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.cookie-dialog__switch {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.cookie-dialog__switch input {
  /* Real checkbox, not a decorative div: keeps native keyboard and screen
     reader behaviour rather than reimplementing a switch's semantics. */
  width: var(--space-5);
  height: var(--space-5);
  accent-color: var(--color-arcilla);
}

.cookie-dialog__actions {
  flex-wrap: wrap;
  margin-top: var(--space-6);
}

@media (max-width: 40rem) {
  .cookie-banner__actions,
  .cookie-dialog__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cookie-banner__actions .btn,
  .cookie-dialog__actions .btn {
    width: 100%;
  }
}
