/* ────────────────────────────────────────────────────────────────
   KitchenSync cookie consent banner styles (hand-rolled).

   Targets:
     #ks-cc-banner           - bottom-right card on desktop, bottom sheet on mobile
     #ks-cc-prefs            - centered modal on desktop, full-screen on mobile

   Compliance posture:
     - Equal-weight Accept/Reject (CA dark-pattern compliance)
     - Min 48x48px tap targets on mobile
     - Honors prefers-reduced-motion
     - Honors safe-area insets
     - No flash-of-no-banner (CSS in <head>, not lazy-loaded)
   ──────────────────────────────────────────────────────────────── */

:root {
  --ks-cc-bg: #FFFCF8;
  --ks-cc-text: #1F1F23;
  --ks-cc-text-muted: #5A5A60;
  --ks-cc-border: rgba(0, 0, 0, 0.10);
  --ks-cc-shadow: 0 8px 28px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.06);
  --ks-cc-radius: 14px;

  --ks-cc-btn-primary-bg: #1F1F23;
  --ks-cc-btn-primary-text: #FFFFFF;
  --ks-cc-btn-primary-bg-hover: #3A3A40;

  --ks-cc-btn-secondary-bg: #FFFFFF;
  --ks-cc-btn-secondary-text: #1F1F23;
  --ks-cc-btn-secondary-border: rgba(0, 0, 0, 0.18);
  --ks-cc-btn-secondary-bg-hover: #F5F5F3;

  --ks-cc-toggle-on: #6E5DA0;
  --ks-cc-toggle-off: #C4C4C0;
  --ks-cc-link: #6E5DA0;
}

/* ── Banner (full-width bottom bar on desktop, bottom sheet on mobile) ── */
#ks-cc-banner {
  position: fixed;
  z-index: 9999;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
#ks-cc-banner.ks-cc-show { opacity: 1; transform: translateY(0); }

.ks-cc-card {
  background: var(--ks-cc-bg);
  color: var(--ks-cc-text);
  border-top: 1px solid var(--ks-cc-border);
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.06);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
}

.ks-cc-text-block {
  flex: 1 1 auto;
  min-width: 0;
}

.ks-cc-title {
  font-family: 'Josefin Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 2px;
  color: var(--ks-cc-text);
}
.ks-cc-desc {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ks-cc-text-muted);
  margin: 0;
}
.ks-cc-desc strong { color: var(--ks-cc-text); font-weight: 700; }
.ks-cc-desc .ks-cc-inline-links {
  margin-left: 8px;
  white-space: nowrap;
}
.ks-cc-desc .ks-cc-inline-links a {
  color: var(--ks-cc-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ks-cc-btns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.ks-cc-btn {
  font-family: 'Josefin Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  min-height: 40px;
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.ks-cc-btn:focus-visible {
  outline: 2px solid var(--ks-cc-toggle-on);
  outline-offset: 2px;
}
.ks-cc-btn.primary {
  background: var(--ks-cc-btn-primary-bg);
  color: var(--ks-cc-btn-primary-text);
  border-color: var(--ks-cc-btn-primary-bg);
}
.ks-cc-btn.primary:hover {
  background: var(--ks-cc-btn-primary-bg-hover);
  border-color: var(--ks-cc-btn-primary-bg-hover);
  transform: translateY(-1px);
}
.ks-cc-btn.secondary {
  background: var(--ks-cc-btn-secondary-bg);
  color: var(--ks-cc-btn-secondary-text);
  border-color: var(--ks-cc-btn-secondary-border);
}
.ks-cc-btn.secondary:hover {
  background: var(--ks-cc-btn-secondary-bg-hover);
  border-color: var(--ks-cc-text);
  transform: translateY(-1px);
}

/* Inline policy links live inside .ks-cc-desc on desktop; the older block
   .ks-cc-footer-links style is no longer used in the bottom-bar layout but
   kept in case any legacy markup references it. */

/* ── Preferences modal (centered on desktop, full-screen on mobile) ── */
#ks-cc-prefs {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  opacity: 0;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
#ks-cc-prefs.ks-cc-show { opacity: 1; }

.ks-cc-prefs-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 22, 0.55);
  backdrop-filter: blur(2px);
  cursor: pointer;
}

.ks-cc-prefs-card {
  position: relative;
  background: var(--ks-cc-bg);
  color: var(--ks-cc-text);
  border-radius: var(--ks-cc-radius);
  box-shadow: var(--ks-cc-shadow);
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px 28px 24px;
}
.ks-cc-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ks-cc-text-muted);
  border-radius: 8px;
}
.ks-cc-close:hover { background: var(--ks-cc-btn-secondary-bg-hover); color: var(--ks-cc-text); }
.ks-cc-close:focus-visible { outline: 2px solid var(--ks-cc-toggle-on); outline-offset: 2px; }

