/* AI Digi World: cookie notice, privacy notice and consent checkboxes.
   Quiet by design: a small card in the bottom-left corner on desktop and a slim
   sheet on phones. It never covers the page centre and never blocks scrolling.
   Uses the design tokens from main.css. */

/* Cookie notice ------------------------------------------------------------- */
.cc {
  position: fixed; z-index: 90;
  left: max(20px, env(safe-area-inset-left)); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: min(372px, calc(100vw - 40px));
  animation: cc-in .35s var(--ease) both;
}
.cc[hidden] { display: none; }
@keyframes cc-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.cc-box {
  background: var(--paper); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 18px 40px -18px rgba(15, 27, 61, .35), 0 2px 6px rgba(15, 27, 61, .05);
  padding: 16px 18px 14px;
  max-height: calc(100vh - 40px); overflow-y: auto; overscroll-behavior: contain;
}

.cc-title {
  display: flex; align-items: center; gap: 8px;
  font: 600 .95rem/1.3 var(--font-display); color: var(--ink); margin: 0 0 6px;
}
.cc-title::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--brand); box-shadow: 0 0 0 4px var(--signal-soft);
}
.cc-text { margin: 0; font-size: .84rem; line-height: 1.55; color: var(--muted); }
.cc-text a { color: var(--signal-dark); font-weight: 600; text-underline-offset: 2px; }
.cc-gpc { margin: 8px 0 0; font-size: .8rem; line-height: 1.45; color: var(--green); font-weight: 600; }

/* Category switches (open with "Choose") */
.cc-prefs { margin: 12px 0 0; border-top: 1px solid var(--line); }
.cc-prefs[hidden] { display: none; }
.cc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.cc-row h3 { font: 600 .88rem/1.3 var(--font-body); color: var(--ink); margin: 0 0 1px; }
.cc-row h3 label { cursor: pointer; }
.cc-row p { margin: 0; font-size: .78rem; line-height: 1.45; color: var(--muted); }

.cc-switch {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 38px; height: 22px; border-radius: 999px; margin: 0;
  background: var(--line-strong); position: relative; cursor: pointer;
  transition: background-color .2s var(--ease);
}
.cc-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(15, 27, 61, .3);
  transition: transform .2s var(--ease);
}
.cc-switch:checked { background: var(--signal); }
.cc-switch:checked::after { transform: translateX(16px); }
.cc-switch:disabled { opacity: .5; cursor: not-allowed; }
.cc-switch:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* Buttons: "Reject" and "Accept" look identical (equal choice, no dark pattern);
   "Choose" is a quiet text link. */
.cc-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.cc-actions [hidden] { display: none; }
.cc .cc-btn {
  min-height: 36px; padding: .45em 1em; font-size: .84rem; font-weight: 600;
  border-radius: 999px; box-shadow: none; transform: none;
}
.cc .cc-btn[data-cc-action="reject"],
.cc .cc-btn[data-cc-action="accept"] {
  flex: 1 1 0; background: var(--ink); border-color: var(--ink); color: #FFFFFF;
}
.cc .cc-btn[data-cc-action="reject"]:hover,
.cc .cc-btn[data-cc-action="accept"]:hover { background: var(--signal-dark); border-color: var(--signal-dark); }
.cc .cc-btn[data-cc-action="customise"] {
  order: -1; flex: none; padding-inline: .2em .6em; min-height: 36px;
  background: none; border-color: transparent; color: var(--signal-dark);
  text-decoration: underline; text-underline-offset: 3px;
}
.cc .cc-btn[data-cc-action="customise"]:hover { color: var(--ink); }
.cc .cc-btn[data-cc-action="save"] {
  order: -1; flex: 1 1 100%; background: var(--paper); color: var(--ink); border-color: var(--line-strong);
}
.cc .cc-btn[data-cc-action="save"]:hover { border-color: var(--ink); }
.cc-actions:has([data-cc-action="save"]:not([hidden])) { flex-wrap: wrap; }
.cc .cc-btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* Phones: slim sheet along the bottom edge */
@media (max-width: 640px) {
  .cc { left: 0; right: 0; bottom: 0; width: 100%; }
  .cc-box {
    border-radius: 16px 16px 0 0; border-width: 1px 0 0;
    padding: 14px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 30px -16px rgba(15, 27, 61, .35);
    max-height: 75vh;
  }
  .cc-title { font-size: .9rem; margin-bottom: 4px; }
  .cc-text { font-size: .82rem; }
  .cc-actions { margin-top: 10px; }
  /* Hide the call / WhatsApp buttons only while the sheet is open (they return after a choice) */
  body.cc-open .contact-float { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cc { animation: none; }
  .cc-switch, .cc-switch::after { transition: none; }
}
@media print { .cc { display: none !important; } }

/* Footer "Cookie settings" link (a button styled like the other legal links). */
.legal-links .link-button {
  background: none; border: 0; padding: 0; font: inherit; color: inherit;
  cursor: pointer; text-decoration: inherit;
}
.legal-links .link-button:hover { text-decoration: underline; }

/* Contact / data-request forms: privacy notice + consent checkboxes ---------- */
.privacy-notice {
  margin: 24px 0 18px; padding: 16px 18px;
  background: var(--mist); border-radius: var(--r-sm);
  font-size: .88rem; line-height: 1.6; color: var(--muted);
}
.privacy-notice h3 { font: 600 .95rem/1.3 var(--font-display); color: var(--ink); margin: 0 0 6px; }
.privacy-notice p { margin: 0 0 6px; }
.privacy-notice p:last-child { margin-bottom: 0; }
.privacy-notice strong { color: var(--text); }
.privacy-notice a { color: var(--signal-dark); font-weight: 600; }

.consent-field {
  display: grid; grid-template-columns: 20px 1fr; column-gap: 12px; align-items: start;
  margin: 0 0 12px; font-size: .9rem; line-height: 1.55;
}
.consent-field input[type="checkbox"] {
  width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--signal); cursor: pointer;
}
.consent-field label { cursor: pointer; color: var(--text); }
.consent-field .field-error { grid-column: 2; }
.consent-field input[aria-invalid="true"] { outline: 2px solid #C62828; outline-offset: 2px; }
.consent-required { color: var(--muted); font-size: .88em; }
