/* ============================================================
   COOKIE CONSENT — banner + preferences panel
   Terra Design Studio
   Reuses existing tokens, .btn classes and .container width;
   no new colours, radii or typography are introduced here.
   ============================================================ */

#cookie-consent { display: none; }
#cookie-consent.is-visible { display: block; }

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: var(--clr-white);
  border-top: 1px solid var(--clr-border);
  box-shadow: var(--shadow-lg);
  padding-block: var(--sp-6);
}

.cookie-banner__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-8);
  flex-wrap: wrap;
}

.cookie-banner__text {
  flex: 1 1 360px;
  min-width: 0;
}

.cookie-banner__title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  color: var(--clr-fg);
  margin-bottom: var(--sp-1);
}

.cookie-banner__desc {
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--clr-fg-muted);
  max-width: 62ch;
}

.cookie-banner__desc a {
  color: var(--clr-accent-dark);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.cookie-banner__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.cookie-banner__actions .btn {
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
}

.cookie-banner__actions .btn--ghost {
  background: transparent;
}

@media (max-width: 640px) {
  .cookie-banner__inner { gap: var(--sp-4); }
  .cookie-banner__actions { width: 100%; }
  .cookie-banner__actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ── Preferences panel ───────────────────────────────────── */
.cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
}

.cookie-modal__overlay {
  position: absolute;
  inset: 0;
  background: var(--clr-overlay-deep);
}

.cookie-modal__box {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - var(--sp-12));
  overflow-y: auto;
  background: var(--clr-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-8);
}

.cookie-modal__title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-medium);
  color: var(--clr-fg);
  margin-bottom: var(--sp-6);
}

.cookie-modal__close {
  position: absolute;
  top: var(--sp-5);
  right: var(--sp-5);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--clr-border);
  border-radius: 50%;
  background: transparent;
  color: var(--clr-fg);
  cursor: pointer;
  font-size: var(--fs-md);
  line-height: 1;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.cookie-modal__close:hover { background: var(--clr-bg-alt); }

.cookie-category {
  padding-block: var(--sp-5);
  border-top: 1px solid var(--clr-border);
}

.cookie-category:first-of-type { border-top: none; }

.cookie-category__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-2);
}

.cookie-category__label {
  font-family: var(--font-display);
  font-size: var(--fs-base);
  font-weight: var(--fw-semi);
  color: var(--clr-fg);
}

.cookie-category__state {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--clr-fg-muted);
}

.cookie-category__desc {
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--clr-fg-muted);
}

/* Toggle switch — keyboard accessible checkbox styled as a switch */
.cookie-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.cookie-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.cookie-switch__track {
  position: absolute;
  inset: 0;
  background: var(--clr-border);
  border-radius: var(--radius-pill);
  transition: background var(--dur-base) var(--ease);
  pointer-events: none;
}

.cookie-switch__track::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--clr-white);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease);
}

.cookie-switch input:checked + .cookie-switch__track {
  background: var(--clr-accent);
}
.cookie-switch input:checked + .cookie-switch__track::before {
  transform: translateX(20px);
}

.cookie-switch input:focus-visible + .cookie-switch__track {
  outline: 2px solid var(--clr-accent);
  outline-offset: 2px;
}

.cookie-switch input:disabled + .cookie-switch__track {
  background: var(--clr-accent);
  opacity: 0.6;
  cursor: not-allowed;
}

.cookie-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-8);
  flex-wrap: wrap;
}

.cookie-modal__actions .btn {
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
}

.cookie-modal__actions .btn--ghost {
  background: transparent;
}

/* Focus visibility — keep clearly visible per accessibility requirement */
.cookie-banner a:focus-visible,
.cookie-banner button:focus-visible,
.cookie-modal a:focus-visible,
.cookie-modal button:focus-visible {
  outline: 2px solid var(--clr-accent);
  outline-offset: 2px;
}
