/* Cookie banner (assets/js/cookie-consent.js), laid out like the Cookiebot banner on ondio.no. */
.twc {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2147483000; /* only matters without <dialog> support; a modal dialog is always on top */
  box-sizing: border-box;
  width: 900px;
  max-width: calc(100% - 32px);
  height: fit-content;
  max-height: calc(100% - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #141414;
  font-size: 15px;
  line-height: 1.5;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .3);
}
.twc:not([open]) { display: none; }
.twc[open] { display: flex; flex-direction: column; }
.twc:focus { outline: none; } /* focused when it opens, see openBanner() */
.twc::backdrop { background: rgba(0, 0, 0, .45); }
.twc a { color: inherit; text-decoration: underline; }
.twc button:focus-visible,
.twc input:focus-visible + .twc-slider { outline: 2px solid #141414; outline-offset: 2px; }

.twc-tabs { display: flex; flex: none; border-bottom: 1px solid #d6d6d6; }
.twc-tab {
  flex: 1;
  margin: 0;
  padding: 14px 8px 11px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.twc-tab[aria-selected="true"] { border-bottom-color: #141414; }

.twc-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.twc-panel { display: none; padding: 20px 24px; }
.twc[data-tab="consent"] .twc-panel-consent,
.twc[data-tab="details"] .twc-panel-details,
.twc[data-tab="about"] .twc-panel-about { display: block; }
.twc-panel p { margin: 0 0 8px; }
.twc-panel p:last-child { margin-bottom: 0; }
.twc-title { margin: 0 0 8px; color: inherit; font-size: 15px; font-weight: 700; line-height: inherit; }

/* Categories: in a row on the Samtykke tab, one below the other with their text on Detaljer. */
.twc-categories {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 0;
  padding: 0;
  border-top: 1px solid #d6d6d6;
  border-bottom: 1px solid #d6d6d6;
  background: #d6d6d6;
  list-style: none;
}
.twc-category { padding: 16px; background: #fff; }
.twc-text { display: none; margin: 8px 0 0; }
.twc[data-tab="details"] .twc-categories { grid-template-columns: 1fr; }
.twc[data-tab="details"] .twc-category { padding: 16px 24px; }
.twc[data-tab="details"] .twc-switch { flex-direction: row; justify-content: space-between; }
.twc[data-tab="details"] .twc-text { display: block; }
.twc[data-tab="about"] .twc-categories { display: none; }

/* The checkbox itself is invisible but still focusable; .twc-slider shows its state. */
.twc-switch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-weight: 700;
  cursor: pointer;
}
.twc-switch input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.twc-slider {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: #8c8c8c;
  transition: background-color .2s;
}
.twc-slider::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.twc-switch input:checked + .twc-slider { background: #141414; }
.twc-switch input:checked + .twc-slider::before { transform: translateX(20px); }
.twc-switch input:disabled + .twc-slider { cursor: not-allowed; }

.twc-buttons { display: flex; flex: none; gap: 12px; padding: 16px 24px; }
.twc-button {
  flex: 1 1 0;
  margin: 0;
  padding: 12px 16px;
  border: 2px solid #141414;
  border-radius: 4px;
  background: #141414;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.twc-button:hover { border-color: #3d3d3d; background: #3d3d3d; }
.twc-button-outline { background: #fff; color: #141414; }
.twc-button-outline:hover { border-color: #141414; background: #f0f0f0; }

@media (max-width: 640px) {
  .twc-panel { padding: 16px; }
  .twc-categories { grid-template-columns: repeat(2, 1fr); }
  .twc[data-tab="details"] .twc-category { padding: 16px; }
  .twc-buttons { flex-direction: column; gap: 8px; padding: 16px; }
  .twc-button { flex: none; }
}
