/* ============================================================
   CAPITAL BUILD — Legal pages (Terms / Privacy)
   Enterprise document layout & Top-Tier Sidebar
   ============================================================ */

.legal-page {
  background: var(--color-offwhite, #F7F5F0);
}

/* ---- Hero band ---- */
.legal-hero {
  position: relative;
  padding:
    calc(var(--header-height, 80px) + var(--topbar-height, 42px) + 2.5rem)
    0 3rem;
  background: var(--color-navy-dark, #060F1F);
  border-bottom: 1px solid rgba(201, 168, 76, 0.2);
  overflow: hidden;
}

.legal-hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.legal-hero__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.25;
  filter: grayscale(40%);
}

.legal-hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(6, 15, 31, 0.6) 0%,
    rgba(6, 15, 31, 0.88) 60%,
    #060F1F 100%
  );
  pointer-events: none;
}

.legal-hero__inner {
  position: relative;
  z-index: 2;
  max-width: 72rem;
}

.legal-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(247, 245, 240, 0.4);
}

.legal-breadcrumb a {
  color: rgba(247, 245, 240, 0.62);
  text-decoration: none;
  transition: color 0.2s ease;
}

.legal-breadcrumb a:hover {
  color: var(--color-gold, #C9A84C);
}

.legal-breadcrumb__sep {
  opacity: 0.45;
}

.legal-breadcrumb [aria-current="page"] {
  color: var(--color-gold, #C9A84C);
}

.legal-hero__eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-gold, #C9A84C);
}

.legal-hero__title {
  margin: 0 0 0.85rem;
  font-family: var(--font-heading, "DM Serif Display", serif);
  font-size: clamp(2rem, 4vw, 2.85rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-offwhite, #F7F5F0);
}

.legal-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0;
  font-size: 0.875rem;
  color: rgba(247, 245, 240, 0.55);
}

/* ---- Body layout ---- */
.legal-body {
  padding: 3rem 0 5rem;
}

.legal-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  max-width: 72rem;
  margin: 0 auto;
  align-items: start;
}

@media (min-width: 1024px) {
  .legal-layout {
    grid-template-columns: 16rem minmax(0, 1fr);
    gap: 3.5rem;
  }
}

/* ---- Top-Tier TOC Sidebar ---- */
.legal-toc {
  display: none;
}

@media (min-width: 1024px) {
  .legal-toc {
    display: block;
    position: sticky;
    top: calc(var(--header-height, 80px) + var(--topbar-height, 42px) + 2rem);
    padding: 1.75rem 1.5rem;
    background: #FFFFFF;
    border: 1px solid rgba(11, 29, 58, 0.08);
    border-radius: 12px;
    box-shadow: 0 10px 30px -20px rgba(11, 29, 58, 0.12);
  }
}

.legal-toc__label {
  margin: 0 0 1.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #9a7a2e;
}

.legal-toc__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.legal-toc__nav a {
  display: block;
  padding: 0.4rem 0.75rem;
  margin: 0 -0.75rem;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  color: #5c6b7e;
  text-decoration: none;
  transition: all 0.2s ease;
}

.legal-toc__nav a:hover {
  background: rgba(201, 168, 76, 0.05);
  border-left-color: var(--color-gold, #C9A84C);
  color: var(--color-navy, #0B1D3A);
  transform: translateX(2px);
}

.legal-toc__aside-links {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(11, 29, 58, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.legal-toc__aside-links a {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-navy, #0B1D3A);
  text-decoration: none;
  transition: color 0.2s ease;
}

.legal-toc__aside-links a:hover {
  color: #9a7a2e;
}

/* ---- Main Document Content ---- */
.legal-content {
  max-width: 44rem;
  background: #FFFFFF;
  border: 1px solid rgba(11, 29, 58, 0.07);
  border-radius: 16px;
  padding: clamp(1.75rem, 4vw, 3rem);
  box-shadow: 0 16px 40px -28px rgba(11, 29, 58, 0.15);
}

.legal-intro {
  margin-bottom: 1rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(11, 29, 58, 0.08);
}

.legal-intro p {
  margin: 0 0 1.25rem;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: #3d4f66;
}

.legal-intro__note {
  margin: 0 !important;
  padding: 1rem 1.25rem;
  font-size: 0.9375rem !important;
  font-weight: 500;
  line-height: 1.6 !important;
  color: #0B1D3A !important;
  background: rgba(201, 168, 76, 0.08);
  border-left: 3px solid var(--color-gold, #C9A84C);
  border-radius: 0 8px 8px 0;
}

.legal-section {
  padding-top: 0.25rem;
  margin-top: 2.5rem;
  scroll-margin-top: calc(var(--header-height, 80px) + var(--topbar-height, 42px) + 1.5rem);
}

.legal-section h2 {
  margin: 0 0 1rem;
  font-family: var(--font-heading, "DM Serif Display", serif);
  font-size: clamp(1.3rem, 2.5vw, 1.5rem);
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-navy, #0B1D3A);
}

.legal-section p,
.legal-section li {
  font-size: 1rem;
  line-height: 1.75;
  color: #3d4f66;
}

.legal-section p {
  margin: 0 0 1.15rem;
}

.legal-section ul {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
}

.legal-section li {
  margin-bottom: 0.65rem;
}

.legal-section li::marker {
  color: var(--color-gold, #C9A84C);
}

.legal-section a {
  color: #8a6d28;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.legal-section a:hover {
  color: #0B1D3A;
}

/* Legal Cards (Inside Content) */
.legal-card {
  margin: 0 0 1.5rem;
  padding: 1.5rem;
  background: var(--color-offwhite, #F7F5F0);
  border: 1px solid rgba(11, 29, 58, 0.07);
  border-radius: 12px;
}

.legal-card p {
  margin: 0 0 0.75rem;
}

.legal-card p:last-child {
  margin-bottom: 0;
}

.legal-card__name {
  font-family: var(--font-heading, "DM Serif Display", serif);
  font-size: 1.25rem !important;
  color: var(--color-navy, #0B1D3A) !important;
  margin-bottom: 0.75rem !important;
}

.legal-card__sep {
  margin: 0 0.35rem;
  color: #94a3b8;
}

.legal-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem !important;
}

.legal-card__actions .btn {
  text-decoration: none;
}

/* End matter */
.legal-end {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(11, 29, 58, 0.08);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.legal-back {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-navy, #0B1D3A);
  text-decoration: none;
  transition: color 0.2s ease;
}

.legal-back:hover {
  color: #8a6d28;
}

.legal-end__copy {
  margin: 0;
  font-size: 0.8125rem;
  color: #64748b;
}

/* Mobile Adjustments */
@media (max-width: 640px) {
  .legal-content {
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
    padding: 1.5rem 1rem;
  }
}