/* =========================================================
   Panel
   ========================================================= */
/* Shared panel motion tokens (CSS custom properties) */
:root {
  --dt-panel-dur-in: 250ms;
  --dt-panel-dur-out: 250ms;
  --dt-panel-ease-in: ease-out;
  --dt-panel-ease-out: ease-in;
}

.panel-shell {
  border-radius: 12px;
  position: absolute;
  inset: 16px auto 16px 16px;
  /* space from top/bottom/left, similar to banner */
  width: min(92vw, 420px);
  max-width: 420px;
  height: auto;
  max-height: calc(100% - 32px);
  /* account for top/bottom inset */
  overflow: auto;
  display: flex;
  flex-direction: column;
  will-change: transform;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 6px 0 24px rgba(0, 0, 0, 0.15);
}
.panel-shell p {
  font-size: 14px;
}
.panel-shell .panel-wrapper {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--g-spacing);
  padding: calc(var(--g-spacing) * 1.4);
}
.panel-shell .panel-header h2 {
  font-size: 19px;
  margin-bottom: 0;
}
.panel-shell .panel-intro {
  font-size: 14px;
  line-height: 1.5;
}
.panel-shell .panel-body {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.panel-shell .panel-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-direction: column;
  padding: 0;
}
.panel-shell .panel-footer button {
  font-size: 13px;
  background: transparent;
  color: var(--cc-muted-fg);
  border: 1px solid var(--cc-muted-border);
  border-radius: 500px;
  padding: 6px;
  transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
}
.panel-shell .panel-footer button:hover,
.panel-shell .panel-footer button:focus-visible {
  color: currentColor;
  border-color: currentColor;
  background-color: color-mix(in srgb, currentColor 10%, transparent);
}
.panel-shell .panel-close {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0 !important;
  line-height: 1;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 3;
  pointer-events: auto;
  -webkit-appearance: none;
  -moz-appearance: none;
       appearance: none;
  color: currentColor;
  transition: color 120ms ease, background-color 120ms ease;
}
.panel-shell .panel-close::after {
  content: "";
  position: absolute;
  inset: 4px;
  /* pulls ring inward so it can't be clipped */
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 0 2px currentColor;
  /* optional: add a second inner contrast ring */
  /* box-shadow: inset 0 0 0 2px currentColor, inset 0 0 0 4px color-mix(in srgb, currentColor 25%, transparent); */
}
.panel-shell .panel-close:hover {
  background-color: color-mix(in srgb, currentColor 10%, transparent);
}
.panel-shell .panel-close:focus-visible {
  outline: none;
  background-color: color-mix(in srgb, currentColor 10%, transparent);
}
.panel-shell .panel-close:focus-visible::after {
  opacity: 1;
}

/* Optional: shared open/close micro-animations (match timing in JS) */
@keyframes panelFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes panelFadeOut {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}
/* Shared slide-in/out from left for panels (for cookie + a11y) */
@keyframes dt-slide-in-left {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}
@keyframes dt-slide-out-left {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}
/* Hook to existing state classes from each feature file (you already have these) */
.cookie-consent--opening .panel-shell,
.a11y--opening .panel-shell {
  animation: panelFadeIn var(--dt-panel-dur-in) var(--dt-panel-ease-in) both;
}

.cookie-consent--closing .panel-shell,
.a11y--closing .panel-shell {
  animation: panelFadeOut var(--dt-panel-dur-out) var(--dt-panel-ease-out) both;
}

.panel-option {
  border: 1px solid var(--clr-border);
  padding: 11px;
  border-radius: 11px;
  margin: 0;
}
.panel-option .desc {
  font-size: 13px;
  line-height: 1.4;
}

.panel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.option-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* === Global panel switches (compatible with cookie-consent) ============ */
/* Use on either .panel-switch or .cookie-switch (both are styled) */
.panel-switch {
  display: inline-flex;
  align-items: flex-start;
  gap: 11px;
  cursor: pointer;
}
.panel-switch input[type=checkbox] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.panel-switch span {
  display: block;
}
.panel-switch {
  /* Slider */
}
.panel-switch .panel-switch__slider {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #cfd6dd;
  position: relative;
  display: inline-block;
  transition: background 0.18s ease;
}
.panel-switch .panel-switch__slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.panel-switch {
  /* Checked */
}
.panel-switch input[type=checkbox]:checked + .panel-switch__slider {
  background: #88c0ff;
}
.panel-switch input[type=checkbox]:checked + .panel-switch__slider::after {
  transform: translateX(20px);
}
.panel-switch {
  /* Disabled */
}
.panel-switch input[type=checkbox]:disabled + .panel-switch__slider {
  background: #a9b1b9;
  opacity: 0.7;
}
.panel-switch {
  /* Focus ring (keyboard) */
}
.panel-switch input[type=checkbox]:focus-visible + .panel-switch__slider {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}
.panel-switch {
  /* Label text */
}
.panel-switch .panel-switch__label {
  font-weight: 600;
}
