/* ================================================================
   BEYOND MADEIRA — Cookie consent
   Vanilla CSS, no deps. Tokens from style.css.
   Reference aesthetic: geneve.com — restrained, single bottom bar,
   no fluff. Three-button flow (Accept / Customise / Reject) for
   GDPR compliance, plus per-category preferences panel.
   ================================================================ */

:root {
  /* Local fallbacks so the banner still renders if loaded before style.css */
  --bm-cc-bg:      #ffffff;
  --bm-cc-text:    #1a1a1a;
  --bm-cc-muted:   #555555;
  --bm-cc-border:  #e0e0e0;
  --bm-cc-primary: #0e5259;
  --bm-cc-primary-hover: #0a3d42;
  --bm-cc-shadow:  0 -8px 32px rgba(0,0,0,0.12);
}

/* ---- Base banner (bottom) ---- */
.bm-cc {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  background: var(--bg, var(--bm-cc-bg));
  color: var(--text, var(--bm-cc-text));
  border-top: 1px solid var(--border, var(--bm-cc-border));
  box-shadow: var(--bm-cc-shadow);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.bm-cc[data-state="open"]   { transform: translateY(0); }
.bm-cc[data-state="closed"] { transform: translateY(100%); pointer-events: none; }

.bm-cc__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.bm-cc__message {
  flex: 1 1 320px;
  min-width: 240px;
  margin: 0;
  font-size: 0.875rem;
  color: var(--text, var(--bm-cc-text));
}
.bm-cc__message a {
  color: var(--primary, var(--bm-cc-primary));
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bm-cc__message a:hover { color: var(--primary-dark, var(--bm-cc-primary-hover)); }

/* ---- Buttons ---- */
.bm-cc__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.bm-cc__btn {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  padding: 12px 20px;
  border-radius: var(--radius, 12px);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
  white-space: nowrap;
}
.bm-cc__btn:focus-visible {
  outline: 2px solid var(--primary, var(--bm-cc-primary));
  outline-offset: 2px;
}

.bm-cc__btn--primary {
  background: var(--primary, var(--bm-cc-primary));
  color: #ffffff;
  border-color: var(--primary, var(--bm-cc-primary));
}
.bm-cc__btn--primary:hover {
  background: var(--primary-dark, var(--bm-cc-primary-hover));
  border-color: var(--primary-dark, var(--bm-cc-primary-hover));
}

.bm-cc__btn--ghost {
  background: transparent;
  color: var(--text, var(--bm-cc-text));
  border-color: var(--border, var(--bm-cc-border));
}
.bm-cc__btn--ghost:hover {
  background: var(--bg-alt, #f8f8f6);
  border-color: var(--text-secondary, var(--bm-cc-muted));
}

.bm-cc__btn--text {
  background: transparent;
  color: var(--text-secondary, var(--bm-cc-muted));
  border-color: transparent;
  padding: 12px 12px;
}
.bm-cc__btn--text:hover {
  color: var(--text, var(--bm-cc-text));
}

/* ---- Mobile (375px) ---- */
@media (max-width: 600px) {
  .bm-cc__inner {
    padding: 16px;
    gap: 12px;
    flex-direction: column;
    align-items: stretch;
  }
  .bm-cc__message {
    flex: 1 1 auto;
    font-size: 0.8125rem;
  }
  .bm-cc__actions {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }
  .bm-cc__btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 0.9375rem;
  }
}

/* =================================================================
   Preferences panel (modal)
   Opens when user clicks "Customise"
   ================================================================= */

.bm-cc-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 240ms cubic-bezier(0.4, 0, 0.2, 1);
}
.bm-cc-modal[data-state="open"] {
  display: flex;
  opacity: 1;
}

.bm-cc-modal__panel {
  background: var(--bg, var(--bm-cc-bg));
  color: var(--text, var(--bm-cc-text));
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  border-radius: 16px 16px 0 0;
  padding: 28px 28px 24px;
  font-family: 'Montserrat', sans-serif;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(0.4, 0, 0.2, 1);
}
.bm-cc-modal[data-state="open"] .bm-cc-modal__panel {
  transform: translateY(0);
}

.bm-cc-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.bm-cc-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--title, #111111);
  margin: 0;
  line-height: 1.3;
}
.bm-cc-modal__close {
  background: transparent;
  border: 0;
  padding: 4px;
  cursor: pointer;
  color: var(--text-secondary, var(--bm-cc-muted));
  border-radius: 8px;
  line-height: 0;
}
.bm-cc-modal__close:hover { color: var(--text, var(--bm-cc-text)); }
.bm-cc-modal__close:focus-visible {
  outline: 2px solid var(--primary, var(--bm-cc-primary));
  outline-offset: 2px;
}

.bm-cc-modal__intro {
  font-size: 0.875rem;
  color: var(--text-secondary, var(--bm-cc-muted));
  margin: 0 0 20px;
  line-height: 1.55;
}

.bm-cc-modal__list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bm-cc-modal__item {
  border: 1px solid var(--border, var(--bm-cc-border));
  border-radius: var(--radius, 12px);
  padding: 16px;
  background: var(--bg, var(--bm-cc-bg));
}
.bm-cc-modal__item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.bm-cc-modal__item-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--title, #111111);
  margin: 0;
}
.bm-cc-modal__item-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary, var(--bm-cc-muted));
  margin: 0;
  line-height: 1.5;
}

/* ---- Toggle switch ---- */
.bm-cc-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.bm-cc-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.bm-cc-toggle__slider {
  position: absolute;
  inset: 0;
  background: #cfcfcf;
  border-radius: 99px;
  transition: background-color 200ms ease;
  cursor: pointer;
}
.bm-cc-toggle__slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 200ms ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.bm-cc-toggle input:checked + .bm-cc-toggle__slider {
  background: var(--primary, var(--bm-cc-primary));
}
.bm-cc-toggle input:checked + .bm-cc-toggle__slider::before {
  transform: translateX(18px);
}
.bm-cc-toggle input:disabled + .bm-cc-toggle__slider {
  background: var(--primary, var(--bm-cc-primary));
  opacity: 0.55;
  cursor: not-allowed;
}
.bm-cc-toggle input:focus-visible + .bm-cc-toggle__slider {
  outline: 2px solid var(--primary, var(--bm-cc-primary));
  outline-offset: 2px;
}

.bm-cc-modal__footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ---- Mobile modal ---- */
@media (max-width: 600px) {
  .bm-cc-modal__panel {
    padding: 24px 20px 20px;
    max-height: calc(100vh - 16px);
  }
  .bm-cc-modal__title { font-size: 1.125rem; }
  .bm-cc-modal__footer {
    flex-direction: column;
  }
  .bm-cc-modal__footer .bm-cc__btn {
    width: 100%;
  }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .bm-cc,
  .bm-cc-modal,
  .bm-cc-modal__panel,
  .bm-cc__btn,
  .bm-cc-toggle__slider,
  .bm-cc-toggle__slider::before {
    transition: none !important;
  }
}
