/* Cookie consent card. Markup: includes/consent.php, behaviour: js/consent.js */

.consent {
  --consent-ink: #2c343c;
  --consent-muted: #5b6670;
  --consent-accent: #3ea28a;
  --consent-line: #e6e9ec;

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  font-family: 'Open Sans', sans-serif;
  color: var(--consent-ink);

  & [hidden] { display: none !important; }
  &[hidden] { display: none; }

  & *,
  & *::before,
  & *::after { box-sizing: border-box; }

  & .consent__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(44 52 60 / 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  &.is-modal .consent__backdrop {
    pointer-events: auto;
  }

  &.is-modal.is-open .consent__backdrop {
    opacity: 1;
  }

  & .consent__card {
    position: absolute;
    left: 24px;
    bottom: 24px;
    width: min(380px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 24px 24px 22px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 18px 48px rgb(44 52 60 / 0.22), 0 2px 8px rgb(44 52 60 / 0.08);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);

    &:focus { outline: none; }
  }

  &.is-open .consent__card {
    opacity: 1;
    transform: translateY(0);
  }

  &.is-modal .consent__card {
    left: 50%;
    top: 50%;
    bottom: auto;
    width: min(520px, calc(100vw - 32px));
    transform: translate(-50%, calc(-50% + 24px));
  }

  &.is-modal.is-open .consent__card {
    transform: translate(-50%, -50%);
  }

  & .consent__view {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  & .consent__view--intro {
    align-items: center;
    text-align: center;
  }

  & .consent__mascot {
    flex: none;
    width: 88px;
    height: 88px;
  }

  & .consent__title {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
    font-weight: 700;
    color: var(--consent-ink);
    text-transform: none;
  }

  & .consent__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--consent-muted);
  }

  & .consent__more {
    margin: 0;
    font-size: 13px;

    & a {
      color: var(--consent-muted);
      text-decoration: underline;

      &:hover { color: var(--consent-ink); }
    }
  }

  & .consent__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  & .consent__view--prefs .consent__actions {
    flex-direction: row;
    flex-wrap: wrap;

    & .consent__btn { flex: 1 1 140px; }
  }

  & .consent__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 20px;
    border: 2px solid var(--consent-ink);
    border-radius: 999px;
    font: 600 15px/1 'Open Sans', sans-serif;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;

    &:active { transform: scale(0.98); }
  }

  & .consent__btn--solid {
    background: var(--consent-ink);
    color: #fff;

    &:hover { background: #1b2026; border-color: #1b2026; }
  }

  & .consent__btn--outline {
    background: #fff;
    color: var(--consent-ink);

    &:hover { background: var(--consent-ink); color: #fff; }
  }

  & .consent__btn--ghost {
    background: #fff;
    border-color: var(--consent-line);
    color: var(--consent-ink);

    &:hover { border-color: var(--consent-ink); }
  }

  & .consent__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  & .consent__item {
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--consent-line);
    border-radius: 16px;
  }

  & .consent__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    cursor: pointer;
  }

  & .consent__row-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--consent-muted);

    & strong {
      font-size: 15px;
      color: var(--consent-ink);
    }
  }

  & .consent__switch {
    appearance: none;
    flex: none;
    position: relative;
    width: 48px;
    height: 28px;
    margin: 0;
    border: 0;
    border-radius: 999px;
    background: #aab2b9;
    cursor: pointer;
    transition: background-color 0.2s ease;

    &::after {
      content: '';
      position: absolute;
      top: 3px;
      left: 3px;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: #fff;
      box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
      transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    &:checked { background: var(--consent-accent); }
    &:checked::after { transform: translateX(20px); }
    &:disabled { opacity: 0.55; cursor: not-allowed; }
  }

  & .consent__details {
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--consent-muted);

    & summary {
      cursor: pointer;
      width: fit-content;
      text-decoration: underline;
    }

    & ul {
      margin: 8px 0 0;
      padding-left: 18px;
    }

    & li { margin: 0 0 4px; }
  }

  & .consent__error {
    margin: 0;
    padding: 10px 14px;
    border-radius: 12px;
    background: #fdecea;
    color: #8a1f17;
    font-size: 13px;
  }

  & :focus-visible {
    outline: 3px solid #1b6fd1;
    outline-offset: 2px;
  }
}

