/* Cookie choice. One layout for every visitor.
   Accept and reject are the same size and weight. The page stays usable.
*/

.cookie-banner,
.cookie-prefs-card,
.cookie-policy {
  box-sizing: border-box;
}
.cookie-banner *,
.cookie-prefs-card *,
.cookie-policy * { box-sizing: border-box; }

.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  top: auto;
  width: auto;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  height: max-content !important;
  min-height: 0 !important;
  max-height: none !important;
  flex: 0 0 auto !important;
  align-self: flex-start !important;
  z-index: 2147483000;
  background: var(--bg-elevated, #2a2724);
  color: var(--text-primary, #f5f2ef);
  border: 1px solid var(--border-default, #403c39);
  border-radius: 14px;
  box-shadow:
    0 18px 50px -16px rgba(0, 0, 0, 0.55),
    0 0 0 1px color-mix(in srgb, var(--text-primary, #f5f2ef) 6%, transparent);
  padding: 18px 20px 16px;
  font-family: var(--font-sans, inherit);
  font-size: 14px;
  line-height: 1.5;
  display: none;
}
.cookie-banner[data-open="1"] { display: block; }
[data-theme="light"] .cookie-banner,
[data-theme="light"] .cookie-prefs-card {
  box-shadow:
    0 16px 40px -18px rgba(28, 25, 23, 0.35),
    0 0 0 1px color-mix(in srgb, var(--text-primary, #000) 8%, transparent);
}

.cookie-banner .cb-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
  height: auto;
  flex: none;
}
.cookie-banner .cb-text { flex: 0 1 auto; min-width: 0; }
.cookie-banner .cb-text h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.cookie-banner .cb-body {
  margin: 0;
  max-width: 68ch;
  color: var(--text-secondary, #d6d3d1);
}
.cookie-banner .cb-text a {
  color: var(--accent, #4d8fd4);
  text-underline-offset: 2px;
}
.cookie-banner .cb-gpc,
.cookie-prefs-card .cb-gpc {
  margin: 10px 0 0;
  max-width: 68ch;
  padding: 1px 0 1px 10px;
  border: 0;
  border-left: 2px solid var(--border-strong, #5a5550);
  border-radius: 0;
  background: none;
  color: var(--text-secondary, #d6d3d1);
  font-size: 13px;
  line-height: 1.45;
}
.cookie-banner .cb-gpc[hidden],
.cookie-prefs-card .cb-gpc[hidden] { display: none; }

.cookie-banner .cb-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.cookie-banner .cb-actions button,
.cookie-prefs-card .cb-foot button {
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  color: inherit;
  text-align: center;
}
.cookie-banner .cb-actions button.cb-choice,
.cookie-prefs-card .cb-foot button.cb-choice {
  min-height: 40px;
  height: auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong, #5a5550);
  background: var(--bg-elevated-2, #353230);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 8px 16px rgba(0, 0, 0, 0.38);
}
.cookie-banner .cb-choice:hover,
.cookie-prefs-card .cb-foot .cb-choice:hover {
  background: color-mix(in srgb, var(--text-primary, #f5f2ef) 8%, var(--bg-elevated-2, #353230));
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 10px 18px rgba(0, 0, 0, 0.42);
}
[data-theme="light"] .cookie-banner .cb-actions button.cb-choice,
[data-theme="light"] .cookie-prefs-card .cb-foot button.cb-choice {
  background: var(--bg-base, #fdfcfc);
  box-shadow:
    0 1px 2px rgba(28, 25, 23, 0.14),
    0 8px 16px rgba(28, 25, 23, 0.12);
}
html.cb-open body.auth-page {
  box-sizing: border-box;
  min-height: 100dvh;
  padding-bottom: calc(var(--oc-cookie-bar, 0px) + 28px);
}
html.cb-open .content-left {
  padding-bottom: calc(var(--oc-cookie-bar, 0px) + 20px) !important;
}
html.cb-open .ld-foot {
  margin-bottom: calc(var(--oc-cookie-bar, 0px) + 24px);
}

.cookie-banner .cb-actions button:focus-visible,
.cookie-prefs-card button:focus-visible,
.cookie-prefs-link:focus-visible {
  outline: 1px solid var(--accent, #4d8fd4);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: no-preference) {
  .cookie-banner .cb-choice:active,
  .cookie-prefs-card .cb-foot .cb-choice:active {
    transform: scale(0.98);
  }
}

@media (max-width: 720px) {
  .cookie-banner {
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    padding: 16px;
  }
  .cookie-banner .cb-actions { grid-template-columns: 1fr; }
  .cookie-banner .cb-text { flex: 0 1 auto; }
  html.cb-open body.auth-page {
    align-items: flex-start;
    overflow-y: auto;
    padding-top: 16px;
    padding-bottom: calc(var(--oc-cookie-bar, 0px) + 24px);
  }
}

/* Preferences */
.cookie-prefs-back {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  background: rgba(12, 10, 9, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.cookie-prefs-back[data-open="1"] { display: flex; }

.cookie-prefs-card {
  background: var(--bg-elevated, #2a2724);
  color: var(--text-primary, #f5f2ef);
  border: 1px solid var(--border-default, #403c39);
  border-radius: 14px;
  width: min(520px, 100%);
  max-height: min(640px, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  padding: 20px 22px 16px;
  box-shadow:
    0 18px 50px -16px rgba(0, 0, 0, 0.55),
    0 0 0 1px color-mix(in srgb, var(--text-primary, #f5f2ef) 6%, transparent);
  font-family: var(--font-sans, inherit);
}
.cookie-prefs-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.cookie-prefs-card .cb-sub {
  margin: 0 0 4px;
  color: var(--text-secondary, #d6d3d1);
  font-size: 13px;
  line-height: 1.45;
}
.cookie-prefs-card .cb-gpc { margin: 12px 0 0; }

.cookie-prefs-card .cb-cats {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
  margin: 12px 0 0;
  padding: 0;
}
.cookie-prefs-card .cat {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--border-muted, #2f2c2a);
  cursor: pointer;
}
.cookie-prefs-card .cat-locked { cursor: default; }
.cookie-prefs-card .cat-info { flex: 1; min-width: 0; }
.cookie-prefs-card .cat-info h4 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.cookie-prefs-card .cat-lock {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted, #a8a29e);
}
.cookie-prefs-card .cat-info p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary, #d6d3d1);
}

.cookie-prefs-card .cat-switch {
  position: relative;
  flex: 0 0 40px;
  width: 40px;
  height: 22px;
}
.cookie-prefs-card .cat-switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.cookie-prefs-card .cat-locked .cat-switch input { cursor: default; }
.cookie-prefs-card .cat-track {
  display: block;
  width: 40px;
  height: 22px;
  border-radius: var(--r-full, 999px);
  background: var(--border-strong, #5a5550);
  border: 0;
  pointer-events: none;
}
.cookie-prefs-card .cat-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-inverse, #1a1816);
  box-shadow: var(--shadow-sm, rgba(0, 0, 0, 0.08) 0 0 0 0.5px);
}
.cookie-prefs-card .cat-switch input:checked + .cat-track {
  background: var(--accent, #4d8fd4);
}
.cookie-prefs-card .cat-switch input:checked + .cat-track::after {
  transform: translateX(18px);
}
.cookie-prefs-card .cat-switch input:focus-visible + .cat-track {
  box-shadow: 0 0 0 3px var(--accent-muted, rgba(77, 143, 212, 0.35));
}
@media (prefers-reduced-motion: no-preference) {
  .cookie-prefs-card .cat-track,
  .cookie-prefs-card .cat-track::after {
    transition: background 0.15s ease, transform 0.15s ease;
  }
}

.cookie-prefs-card .cb-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border-muted, #2f2c2a);
}

.cookie-prefs-link {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cookie-prefs-link:hover { color: var(--text-primary, inherit); }

/* Cookie policy page */
.cookie-policy {
  max-width: 720px;
  margin: 28px auto 72px;
  padding: 0 24px;
  line-height: 1.55;
  color: var(--text-primary);
  font-family: var(--font-sans, inherit);
}
.cookie-policy h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.cookie-policy .dim {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 13px;
}
.cookie-policy h2 {
  margin: 28px 0 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.cookie-policy h3 {
  margin: 18px 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cookie-policy p {
  margin: 0 0 12px;
  max-width: 66ch;
  color: var(--text-secondary, var(--text-primary));
}
.cookie-policy ul {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  border-top: 1px solid var(--border-muted, var(--border-default));
}
.cookie-policy li {
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-muted, var(--border-default));
}
.cookie-policy li code {
  display: inline;
  margin-right: 4px;
  padding: 1px 6px;
  border-radius: var(--r-sm, 6px);
  background: var(--bg-elevated-2, #353230);
  color: var(--text-primary);
  font-size: 13px;
}
.cookie-policy code {
  font-family: var(--font-mono, ui-monospace, monospace);
}
