/* ==========================================================================
   Gallus — Legal pages (privacy.html, termsofservice.html)
   Builds on css/site.css. Reading-first layout: sticky contents on the left,
   a ~70ch text column, reading progress under the local nav.
   ========================================================================== */

/* ── Reading progress (inside the sticky local nav) ── */
.lnav { position: sticky; }
.read-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.read-progress span { display: block; height: 100%; width: 0; background: var(--grad); }

/* ── Hero ── */
.legal-hero { padding: 110px 0 72px; text-align: center; background: #fff; }
.legal-h1 {
  font-size: clamp(48px, 8vw, 88px); line-height: 1.02; font-weight: 600;
  letter-spacing: -0.045em; margin-bottom: 18px;
}
.legal-sub { font-size: clamp(19px, 2.2vw, 24px); color: var(--muted); letter-spacing: -0.015em; max-width: 640px; margin: 0 auto 28px; }
.legal-meta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 980px; background: var(--surface);
  font-size: 14px; color: var(--muted);
}
.legal-meta .mi { font-size: 17px; color: var(--blue); vertical-align: -3px; margin-right: 4px; }
.legal-meta strong { color: var(--text); font-weight: 600; }
.legal-hero .reveal:nth-child(2) { transition-delay: .06s; }
.legal-hero .reveal:nth-child(3) { transition-delay: .12s; }
.legal-hero .reveal:nth-child(4) { transition-delay: .18s; }

/* ── Layout ── */
.legal-layout { background: var(--surface); padding: 72px 0 140px; border-top: 1px solid var(--line); }
.legal-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 64px; align-items: start; }

/* ── Contents (sticky) ── */
.legal-toc { position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow-y: auto; scrollbar-width: none; padding-bottom: 12px; }
.legal-toc::-webkit-scrollbar { display: none; }
.toc-toggle { display: none; }
.toc-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.toc-nav { display: grid; gap: 2px; border-left: 1px solid var(--line); }
.toc-item {
  position: relative; display: block; padding: 6px 0 6px 16px; margin-left: -1px;
  font-size: 14px; color: var(--muted); border-left: 2px solid transparent;
  transition: color .2s, border-color .25s var(--ease);
}
.toc-item:hover { color: var(--text); }
.toc-item.active { color: var(--blue); font-weight: 600; border-left-color: var(--blue); }
.toc-related {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 26px;
  font-size: 14px; font-weight: 500; color: var(--blue);
}
.toc-related .mi { font-size: 18px; }
.toc-related::after { content: " ›"; transition: transform .25s var(--ease); display: inline-block; }
.toc-related:hover::after { transform: translateX(3px); }

/* ── Document column ── */
.legal-content { max-width: 720px; min-width: 0; }
.legal-intro {
  background: #fff; border-radius: 28px; padding: 34px 36px; margin-bottom: 20px;
  font-size: 18px; line-height: 1.6; color: var(--text);
}
.legal-section {
  background: #fff; border-radius: 28px; padding: 40px 36px; margin-bottom: 20px;
  scroll-margin-top: 28px; /* + html scroll-padding-top (56px) = clears the sticky nav */
}
.legal-section-label { font-size: 14px; font-weight: 600; color: var(--blue); margin-bottom: 8px; }
.legal-section-title { font-size: clamp(24px, 2.6vw, 30px); line-height: 1.15; font-weight: 600; letter-spacing: -0.03em; margin-bottom: 18px; }
.legal-content p { font-size: 17px; line-height: 1.65; color: #424245; margin: 0 0 16px; }
.legal-content p:last-child { margin-bottom: 0; }
.legal-content strong { color: var(--text); font-weight: 600; }
.legal-content a { color: var(--blue); text-decoration: underline; text-decoration-color: rgba(0,92,187,.3); text-underline-offset: 3px; }
.legal-content a:hover { text-decoration-color: var(--blue); }

.legal-list { display: grid; gap: 10px; margin: 6px 0 16px; }
.legal-list li { position: relative; padding-left: 22px; font-size: 17px; line-height: 1.6; color: #424245; }
.legal-list li::before { content: ""; position: absolute; left: 2px; top: .68em; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); }

.legal-callout {
  display: flex; gap: 12px; align-items: flex-start; margin: 18px 0 4px;
  padding: 18px 20px; border-radius: 18px; background: #eef6ff;
  font-size: 16px; line-height: 1.6; color: #1d3a5c;
}
.legal-callout .mi { flex: none; font-size: 20px; color: var(--blue); margin-top: 2px; }

.legal-contact-card { display: grid; gap: 12px; margin-top: 22px; padding: 22px 24px; border-radius: 18px; background: var(--ink); color: #fff; }
.contact-row { display: flex; align-items: center; gap: 12px; font-size: 16px; }
.contact-row .mi { font-size: 20px; color: var(--ice); }
.legal-contact-card a { color: var(--ice); text-decoration-color: rgba(140,224,255,.4); }

.legal-footer-note { margin-top: 28px; padding: 0 6px; font-size: 14px; line-height: 1.6; color: var(--muted); }

/* ── Closing CTA (shares .cta from site.css) ── */
.legal-cta { padding: 140px 0; }
.legal-cta .cta-sub a { color: var(--ice); }

/* Shared .mi icons inside legal markup use the old size helpers */
.legal-content .mi-sm { font-size: 18px; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
  .legal-grid { grid-template-columns: 1fr; gap: 24px; }
  /* Contents collapse into a sticky dropdown under the local nav */
  .legal-toc {
    top: 52px; z-index: 40; max-height: none; overflow: visible; padding: 0;
    margin: 0 -16px; background: rgba(246,248,250,.88);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
  }
  .toc-label, .toc-related { display: none; }
  .toc-toggle {
    display: flex; width: 100%; align-items: center; justify-content: space-between;
    padding: 14px 16px; font-size: 15px; font-weight: 600; text-align: left;
  }
  .toc-toggle .mi { transition: transform .3s var(--ease); }
  .legal-toc.open .toc-toggle .mi { transform: rotate(180deg); }
  /* Floats over the text (absolute) so opening/closing never shifts the page
     — otherwise jumping to a section would land off-target as the list collapses */
  .toc-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    border-left: 0; max-height: 0; overflow-y: auto; padding: 0 16px;
    background: rgba(246,248,250,.97); box-shadow: 0 18px 30px -18px rgba(11,34,57,.25);
    transition: max-height .4s var(--ease), padding .4s var(--ease);
  }
  .legal-toc.open .toc-nav { max-height: 60vh; padding: 0 16px 14px; }
  .toc-item { border-left: 0; padding: 9px 0; margin: 0; }
  .toc-item.active { border-left: 0; }
  .legal-section { scroll-margin-top: 60px; } /* + 56px: clears nav + contents bar */
}
@media (max-width: 600px) {
  .legal-hero { padding: 72px 0 52px; }
  .legal-layout { padding: 0 0 96px; }
  .legal-intro, .legal-section { padding: 26px 22px; border-radius: 22px; }
  .legal-intro { font-size: 17px; margin-top: 8px; }
  .legal-content p, .legal-list li { font-size: 16px; }
  .legal-meta { font-size: 13px; }
  .legal-cta { padding: 110px 0; }
}
