/* ─── Legal center layout ─── */
.legal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
}

.legal-topbar {
  position: sticky;
  top: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 32px;
  background: rgba(251, 252, 254, 0.92);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(14px);
}

.legal-topbar__logo {
  width: 128px;
  height: auto;
}

.legal-topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legal-topbar__back {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.legal-topbar__back:hover {
  color: var(--brand-primary);
  border-color: var(--brand-mint);
  background: var(--brand-primary-soft);
}

.legal-topbar__print {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

.legal-topbar__print:hover {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}

/* Hero */
.legal-hero {
  animation: legalBlockIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  padding: 40px 32px 32px;
  background: var(--bg-page);
  background-image: radial-gradient(ellipse 120% 80% at 50% 0%, var(--brand-primary-soft) 0%, rgba(251, 252, 254, 0) 100%);
  border-bottom: 1px solid var(--border-soft);
}

.legal-hero__inner {
  max-width: 1120px;
  margin: 0 auto;
}

.legal-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin-bottom: 16px;
  border-radius: var(--radius-pill);
  background: var(--brand-primary-soft);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-primary-dark);
}

.legal-hero__title {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -1.2px;
  line-height: 1.08;
  margin-bottom: 12px;
}

.legal-hero__desc {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: 640px;
  margin-bottom: 20px;
}

.legal-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legal-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.legal-meta-chip strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Cross-page view transitions (legal center tab switches) */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: 0.28s cubic-bezier(0.4, 0, 1, 1) both legal-page-exit;
}

::view-transition-new(root) {
  animation: 0.42s cubic-bezier(0.22, 1, 0.36, 1) both legal-page-enter;
}

@keyframes legal-page-exit {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-6px); }
}

@keyframes legal-page-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Pill subnav — persist across legal page navigations */
.legal-subnav-wrap {
  position: sticky;
  top: 61px;
  z-index: 105;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border-soft);
  padding: 12px 32px;
  view-transition-name: legal-subnav-persist;
}

::view-transition-group(legal-subnav-persist) {
  animation-duration: 0.38s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

::view-transition-old(legal-subnav-persist),
::view-transition-new(legal-subnav-persist) {
  animation: none;
  mix-blend-mode: normal;
  height: 100%;
  overflow: clip;
}

.legal-subnav {
  position: relative;
  display: flex;
  gap: 4px;
  max-width: 1120px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 4px;
}

.legal-subnav::-webkit-scrollbar { display: none; }

.legal-subnav__indicator {
  position: absolute;
  top: 4px;
  left: 0;
  height: calc(100% - 8px);
  border-radius: var(--radius-pill);
  background: var(--brand-primary);
  box-shadow: 0 4px 14px rgba(11, 37, 69, 0.22);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transform: translateX(0) scale(0.92);
  transition:
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
  will-change: transform, width;
}

.legal-subnav__indicator--visible {
  opacity: 1;
}

.legal-subnav__indicator--instant {
  transition: none;
}

.legal-subnav__link {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  white-space: nowrap;
  transition:
    color 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.legal-subnav__link:hover:not(.legal-subnav__link--active) {
  color: var(--text-primary);
  transform: translateY(-1px);
}

.legal-subnav__link--active {
  color: var(--text-on-dark);
  font-weight: 600;
  transform: translateY(0);
}

.legal-subnav__link--active:hover {
  color: var(--text-on-dark);
  transform: translateY(0);
}

.legal-subnav__link--active .shadcn-icon__svg,
.legal-subnav__link--active .legal-subnav__icon {
  color: var(--text-on-dark);
}

.legal-subnav__link--active .shadcn-icon__svg {
  stroke: currentColor;
}

.legal-subnav__link.legal-subnav__link--leaving {
  pointer-events: none;
}

.legal-subnav__icon {
  display: flex;
  opacity: 0.8;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.legal-subnav__link--active .legal-subnav__icon {
  opacity: 1;
}

.legal-subnav__link:hover .legal-subnav__icon {
  transform: scale(1.05);
}

@keyframes legalBlockIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Two-column layout */
.legal-layout {
  animation: legalBlockIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 48px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 32px 64px;
  align-items: start;
}

.legal-sidebar {
  position: sticky;
  top: 130px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.legal-toc {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.legal-toc__label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.legal-toc__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legal-toc__link {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.4;
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.legal-toc__link:hover {
  background: var(--brand-primary-soft);
  color: var(--text-primary);
}

.legal-toc__link--active {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  border-left-color: var(--brand-accent);
  font-weight: 600;
}

.legal-sidebar__card {
  background: var(--bg-dark);
  border-radius: var(--radius-lg);
  padding: 22px;
  color: var(--text-on-dark);
  background-image: radial-gradient(ellipse 100% 80% at 20% 0%, rgba(79, 163, 227, 0.25) 0%, rgba(10, 26, 51, 0) 100%);
}

.legal-sidebar__card-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

.legal-sidebar__card-text {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-on-dark-muted);
  line-height: 1.55;
  margin-bottom: 14px;
}

.legal-sidebar__card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-mint);
}

.legal-sidebar__card-link:hover {
  text-decoration: underline;
}

/* Main content */
.legal-main {
  min-width: 0;
}

.legal-doc__summary {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 36px;
  padding: 22px 24px;
  background: var(--brand-primary-soft);
  border-radius: var(--radius-lg);
  border: 1px solid var(--brand-mint);
}

.legal-doc__summary-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--brand-primary);
  flex-shrink: 0;
}

.legal-doc__section {
  margin-bottom: 28px;
  padding: 28px 28px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  scroll-margin-top: 140px;
  animation: legalSectionIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.legal-doc__section:nth-child(2) { animation-delay: 0.04s; }
.legal-doc__section:nth-child(3) { animation-delay: 0.08s; }
.legal-doc__section:nth-child(4) { animation-delay: 0.1s; }
.legal-doc__section:nth-child(n + 5) { animation-delay: 0.12s; }

@keyframes legalSectionIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.legal-doc h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.35px;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.legal-doc h3 {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 8px;
}

.legal-doc p,
.legal-doc li {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.legal-doc p { margin-bottom: 14px; }

.legal-doc__fineprint {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-muted);
  padding: 16px 18px;
  background: var(--bg-warm);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
}

.legal-doc ul,
.legal-doc ol {
  margin: 0 0 16px 20px;
}

.legal-doc li { margin-bottom: 8px; }

.legal-doc a {
  color: var(--brand-primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-doc a:hover { color: var(--brand-accent); }

.legal-doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.legal-doc th,
.legal-doc td {
  border: 1px solid var(--border-soft);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

.legal-doc th {
  background: var(--bg-warm);
  color: var(--text-primary);
  font-weight: 600;
}

/* Contact strip at bottom of doc */
.legal-doc__contact {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
  margin-bottom: 32px;
  padding: 24px;
  background: var(--bg-warm);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
}

.legal-doc__contact-item {
  flex: 1;
  min-width: 200px;
}

.legal-doc__contact-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.legal-doc__contact-value {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: var(--brand-primary);
}

/* Footer */
.legal-footer {
  margin-top: auto;
  padding: 28px 32px;
  text-align: center;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-warm);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-muted);
}

.legal-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-bottom: 12px;
}

.legal-footer a {
  color: var(--brand-primary);
  font-weight: 500;
}

.legal-footer a:hover { text-decoration: underline; }

/* Mobile TOC toggle */
.legal-toc-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Cookie preferences */
.cookie-prefs {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 8px;
}

.cookie-pref {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 24px 26px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cookie-pref:hover {
  border-color: var(--brand-mint);
  box-shadow: var(--shadow-card);
}

.cookie-pref__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  align-self: flex-start;
}

.cookie-pref__head {
  flex: 1;
}

.cookie-pref__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.cookie-pref__desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.cookie-pref__badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-warm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cookie-pref__badge--on {
  background: rgba(15, 179, 122, 0.13);
  color: var(--brand-primary-dark);
}

.cookie-toggle {
  position: relative;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
  align-self: center;
  background: var(--border-soft);
  border-radius: var(--radius-pill);
  transition: background 0.2s;
  cursor: pointer;
  border: none;
}

.cookie-toggle--on { background: var(--brand-primary); }

.cookie-toggle--disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cookie-toggle__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s;
}

.cookie-toggle--on .cookie-toggle__knob {
  transform: translateX(22px);
}

.cookie-prefs__panel {
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.cookie-prefs__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cookie-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--brand-primary);
  font-weight: 500;
  margin-top: 16px;
  min-height: 24px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--brand-primary-soft);
}

