/* ==========================================================================
   Legal pages (Terms of Service, Privacy Policy)
   Hero with the page title (character reveal, glass accent), a short lede and
   meta pills; three "at a glance" cards; then a sticky table of contents next
   to the numbered sections. js/legal.js reveals the blocks, keeps the active
   section highlighted in the contents and scrolls to anchors.
   Shared typography (home-h1, home-body) and the footer bar come from base.css
   / footer-bar.css.
   ========================================================================== */
html.page-bg,
html.page-bg body {
  background-color: #000;
  color-scheme: dark;
}

.legal {
  --legal-accent: rgba(255, 193, 126, .9);
  --legal-line: rgba(255, 255, 255, .09);
  --legal-ink: #ffffffb8;
  --legal-muted: #ffffff80;
  --legal-max: 1180px;
  color: #fff;
  font-family: var(--font-display);
  isolation: isolate;
  padding: calc(var(--home-header-offset) + 1.75rem) 1.5rem 5rem;
  position: relative;
}

/* soft warm light behind the title, like the footer's sunrise but still */
.legal__glow {
  background: radial-gradient(ellipse 70% 42% at 50% 0%, rgb(255 193 126 / .16), rgb(170 110 35 / .06) 45%, transparent 72%);
  inset: 0 0 auto;
  height: 42rem;
  pointer-events: none;
  position: absolute;
  z-index: -1;
}

/* every block starts hidden; js/legal.js adds .legal--in */
.legal__hero > :not(.legal__title),
.legal__glance,
.legal__toc,
.legal__content {
  filter: blur(6px);
  opacity: 0;
  transform: translate3d(0, 12px, 0);
  transition: opacity .9s var(--home-ease), transform .9s var(--home-ease), filter .9s var(--home-ease);
}

.legal--in .legal__hero > :not(.legal__title),
.legal--in .legal__glance,
.legal--in .legal__toc,
.legal--in .legal__content {
  filter: none;
  opacity: 1;
  transform: none;
}

.legal--in .legal__lede { transition-delay: .1s; }
.legal--in .legal__meta { transition-delay: .2s; }
.legal--in .legal__glance { transition-delay: .32s; }
.legal--in .legal__toc,
.legal--in .legal__content { transition-delay: .46s; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.legal__hero {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin: 0 auto;
  max-width: var(--legal-max);
}

.legal__eyebrow,
.legal__num,
.legal__toc-title,
.legal__card-label {
  color: var(--legal-accent);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .18em;
  line-height: 1;
  margin: 0;
  text-transform: uppercase;
}

.legal__title {
  max-width: 14em;
  text-shadow: 0 0 8px rgba(255, 239, 225, .3);
}

.legal__title--wide {
  max-width: 20em;
}

.legal__lede {
  margin: 0;
  max-width: 34em;
}

.legal__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  list-style: none;
  margin: .4rem 0 0;
  padding: 0;
}

.legal__meta li {
  border: 1px solid var(--legal-line);
  border-radius: 999px;
  color: var(--legal-muted);
  font-size: 13px;
  letter-spacing: -.01em;
  line-height: 1;
  padding: .55rem .85rem;
}

/* --------------------------------------------------------------------------
   At a glance
   -------------------------------------------------------------------------- */
.legal__glance {
  display: grid;
  gap: .85rem;
  list-style: none;
  margin: 2.5rem auto 0;
  max-width: var(--legal-max);
  padding: 0;
}

