/**
 * Helmies.fi — Cookie consent banner + preferences panel
 * Pearl-glass material to match the rest of the site.
 */

/* ─── Banner (bottom-anchored on first visit) ─────────────── */
.cc-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 1400;
  max-width: 760px;
  margin: 0 auto;
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.18) 0%, transparent 60%),
    rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.30);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 12px 32px rgba(0, 0, 0, 0.40);
  color: #fff;
  font-family: var(--font-body, sans-serif);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
.cc-banner.is-open { opacity: 1; transform: translateY(0); }

.cc-banner__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  flex-wrap: wrap;
}
.cc-banner__copy { flex: 1 1 320px; min-width: 0; }
.cc-banner__title {
  display: block;
  font-family: var(--font-heading, 'Cormorant Garamond', serif);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-bottom: 0.15rem;
}
.cc-banner__text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
}
.cc-banner__text a {
  color: rgba(192, 132, 252, 0.95);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cc-banner__text a:hover { color: #fff; }
.cc-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex-shrink: 0;
}

/* Buttons — shared between banner and panel. */
.cc-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}
.cc-btn:active { transform: scale(0.97); }
.cc-btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.92);
}
.cc-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.40);
}
.cc-btn--primary {
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.32) 0%, transparent 55%),
    rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -6px 14px rgba(0, 0, 0, 0.30);
}
.cc-btn--primary:hover { border-color: rgba(255, 255, 255, 0.65); }

/* ─── Preferences panel (modal) ───────────────────────────── */
.cc-panel {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.24s ease;
  -webkit-tap-highlight-color: transparent;
}
.cc-panel[hidden] { display: none !important; }
.cc-panel.is-open { opacity: 1; }

.cc-panel__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(48, 32, 80, 0.45) 0%, transparent 70%),
    rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.cc-panel__inner {
  position: relative;
  width: min(560px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.18) 0%, transparent 50%),
    rgba(5, 3, 16, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.20);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 24px 60px rgba(0, 0, 0, 0.50);
  color: #fff;
  font-family: var(--font-body, sans-serif);
  overflow: hidden;
  transform: scale(0.97);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.cc-panel.is-open .cc-panel__inner { transform: scale(1); }

.cc-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.cc-panel__header strong {
  font-family: var(--font-heading, 'Cormorant Garamond', serif);
  font-size: 1.2rem;
  font-weight: 500;
}
.cc-panel__close {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}
.cc-panel__close:hover { background: rgba(255, 255, 255, 0.16); }

.cc-panel__body {
  padding: 0.4rem 0.55rem 0.6rem;
  overflow-y: auto;
}
.cc-panel__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
}

/* Preference rows. */
.cc-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0.6rem;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.cc-row:hover { background: rgba(255, 255, 255, 0.04); }
.cc-row__copy { flex: 1; min-width: 0; }
.cc-row__copy strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.15rem;
}
.cc-row__copy span {
  display: block;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.45;
}

/* Toggle switch. */
.cc-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 22px;
}
.cc-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  margin: 0;
}
.cc-toggle__slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.cc-toggle__slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  transition: transform 0.22s ease, background 0.2s ease;
}
.cc-toggle input:checked + .cc-toggle__slider {
  background: rgba(192, 132, 252, 0.40);
  border-color: rgba(192, 132, 252, 0.65);
}
.cc-toggle input:checked + .cc-toggle__slider::after {
  transform: translateX(16px);
  background: #fff;
}
.cc-toggle.is-locked .cc-toggle__slider {
  background: rgba(192, 132, 252, 0.30);
  border-color: rgba(192, 132, 252, 0.40);
  opacity: 0.7;
  cursor: not-allowed;
}

/* Reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .cc-banner,
  .cc-panel,
  .cc-panel__inner,
  .cc-toggle__slider,
  .cc-toggle__slider::after { transition: none; }
}

/* Mobile tweaks. */
@media (max-width: 600px) {
  .cc-banner__inner { padding: 0.85rem 1rem; }
  .cc-banner__actions { width: 100%; }
  .cc-btn { flex: 1 1 0; }
}