.ks-cc-prefs-title {
  font-family: 'Josefin Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 10px;
}
.ks-cc-prefs-intro {
  font-size: 0.9rem;
  line-height: 1.62;
  color: var(--ks-cc-text-muted);
  margin: 0 0 22px;
}
.ks-cc-prefs-intro a { color: var(--ks-cc-link); }
.ks-cc-prefs-intro strong { color: var(--ks-cc-text); }

.ks-cc-section {
  border-top: 1px solid var(--ks-cc-border);
  padding: 16px 0;
}
.ks-cc-section:last-of-type { border-bottom: 1px solid var(--ks-cc-border); margin-bottom: 22px; }
.ks-cc-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.ks-cc-section-title {
  font-family: 'Josefin Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.ks-cc-section-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ks-cc-text-muted);
  margin: 0;
}

/* ── Toggle ──────────────────────────────────────────────────── */
.ks-cc-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.ks-cc-toggle.is-disabled { opacity: 0.55; cursor: not-allowed; }
.ks-cc-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.ks-cc-toggle-track {
  width: 40px;
  height: 22px;
  background: var(--ks-cc-toggle-off);
  border-radius: 999px;
  position: relative;
  transition: background-color 0.18s ease;
}
.ks-cc-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.ks-cc-toggle input:checked + .ks-cc-toggle-track { background: var(--ks-cc-toggle-on); }
.ks-cc-toggle input:checked + .ks-cc-toggle-track .ks-cc-toggle-knob {
  transform: translateX(18px);
}
.ks-cc-toggle input:focus-visible + .ks-cc-toggle-track {
  outline: 2px solid var(--ks-cc-toggle-on);
  outline-offset: 3px;
}

.ks-cc-prefs-btns { margin-top: 20px; }

/* ── Tablet/narrow desktop (stack text and buttons) ───────────── */
@media (max-width: 960px) {
  .ks-cc-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 20px;
  }
  .ks-cc-btns { justify-content: flex-end; }
}

/* ── Mobile (compact bottom bar + full-screen modal) ─────────── */
@media (max-width: 640px) {
  .ks-cc-card {
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    gap: 10px;
  }
  /* Keep the first paint small: title is redundant with the description,
     and the description compresses to two short lines. */
  .ks-cc-title { display: none; }
  .ks-cc-desc { font-size: 0.78rem; line-height: 1.45; }
  .ks-cc-desc .ks-cc-inline-links {
    margin-left: 6px;
    white-space: nowrap;
  }
  #ks-cc-prefs {
    padding: 0;
    align-items: stretch;
  }
  .ks-cc-prefs-card {
    width: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }
  /* Accept / Reject stay side by side; "Set preferences" reads as a
     compact text action beneath them instead of a third full button. */
  .ks-cc-btns { flex-wrap: wrap; gap: 8px; }
  .ks-cc-btn { min-height: 44px; flex: 1 1 auto; }
  .ks-cc-btn[data-act="prefs"] {
    order: 3;
    flex: 1 1 100%;
    min-height: 0;
    padding: 4px;
    background: transparent;
    border-color: transparent;
    color: var(--ks-cc-text-muted);
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  /* The preferences modal keeps stacked full-width buttons. */
  .ks-cc-prefs-btns { flex-direction: column-reverse; }
  .ks-cc-prefs-btns .ks-cc-btn { width: 100%; flex: 0 0 auto; min-height: 44px; }
}

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #ks-cc-banner,
  #ks-cc-prefs,
  .ks-cc-toggle-track,
  .ks-cc-toggle-knob,
  .ks-cc-btn {
    transition: none !important;
  }
}
