/* Cookie consent modal (ck-*): centered dialog on a dimmed, lightly blurred page;
   a bottom sheet on phones. Self-contained (switch styles included) so any page
   can use it with only tokens.css. */
html.ck-locked { overflow: hidden; }
html.ck-locked body { padding-right: var(--ck-gap, 0px); }

.ck-host {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(10, 12, 14, 0.32);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  overscroll-behavior: contain;
  animation: ck-fade 0.25s ease;
}

.ck-modal {
  position: relative;
  width: min(600px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 48px 48px 40px;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 100px -30px rgba(10, 12, 14, 0.45);
  text-align: center;
  animation: ck-pop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
/* The dialog itself takes focus on open (so screen readers announce it); its buttons keep their own rings. */
.ck-modal:focus { outline: none; }

.ck-art { display: flex; justify-content: center; margin-bottom: 20px; }
.ck-art svg { width: 172px; height: auto; }
.ck-art-halo { fill: var(--accent-soft); }
.ck-art-gap { fill: var(--surface); }
.ck-art-spark { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; opacity: 0.7; }

.ck-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.ck-text { font-size: 18px; line-height: 1.4; color: var(--text-2); max-width: 504px; margin: 0 auto; }
.ck-text a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.ck-text a:hover { color: var(--accent-hover); }
.ck-title-left, .ck-text-left { text-align: left; margin-left: 0; }

.ck-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 32px;
}
.ck-choice .btn { width: 100%; min-height: 58px; padding: 0 16px; font-size: 18px; white-space: normal; text-align: center; }

.ck-link {
  margin-top: 16px;
  padding: 8px 10px;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--line-strong);
  cursor: pointer;
  border-radius: var(--radius-btn);
}
.ck-link:hover { text-decoration-color: currentColor; }

/* Settings view */
.ck-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-btn);
}
.ck-nav:hover { color: var(--text); }
.ck-nav-back { display: flex; margin: -16px 0 20px -6px; padding: 6px; }
.ck-nav-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  justify-content: center;
  border: 1px solid var(--line);
}
.ck-modal:has(.ck-nav-close) .ck-title { padding-right: 32px; }

.ck-rows {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
}
.ck-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.ck-row + .ck-row { border-top: 1px solid var(--line); }
.ck-row-title { font-weight: 500; font-size: 17px; }
.ck-row-text { margin-top: 2px; font-size: 15px; line-height: 1.4; color: var(--muted); }
.ck-always { font-size: 14px; font-weight: 500; color: var(--good-text); white-space: nowrap; }

.ck-save { width: 100%; min-height: 58px; margin-top: 24px; font-size: 18px; }
.ck-save + .ck-choice { margin-top: 8px; }

.ck-switch { position: relative; width: 44px; height: 26px; flex: none; }
.ck-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.ck-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background 0.2s; pointer-events: none; }
.ck-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(10, 12, 14, 0.2); transition: transform 0.2s; }
.ck-switch input:checked + span { background: var(--accent-btn); }
.ck-switch input:checked + span::after { transform: translateX(18px); }
.ck-switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

@keyframes ck-fade { from { opacity: 0; } }
@keyframes ck-pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes ck-sheet { from { transform: translateY(100%); } }

/* Phones: bottom sheet, stacked buttons of equal size. */
@media (max-width: 640px) {
  .ck-host { place-items: end stretch; padding: 0; }
  .ck-modal {
    width: 100%;
    max-height: calc(100dvh - 24px);
    padding: 32px 20px calc(20px + env(safe-area-inset-bottom));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: ck-sheet 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .ck-modal::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: var(--line-strong);
  }
  .ck-art { margin-bottom: 12px; }
  .ck-art svg { width: 132px; }
  .ck-title { font-size: 26px; margin-bottom: 12px; }
  .ck-text { font-size: 16px; }
  .ck-choice { grid-template-columns: 1fr; margin-top: 24px; }
  .ck-choice .btn, .ck-save { min-height: 52px; font-size: 17px; }
  .ck-link { margin-top: 8px; }
  .ck-nav-back { margin: -8px 0 12px -6px; }
  .ck-nav-close { top: 14px; right: 14px; }
  .ck-row { padding: 14px 16px; }
  .ck-row-title { font-size: 16px; }
  .ck-row-text { font-size: 14px; }
}

@media (max-height: 560px) and (min-width: 641px) {
  .ck-art { display: none; }
  .ck-modal { padding: 32px; }
}
