/*!
 * Simply Will — cookie banner + preferences panel styles. v1.0.0 (draft for approval)
 * Namespaced with .sw- so it cannot collide with page styles.
 * Brand tokens match the live site: navy #0A1628 / surface #111D33 / violet-light #9B92FF / violet-pale #C4BFFF.
 * Contrast (checked): navy text on #9B92FF ≈ 6.8:1 · #E6EBF4 on #111D33 ≈ 14:1 · #C4BFFF on #111D33 ≈ 9:1.
 * White text on #7B6FFF (≈3.8:1) is deliberately NOT used — it fails WCAG AA for normal text.
 */
.sw-consent, .sw-prefs {
  --sw-navy: #0A1628;
  --sw-surface: #111D33;
  --sw-surface-2: #152845;
  --sw-violet-l: #9B92FF;
  --sw-violet-p: #C4BFFF;
  --sw-text: #E6EBF4;
  --sw-muted: #B3BDCE;
  --sw-line: rgba(155, 146, 255, .28);
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--sw-text);
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}
.sw-consent *, .sw-prefs * { box-sizing: border-box; }

/* ───── Banner ───── */
.sw-consent {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10000;
  padding: 12px;
  pointer-events: none;                 /* only the card itself is interactive */
  max-height: 100vh;
}
.sw-consent:focus { outline: none; }
.sw-consent__inner {
  pointer-events: auto;
  max-width: 880px;
  margin: 0 auto;
  background: var(--sw-surface);
  border: 1px solid var(--sw-line);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55), 0 0 0 1px rgba(10, 22, 40, .6);
  padding: 18px 20px;
  display: flex;
  gap: 18px 24px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  animation: sw-rise .28s ease-out;
}
.sw-consent__text { flex: 1 1 380px; min-width: 0; }
.sw-consent__title, .sw-prefs__title {
  font-family: 'Outfit', 'DM Sans', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff;
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.25;
}
.sw-consent__desc, .sw-prefs__desc, .sw-cat__text, .sw-prefs__links {
  margin: 0;
  color: var(--sw-text);
  font-size: 14.5px;
}
.sw-consent a, .sw-prefs a { color: var(--sw-violet-p); text-decoration: underline; text-underline-offset: 2px; }
.sw-consent a:hover, .sw-prefs a:hover { color: #fff; }
.sw-consent__actions, .sw-prefs__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 0 1 auto;
}

/* ───── Buttons ───── */
.sw-btn {
  appearance: none;
  -webkit-appearance: none;
  min-height: 46px;                      /* comfortable touch target (WCAG 2.2: ≥ 24px, aim ≥ 44px) */
  padding: 10px 20px;
  border-radius: 12px;
  font: 700 15px/1.2 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
  border: 2px solid var(--sw-violet-l);
  transition: background-color .15s, color .15s, transform .15s;
}
/* Accept and Reject share exactly the same class → identical size, colour, weight and position weight. */
.sw-btn--choice { background: var(--sw-violet-l); color: var(--sw-navy); min-width: 184px; /* wider than either label, so Accept and Reject always render the same width */ }
.sw-btn--choice:hover { background: var(--sw-violet-p); border-color: var(--sw-violet-p); }
.sw-btn--ghost { background: transparent; color: var(--sw-violet-p); border-color: rgba(196, 191, 255, .6); }
.sw-btn--ghost:hover { background: rgba(155, 146, 255, .14); color: #fff; }
.sw-btn:active { transform: translateY(1px); }
.sw-btn:focus-visible,
.sw-switch__input:focus-visible,
.sw-consent a:focus-visible,
.sw-prefs a:focus-visible,
.sw-inline-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px #0A1628;       /* keeps the white ring visible on any background */
}

/* ───── Preferences panel ───── */
.sw-prefs {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 10, 20, .74);
  animation: sw-fade .18s ease-out;
}
.sw-prefs__panel {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--sw-surface);
  border: 1px solid var(--sw-line);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
}
.sw-prefs__panel:focus { outline: none; }
.sw-prefs__title { font-size: 22px; margin-bottom: 8px; }
.sw-cat {
  margin-top: 16px;
  padding: 16px;
  background: var(--sw-surface-2);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
}
.sw-cat__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sw-cat__name { margin: 0; font: 600 16px/1.3 'Outfit', 'DM Sans', system-ui, sans-serif; color: #fff; }
.sw-cat__name label { cursor: pointer; }
.sw-cat__fixed { font-size: 13px; font-weight: 600; color: var(--sw-muted); white-space: nowrap; }
.sw-cat__text { color: var(--sw-muted); font-size: 14px; }
.sw-cat code, .sw-prefs code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; color: var(--sw-violet-p); background: rgba(10, 22, 40, .6);
  padding: 1px 6px; border-radius: 6px; word-break: break-all;
}
.sw-prefs__links { margin-top: 16px; font-size: 14px; }
.sw-prefs__actions { margin-top: 20px; }

/* ───── Switch (native checkbox, so keyboard + screen reader behaviour is built in) ───── */
.sw-switch { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.sw-switch__input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 52px; height: 30px;
  margin: 0;
  border-radius: 999px;
  background: #0A1628;
  border: 2px solid #8090A8;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.sw-switch__input::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #B3BDCE;
  transition: transform .15s, background-color .15s;
}
.sw-switch__input:checked { background: var(--sw-violet-l); border-color: var(--sw-violet-l); }
.sw-switch__input:checked::after { transform: translateX(22px); background: var(--sw-navy); }
.sw-switch__state { min-width: 26px; font-size: 13px; font-weight: 700; color: var(--sw-text); } /* text label so state isn't colour-only */

/* ───── Inline button used inside the Cookie Policy page ───── */
.sw-inline-btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 10px 20px; border-radius: 12px; cursor: pointer;
  font: 700 15px/1.2 'DM Sans', system-ui, sans-serif;
  background: #9B92FF; color: #0A1628; border: 2px solid #9B92FF;
}
.sw-inline-btn:hover { background: #C4BFFF; border-color: #C4BFFF; }

/* ───── Utilities ───── */
.sw-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html.sw-lock { overflow: hidden; }

@keyframes sw-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes sw-fade { from { opacity: 0; } to { opacity: 1; } }

/* ───── Small screens ───── */
@media (max-width: 600px) {
  .sw-consent { padding: 8px; }
  .sw-consent__inner { padding: 16px; border-radius: 14px; max-height: calc(100vh - 16px); }
  .sw-consent__actions { width: 100%; flex-direction: column; }
  .sw-consent__actions .sw-btn, .sw-prefs__actions .sw-btn { width: 100%; }
  .sw-prefs { align-items: flex-end; padding: 8px; }
  .sw-prefs__panel { padding: 20px; border-radius: 16px; max-height: calc(100vh - 16px); }
  .sw-prefs__actions { flex-direction: column; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .sw-consent__inner { padding: 12px 16px; }
  .sw-consent__title { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sw-consent__inner, .sw-prefs { animation: none; }
  .sw-btn, .sw-switch__input, .sw-switch__input::after { transition: none; }
}
@media (forced-colors: active) {
  .sw-btn, .sw-switch__input, .sw-consent__inner, .sw-prefs__panel { border: 2px solid CanvasText; }
  .sw-switch__input:checked { background: Highlight; }
}
@media print { .sw-consent, .sw-prefs { display: none !important; } }