@media (max-width: 580px) {
  .consent .consent__card {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: calc(100vh - 24px);
  }

  .consent.is-modal .consent__card {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    width: auto;
    transform: translateY(24px);
  }

  .consent.is-modal.is-open .consent__card {
    transform: none;
  }

  .consent .consent__mascot {
    width: 72px;
    height: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .consent,
  .consent * {
    transition: none !important;
  }
}

/* Placeholders shown in place of a third-party embed until the visitor accepts it */
.consent-gate {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  overflow: hidden;
  border-radius: 12px;
  background: #eef1f3;
  color: #2c343c;

  &[hidden] { display: none; }

  & img {
    display: block;
    width: 100%;
    height: 324px;
    object-fit: cover;
  }

  & .consent-gate__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    background: rgb(255 255 255 / 0.72);
    text-align: center;

    & p {
      max-width: 34ch;
      margin: 0;
      font-size: 14px;
      line-height: 1.5;
    }
  }

  &.consent-gate--inline {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;

    & p {
      margin: 0;
      font-size: 14px;
      line-height: 1.5;
    }
  }
}

/* Submit buttons stay visible but inert until the required service is accepted */
.is-consent-blocked {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 580px) {
  .consent-gate img { height: 300px; }
}

/* Inline preferences (cookies page): same rows and switches as the popup preferences view */
.consent-center {
  --consent-ink: #2c343c;
  --consent-muted: #5b6670;
  --consent-accent: #3ea28a;
  --consent-yes: #2b8570;
  --consent-line: #e6e9ec;

  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: 'Open Sans', sans-serif;
  color: var(--consent-ink);

  & [hidden] { display: none !important; }

  & *,
  & *::before,
  & *::after { box-sizing: border-box; }

  & .consent__actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
  }

  & .consent__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 26px;
    border: 2px solid var(--consent-ink);
    border-radius: 999px;
    font: 600 15px/1 'Open Sans', sans-serif;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;

    &:active { transform: scale(0.98); }
  }

  & .consent__btn--accept {
    background: var(--consent-yes);
    border-color: var(--consent-yes);
    color: #fff;

    &:hover { background: #1f6a58; border-color: #1f6a58; }
  }

  & .consent__btn--outline {
    background: #fff;
    color: var(--consent-ink);

    &:hover { background: var(--consent-ink); color: #fff; }
  }

  & .consent__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  & .consent__item {
    margin: 0;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--consent-line);
    border-radius: 16px;
  }

  & .consent__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    cursor: pointer;
  }

  & .consent__row-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--consent-muted);

    & strong {
      font-size: 15px;
      color: var(--consent-ink);
    }
  }

  & .consent__switch {
    appearance: none;
    flex: none;
    position: relative;
    width: 48px;
    height: 28px;
    margin: 0;
    border: 0;
    border-radius: 999px;
    background: #aab2b9;
    cursor: pointer;
    transition: background-color 0.2s ease;

    &::after {
      content: '';
      position: absolute;
      top: 3px;
      left: 3px;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: #fff;
      box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
      transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    &:checked { background: var(--consent-accent); }
    &:checked::after { transform: translateX(20px); }
    &:disabled { opacity: 0.55; cursor: not-allowed; }
  }

  & .consent__details {
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--consent-muted);

    & summary {
      cursor: pointer;
      width: fit-content;
      text-decoration: underline;
    }

    & ul {
      margin: 8px 0 0;
      padding-left: 18px;
      list-style: disc;
    }

    & li { margin: 0 0 4px; }
  }

  & .consent-center__status {
    margin: 0;
    padding: 10px 14px;
    border-radius: 12px;
    background: #e6f4ef;
    color: #1d5b46;
    font-size: 14px;
  }

  & :focus-visible {
    outline: 3px solid #1b6fd1;
    outline-offset: 2px;
  }
}
