/* Cookie banner styles. Plain CSS, values copied from the site theme so it also works on WordPress. */
/* skov #2C4A2E, creme #F4F6E6, lys #FBFCF1, gul #FFC200 */

.spireli-samtykke {
  position: fixed;
  z-index: 45; /* above header (30) and cart overlay (40), below cart drawer (50) */
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  box-sizing: border-box;
  width: calc(100% - 3rem);
  max-width: 44rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  padding: 1.75rem 2rem 2rem;
  background: #F4F6E6;
  color: #2C4A2E;
  border: 1.5px solid #2C4A2E;
  border-radius: 0;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
}

.spireli-samtykke:focus { outline: none; }

.spireli-samtykke *,
.spireli-samtykke *::before,
.spireli-samtykke *::after { box-sizing: border-box; }

.spireli-samtykke__overskrift {
  margin: 0 0 0.75rem;
  font-family: "Instrument Sans", "Inter", sans-serif;
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.2;
  color: #2C4A2E;
}

.spireli-samtykke__tekst {
  margin: 0;
  font-size: 1.0625rem;
  color: #2C4A2E;
}

.spireli-samtykke__tekst a {
  color: #2C4A2E;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.spireli-samtykke__tekst a:hover { text-decoration-thickness: 2px; }

/* Choice rows, only visible in the expanded view */
.spireli-samtykke__raekker {
  display: none;
  margin: 1.25rem 0 0;
  border-top: 1px solid #2C4A2E;
}

.spireli-samtykke--udvidet .spireli-samtykke__raekker { display: block; }

.spireli-samtykke__raekke {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid #2C4A2E;
}

label.spireli-samtykke__raekke { cursor: pointer; }

.spireli-samtykke__tekster { display: flex; flex-direction: column; gap: 0.125rem; }
.spireli-samtykke__titel { font-weight: 600; font-size: 1.0625rem; }
.spireli-samtykke__besk { font-size: 1.0625rem; }
.spireli-samtykke__altid { font-weight: 600; white-space: nowrap; }

/* Switch: a real checkbox with role=switch, drawn as a track and knob */
.spireli-samtykke__kontakt {
  position: relative;
  flex: none;
  width: 3.25rem;
  height: 1.875rem;
}

.spireli-samtykke__switch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.spireli-samtykke__skyder {
  position: absolute;
  inset: 0;
  background: #FBFCF1;
  border: 1.5px solid #2C4A2E;
  border-radius: 0;
  pointer-events: none;
}

.spireli-samtykke__skyder::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(1.875rem - 9px);
  height: calc(1.875rem - 9px);
  background: #2C4A2E;
}

.spireli-samtykke__switch:checked + .spireli-samtykke__skyder { background: #2C4A2E; }

.spireli-samtykke__switch:checked + .spireli-samtykke__skyder::after {
  left: calc(100% - 3px - (1.875rem - 9px));
  background: #FBFCF1;
}

.spireli-samtykke__switch:focus-visible + .spireli-samtykke__skyder {
  outline: 3px solid #2C4A2E;
  outline-offset: 3px;
}

/* Buttons: same height and weight as the site's .btn */
.spireli-samtykke__knapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.spireli-samtykke__knap {
  box-sizing: border-box;
  height: 3.5rem;
  padding: 0 1.75rem;
  border: 1px solid #2C4A2E;
  border-radius: 0;
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.spireli-samtykke__knap--fyldt { background: #2C4A2E; color: #FBFCF1; }
.spireli-samtykke__knap--fyldt:hover { background: #FFC200; border-color: #FFC200; color: #2C4A2E; }

.spireli-samtykke__knap--ramme { background: transparent; color: #2C4A2E; }
.spireli-samtykke__knap--ramme:hover { background: #FFC200; border-color: #FFC200; color: #2C4A2E; }

.spireli-samtykke__knap:focus-visible {
  outline: 3px solid #2C4A2E;
  outline-offset: 3px;
}

/* View-dependent buttons: "Vælg selv" before expanding, "Gem mit valg" after */
.spireli-samtykke__kun-udvidet { display: none; }
.spireli-samtykke--udvidet .spireli-samtykke__kun-udvidet { display: inline-block; }
.spireli-samtykke--udvidet .spireli-samtykke__kun-lukket { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .spireli-samtykke { animation: spireli-samtykke-ind 0.25s ease-out both; }
  @keyframes spireli-samtykke-ind {
    from { opacity: 0; transform: translate(-50%, 0.75rem); }
    to { opacity: 1; transform: translate(-50%, 0); }
  }
}

/* Phone: full-width bottom sheet, buttons stacked at equal width */
@media (max-width: 639.98px) {
  .spireli-samtykke {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    max-width: none;
    max-height: 85vh;
    max-height: 85dvh;
    padding: 1.25rem 1.25rem max(1.25rem, env(safe-area-inset-bottom));
    border-width: 1.5px 0 0;
    overscroll-behavior: contain;
  }

  .spireli-samtykke__overskrift { font-size: 1.375rem; margin-bottom: 0.5rem; }
  .spireli-samtykke__raekker { margin-top: 1rem; }
  .spireli-samtykke__raekke { min-height: 2.75rem; padding: 0.75rem 0; gap: 1rem; }

  .spireli-samtykke__knapper { flex-direction: column; flex-wrap: nowrap; gap: 0.625rem; margin-top: 1.25rem; }
  .spireli-samtykke__knap { width: 100%; }
  .spireli-samtykke--udvidet .spireli-samtykke__kun-udvidet { display: block; }
}

@media (max-width: 639.98px) and (prefers-reduced-motion: no-preference) {
  .spireli-samtykke { animation-name: spireli-samtykke-ind-mobil; }
  @keyframes spireli-samtykke-ind-mobil {
    from { opacity: 0; transform: translateY(1rem); }
    to { opacity: 1; transform: none; }
  }
}
