/* =========================================================
   Ameya Health — legal pages (Privacy Policy, Terms of Use)
   Loads AFTER style.css and reuses its tokens, nav and footer.
   style.css resets margins and list styles for the landing page,
   so prose defaults are restored here.
   ========================================================= */

/* ---------- page shell ---------- */
.legal-hero {
  background: linear-gradient(180deg, #f2f9fd 0%, #eaf4fb 55%, #fff 100%);
  border-bottom: 1px solid rgba(35, 48, 44, .06);
  padding: 140px 0 56px;
}
.legal-hero__inner { max-width: 1236px; margin: 0 auto; padding: 0 var(--gutter); }
.legal-hero h1 {
  padding-top: 16px; margin: 0;
  font-weight: 800; font-size: 44px; line-height: 1.18; letter-spacing: -.9px;
  color: var(--navy);
}
.legal-hero__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding-top: 20px;
  font-size: 15px; line-height: 24px; color: var(--muted);
}
.legal-hero__meta strong { color: var(--navy); font-weight: 700; }
.legal-hero__meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); opacity: .5; }
.legal-hero__meta a {
  color: var(--blue); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: rgba(21, 85, 182, .35);
}
.legal-hero__meta a:hover { color: var(--indigo); text-decoration-color: currentColor; }
.legal-hero__meta a:focus-visible { outline: 3px solid #9ec2ff; outline-offset: 2px; border-radius: 3px; }

/* ---------- two-column layout ---------- */
.legal-layout {
  max-width: 1236px; margin: 0 auto; padding: 0 var(--gutter) 96px;
  display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 56px;
  align-items: start;
}

/* ---------- table of contents ---------- */
.toc {
  position: sticky; top: 104px;
  margin-top: 56px;
  border: 1px solid var(--card-border); border-radius: 18px;
  background: var(--cream);
  padding: 22px 20px;
  box-shadow: 0 18px 40px -30px rgba(16, 47, 96, .35);
}
.toc__h {
  font-weight: 800; font-size: 12px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--teal); margin: 0 0 12px;
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: grid; grid-template-columns: 26px 1fr; gap: 6px;
  padding: 7px 8px; border-radius: 9px;
  font-size: 14px; line-height: 20px; font-weight: 600; color: var(--muted);
  transition: background .15s, color .15s;
}
.toc a::before { content: counter(toc) "."; color: var(--teal); font-weight: 700; opacity: .75; }
.toc a:hover { background: var(--teal-bg); color: var(--navy); }
.toc a:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.toc a[aria-current="true"] { background: var(--teal-bg); color: var(--navy); }
.toc a[aria-current="true"]::before { opacity: 1; }

/* mobile: the TOC becomes a disclosure above the text */
.toc__toggle { display: none; }
.toc > summary { list-style: none; }
.toc > summary::-webkit-details-marker { display: none; }

/* ---------- article ---------- */
.legal {
  padding-top: 56px;
  max-width: 760px;
  font-size: 16.5px; line-height: 1.78; color: #46506b;
}
.legal > section { padding-top: 44px; scroll-margin-top: 104px; }
.legal > section:first-of-type { padding-top: 8px; }

.legal h2 {
  margin: 0 0 6px;
  padding-top: 14px;
  font-weight: 800; font-size: 25px; line-height: 1.3; letter-spacing: -.3px;
  color: var(--navy);
  position: relative;
}
.legal h2::before {
  content: ""; position: absolute; top: 0; left: 0;
  width: 34px; height: 3px; border-radius: 2px; background: var(--teal);
}
.legal h3 {
  margin: 30px 0 4px;
  font-weight: 700; font-size: 17.5px; line-height: 1.4;
  color: var(--ink);
}
.legal p { margin: 14px 0; }
.legal strong { color: var(--navy); font-weight: 700; }
.legal em { font-style: italic; }

.legal a {
  color: var(--blue); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: rgba(21, 85, 182, .35);
  transition: text-decoration-color .15s, color .15s;
}
.legal a:hover { color: var(--indigo); text-decoration-color: currentColor; }
.legal a:focus-visible { outline: 3px solid #9ec2ff; outline-offset: 2px; border-radius: 3px; }

/* lists — style.css strips markers for the landing page, restore them */
.legal ul, .legal ol { margin: 14px 0; padding-left: 0; }
.legal ul { list-style: none; }
.legal ol { list-style: decimal; padding-left: 22px; }
.legal li { margin: 9px 0; padding-left: 0; }
.legal ol li { padding-left: 4px; }
.legal ul > li {
  position: relative; padding-left: 26px;
}
.legal ul > li::before {
  content: ""; position: absolute; left: 4px; top: .72em;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal); opacity: .55;
}
.legal li > ul { margin: 8px 0; }

/* definition lists render as labelled cards */
.legal dl { margin: 18px 0; display: grid; gap: 12px; }
.legal dt {
  font-weight: 700; font-size: 16px; color: var(--navy);
  padding-bottom: 2px;
}
.legal dd {
  margin: 0 0 4px; padding: 0 0 14px 16px;
  border-left: 2px solid var(--teal-bg);
}
.legal dd:last-child { padding-bottom: 0; }

/* contact block */
.legal address {
  font-style: normal;
  margin: 18px 0 0;
  padding: 20px 22px;
  border: 1px solid var(--card-border); border-radius: 16px;
  background: var(--cream);
  line-height: 1.7;
}

/* ---------- back to top ---------- */
.legal-top {
  margin-top: 56px; padding-top: 28px;
  border-top: 1px solid var(--card-border);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.legal-top p { margin: 0; font-size: 14px; color: var(--muted); }
.legal-top a { font-weight: 700; font-size: 14.5px; color: var(--blue); }
.legal-top a:hover { color: var(--indigo); }

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
  .legal-hero { padding: 120px 0 44px; }
  .legal-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }

  .toc {
    position: static; margin-top: 32px; padding: 0;
    background: var(--cream); box-shadow: none;
  }
  .toc__h { display: none; }
  .toc__toggle {
    display: block; width: 100%;
    padding: 16px 20px; border: 0; background: none;
    font: inherit; font-weight: 800; font-size: 14px; letter-spacing: 1.2px;
    text-transform: uppercase; color: var(--teal); text-align: left; cursor: pointer;
  }
  .toc__toggle::after { content: " ▾"; }
  .toc[open] .toc__toggle::after { content: " ▴"; }
  .toc > ol { padding: 0 12px 16px; }
  .legal { padding-top: 36px; }
  .legal > section { scroll-margin-top: 96px; }
}

@media (max-width: 640px) {
  .legal-hero { padding: 104px 0 36px; }
  .legal-hero h1 { font-size: 32px; letter-spacing: -.6px; }
  /* stacked, so a wrap never strands a separator dot at end of line */
  .legal-hero__meta { display: block; }
  .legal-hero__meta > span { display: block; }
  .legal-hero__meta .dot { display: none; }
  .legal-hero__meta > span + span { margin-top: 4px; }
  .legal { font-size: 16px; }
  .legal h2 { font-size: 21px; }
  .legal dd { padding-left: 13px; }
}

/* the landing page's reveal animation never applies here — legal text must
   be readable the instant it paints, including for crawlers and printers */
@media print {
  .nav, .toc, .footer, .legal-top { display: none !important; }
  .legal-hero { padding: 0 0 18px; background: none; }
  .legal { padding-top: 0; max-width: none; font-size: 11pt; color: #000; }
  .legal > section { padding-top: 18px; break-inside: avoid-page; }
  .legal a { color: #000; text-decoration: underline; }
  .legal a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; }
}