.legal__card {
  background: linear-gradient(180deg, #ffffff0d, #ffffff05);
  border: 1px solid var(--legal-line);
  border-radius: 20px;
  box-shadow: inset 0 1px #ffffff14;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: 1.25rem 1.35rem 1.4rem;
}

.legal__card-title {
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 24px;
  margin: 0;
}

.legal__card-text {
  color: var(--legal-ink);
  font-size: 15px;
  letter-spacing: -.01em;
  line-height: 22px;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Contents + sections
   -------------------------------------------------------------------------- */
.legal__body {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr);   /* the column may shrink below the pill row's width */
  margin: 2.75rem auto 0;
  max-width: var(--legal-max);
}

.legal__toc,
.legal__content {
  min-width: 0;                            /* grid items: never grow to the widest child */
}

.legal__toc-title {
  margin-bottom: .9rem;
}

.legal__toc ol {
  counter-reset: toc;
  display: flex;
  gap: .5rem;
  list-style: none;
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 0 0 .5rem;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.legal__toc ol::-webkit-scrollbar {
  display: none;
}

.legal__toc a {
  border: 1px solid var(--legal-line);
  border-radius: 999px;
  color: var(--legal-muted);
  display: inline-block;
  font-size: 13px;
  letter-spacing: -.01em;
  line-height: 1;
  padding: .55rem .85rem;
  text-decoration: none;
  transition: color .3s ease, background .3s ease, border-color .3s ease;
  white-space: nowrap;
}

.legal__toc a:hover {
  color: #fff;
}

.legal__toc a.is-active {
  background: #ffffff14;
  border-color: #ffffff29;
  color: #fff;
}

.legal__section {
  border-top: 1px solid var(--legal-line);
  padding: 2rem 0 2.25rem;
  scroll-margin-top: calc(var(--home-header-offset) + 1rem);
}

.legal__section:first-child {
  border-top: 0;
  padding-top: 0;
}

.legal__section:last-child {
  padding-bottom: 0;
}

.legal__num {
  display: block;
  margin-bottom: .7rem;
}

.legal__content h2 {
  color: #fff;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 30px;
  margin: 0 0 1rem;
}

.legal__content h3 {
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 24px;
  margin: 1.4rem 0 .45rem;
}

.legal__content p,
.legal__content li {
  color: var(--legal-ink);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -.01em;
  line-height: 27px;
}

.legal__content p {
  margin: 0;
}

.legal__content p + p,
.legal__content ul + p,
.legal__content p + ul {
  margin-top: .9rem;
}

.legal__content ul {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.legal__content li {
  padding-left: 1.35rem;
  position: relative;
}

.legal__content li::before {
  background: var(--legal-accent);
  border-radius: 999px;
  content: "";
  height: 5px;
  left: .15rem;
  position: absolute;
  top: 11px;
  width: 5px;
}

.legal__content strong {
  color: #fff;
  font-weight: 600;
}

.legal__content a {
  color: #ffd9b0;
  text-decoration: underline;
  text-decoration-color: rgba(255, 193, 126, .45);
  text-underline-offset: 3px;
  transition: text-decoration-color .3s ease;
}

.legal__content a:hover {
  text-decoration-color: rgba(255, 193, 126, .95);
}

/* --------------------------------------------------------------------------
   Agreements: numbered clauses (9.1, 9.2 …) with their lists indented under
   the clause text. The clause number is a CSS counter, so it follows the
   order of the sections.
   -------------------------------------------------------------------------- */
.legal__content--clauses {
  counter-reset: clause-section;
}

.legal__content--clauses .legal__section {
  counter-increment: clause-section;
  counter-reset: clause;
}

.legal__clause {
  counter-increment: clause;
  padding-left: 3.1rem;
  position: relative;
}

.legal__clause::before {
  color: var(--legal-accent);
  content: counter(clause-section) "." counter(clause);
  font-size: 13px;
  font-weight: 500;
  left: 0;
  letter-spacing: .02em;
  line-height: inherit;
  position: absolute;
  top: 0;
}

.legal__content--clauses .legal__section > ul {
  padding-left: 3.1rem;
}

.legal__content--clauses p + .legal__clause,
.legal__content--clauses ul + .legal__clause {
  margin-top: .9rem;
}

/* --------------------------------------------------------------------------
   Footer bar (shared styles in footer-bar.css)
   -------------------------------------------------------------------------- */
.legal-footer {
  background: #050403;
  display: block;
  width: 100%;
}

/* --------------------------------------------------------------------------
   Tablet and up
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .legal {
    padding: calc(var(--home-header-offset) + 3rem) 6.25rem 7rem;
  }

  .legal__hero {
    gap: 1.35rem;
  }

  .legal__glance {
    gap: 1.15rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 3.25rem;
  }

  .legal__card {
    border-radius: 24px;
    padding: 1.5rem 1.6rem 1.65rem;
  }

  .legal__body {
    margin-top: 3.5rem;
  }

  .legal__content h2 {
    font-size: 28px;
    line-height: 34px;
  }

  .legal__content p,
  .legal__content li {
    font-size: 18px;
    line-height: 29px;
  }

  .legal__content li::before {
    top: 12px;
  }

  .legal__section {
    padding: 2.5rem 0 2.75rem;
  }
}

/* Desktop: sticky contents on the left, text on the right */
@media (min-width: 1024px) {
  .legal__body {
    align-items: start;
    gap: 4.5rem;
    grid-template-columns: 15rem minmax(0, 44rem);
  }

  .legal__toc {
    max-height: calc(100vh - var(--home-header-offset) - 1.5rem);   /* long lists scroll inside the sticky column */
    overflow-y: auto;
    overscroll-behavior: contain;
    position: sticky;
    scrollbar-width: none;
    top: calc(var(--home-header-offset) + .75rem);
  }

  .legal__toc::-webkit-scrollbar {
    display: none;
  }

  .legal__toc ol {
    counter-reset: toc;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: visible;
    padding: 0;
  }

  .legal__toc li {
    counter-increment: toc;
  }

  .legal__toc a {
    border: 0;
    border-left: 1px solid var(--legal-line);
    border-radius: 0;
    display: flex;
    font-size: 14px;
    gap: .7rem;
    line-height: 20px;
    padding: .45rem 0 .45rem 1rem;
    white-space: normal;
  }

  .legal__toc a::before {
    color: var(--legal-accent);
    content: counter(toc, decimal-leading-zero);
    flex: 0 0 auto;
    font-size: 11px;
    letter-spacing: .12em;
    line-height: 20px;
    opacity: .75;
  }

  .legal__toc a.is-active {
    background: transparent;
    border-left-color: var(--legal-accent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .legal__hero > :not(.legal__title),
  .legal__glance,
  .legal__toc,
  .legal__content {
    filter: none;
    opacity: 1;
    transform: none;
    transition: none;
  }
}
