/* ============================================================
   AtropaX Security — consent banner
   Loaded on every page. Uses the shared design tokens, which index.html and
   legal.css both declare, so the banner follows the light/dark theme without
   any rules of its own. The only literals left are the drop shadows and the
   modal scrim, which stay dark in both themes on purpose.
   ============================================================ */
.consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: var(--ink-2);
  border-top: 1px solid var(--paper-hair);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  animation: consent-in 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes consent-in {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .consent { animation: none; }
}

.consent__inner {
  max-width: 1200px;
  margin-inline: auto;
  padding: 1.15rem clamp(1.25rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.consent__text { flex: 1 1 auto; min-width: 0; }

.consent__title {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 500;
  margin: 0 0 0.35rem;
}

.consent__body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  font-weight: 300;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--paper-dim);
  max-width: 78ch;
}
.consent__body a {
  color: var(--flame);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.consent__body a:hover { color: var(--flame-hot); }

.consent__actions {
  flex: none;
  display: flex;
  gap: 0.65rem;
}

.consent__btn {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 0.8rem 1.3rem;
  min-height: 44px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

/* Both choices carry equal visual weight — a decline that is harder to
   find than accept is not freely given consent. */
.consent__btn--primary {
  background: var(--flame);
  color: var(--ink);
}
.consent__btn--primary:hover { background: var(--flame-hot); }

.consent__btn--ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--paper-fade);
}
.consent__btn--ghost:hover { border-color: var(--paper); }

/* "Manage cookies" is a third way out, not a third choice — quieter than
   the two decisions, but still a full-size target. */
.consent__btn--link {
  background: transparent;
  color: var(--paper-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding-inline: 0.9rem;
}
.consent__btn--link:hover { color: var(--paper); }

.consent__btn:focus-visible {
  outline: 2px solid var(--flame);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .consent__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding-block: 1rem;
  }
  .consent__actions { flex-wrap: wrap; }
  .consent__btn--ghost, .consent__btn--primary { flex: 1 1 0; }
  .consent__btn--link { flex: 1 0 100%; order: 3; }
  .consent__body { font-size: 0.83rem; }
}

/* ============================================================
   Preferences panel — the second layer, where the vendors are named
   ============================================================ */
body.consent-locked { overflow: hidden; }

.consent-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(6, 9, 14, 0.74);
  overflow-y: auto;
  animation: consent-fade 0.2s ease-out;
}
@keyframes consent-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .consent-panel { animation: none; } }

.consent-panel__card {
  width: min(560px, 100%);
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
  background: var(--ink-2);
  border: 1px solid var(--paper-hair);
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: clamp(1.25rem, 3vw, 1.9rem);
}

.consent-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.consent-panel__title {
  margin: 0;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--paper);
}

.consent-panel__close {
  flex: none;
  width: 34px;
  height: 34px;
  line-height: 1;
  font-size: 1.4rem;
  background: none;
  border: 0;
  border-radius: 3px;
  color: var(--paper-dim);
  cursor: pointer;
}
.consent-panel__close:hover { color: var(--paper); }
.consent-panel__close:focus-visible { outline: 2px solid var(--flame); outline-offset: 2px; }

.consent-panel__intro {
  margin: 0.6rem 0 1.4rem;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  font-weight: 300;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--paper-dim);
}
.consent-panel__intro a {
  color: var(--flame);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.consent-panel__intro a:hover { color: var(--flame-hot); }

.consent-opt {
  padding: 1rem 0;
  border-top: 1px solid var(--paper-hair);
}
.consent-opt:last-of-type { border-bottom: 1px solid var(--paper-hair); }

.consent-opt__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.consent-opt__name {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--paper);
  cursor: pointer;
}

.consent-opt__always {
  flex: none;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
}

.consent-opt__desc {
  margin: 0.5rem 0 0;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  font-weight: 300;
  font-size: 0.83rem;
  line-height: 1.55;
  color: var(--paper-dim);
  max-width: 62ch;
}

/* The checkbox stays a real checkbox — it is simply laid over the drawn
   switch, so keyboard, screen readers and form semantics all still work. */
.consent-opt__switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
}
.consent-opt__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.consent-opt__track {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--paper-hair);
  border: 1px solid var(--paper-fade);
  transition: background 0.2s, border-color 0.2s;
}
.consent-opt__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--paper);
  transition: transform 0.2s, background 0.2s;
}
.consent-opt__input:checked + .consent-opt__track {
  background: var(--flame);
  border-color: var(--flame);
}
.consent-opt__input:checked + .consent-opt__track::after {
  transform: translateX(20px);
  background: var(--ink);
}
.consent-opt__input:focus-visible + .consent-opt__track {
  outline: 2px solid var(--flame);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .consent-opt__track, .consent-opt__track::after { transition: none; }
}

.consent-panel__foot {
  display: flex;
  gap: 0.65rem;
  margin-top: 1.5rem;
}
.consent-panel__foot .consent__btn { flex: 1 1 0; padding-inline: 0.75rem; }

@media (max-width: 560px) {
  .consent-panel { padding: 0; align-items: flex-end; }
  .consent-panel__card {
    width: 100%;
    max-height: 88vh;
    border-radius: 4px 4px 0 0;
    border-inline: 0;
    border-bottom: 0;
  }
  .consent-panel__foot { flex-wrap: wrap; }
  .consent-panel__foot .consent__btn--primary { flex: 1 0 100%; order: -1; }
}

/* Footer entry point for changing the decision later */
.consent-link {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-decoration: none;
  /* sits among <a> siblings in a flex footer — match them: never wrap,
     never be the item the row chooses to compress */
  white-space: nowrap;
  flex: none;
}
.consent-link:hover { text-decoration: underline; }
