/* ── Smooth scroll ── */
html.legal-html {
  scroll-behavior: smooth;
  /* Prevent bare void flash during page transitions */
  background: var(--void);
}

/* Scroll actually happens on body (overflow-y: auto !important per page),
   so this is the real smooth-scroll fix */
body.page-scrollable {
  scroll-behavior: smooth;
  background:
    radial-gradient(circle at 14% 18%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 28%),
    radial-gradient(circle at 82% 16%, color-mix(in srgb, #818cf8 8%, transparent), transparent 24%),
    var(--void);
}

body.page-scrollable .theme-toggle {
  position: fixed;
}

/* ── Page enter / leave animations ── */
body.page-scrollable.legal-body {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}
body.page-scrollable.legal-body.legal-page-ready {
  opacity: 1;
  transform: translateY(0);
}
body.page-scrollable.legal-body.legal-page-leaving {
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.16s ease, transform 0.18s ease;
}
@media (prefers-reduced-motion: reduce) {
  body.page-scrollable.legal-body,
  body.page-scrollable.legal-body.legal-page-leaving {
    transition: none;
    transform: none;
  }
}

/* ── Shell layout: sidebar + content ── */
.legal-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.legal-nav {
  width: 250px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 34px 0 40px 30px;
  border-right: 1px solid var(--dim);
  display: flex;
  flex-direction: column;
  gap: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--void) 94%, transparent), color-mix(in srgb, var(--panel) 32%, transparent));
}
.legal-nav::-webkit-scrollbar { display: none; }

.legal-nav-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Counteract the nav's 30px left padding so the logo sits centered in the full 250px column */
  width: calc(100% + 30px);
  margin-left: -30px;
  gap: 14px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.10em;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 36px;
  transition: opacity 0.15s;
}
.legal-nav-logo:hover {
  opacity: 0.88;
}
.legal-nav-logo svg {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.legal-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--t3);
  text-decoration: none;
  padding: 8px 0;
  margin-bottom: 14px;
  transition: color 0.15s;
}
.legal-nav-back:hover { color: var(--accent); }

.legal-nav-divider {
  height: 1px;
  background: var(--dim);
  margin: 14px 24px 18px 0;
}

.legal-nav-group {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 10px;
  margin-top: 10px;
}

.legal-nav-link {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--t2);
  text-decoration: none;
  padding: 7px 0;
  border-radius: 0;
  transition: color 0.13s, transform 0.13s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 20px;
}
.legal-nav-link:hover {
  color: var(--t1);
  transform: translateX(2px);
}
.legal-nav-link.active {
  color: var(--accent);
  font-weight: 700;
}

/* ── Content area ── */
.legal-content {
  flex: 1;
  min-width: 0;
  padding: 62px clamp(28px, 4vw, 64px) 96px 54px;
}

/* hide the old standalone back link once shell is injected */
.legal-shell .legal-back {
  display: none;
}

/* ── Page content block ── */
.legal-page {
  width: min(920px, 100%);
  margin: 0;
}

/* inside the old layout (no shell), keep centred */
body > .legal-page {
  margin: 0 auto;
  padding: 64px 24px 80px;
}

/* ── Legacy back link (shown when no shell / JS disabled) ── */
.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--t3);
  text-decoration: none;
  margin-bottom: 40px;
  transition: color 0.15s;
}
.legal-back:hover { color: var(--accent); }

/* ── Typography ── */
.legal-kicker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.legal-title {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(42px, 5vw, 64px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.05em;
  color: var(--t1);
  margin-bottom: 12px;
}

.legal-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--t3);
  margin-bottom: 56px;
}

.legal-section { margin-bottom: 46px; }

.legal-section h2 {
  font-family: 'DM Sans', sans-serif;
  font-size: 30px;
  line-height: 1.08;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 16px;
}

.legal-section p, .legal-section li {
  font-family: 'DM Sans', sans-serif;
  font-size: 18px;
  line-height: 1.8;
  color: var(--t2);
}

.legal-section p + p {
  margin-top: 14px;
}

.legal-section ul,
.legal-section ol {
  padding-left: 24px;
  margin-top: 14px;
}

.legal-section li + li {
  margin-top: 10px;
}

.legal-section a { color: var(--accent); text-decoration: none; }
.legal-section a:hover { text-decoration: underline; }

.legal-divider { border: none; border-top: 1px solid var(--dim); margin: 48px 0; }

/* ── Contact cards ── */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.contact-card {
  padding: 20px 20px 18px;
  border-radius: 14px;
  border: 1px solid var(--dim);
  background: color-mix(in srgb, var(--raised) 60%, transparent);
}
.contact-card-kicker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.contact-card-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: 6px;
}
.contact-card-body {
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--t2);
  margin-bottom: 14px;
}
.contact-card-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s;
}
.contact-card-link:hover { opacity: 0.8; }

.contact-note {
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--t3);
  padding: 16px 18px;
  border-radius: 10px;
  border: 1px solid var(--dim);
  background: color-mix(in srgb, var(--raised) 40%, transparent);
}

/* ── Responsive: collapse sidebar below 900px ── */
@media (max-width: 900px) {
  .legal-nav { display: none; }
  .legal-content { padding: 40px 22px 72px; }
  .legal-shell .legal-back { display: inline-flex; }
  .legal-title {
    font-size: clamp(34px, 10vw, 48px);
    line-height: 1;
  }
  .legal-section h2 {
    font-size: 24px;
  }
  .legal-section p,
  .legal-section li {
    font-size: 16px;
    line-height: 1.72;
  }
}
