/* ============================================================
   Edunexa "Aurora" — legal document layer
   Shared by terms.html, legal/privacy/index.html,
   cookie-policy.html and refund-policy.html.

   Loaded after style.css (same <head>, right after it) so equal-
   specificity rules here win over the base `.legal*` rules in
   style.css — this file extends/refines that base treatment into
   a two-column reading layout rather than replacing it wholesale.

   Does NOT touch style.css, main.js, the navbar, or the footer.

   CAUTION preserved from the base stylesheet: never put
   backdrop-filter / filter / transform on an ancestor of a
   position:fixed element — it silently re-anchors the fixed
   element to that ancestor instead of the viewport. The one
   fixed element on this page (.legal-progress) lives directly
   inside <main>, which carries none of those properties, and the
   sticky sidebar below uses `position: sticky`, which never has
   this problem in the first place.
   ============================================================ */

/* ---------- Reading progress bar ---------- */
.legal-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 40;
  pointer-events: none;
  background: transparent;
}
.legal-progress__bar {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--gradient-aurora);
}
@media (prefers-reduced-motion: no-preference) {
  .legal-progress__bar { transition: width 0.12s linear; }
}

/* ---------- Page shell ---------- */
.legal { padding: 64px 0 130px; background: var(--paper); }
.legal .wrap { max-width: 1180px; }

.legal__eyebrow { margin-bottom: 22px; }

.legal__title { max-width: 640px; }

/* Callout that replaces the plain "Effective as of..." line */
.legal__callout {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 640px;
  margin: 24px 0 44px;
  padding: 14px 20px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: var(--radius-md);
}
.legal__callout-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gradient-aurora);
}
.legal .legal__callout .legal__updated {
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 700;
}

/* ---------- Two-column reading layout ----------
   Deliberately NOT align-items:start: the aside must stretch to
   match the height of the (much taller) content column so that
   position:sticky on .legal__toc below has room to stick while
   the reader scrolls through a long document, rather than being
   confined to a box only as tall as the TOC card itself. */
.legal__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 72px;
}

/* Comfortable measure for long-form legal copy (~68-75ch) */
.legal .legal__body { max-width: 680px; }

.legal .legal__body h2 {
  font-size: 1.4rem;
  line-height: 1.3;
  margin: 52px 0 16px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 112px;
}
.legal .legal__body h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.legal .legal__body h3 { scroll-margin-top: 112px; }
.legal .legal__body p,
.legal .legal__body li { max-width: 68ch; }

/* Table upgrade — used automatically if any of these pages ever
   grows a <table> inside .legal__table-wrap. */
.legal .legal__table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.legal .legal__table-wrap table { margin: 0; border: none; }
.legal .legal__table-wrap th,
.legal .legal__table-wrap td { border: none; border-bottom: 1px solid var(--border); }
.legal .legal__table-wrap tr:last-child td { border-bottom: none; }
.legal .legal__table-wrap thead th {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  background: var(--paper-soft);
}
.legal .legal__table-wrap tbody tr:hover { background: var(--paper-soft); }

/* Footer contact block, polished into a card */
.legal .legal__footer {
  margin-top: 64px;
  padding: 28px 30px 26px;
  border-top: none;
  background: var(--paper-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.legal .legal__footer p:last-child { margin-bottom: 0; }
.legal .legal__footer a { color: var(--accent-dark); font-weight: 700; }
.legal .legal__footer a:hover { text-decoration: underline; }

/* ---------- Sticky sidebar table of contents ---------- */
.legal__toc { position: sticky; top: 100px; }

.legal__toc-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 18px 16px;
}

.legal__toc-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
  cursor: pointer;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.legal__toc-summary::-webkit-details-marker { display: none; }
.legal__toc-summary::after {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
.legal__toc-card[open] .legal__toc-summary::after { transform: rotate(-135deg); }

.legal__toc-nav {
  margin-top: 14px;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
}
.legal__toc-list { display: flex; flex-direction: column; gap: 1px; }
.legal__toc-list a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.4;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.legal__toc-list a:hover { color: var(--ink); background: var(--paper-soft); }
.legal__toc-list a.is-active {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 700;
}

.legal__toc-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  width: 100%;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}
.legal__toc-top:hover { color: var(--accent-dark); }

/* On desktop the TOC card behaves as a static, always-open panel:
   the <details>/<summary> markup below is only there to give
   mobile an accordion for free — pointer-events:none here simply
   stops a desktop click from ever collapsing it. */
@media (min-width: 981px) {
  .legal__toc-summary { cursor: default; pointer-events: none; }
  .legal__toc-summary::after { display: none; }
}

@media (max-width: 980px) {
  .legal__grid { grid-template-columns: 1fr; gap: 28px; }
  .legal__toc { position: static; order: -1; }
  .legal .legal__body { max-width: none; }
  .legal .legal__body p,
  .legal .legal__body li { max-width: none; }
  .legal__toc-nav { max-height: none; }
}

@media (max-width: 560px) {
  .legal__callout { padding: 12px 16px; }
  .legal .legal__footer { padding: 22px 20px; }
}
