/* ==========================================================================
   Room for Hebrew – cookie banner (same on every page; behaviour in js/cookies.js)

   A panel fixed to the bottom of the window, above the page. It is
   not a modal: the page behind stays usable. Colours come from the site's
   tokens, so it follows the light and dark themes. Three button styles,
   in order of weight: solid (accept), soft light blue (manage or save) and
   outlined (reject).
   ========================================================================== */

.cookie-banner {
  position: fixed;
  inset-inline: var(--space-xs); /* full width on a phone; from 36rem up it stays at the left edge */
  bottom: var(--space-xs);
  z-index: 55; /* above the sticky header (50), below the skip link (60) */
  max-width: 34rem;
  max-height: calc(100dvh - 2 * var(--space-xs));
  padding: var(--space-m);
  overflow-y: auto; /* a tall panel (small window, large text) scrolls inside itself */
  color: var(--color-text);
  background-color: var(--color-card);
  border: var(--divider-width) solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lift);
}

/* A little less padding on a phone, so the buttons share one row */
@media (max-width: 29.99em) {
  .cookie-banner {
    padding: var(--space-s);
  }
}

.cookie-banner[hidden],
.cookie-banner [hidden] {
  display: none;
}

.cookie-banner p {
  margin-bottom: var(--space-m);
}

/* Looks like the site's headings */
.cookie-banner .cookie-banner__title {
  margin-bottom: var(--space-xs);
  font-family: var(--font-title);
  font-size: var(--font-size-card-title);
  font-weight: 700;
  line-height: var(--line-height-title);
  color: var(--color-heading);
}

.cookie-banner a {
  color: var(--color-accent);
}

/* The buttons share one row down to a 320px screen: their side padding shrinks with the screen
   (and they wrap only when text is enlarged, so nothing is ever cut off) */
.cookie-banner__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.cookie-banner__buttons .btn {
  padding-inline: clamp(0.5rem, 3vw, 1.5rem);
}

/* --------------------------------------------------------------------------
   Buttons (the base look is .btn in css/base.css)
   -------------------------------------------------------------------------- */
.btn--solid {
  color: var(--color-on-strong);
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}

/* Light blue, mixed from the site's own blue and the panel colour */
.btn--soft {
  color: var(--color-heading);
  background-color: var(--color-bg-tint);
  background-color: color-mix(in srgb, var(--sky) 35%, var(--color-card));
  border-color: transparent;
}

@media (hover: hover) {
  .btn--solid:hover {
    color: var(--color-bg);
    background-color: var(--color-heading);
    border-color: var(--color-heading);
  }

  .btn--soft:hover {
    background-color: color-mix(in srgb, var(--sky) 55%, var(--color-card));
  }
}

/* --------------------------------------------------------------------------
   Switches. A real check box (role="switch") that is hidden but stays
   reachable by keyboard; the track beside it shows the state. The state shows
   by the position of the knob as well as by colour.
   -------------------------------------------------------------------------- */
.cookie-banner__switches {
  display: grid;
  gap: var(--space-xs);
  padding: 0;
  margin: 0 0 var(--space-m);
  list-style: none;
}

.cookie-banner__switch {
  position: relative;
  padding: var(--space-xs) var(--space-s);
  border: var(--divider-width) solid var(--color-border);
  border-radius: var(--radius-control);
}

.cookie-banner__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.cookie-banner__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  font-weight: 700;
  cursor: pointer;
}

.cookie-banner__input:disabled + .cookie-banner__label {
  cursor: default;
}

.cookie-banner__note {
  display: block;
  font-size: var(--font-size-label);
  color: var(--color-text-muted);
}

.cookie-banner__track {
  position: relative;
  flex-shrink: 0;
  width: 3rem;
  height: 1.75rem;
  background-color: var(--color-text-muted);
  border-radius: var(--radius-pill);
}

.cookie-banner__track::after {
  content: "";
  position: absolute;
  inset-block: 0.1875rem;
  inset-inline-start: 0.1875rem;
  width: 1.375rem;
  background-color: var(--color-card);
  border-radius: 50%;
}

.cookie-banner__input:checked + .cookie-banner__label .cookie-banner__track {
  background-color: var(--color-accent);
}

.cookie-banner__input:checked + .cookie-banner__label .cookie-banner__track::after {
  transform: translateX(1.25rem);
}

/* The one switch that cannot be changed looks quieter */
.cookie-banner__input:disabled + .cookie-banner__label .cookie-banner__track {
  opacity: 0.6;
}

.cookie-banner__input:focus-visible + .cookie-banner__label .cookie-banner__track {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .cookie-banner__track,
  .cookie-banner__track::after {
    transition:
      background-color var(--duration-base) ease,
      transform var(--duration-base) ease;
  }
}
