/**
 * Cookie consent banner + customise modal.
 *
 * Two surfaces:
 *   .cv-cookie-banner — slim bottom bar shown on first visit
 *   .cv-cookie-modal  — center modal opened from "Customise" or footer link
 *
 * Uses CSS custom properties from the Astro tokens (--paper, --bordeaux,
 * etc.) where available, with hard-coded fallbacks for Odoo-served pages
 * that don't include the Astro tokens stylesheet. Fallbacks match the
 * Cave Moderne palette, same pattern as age_gate.css.
 *
 * Compliance design (per APD checklist Oct 2023 + EDPB Cookie Banner
 * Taskforce report Jan 2023): the three first-layer buttons (Refuse /
 * Customise / Accept) have identical visual weight — same size, same
 * font weight, same accent treatment. No dark-pattern nudge toward
 * Accept.
 */

/* ============== BANNER ============== */

.cv-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9000; /* below age gate (10000), above page chrome */
  background: var(--paper, #faf6ef);
  color: var(--ink, #1a1614);
  font-family: var(--font-body, 'Inter', system-ui, -apple-system, sans-serif);
  border-top: 2px solid var(--gold, #c9a14a);
  transform: translateY(100%);
  transition: transform 0.25s ease;
  box-shadow: 0 -8px 32px rgba(58, 46, 38, 0.18);
}

.cv-cookie-banner--visible {
  transform: translateY(0);
}

.cv-cookie-banner__inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px clamp(16px, 3vw, 32px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}

.cv-cookie-banner__copy {
  min-width: 0;
}

.cv-cookie-banner__title {
  font-family: var(--font-display, 'Cormorant Garamond', Georgia, serif);
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--bordeaux, #7b2c3b);
}

.cv-cookie-banner__body {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted, #6b625a);
  max-width: 72ch;
}

.cv-cookie-banner__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cv-cookie-banner__btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border, #d9cfbc);
  background: #fff;
  color: var(--ink, #1a1614);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 10px 18px;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}

.cv-cookie-banner__btn:hover {
  background: var(--linen, #f3ede2);
  border-color: var(--bordeaux, #7b2c3b);
  color: var(--bordeaux, #7b2c3b);
}

@media (max-width: 720px) {
  .cv-cookie-banner__inner {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .cv-cookie-banner__actions {
    justify-content: stretch;
  }
  .cv-cookie-banner__btn {
    flex: 1 1 0;
    text-align: center;
    min-width: 100px;
  }
}

/* ============== MODAL ============== */

html.cv-cookie-modal-open {
  overflow: hidden;
}

.cv-cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 10500; /* above the cookie banner, above the age gate too */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: var(--font-body, 'Inter', system-ui, -apple-system, sans-serif);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cv-cookie-modal--visible {
  opacity: 1;
}

.cv-cookie-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 22, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cv-cookie-modal__panel {
  position: relative;
  z-index: 1;
  background: var(--paper, #faf7f2);
  padding: 36px clamp(20px, 4vw, 40px);
  max-width: 560px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-top: 4px solid var(--bordeaux, #a8262d);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
}

.cv-cookie-modal__panel h2 {
  font-family: var(--font-display, 'Cormorant Garamond', Georgia, serif);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink, #1a1614);
  margin: 0 0 12px;
}

.cv-cookie-modal__intro {
  margin: 0 0 24px;
  color: var(--muted, #6b625a);
  line-height: 1.55;
  font-size: 0.92rem;
}

/* ----- categories ----- */

.cv-cookie-modal__cats {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 28px;
  border-top: 1px solid var(--border, #e4ddd0);
}

.cv-cookie-modal__cat {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid var(--border, #e4ddd0);
  cursor: pointer;
}

.cv-cookie-modal__cat--locked {
  cursor: not-allowed;
  opacity: 0.85;
}

.cv-cookie-modal__cat-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cv-cookie-modal__cat-name {
  font-weight: 600;
  color: var(--ink, #1a1614);
  font-size: 0.94rem;
}

.cv-cookie-modal__cat-body {
  color: var(--muted, #6b625a);
  font-size: 0.84rem;
  line-height: 1.5;
}

/* ----- toggle (custom-styled checkbox) ----- */

.cv-cookie-modal__toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}

.cv-cookie-modal__toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.cv-cookie-modal__toggle input:disabled {
  cursor: not-allowed;
}

.cv-cookie-modal__pill {
  position: absolute;
  inset: 0;
  background: var(--border, #e4ddd0);
  border-radius: 11px;
  transition: background 0.15s ease;
}

.cv-cookie-modal__pill::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--paper, #faf7f2);
  border-radius: 50%;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.cv-cookie-modal__toggle input:checked ~ .cv-cookie-modal__pill {
  background: var(--bordeaux, #a8262d);
}

.cv-cookie-modal__toggle input:checked ~ .cv-cookie-modal__pill::after {
  transform: translateX(18px);
}

.cv-cookie-modal__toggle input:focus-visible ~ .cv-cookie-modal__pill {
  outline: 2px solid var(--gold, #c9a14a);
  outline-offset: 2px;
}

/* ----- modal actions ----- */

.cv-cookie-modal__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.cv-cookie-modal__btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 12px 22px;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  background: var(--bordeaux, #a8262d);
  color: var(--paper, #faf7f2);
}

.cv-cookie-modal__btn:hover {
  background: var(--bordeaux-dark, #8b1d23);
}

.cv-cookie-modal__btn--ghost {
  background: transparent;
  color: var(--ink, #1a1614);
  border: 1px solid var(--border, #e4ddd0);
}

.cv-cookie-modal__btn--ghost:hover {
  background: var(--paper-2, #f1ece4);
  color: var(--ink, #1a1614);
}

@media (max-width: 480px) {
  .cv-cookie-modal__panel {
    padding: 28px 20px;
  }
  .cv-cookie-modal__panel h2 {
    font-size: 1.35rem;
  }
  .cv-cookie-modal__actions {
    flex-direction: column-reverse;
  }
  .cv-cookie-modal__btn {
    width: 100%;
    text-align: center;
  }
}
