/*
 * TrackPostcode.UK - cookie consent styles
 *
 * Self-contained: every colour is a custom property with a fallback, so the
 * same file drops into any site and takes that site's palette when the
 * variables are defined on :root, or falls back to a neutral dark panel when
 * they are not. The only class it assumes from the host stylesheet is
 * .visually-hidden, which every site in the portfolio has; a fallback
 * definition is included below in case one does not.
 *
 * Accept all and Reject all share one class, .tpc-btn-primary, on purpose:
 * equal prominence is a legal requirement, not a styling choice, and giving
 * the two a shared rule is what stops a later edit quietly favouring one.
 */

.tpc {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10000;
  padding: 12px;
  pointer-events: none;
  font-family: var(--tpc-font, var(--tp-font-sans, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif));
}
.tpc[hidden] { display: none; }

.tpc-box {
  pointer-events: auto;
  max-width: 720px;
  margin: 0 auto;
  background: var(--tpc-bg, #0f1115);
  color: var(--tpc-fg, #f4f6f8);
  border: 1px solid var(--tpc-border, #2a2e36);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  font-size: 15px;
  line-height: 1.5;
}

.tpc-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
}
.tpc-desc,
.tpc-note,
.tpc-id {
  margin: 0 0 12px;
  color: var(--tpc-muted, #b4bcc8);
  font-size: 14px;
}
.tpc-desc a,
.tpc-note a {
  color: var(--tpc-link, #d8ff33);
  text-decoration: underline;
}
.tpc-id code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--tpc-row-bg, #171a20);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--tpc-fg, #f4f6f8);
  word-break: break-all;
}

.tpc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tpc-btn {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 44px;
}
.tpc-btn:focus-visible {
  outline: 2px solid var(--tpc-focus, #d8ff33);
  outline-offset: 2px;
}
.tpc-btn-primary {
  background: var(--tpc-btn-bg, #f4f6f8);
  color: var(--tpc-btn-fg, #0f1115);
  border-color: var(--tpc-btn-bg, #f4f6f8);
}
.tpc-btn-primary:hover { filter: brightness(.92); }
.tpc-btn-text {
  background: transparent;
  color: var(--tpc-fg, #f4f6f8);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding-left: 8px;
  padding-right: 8px;
}
.tpc-btn[hidden] { display: none; }

/* Category rows */
.tpc-rows {
  border-top: 1px solid var(--tpc-border, #2a2e36);
  margin: 4px 0 14px;
}
.tpc-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--tpc-border, #2a2e36);
}
.tpc-row-text { display: flex; flex-direction: column; gap: 2px; }
.tpc-row-text strong { font-size: 15px; }
.tpc-row-text label { cursor: pointer; }
.tpc-row-text span {
  font-size: 13px;
  color: var(--tpc-muted, #b4bcc8);
}
.tpc-always {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--tpc-muted, #b4bcc8);
  padding-top: 4px;
}

/* The switch: a native checkbox restyled, so keyboard and assistive
   behaviour come for free and nothing here has to re-implement them. */
.tpc-switch {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  margin: 2px 0 0;
  border-radius: 13px;
  background: var(--tpc-switch-off, #3a3f49);
  position: relative;
  cursor: pointer;
  transition: background .15s;
}
.tpc-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s;
}
.tpc-switch:checked { background: var(--tpc-switch-on, #1fe3a6); }
.tpc-switch:checked::after { transform: translateX(20px); }
.tpc-switch:focus-visible {
  outline: 2px solid var(--tpc-focus, #d8ff33);
  outline-offset: 2px;
}

/* Small screens: full-width panel, stacked buttons each a full tap target. */
@media (max-width: 560px) {
  .tpc { padding: 8px; }
  .tpc-box { padding: 16px; border-radius: 10px; }
  .tpc-actions .tpc-btn { flex: 1 1 100%; text-align: center; }
}

/* Reduced motion: no switch animation. */
@media (prefers-reduced-motion: reduce) {
  .tpc-switch, .tpc-switch::after { transition: none; }
}

/* Never on paper. */
@media print {
  .tpc { display: none !important; }
}

/* Fallback for sites without a visually-hidden utility. Identical to the
   usual definition, so a host rule wins by cascade order and nothing changes. */
.tpc .visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
