/* HFS Samtykke – hvitt/svart, aksentfarge (innstilling) i bryterne. Ingen filter/backdrop-filter (iOS-ytelse). */
:root { --hfs-smt-accent: #4c91e5; }

.hfs-smt[hidden] { display: none !important; }

/* Sentrert boks med mørkt bakteppe (standard) */
.hfs-smt--center {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .55);
  -webkit-overflow-scrolling: touch;
}
/* Kort nederst, uten bakteppe */
.hfs-smt--bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100000;
  display: flex;
  justify-content: center;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
.hfs-smt--bottom .hfs-smt__dialog { pointer-events: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .22); }

.hfs-smt__dialog {
  outline: none; /* får programmatisk fokus ved åpning; ingen ring */
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  background: #f6f6f6; /* tekst og brytere lys grå, knappefeltet hvitt */
  color: #222;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
}

.hfs-smt__body { padding: 28px 32px 22px; background: #f6f6f6; }
.hfs-smt__logo { margin: 0 0 16px; line-height: 0; }
.hfs-smt__logo img { display: block; width: auto; max-width: 320px; height: 40px; object-fit: contain; object-position: left center; } /* 1.0.6: 220/28 → 320/40 (brede ordmerker) */
.hfs-smt__title {
  margin: 0 0 14px;
  font-size: 22px; /* 1.0.4: 24 → 22, 600 → 700 */
  font-weight: 700;
  line-height: 1.2;
  color: #111;
  text-transform: none;
  letter-spacing: 0;
}
.hfs-smt__text p { margin: 0 0 12px; }
.hfs-smt__text p:last-child { margin-bottom: 0; }
.hfs-smt__privacy { margin: 12px 0 0; }
.hfs-smt__link { color: #222; text-decoration: underline; text-underline-offset: 2px; }
.hfs-smt__link:hover { color: var(--hfs-smt-accent); }
button.hfs-smt__link--policy { margin: 0; padding: 0; border: 0; background: none; font: inherit; font-size: 14px; cursor: pointer; box-shadow: none; line-height: inherit; text-transform: none; letter-spacing: 0; }
button.hfs-smt__link--policy:focus-visible { outline: 2px solid var(--hfs-smt-accent); outline-offset: 2px; }
.hfs-smt__sep { margin: 0 6px; color: #999; }
.hfs-smt__names { display: block; margin-top: 2px; font-size: 12px; color: #777; }
.hfs-smt__body[hidden], .hfs-smt__policy[hidden], .hfs-smt__cats[hidden], .hfs-smt__btn[hidden] { display: none !important; }

/* Erklæringen inni banneret */
.hfs-smt__policy { padding: 28px 32px 22px; background: #f6f6f6; outline: none; }
.hfs-smt-policy__title { margin: 0 0 6px; font-size: 22px; font-weight: 600; line-height: 1.2; color: #111; text-transform: none; letter-spacing: 0; }
.hfs-smt-policy__updated { margin: 0 0 14px; font-size: 12px; color: #777; }
.hfs-smt-policy__intro p { margin: 0 0 10px; }
.hfs-smt-policy__cat { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid #e6e6e6; }
.hfs-smt-policy__cat h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: #111; text-transform: none; letter-spacing: 0; }
.hfs-smt-policy__catdesc { margin: 0 0 10px; color: #444; }
.hfs-smt-policy__none { margin: 0; color: #777; font-style: italic; }
.hfs-smt-policy__list { list-style: none; margin: 0; padding: 0; }
.hfs-smt-policy__list li { display: grid; gap: 2px; padding: 8px 0; border-top: 1px dashed #e6e6e6; }
.hfs-smt-policy__list li:first-child { border-top: 0; padding-top: 0; }
.hfs-smt-policy__name { font-weight: 600; color: #111; font-family: Consolas, Menlo, monospace; font-size: 13px; }
.hfs-smt-policy__purpose { color: #222; }
.hfs-smt-policy__meta { font-size: 12px; color: #777; }

/* Erklæringen som egen side ([hfs_samtykke_erklaering]) */
.hfs-smt-policy--page { max-width: 760px; font-size: 15px; line-height: 1.5; }
.hfs-smt-policy--page .hfs-smt-policy__title { font-size: 32px; margin-bottom: 8px; }
.hfs-smt-policy--page .hfs-smt-policy__cat h3 { font-size: 18px; }
.hfs-smt-policy__change { margin: 24px 0 0; }
.hfs-smt-policy__btn { min-width: 220px; }

.hfs-smt__details {
  display: inline-block;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: #111;
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  box-shadow: none;
}
.hfs-smt__details:hover { color: var(--hfs-smt-accent); }
.hfs-smt__details:focus-visible { outline: 2px solid var(--hfs-smt-accent); outline-offset: 2px; }

.hfs-smt__desc { margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid #e6e6e6; }
.hfs-smt__desc dt { margin: 8px 0 2px; font-weight: 600; color: #111; }
.hfs-smt__desc dd { margin: 0; color: #444; }

/* Knapper – like store, like lette å nå */
.hfs-smt__actions {
  position: sticky; /* knappene blir stående nederst når erklæringen scroller */
  bottom: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr; /* venstre: Avvis alle ↔ Lagre innstillinger (skifter med bryterne) · høyre: Godta alle */
  gap: 16px;
  padding: 22px 32px 24px;
  background: #fff;
  border-top: 1px solid #e6e6e6;
}
.hfs-smt__btn {
  margin: 0;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid #111;
  border-radius: 3px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: none;
  transition: background-color .12s ease, color .12s ease;
}
/* 1.0.7: knappene hvitt/svart (godkjent utseende 25.10.2026); aksentfargen brukes på bryterne og fokusringer. */
.hfs-smt__btn--save, .hfs-smt__btn--settings, .hfs-smt__btn--reject { background: #fff; color: #111; }
.hfs-smt__btn--save:hover, .hfs-smt__btn--settings:hover, .hfs-smt__btn--reject:hover { background: #f4f4f4; }
.hfs-smt__btn--accept { background: #111; color: #fff; border-color: #111; }
.hfs-smt__btn--accept:hover { background: #000; }
.hfs-smt__btn:focus-visible { outline: 2px solid var(--hfs-smt-accent); outline-offset: 2px; }

/* «Tilpass valg» – bare på mobil (bryterne er alltid synlige på PC) */
.hfs-smt__cats-toggle { display: none; }

/* Kategorirad med brytere */
.hfs-smt__cats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid #e6e6e6;
  background: #f6f6f6;
}
.hfs-smt__cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 16px 8px 18px;
  border-right: 1px solid #e3e3e3;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
}
.hfs-smt__cat:last-child { border-right: 0; }
.hfs-smt__cat--locked { cursor: default; }
.hfs-smt__cat-label { font-size: 14px; color: #222; text-align: center; }
.hfs-smt__check { position: absolute; opacity: 0; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }

.hfs-smt__switch {
  position: relative;
  display: block;
  width: 56px;
  height: 32px;
  border-radius: 16px;
  background: #cfcfcf;
  transition: background-color .15s ease;
}
.hfs-smt__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .15s ease;
}
.hfs-smt__check:checked + .hfs-smt__switch { background: var(--hfs-smt-accent); }
.hfs-smt__check:checked + .hfs-smt__switch .hfs-smt__knob { transform: translateX(24px); }
.hfs-smt__check:focus-visible + .hfs-smt__switch { outline: 2px solid var(--hfs-smt-accent); outline-offset: 2px; }
.hfs-smt__switch.is-locked { background: var(--hfs-smt-accent); opacity: .4; cursor: default; } /* «Nødvendige»: på, men låst – samme blå, dempet */
.hfs-smt__switch.is-locked .hfs-smt__knob { transform: translateX(24px); }

/* Lenken i footeren */
.hfs-smt-open { cursor: pointer; }

/* Flytende knapp nede til venstre som åpner valget igjen */
.hfs-smt-fab {
  position: fixed;
  left: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 9990;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
  line-height: 0;
  transition: color .12s ease, border-color .12s ease;
}
.hfs-smt-fab:hover, .hfs-smt-fab:focus-visible { color: var(--hfs-smt-accent); border-color: var(--hfs-smt-accent); background: #fff; outline: none; }
html.hfs-smt-open .hfs-smt-fab { display: none; }

@media (max-width: 599px) {
  /* Kompakt bunnark: siden skal synes bak. Bryterne ligger bak «Tilpass valg». */
  .hfs-smt--center { align-items: flex-end; padding: 0; background: rgba(0, 0, 0, .35); }
  .hfs-smt--center .hfs-smt__dialog { max-width: none; max-height: 80vh; max-height: 80dvh; border-radius: 12px 12px 0 0; }
  .hfs-smt__dialog { font-size: 13px; line-height: 1.4; }
  .hfs-smt__body { padding: 16px 18px 12px; }
  .hfs-smt__policy { padding: 16px 18px 12px; }
  .hfs-smt__logo { margin-bottom: 10px; }
  .hfs-smt__logo img { height: 26px !important; max-width: 220px; }
  .hfs-smt__title { font-size: 16px; margin-bottom: 8px; }
  .hfs-smt__text p { margin-bottom: 8px; }
  .hfs-smt__privacy { margin-top: 8px; font-size: 13px; }
  button.hfs-smt__link--policy, .hfs-smt__details { font-size: 13px; }
  .hfs-smt__details { margin-top: 8px; }
  .hfs-smt-policy__title { font-size: 18px; }
  .hfs-smt__actions { grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 18px 12px; }
  .hfs-smt__btn { min-height: 44px; padding: 8px 10px; font-size: 12px; letter-spacing: .03em; }
  /* Mobil: to knapper side om side, som på PC */
  .hfs-smt__cats-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-top: 1px solid #e6e6e6;
    background: #f6f6f6;
    color: #222;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    box-shadow: none;
  }
  .hfs-smt__cats-toggle:focus-visible { outline: 2px solid var(--hfs-smt-accent); outline-offset: -2px; }
  .hfs-smt__chev { width: 8px; height: 8px; border-right: 2px solid #222; border-bottom: 2px solid #222; transform: translateY(-2px) rotate(45deg); transition: transform .15s ease; }
  .hfs-smt--cats-open .hfs-smt__chev { transform: translateY(2px) rotate(-135deg); }
  .hfs-smt--cats-open .hfs-smt__cats-toggle { padding-bottom: 12px; }
  .hfs-smt:not(.hfs-smt--cats-open) .hfs-smt__cats { display: none; }
  .hfs-smt__cats { grid-template-columns: repeat(2, 1fr); }
  .hfs-smt__cat { padding: 12px 8px 14px; gap: 8px; border-bottom: 1px solid #e6e6e6; }
  .hfs-smt__cat:nth-child(2n) { border-right: 0; }
  .hfs-smt__cat:nth-last-child(-n+2) { border-bottom: 0; }
  .hfs-smt__cat-label { font-size: 13px; }
  .hfs-smt__switch { width: 48px; height: 28px; }
  .hfs-smt__knob { width: 22px; height: 22px; }
  .hfs-smt__check:checked + .hfs-smt__switch .hfs-smt__knob, .hfs-smt__switch.is-locked .hfs-smt__knob { transform: translateX(20px); }
  .hfs-smt__cats { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .hfs-smt__policy[hidden] ~ .hfs-smt__cats-toggle { display: flex; }
  .hfs-smt__body[hidden] ~ .hfs-smt__cats-toggle { display: none; } /* erklæringen åpen: ingen bryter-knapp */
}

@media (prefers-reduced-motion: reduce) {
  .hfs-smt__switch, .hfs-smt__knob, .hfs-smt__btn { transition: none; }
}
