:root {
  --legal-surface: #ffffff;
  --legal-surface-soft: #f8faff;
  --legal-shadow: 0 18px 48px rgba(15, 23, 42, 0.07);
}

body {
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 28%),
    radial-gradient(circle at bottom left, rgba(6, 182, 212, 0.06), transparent 26%),
    #fff;
}

nav {
  height: 72px;
  padding: 0 2rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(22px);
}

.n-logo img {
  height: 42px !important;
}

.n-back {
  min-height: 40px;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.88);
}

.page {
  max-width: 1240px;
  padding: 118px 2rem 96px;
}

.page-head {
  margin-bottom: 2rem;
}

.page-eyebrow {
  margin-bottom: 1rem;
}

.page-title {
  max-width: 820px;
  margin-bottom: 1rem;
}

.page-meta {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
  max-width: 780px;
}

.legal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.9fr);
  gap: 1.5rem;
  align-items: stretch;
  margin-bottom: 2rem;
}

.legal-hero-card,
.legal-summary,
.legal-panel,
.clause,
.company-box,
.highlight {
  border-radius: 22px;
}

.legal-hero-card {
  border: 1px solid var(--rule);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.92));
  box-shadow: var(--legal-shadow);
  padding: 2rem;
}

.legal-hero-aside {
  display: grid;
  gap: 1rem;
}

.legal-summary,
.legal-panel {
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--legal-shadow);
  padding: 1.3rem;
}

.legal-kicker,
.legal-panel h2 {
  font-family: var(--font-h);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legal-kicker {
  color: var(--blue);
  margin-bottom: 0.8rem;
}

.legal-summary-list,
.legal-doc-list,
.legal-toc {
  list-style: none;
  padding: 0;
  margin: 0;
}

.legal-summary-list {
  display: grid;
  gap: 0.8rem;
}

.legal-summary-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 0.75rem;
  align-items: start;
  font-size: 0.95rem;
  color: var(--slate);
  line-height: 1.65;
}

.legal-summary-item::before {
  content: "";
  width: 18px;
  height: 18px;
  margin-top: 0.18rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(6, 182, 212, 0.24));
  box-shadow: inset 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.5rem;
  align-items: start;
}

.legal-main {
  min-width: 0;
}

.legal-aside {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 1rem;
}

.legal-panel h2 {
  color: var(--navy);
  margin-bottom: 0.85rem;
}

.legal-panel p {
  font-size: 0.93rem;
  color: var(--slate);
  line-height: 1.65;
}

.legal-toc {
  display: grid;
  gap: 0.35rem;
}

.legal-toc a,
.legal-doc-list a {
  display: block;
  text-decoration: none;
  color: var(--slate);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0.72rem 0.85rem;
  font-size: 0.92rem;
  line-height: 1.4;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.legal-toc a:hover,
.legal-doc-list a:hover,
.legal-toc a.active,
.legal-doc-list a.active {
  color: var(--navy);
  background: var(--blue-gl);
  border-color: var(--blue-br);
  transform: translateY(-1px);
}

.legal-doc-list {
  display: grid;
  gap: 0.45rem;
}

.legal-panel strong {
  color: var(--navy);
}

.legal-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.95rem;
}

.legal-chip {
  border-radius: 999px;
  border: 1px solid var(--blue-br);
  background: var(--blue-gl);
  color: var(--blue);
  font-family: var(--font-h);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.45rem 0.8rem;
}

.company-box,
.clause,
.highlight {
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--legal-shadow);
}

.company-box,
.clause {
  padding: 1.6rem 1.5rem;
}

.clause {
  scroll-margin-top: 100px;
  margin-bottom: 1.25rem;
}

.clause h2 {
  font-size: clamp(1.3rem, 2vw, 1.65rem);
}

.clause p,
.clause li,
.sub-clause p,
.sub-clause li,
.company-detail p {
  font-size: 0.98rem;
  line-height: 1.8;
}

.clause > ul li,
.clause-body > ul li,
.sub-clause ul li,
.clause ul li {
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.highlight {
  padding: 1.15rem 1.2rem;
}

hr.clause-rule {
  margin: 1rem 0 1.25rem;
}

footer {
  padding: 2.25rem 2rem;
  background: rgba(248, 250, 255, 0.9);
}

.footer-inner {
  max-width: 1240px;
  align-items: flex-start;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.15rem;
  align-items: center;
}

.footer-links .footer-back {
  font-weight: 500 !important;
  color: var(--mid) !important;
}

.footer-links .footer-back.back-home {
  color: var(--blue) !important;
  font-weight: 700 !important;
}

@media (max-width: 980px) {
  .legal-hero,
  .legal-layout {
    grid-template-columns: 1fr;
  }

  /* On narrower screens move the aside below the main content to avoid overlay
     and ordering issues where panels can cover section headings. */
  .legal-aside {
    position: static !important;
    order: 2 !important;
    width: 100%;
    margin-top: 1rem;
  }

  /* If moving the aside still causes visual overlap on some devices,
     hide the aside entirely on narrow screens to avoid blocking content. */
  .legal-aside { display: none !important; }

  /* Reduce heavy card shadows and borders on mobile so they don't visually
     compete with main content or appear to float above headings. */
  .legal-panel,
  .legal-summary,
  .company-box,
  .clause,
  .highlight {
    box-shadow: none;
    border-radius: 12px;
  }

  /* Make TOC and related docs full-width rows on narrow screens */
  .legal-toc a,
  .legal-doc-list a {
    padding: 0.6rem 0.85rem;
  }

  .legal-toc,
  .legal-doc-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  nav {
    height: 68px;
    padding: 0 1rem;
  }

  .n-back {
    padding: 0.55rem 0.8rem;
    font-size: 0.78rem;
  }

  .page {
    padding: 96px 1rem 72px;
  }

  /* Reduce scroll offset so anchor links land visibly below the fixed nav */
  .clause { scroll-margin-top: 70px; }

  .legal-hero-card,
  .legal-summary,
  .legal-panel,
  .company-box,
  .clause,
  .highlight {
    border-radius: 18px;
  }

  .legal-hero-card,
  .company-box,
  .clause {
    padding: 1.25rem;
  }

  .legal-summary,
  .legal-panel {
    padding: 1rem;
  }

  .legal-toc,
  .legal-doc-list {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
  }

  .footer-links {
    gap: 0.75rem;
  }

  /* On very small screens hide the summary panel to avoid overlay issues */
  .legal-summary { display: none !important; }
}