.cookie-status:empty {
  display: none;
  padding: 0;
  background: none;
}

@media (max-width: 960px) {
  .legal-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 24px;
  }

  .legal-sidebar {
    position: static;
  }

  .legal-toc-toggle {
    display: flex;
  }

  .legal-toc--collapsed .legal-toc__list {
    display: none;
  }

  .legal-sidebar__card {
    display: none;
  }
}

@media (max-width: 640px) {
  .legal-topbar,
  .legal-subnav-wrap,
  .legal-hero,
  .legal-layout {
    padding-left: 20px;
    padding-right: 20px;
  }

  .legal-doc__section {
    padding: 20px 18px 4px;
  }

  .cookie-pref {
    flex-direction: column;
    gap: 16px;
  }

  .cookie-toggle {
    align-self: flex-start;
  }
}

html.legal-navigating .legal-hero,
html.legal-navigating .legal-layout {
  opacity: 0.35;
  transform: translateY(-4px);
  transition:
    opacity 0.28s cubic-bezier(0.4, 0, 1, 1),
    transform 0.28s cubic-bezier(0.4, 0, 1, 1);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }

  .legal-hero,
  .legal-layout,
  .legal-doc__section {
    animation: none !important;
  }

  .legal-subnav__indicator {
    transition: none !important;
  }

  .legal-subnav__link {
    transition: color 0.15s ease !important;
  }

  html.legal-navigating .legal-hero,
  html.legal-navigating .legal-layout {
    opacity: 1;
    transform: none;
  }
}

@media print {
  .legal-topbar__print,
  .legal-subnav-wrap,
  .legal-sidebar,
  .legal-toc-toggle,
  .legal-footer {
    display: none !important;
  }

  .legal-layout {
    display: block;
    padding: 0;
  }

  .legal-doc__section {
    break-inside: avoid;
    border: none;
    padding: 0 0 16px;
  }
}

/* Standalone pages (about, accessibility) */
.legal-layout--single {
  display: block;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 32px 64px;
}

.legal-main--standalone .legal-doc__section h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 10px;
  letter-spacing: -0.4px;
}

.legal-main--standalone .legal-doc__section p,
.legal-main--standalone .legal-doc__section li {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.legal-main--standalone .legal-doc__section ul {
  margin: 0;
  padding-left: 20px;
}

.legal-main--standalone .legal-doc__section + .legal-doc__section {
  margin-top: 28px;
}
