/* ============================================================
   POMODEV — LEGAL DOCUMENT LAYOUT
   Built on top of editorial.css's tokens/typography (.ed-*), scoped
   to privacy.html and terms.html. A legal page is the one place on
   the site where "premium" means "effortless to navigate and read",
   not decorative — so the additions here are a sticky scroll-spy
   table of contents, a reading-progress bar, and a gentle per-section
   reveal, in that priority order.
   ============================================================ */

/* reading progress — thin accent bar tracking scroll position, sits
   directly under the sticky nav so it never fights it for space */
.ed-legal-progress {
  position: sticky; top: 72px; z-index: 480;
  height: 2px; width: 100%;
  background: var(--line);
}
.ed-legal-progress__bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--tomato), var(--tomato-lit));
  transform-origin: left;
  transition: width .12s linear;
}

.ed-legal-hero { max-width: 780px; margin: 28px 0 40px; }
.ed-legal-hero__badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--tomato-lit); background: color-mix(in srgb, var(--tomato) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tomato) 30%, transparent);
  border-radius: 999px; padding: 6px 13px; margin-bottom: 22px;
}
.ed-legal-hero h1 {
  font-family: var(--font-serif); font-weight: 400; letter-spacing: -0.01em;
  font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.08; color: var(--bone);
}
.ed-legal-hero__lead {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--muted); margin-top: 20px; max-width: 60ch; line-height: 1.6;
}
.ed-legal-hero__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 28px;
}
.ed-legal-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .02em; color: var(--muted-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px;
}
.ed-legal-chip svg { width: 13px; height: 13px; flex: none; }

/* two-column layout: sticky scroll-spy rail + article */
.ed-legal-layout { display: grid; grid-template-columns: 240px 1fr; gap: 56px; align-items: start; }

.ed-legal-toc {
  position: sticky; top: 108px;
  padding-left: 18px;
}
.ed-legal-toc__label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: 14px;
}
.ed-legal-toc__rail { position: relative; }
.ed-legal-toc__rail::before {
  content: ''; position: absolute; left: -18px; top: 4px; bottom: 4px; width: 1px; background: var(--line);
}
.ed-legal-toc__indicator {
  position: absolute; left: -19px; width: 3px; border-radius: 999px;
  background: var(--tomato-lit); height: 0; top: 0;
  transition: transform .45s var(--ease), height .45s var(--ease), opacity .3s;
  opacity: 0;
}
.ed-legal-toc a {
  display: block; padding: 7px 0; font-size: 13px; line-height: 1.4; color: var(--muted);
  transition: color .25s;
}
.ed-legal-toc a:hover { color: var(--bone); }
.ed-legal-toc a.is-active { color: var(--tomato-lit); font-weight: 550; }

/* mobile / narrow: the sticky rail can't work without room to sit in, so it
   collapses into the existing flat .ed-toc box (already styled by
   editorial.css) placed inline before the article instead. */
.ed-legal-toc--mobile { display: none; }

@media (max-width: 960px) {
  .ed-legal-layout { grid-template-columns: 1fr; gap: 0; }
  .ed-legal-toc--desktop { display: none; }
  .ed-legal-toc--mobile { display: block; }
}

/* per-section reveal — each <section> starts very slightly lowered and
   transparent, and settles into place the first time it crosses into view.
   Respects prefers-reduced-motion via the JS gate (no observer is attached
   at all, sections just render visible). */
.ed-legal-section {
  opacity: 0; transform: translateY(22px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.ed-legal-section.is-visible { opacity: 1; transform: none; }
.ed-legal-section:not(:first-child) { margin-top: 52px; }
.ed-legal-section h2 { scroll-margin-top: 108px; }

.ed-legal-footnote {
  margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
}
.ed-legal-footnote p { font-size: 13px; color: var(--muted-2); margin: 0; }
