/* ============================================================================
   NVC Rising — Cookie consent banner + settings dialog
   Built entirely on existing design tokens (tokens.css). Loaded after site.css.
   The markup is injected at runtime by js/site.js (wireConsent()).
   Two pieces:
     #consent-root .consent-bar     — first-visit bottom bar
     #consent-root .consent-dialog  — settings/renew modal (centered + backdrop)
   Hidden by default (display:none); site.js adds .is-open when state is unknown
   or when the user reopens settings.
   ============================================================================ */

#consent-root { font-family: var(--font-body); }

/* ---- hidden until JS decides ------------------------------------------- */
.consent-bar,
.consent-overlay { display: none; }
.consent-bar.is-open,
.consent-overlay.is-open { display: block; }

/* ===== BOTTOM BAR ======================================================== */
.consent-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;               /* above the nav frost layer */
  background: var(--paper);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
/* Signature spectrum hairline along the top edge */
.consent-bar::before {
  content: "";
  position: absolute; top: -1px; left: 0; right: 0; height: 3px;
  background: var(--gradient-spectrum);
}
.consent-bar.is-open { animation: consent-rise .32s cubic-bezier(.22,1,.36,1); }

@keyframes consent-rise {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.consent-bar-inner {
  max-width: 1200px; margin: 0 auto;
  padding: var(--space-5) var(--space-6);
  display: flex; align-items: center; gap: var(--space-6);
  flex-wrap: wrap;
}
.consent-bar-copy { flex: 1 1 360px; min-width: 0; }
.consent-bar-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: 22px; line-height: 1.2; margin: 0 0 6px;
}
.consent-bar-text {
  font-size: 14px; line-height: 1.55; color: var(--ink-soft); margin: 0;
}
.consent-bar-text a { color: var(--brand-ink); text-decoration: underline; }

.consent-actions {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
}
/* Compact buttons — the page .btn padding is generous for a bar */
.consent-actions .btn { padding: 12px 22px; font-size: 12px; }

/* ===== SETTINGS DIALOG (modal) =========================================== */
.consent-overlay {
  position: fixed; inset: 0; z-index: 1001;
  background: rgba(42,34,51,.42);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  padding: var(--space-5);
  overflow-y: auto;
}
.consent-overlay.is-open { animation: consent-fade .2s ease; }
@keyframes consent-fade { from { opacity: 0; } to { opacity: 1; } }

.consent-dialog {
  max-width: 620px; margin: 6vh auto;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 88vh;
}
.consent-dialog-head {
  position: relative;
  padding: var(--space-6) var(--space-6) 0;
}
.consent-dialog-head::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient-spectrum);
}
.consent-dialog-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: 28px; line-height: 1.1; margin: 0 0 var(--space-2);
}
.consent-close {
  position: absolute; top: var(--space-4); right: var(--space-4);
  width: 36px; height: 36px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  color: var(--ink-faint); border-radius: var(--radius-pill);
}
.consent-close:hover { background: var(--paper-2); color: var(--ink); }
.consent-close svg { width: 20px; height: 20px; }

/* ---- tabs --------------------------------------------------------------- */
.consent-tabs {
  display: flex; gap: var(--space-5);
  padding: var(--space-4) var(--space-6) 0;
  border-bottom: 1px solid var(--line);
}
.consent-tab {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint);
  background: none; border: none; cursor: pointer;
  padding: 0 0 var(--space-3); margin-bottom: -1px;
  border-bottom: 2px solid transparent;
}
.consent-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }

.consent-panel { display: none; padding: var(--space-5) var(--space-6);
  overflow-y: auto; }
.consent-panel.is-active { display: block; }
.consent-panel p { font-size: 14px; line-height: 1.6; color: var(--ink-soft); }
.consent-panel a { color: var(--brand-ink); text-decoration: underline; }

/* ---- category rows ------------------------------------------------------ */
.consent-cat {
  display: flex; align-items: flex-start; gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--line);
}
.consent-cat:last-child { border-bottom: none; }
.consent-cat-body { flex: 1 1 auto; min-width: 0; }
.consent-cat-name {
  font-family: var(--font-body); font-weight: 500; font-size: 15px;
  color: var(--ink); margin: 0 0 2px;
}
.consent-cat-desc { font-size: 13px; line-height: 1.5; color: var(--ink-soft); margin: 0; }

/* ---- toggle switch ------------------------------------------------------ */
.consent-switch {
  flex: none; position: relative; width: 44px; height: 24px;
  display: inline-block;
}
.consent-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.consent-switch .track {
  position: absolute; inset: 0; border-radius: var(--radius-pill);
  background: var(--ink-ghost); transition: background .18s ease;
}
.consent-switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: var(--radius-pill);
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform .18s cubic-bezier(.22,1,.36,1);
}
.consent-switch input:checked + .track { background: var(--brand); }
.consent-switch input:checked + .track::after { transform: translateX(20px); }
.consent-switch input:focus-visible + .track { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
/* Necessary is always-on and locked */
.consent-switch.is-locked .track { background: var(--accent-green); opacity: .85; }
.consent-switch.is-locked input { cursor: not-allowed; }

/* ---- dialog footer ------------------------------------------------------ */
.consent-dialog-foot {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}
.consent-dialog-foot .btn { padding: 12px 22px; font-size: 12px; }
.consent-dialog-foot .consent-spacer { flex: 1 1 auto; }

/* ===== RESPONSIVE ======================================================== */
@media (max-width: 760px) {
  .consent-bar-inner { flex-direction: column; align-items: stretch; gap: var(--space-4); padding: var(--space-5); }
  .consent-bar-copy { flex: 0 0 auto; }   /* drop the 360px flex-basis so the column hugs the text */
  .consent-actions { width: 100%; flex-direction: column; align-items: stretch; gap: var(--space-3); }
  .consent-actions .btn { width: 100%; justify-content: center; }
  .consent-dialog { margin: 0 auto; border-radius: var(--radius-md); max-height: 100vh; }
  .consent-overlay { padding: 0; }
  .consent-dialog-foot { flex-direction: column-reverse; align-items: stretch; }
  .consent-dialog-foot .btn { width: 100%; justify-content: center; }
  .consent-dialog-foot .consent-spacer { display: none; }
}

/* Honor reduced-motion: no slide/fade for users who ask to avoid it */
@media (prefers-reduced-motion: reduce) {
  .consent-bar.is-open,
  .consent-overlay.is-open { animation: none; }
  .consent-switch .track,
  .consent-switch .track::after { transition: none; }
}
