---
// Shared layout for legal pages (Privacy Policy, Terms of Service)
// Provides the legal-layout grid + scoped CSS
---
<div class="legal-layout">
  <aside class="legal-rail" aria-label={Astro.props.railLabel}>
    <p class="eyebrow">{Astro.props.railEyebrow}</p>
    <h2>{Astro.props.railTitle}</h2>
    <ul>
      {Astro.props.railItems.map((item: string) => <li>{item}</li>)}
    </ul>
  </aside>

  <div class="legal-content legal-document">
    <slot />
  </div>
</div>

<style>
  .legal-layout {
    display: grid;
    grid-template-columns: minmax(220px, .34fr) minmax(0, .66fr);
    gap: clamp(18px, 3vw, 34px);
    align-items: start;
    max-width: var(--container);
    margin-inline: auto;
  }

  .legal-rail,
  .legal-content {
    position: relative;
    border: 1px solid rgb(19 18 13 / .08);
    border-radius: 30px;
    background: white;
    color: var(--ink);
    box-shadow: 0 24px 70px rgb(42 36 18 / .07);
  }

  .legal-rail .eyebrow {
    border-color: rgb(19 18 13 / .18);
    background: var(--yellow);
    color: var(--ink);
  }

  .legal-rail {
    position: sticky;
    top: 112px;
    padding: clamp(22px, 3vw, 34px);
  }

  .legal-rail h2 {
    margin-top: 12px;
    color: var(--ink);
    font-size: clamp(1.6rem, 2vw, 2.3rem);
  }

  .legal-rail ul {
    display: grid;
    gap: 10px;
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
  }

  .legal-rail li {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    color: rgb(19 18 13 / .76);
    line-height: 1.55;
  }

  .legal-content {
    padding: clamp(24px, 5vw, 56px);
  }

  .legal-content h2 {
    margin-top: clamp(32px, 5vw, 56px);
    margin-bottom: 12px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
    font-size: clamp(1.35rem, 1.1vw + 1rem, 1.85rem);
    color: var(--ink);
  }

  .legal-content h2:first-of-type {
    margin-top: 0;
    border-top: 0;
    padding-top: 0;
  }

  .legal-content h3 {
    margin-top: 24px;
    font-size: clamp(1.05rem, .4vw + 1rem, 1.2rem);
    font-weight: 700;
    color: var(--ink);
  }

  .legal-content p,
  .legal-content li {
    line-height: 1.8;
    color: rgb(19 18 13 / .76);
  }

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

  .legal-content em {
    color: rgb(19 18 13 / .70);
  }

  .legal-content > p:first-of-type {
    margin-top: 0;
    color: var(--ink);
    font-size: clamp(1.05rem, .45vw + 1rem, 1.22rem);
  }

  .legal-content ul {
    padding-inline-start: 1.5rem;
    margin-block: 12px;
  }

  .legal-content li {
    margin-bottom: .25rem;
  }

  .legal-content hr {
    margin-block: 32px;
    border-color: var(--line);
  }

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

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

    .legal-rail {
      position: static;
    }
  }

  @media (max-width: 620px) {
    .legal-content,
    .legal-rail {
      padding: 22px;
    }
  }
</style>
