/* ==========================================================================
   AGP — Legal pages (privacy.html, terms.html)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.legal-hero {
  padding-bottom: clamp(48px, 6vw, 88px);
}

.legal-hero__blob {
  top: -220px;
  right: -180px;
  width: 520px;
  height: 520px;
}

.legal-hero__ring {
  bottom: -150px;
  left: -120px;
  width: 300px;
  height: 300px;
}

.legal-hero__glyph {
  position: absolute;
  z-index: 1;
  top: -0.1em;
  right: 3vw;
  font-family: var(--font-display);
  font-size: clamp(14rem, 30vw, 26rem);
  font-weight: 500;
  line-height: 0.8;
  color: transparent;
  -webkit-text-stroke: 1px rgba(169, 122, 60, 0.28);
  transform: rotate(8deg);
  pointer-events: none;
  user-select: none;
}

.legal-hero__effective {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.legal-hero__effective svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Layout + table of contents
   -------------------------------------------------------------------------- */
.legal__grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: start;
  gap: clamp(40px, 6vw, 96px);
}

.legal-toc {
  position: sticky;
  top: calc(var(--header-h) + var(--safe-top) + 24px);
}

.legal-toc__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: left;
  pointer-events: none;
}

.legal-toc__toggle svg {
  flex: none;
  width: 18px;
  height: 18px;
}

.legal-toc__chevron {
  display: none;
}

.legal-toc__list {
  display: grid;
  gap: 2px;
  margin: 16px 0 0;
  padding: 0;
  border-left: 1px solid var(--line-strong);
  list-style: none;
  counter-reset: toc;
}

.legal-toc__list a {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  margin-left: -1px;
  padding: 7px 12px;
  border-left: 2px solid transparent;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--muted);
  counter-increment: toc;
  transition: color var(--dur-base) ease, border-color var(--dur-base) ease, background-color var(--dur-base) ease;
}

.legal-toc__list a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-display);
  font-size: 1rem;
  font-variant-numeric: lining-nums;
  line-height: 1.3;
  color: var(--accent-soft);
}

.legal-toc__list a:hover {
  color: var(--ink);
}

.legal-toc__list a[aria-current="true"] {
  border-left-color: var(--gold-500);
  background: linear-gradient(90deg, rgba(207, 165, 101, 0.14), transparent);
  font-weight: 600;
  color: var(--ink);
}

.legal-toc__list a[aria-current="true"]::before {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Content
   -------------------------------------------------------------------------- */
.legal__content {
  min-width: 0;
  max-width: 76ch;
}

.legal-summary {
  position: relative;
  overflow: hidden;
  margin-bottom: clamp(36px, 5vw, 56px);
  padding: clamp(24px, 3.2vw, 36px);
  border-radius: 40px 12px 40px 12px;
  background: var(--surface-gold);
  box-shadow: var(--shadow-gold);
  color: var(--ink);
}

.legal-summary::after {
  content: "";
  position: absolute;
  top: -80px;
  right: -60px;
  width: 200px;
  height: 200px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
}

.legal-summary__title {
  margin-bottom: 16px;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-style: italic;
  font-weight: 600;
  line-height: 1.1;
}

.legal-summary .check-list {
  position: relative;
  z-index: 1;
  font-weight: 500;
  line-height: 1.55;
}

.legal-summary .check-list li::before {
  background: var(--ink);
}

.legal-prose {
  counter-reset: legal;
}

.legal-section {
  padding: 32px 0 12px;
  border-top: 1px solid var(--line);
  counter-increment: legal;
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.legal-section h2 {
  display: flex;
  align-items: baseline;
  gap: 16px;
  font-size: clamp(1.55rem, 2.6vw, 2.05rem);
}

.legal-section h2::before {
  content: counter(legal, decimal-leading-zero);
  flex: none;
  font-size: 0.8em;
  font-weight: 500;
  font-variant-numeric: lining-nums;
  color: var(--accent-soft);
}

.legal-section p,
.legal-section li {
  color: var(--ink-soft);
}

.legal-section strong {
  color: var(--ink);
}

.legal-section ul {
  margin: 0 0 1em;
  padding-left: 1.2em;
}

.legal-section li + li {
  margin-top: 0.4em;
}

.legal-section li::marker {
  color: var(--accent);
}

.legal-section a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-contact {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  margin-top: clamp(40px, 5vw, 64px);
  padding: clamp(26px, 3.4vw, 40px);
  border-radius: 12px 40px 12px 40px;
  background: var(--night-gold-glow), var(--night);
  color: var(--on-night);
}

.legal-contact h2 {
  margin-bottom: 6px;
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  color: #fff;
}

.legal-contact p {
  margin: 0;
  color: var(--on-night-muted);
}

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

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .legal__grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .legal-toc {
    position: static;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 22px 8px 22px 8px;
    background: var(--card);
  }

  .legal-toc__toggle {
    min-height: 52px;
    padding: 0 16px;
    pointer-events: auto;
  }

  .legal-toc__chevron {
    display: block;
    margin-left: auto;
    transition: transform var(--dur-base) var(--ease-spring);
  }

  .legal-toc__toggle[aria-expanded="true"] .legal-toc__chevron {
    transform: rotate(180deg);
  }

  .legal-toc__list {
    display: none;
    margin: 0 12px 14px 16px;
  }

  .legal-toc.is-open .legal-toc__list {
    display: grid;
  }

  .legal-toc__list a {
    min-height: 44px;
    align-items: center;
  }
}

@media (max-width: 640px) {
  .legal-hero__glyph {
    top: auto;
    right: -6vw;
    bottom: -0.15em;
    font-size: 15rem;
  }

  .legal-contact__actions,
  .legal-contact__actions .btn {
    width: 100%;
  }
}
