/* =========================================================================
   PIC Assistance: cookie consent banner (see cookies/cookies.js).
   Uses the site tokens from css/style.css (light + dark follow automatically).
   Bottom-left, leaves the chatbot corner (bottom-right) free.
   z-index 95: above the chat (90), below the mobile menu (99) and header (100).
   ========================================================================= */
.pic-cookie-banner {
  position: fixed;
  left: max(24px, env(safe-area-inset-left));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: min(520px, calc(100vw - 48px - 96px));
  max-height: calc(100vh - var(--header-h) - 48px);
  max-height: calc(100dvh - var(--header-h) - 48px);
  overflow: auto;
  overscroll-behavior: contain;
  z-index: 95;
  box-sizing: border-box;
  padding: var(--space-5);
  background: var(--sheet);
  color: var(--text);
  /* taste-skill-ignore: floating panel edge */ border: 1px solid var(--border);
  border-radius: var(--radius);
  /* taste-skill-ignore: floating panel */ box-shadow: var(--shadow);
  font-family: var(--font);
  font-size: var(--step-small);
  line-height: 1.5;
  animation: pic-cookie-in var(--dur-3, 320ms) var(--ease-out, ease-out);
}
@keyframes pic-cookie-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.pic-cookie-banner[hidden], .pic-cookie-view[hidden] { display: none; }
.pic-cookie-banner *, .pic-cookie-banner *::before, .pic-cookie-banner *::after { box-sizing: border-box; }
.pic-cookie-banner:focus { outline: none; }
.pic-cookie-banner:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.nav-open .pic-cookie-banner { visibility: hidden; }

.pic-cookie-title {
  margin: 0 0 var(--space-2);
  font-size: 1.125rem; font-weight: 750; line-height: 1.25; letter-spacing: -0.015em;
  color: var(--text);
}
.pic-cookie-title:focus { outline: none; }
.pic-cookie-title:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pic-cookie-text { margin: 0 0 var(--space-4); color: var(--text); }
.pic-cookie-short { display: none; }
.pic-cookie-link { color: var(--brand-strong); font-weight: 650; text-underline-offset: 2px; }
.pic-cookie-link:hover { color: var(--brand); }
.pic-cookie-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }

.pic-cookie-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
/* Equal visual weight for every choice (no dark pattern) */
.pic-cookie-btn {
  flex: 1 1 0; min-width: 120px; min-height: 44px;
  margin: 0; padding: 10px 16px;
  border: 0; border-radius: var(--radius);
  background: var(--brand); color: var(--on-brand);
  font: inherit; font-weight: 700; line-height: 1.2;
  cursor: pointer;
  transition: background-color var(--dur-1, 120ms) var(--ease), transform var(--dur-1, 120ms) var(--ease);
}
.pic-cookie-btn:hover { background: var(--brand-strong); }
.pic-cookie-btn:active { transform: var(--press, scale(0.97)); }
.pic-cookie-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.pic-cookie-cats { list-style: none; margin: var(--space-1) 0 var(--space-4); padding: 0; display: grid; gap: var(--space-2); }
.pic-cookie-cat { padding: var(--space-3) var(--space-4); background: var(--surface); border-radius: var(--radius); }
.pic-cookie-cat-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.pic-cookie-cat-name { font-weight: 700; color: var(--text); }
label.pic-cookie-cat-name { cursor: pointer; }
.pic-cookie-cat-desc { margin: var(--space-1) 0 0; color: var(--muted); font-size: 0.875rem; }
.pic-cookie-always { font-size: 0.8125rem; font-weight: 650; color: var(--brand-strong); white-space: nowrap; }

/* Switch */
.pic-cookie-switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.pic-cookie-switch input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer; z-index: 1;
}
.pic-cookie-slider {
  position: absolute; inset: 0;
  background: var(--bg);
  border: 1.5px solid var(--muted);
  border-radius: 999px;
  transition: background-color var(--dur-1, 120ms) var(--ease), border-color var(--dur-1, 120ms) var(--ease);
}
.pic-cookie-slider::after {
  content: ""; position: absolute; top: 3.5px; left: 3.5px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted);
  transition: transform var(--dur-2, 200ms) var(--ease), background-color var(--dur-1, 120ms) var(--ease);
}
.pic-cookie-switch input:checked + .pic-cookie-slider { background: var(--brand); border-color: var(--brand); }
.pic-cookie-switch input:checked + .pic-cookie-slider::after { transform: translateX(20px); background: var(--on-brand); }
.pic-cookie-switch input:focus-visible + .pic-cookie-slider { outline: 3px solid var(--focus); outline-offset: 2px; }

/* "Manage cookies" button in the footer (looks like the other footer links) */
.pic-cookie-manage {
  margin: 0; padding: 0; border: 0; background: none;
  font: inherit; line-height: inherit; text-align: left;
  color: var(--ink); text-decoration: none; cursor: pointer;
}
.pic-cookie-manage:hover { color: var(--teal); text-decoration: underline; }
.pic-cookie-manage:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
/* Inline variant inside running text (privacy page) */
.pic-cookie-manage-inline { color: var(--brand-strong); font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 559.98px) {
  .pic-cookie-banner {
    left: max(12px, env(safe-area-inset-left));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: calc(100vw - 12px - 84px); /* the bottom-right corner stays free for the chat launcher */
    padding: var(--space-3);
    font-size: 0.8125rem;
    line-height: 1.4;
  }
  /* compact on phones: short text, small title, the three choices on one row */
  .pic-cookie-long { display: none; }
  .pic-cookie-short { display: inline; }
  .pic-cookie-title { font-size: 0.9375rem; margin-bottom: var(--space-1); }
  .pic-cookie-text { margin-bottom: var(--space-3); }
  .pic-cookie-actions { flex-wrap: nowrap; gap: 6px; }
  .pic-cookie-btn { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 8px 4px; font-size: 0.8125rem; }
  .pic-cookie-view#pic-cookie-prefs .pic-cookie-actions { flex-wrap: wrap; }
  .pic-cookie-cat { padding: var(--space-3); }
}

@media (prefers-reduced-motion: reduce) {
  .pic-cookie-banner { animation-name: pic-cookie-fade; }
  .pic-cookie-btn:active { transform: none; }
  .pic-cookie-slider, .pic-cookie-slider::after { transition: none; }
}
@keyframes pic-cookie-fade { from { opacity: 0; } to { opacity: 1; } }

@media print { .pic-cookie-banner { display: none !important; } }
