/*
 * Stryvel Cookie Consent — banner, settings modal, policy table.
 * Themeable via --scc-* custom properties (neutral fallbacks). A client theme overrides them, e.g.
 *   :root { --scc-accent: var(--c-blue); --scc-accent-fg: #fff; }
 * The plugin never references client token names directly.
 */

.scc {
  --scc-bg: #ffffff;
  --scc-fg: #16181b;
  --scc-muted: #565b61;
  --scc-border: #e3e5e8;
  --scc-accent: #16181b;
  --scc-accent-fg: #ffffff;
  --scc-accent-hover: #2c2f34;
  --scc-radius: 14px;
  --scc-radius-sm: 9px;
  --scc-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  --scc-overlay: rgba(6, 10, 14, 0.55);
  --scc-focus: #2f6fb0;
  --scc-gap: 14px;
  --scc-pad: clamp(18px, 3vw, 26px);
  --scc-max: 560px;

  position: fixed;
  inset: 0;
  z-index: 2147483000; /* above site chrome */
  display: block;
  font-family: inherit;
  color: var(--scc-fg);
}
.scc[hidden] { display: none; }

/* Overlay only backs the settings modal (banner leaves the page usable). */
.scc__overlay {
  position: fixed;
  inset: 0;
  background: var(--scc-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.scc.is-modal .scc__overlay { opacity: 1; visibility: visible; }

/* ---- Banner (first layer): bottom-left card, non-blocking ---- */
.scc__banner {
  position: fixed;
  left: clamp(12px, 3vw, 28px);
  right: auto;
  bottom: clamp(12px, 3vw, 28px);
  width: min(var(--scc-max), calc(100vw - 24px));
  background: var(--scc-bg);
  border: 1px solid var(--scc-border);
  border-radius: var(--scc-radius);
  box-shadow: var(--scc-shadow);
  padding: var(--scc-pad);
}
.scc__banner[hidden] { display: none; }

/* ---- Settings modal (second layer): centered ---- */
.scc__modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(640px, calc(100vw - 24px));
  max-height: min(86vh, 760px);
  overflow-y: auto;
  background: var(--scc-bg);
  border: 1px solid var(--scc-border);
  border-radius: var(--scc-radius);
  box-shadow: var(--scc-shadow);
  padding: var(--scc-pad);
}
.scc__modal[hidden] { display: none; }

.scc__title { margin: 0 0 8px; font-size: 1.15rem; line-height: 1.25; font-weight: 700; }
.scc__body,
.scc__intro { margin: 0; color: var(--scc-muted); font-size: 0.95rem; line-height: 1.55; }
.scc__policy { color: var(--scc-accent); text-decoration: underline; }
.scc__modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.scc__intro { margin-top: 6px; }

.scc__close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--scc-muted);
  font-size: 1.7rem;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: var(--scc-radius-sm);
}
.scc__close:hover { color: var(--scc-fg); }

/* ---- Actions: Accept and Reject share --primary → identical weight (no dark pattern) ---- */
.scc__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: var(--scc-gap);
}
.scc__btn {
  appearance: none;
  flex: 1 1 auto;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: var(--scc-radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.scc__btn--primary { background: var(--scc-accent); color: var(--scc-accent-fg); border-color: var(--scc-accent); }
.scc__btn--primary:hover { background: var(--scc-accent-hover); border-color: var(--scc-accent-hover); }
.scc__btn--ghost { background: transparent; color: var(--scc-fg); border-color: var(--scc-border); flex: 0 1 auto; }
.scc__btn--ghost:hover { border-color: var(--scc-fg); }

/* ---- Categories + toggle switches ---- */
.scc__cats { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.scc__cat { border: 1px solid var(--scc-border); border-radius: var(--scc-radius-sm); padding: 14px 16px; }
.scc__cat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scc__cat-label { font-weight: 700; font-size: 0.98rem; }
.scc__cat-desc { margin: 8px 0 0; color: var(--scc-muted); font-size: 0.9rem; line-height: 1.5; }
.scc__always { color: var(--scc-muted); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

.scc__switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.scc__switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.scc__slider {
  width: 44px; height: 26px; border-radius: 999px;
  background: var(--scc-border); position: relative; transition: background-color 0.15s ease; flex: none;
}
.scc__slider::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}
.scc__switch input:checked + .scc__slider { background: var(--scc-accent); }
.scc__switch input:checked + .scc__slider::after { transform: translateX(18px); }
.scc__switch input:focus-visible + .scc__slider { outline: 2px solid var(--scc-focus); outline-offset: 2px; }
.scc__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Persistent revoke trigger (theme positions it). */
.scc-revoke {
  appearance: none; background: transparent; border: 0; padding: 0; margin: 0;
  color: inherit; font: inherit; cursor: pointer; text-decoration: underline;
}

/* Visible keyboard focus everywhere. */
.scc__btn:focus-visible,
.scc__close:focus-visible,
.scc__policy:focus-visible,
.scc-revoke:focus-visible { outline: 2px solid var(--scc-focus); outline-offset: 2px; }

/* ---- Cookie policy table ([stryvel_cookie_table]) ---- */
.scc-table__cat { margin: 22px 0 8px; font-size: 1.05rem; }
.scc-table__scroll { overflow-x: auto; }
.scc-table__table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.scc-table__table th,
.scc-table__table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--scc-border, #e3e5e8); vertical-align: top; }
.scc-table__table th { font-weight: 700; white-space: nowrap; }
.scc-table__table code { font-size: 0.86em; }

@media (max-width: 640px) {
  .scc__banner { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .scc__btn { flex: 1 1 100%; }
  .scc__btn--ghost { flex: 1 1 100%; order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  .scc *, .scc__overlay { transition: none !important; }
}
