/* ============================================================
   AETHER cookie consent
   Deliberately self-contained. This ships on shells that never
   load theme.css (Account/AcceptInvite, Account/InvitationInvalid),
   so every custom property carries a literal fallback. The
   fallbacks are the LIGHT values on purpose: those two pages are
   unconditionally light and carry no html.dark / html.light class,
   while every themed shell defines the tokens and wins.
   ============================================================ */

.aether-consent,
.aether-consent * {
  box-sizing: border-box;
}

/* ---- Banner ---- */

.aether-consent {
  position: fixed;
  z-index: 9998;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  margin: 0 auto;
  max-width: 72rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.125rem 1.5rem;
  border-radius: 1rem;
  border: 1px solid var(--border-subtle, #E5E7EB);
  background: var(--surface-1, #FFFFFF);
  box-shadow: var(--shadow-lg, 0 14px 36px rgba(16, 24, 40, 0.12));
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text-secondary, #475569);
  transform: translateY(0);
  opacity: 1;
  transition: transform 260ms ease, opacity 260ms ease;
}

/* The banner takes focus on appearance so assistive technology announces it, but it
   is a region rather than a control, so the browser's default focus ring is wrong
   here: it paints a bright hairline around the whole card. The buttons inside keep
   their own focus-visible styling. */
.aether-consent:focus,
.aether-consent:focus-visible {
  outline: none;
}

/* display:flex would otherwise beat the hidden attribute */
.aether-consent[hidden],
.aether-consent__modal[hidden] {
  display: none;
}

.aether-consent--entering {
  transform: translateY(calc(100% + 1rem));
  opacity: 0;
}

.aether-consent__icon {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft, rgba(0, 149, 255, 0.10));
  color: #0095FF;
}

.aether-consent__icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.aether-consent__copy {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.aether-consent__copy p {
  margin: 0;
}

.aether-consent__copy a {
  color: #0095FF;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.aether-consent__copy a:hover {
  color: #0077CC;
}

.aether-consent__actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

/* ---- Buttons ----
   Decline and Accept are identical in size, padding and weight. Equal prominence
   for refusing and accepting is a GDPR requirement, not a stylistic preference. */

.aether-consent__btn {
  appearance: none;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.75rem 1.375rem;
  min-width: 7rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.aether-consent__btn:focus-visible,
.aether-consent__close:focus-visible,
.aether-consent__switch input:focus-visible + .aether-consent__switch-track {
  outline: 2px solid #0095FF;
  outline-offset: 2px;
}

.aether-consent__btn--ghost {
  background: transparent;
  border-color: var(--border-strong, #CBD5E1);
  color: var(--text-primary, #0F172A);
}

.aether-consent__btn--ghost:hover {
  background: var(--surface-2, #F1F5F9);
  border-color: var(--text-muted, #64748B);
}

.aether-consent__btn--accept {
  background: #0095FF;
  border-color: #0095FF;
  color: #FFFFFF;
}

.aether-consent__btn--accept:hover {
  background: #0077CC;
  border-color: #0077CC;
}

/* ---- Preferences modal ---- */

.aether-consent__modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(4px);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  overflow-y: auto;
}

.aether-consent__panel {
  width: 100%;
  max-width: 40rem;
  max-height: min(90vh, 46rem);
  display: flex;
  flex-direction: column;
  border-radius: 1rem;
  border: 1px solid var(--border-subtle, #E5E7EB);
  background: var(--surface-1, #FFFFFF);
  box-shadow: var(--shadow-lg, 0 14px 36px rgba(16, 24, 40, 0.12));
  color: var(--text-secondary, #475569);
}

.aether-consent__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1rem;
}

.aether-consent__title {
  margin: 0 0 0.375rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary, #0F172A);
}

.aether-consent__subtitle {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.aether-consent__subtitle a {
  color: #0095FF;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.aether-consent__close {
  flex: 0 0 auto;
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 0;
  border-radius: 0.375rem;
  color: var(--text-muted, #64748B);
}

.aether-consent__close:hover {
  color: var(--text-primary, #0F172A);
  background: var(--surface-2, #F1F5F9);
}

.aether-consent__close svg {
  width: 1.25rem;
  height: 1.25rem;
}

.aether-consent__body {
  overflow-y: auto;
  padding: 0 1.5rem;
}

.aether-consent__row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.125rem 0;
  border-top: 1px solid var(--border-subtle, #E5E7EB);
}

.aether-consent__row-main {
  flex: 1 1 auto;
  min-width: 0;
}

.aether-consent__row-title {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #0F172A);
}

.aether-consent__row-desc {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.aether-consent__row-note {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted, #64748B);
}

/* ---- Toggle switch ----
   A real checkbox under a styled track, so keyboard and screen reader
   behaviour is the browser's rather than something reimplemented badly. */

.aether-consent__switch {
  flex: 0 0 auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-top: 0.125rem;
}

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

.aether-consent__switch-track {
  display: block;
  width: 2.75rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--border-strong, #CBD5E1);
  transition: background-color 160ms ease;
  pointer-events: none;
}

.aether-consent__switch-track::after {
  content: '';
  display: block;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0.1875rem;
  border-radius: 999px;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.25);
  transform: translateX(0);
  transition: transform 160ms ease;
}

.aether-consent__switch input:checked + .aether-consent__switch-track {
  background: #0095FF;
}

.aether-consent__switch input:checked + .aether-consent__switch-track::after {
  transform: translateX(1.25rem);
}

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

.aether-consent__switch input:disabled + .aether-consent__switch-track {
  background: #0095FF;
  opacity: 0.45;
}

.aether-consent__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.625rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-subtle, #E5E7EB);
}

.aether-consent__footer .aether-consent__btn {
  min-width: 8.5rem;
}

/* ---- Small screens ---- */

@media (max-width: 720px) {
  .aether-consent {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1.25rem;
  }

  .aether-consent__icon {
    display: none;
  }

  .aether-consent__actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .aether-consent__btn {
    width: 100%;
  }

  .aether-consent__footer {
    flex-direction: column-reverse;
  }

  .aether-consent__footer .aether-consent__btn {
    width: 100%;
  }
}

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  .aether-consent,
  .aether-consent__switch-track,
  .aether-consent__switch-track::after {
    transition: none;
  }

  .aether-consent--entering {
    transform: none;
  }
}
