/* ============================================================
   Vyshnavam — legal document pages
   Builds on styles.css (tokens, header, footer, buttons, orn)
   ============================================================ */

/* ---------- Reading progress ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--maroon), var(--gold));
  z-index: 140; transition: width 0.08s linear;
}

/* ---------- Legal hero ---------- */
.legal-hero {
  position: relative; overflow: hidden; color: var(--on-dark);
  padding: 150px 0 clamp(2.6rem, 6vw, 4.6rem);
  background: linear-gradient(180deg, var(--wine), var(--maroon-deep));
}
.legal-hero::before {
  content: ""; position: absolute; inset: 0; opacity: 0.4;
  background-image: radial-gradient(rgba(215, 185, 136, 0.14) 1.3px, transparent 1.4px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(70% 70% at 25% 40%, #000 10%, transparent 76%);
  mask-image: radial-gradient(70% 70% at 25% 40%, #000 10%, transparent 76%);
}
.legal-hero .shell { position: relative; z-index: 2; }
.legal-hero .skyline { opacity: 0.14; }

.breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem;
  font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--on-dark-muted); margin: 0 0 1.3rem;
}
.breadcrumb a { color: var(--gold-soft); transition: color 0.3s var(--ease); }
.breadcrumb a:hover { color: var(--on-dark); }
.breadcrumb span { opacity: 0.5; }

.legal-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.1rem, 5.6vw, 3.6rem); line-height: 1.04;
  color: var(--on-dark); margin: 0 0 1rem; letter-spacing: -0.015em; text-wrap: balance;
}
.legal-sub { color: var(--on-dark-muted); max-width: var(--measure-lead); font-size: clamp(1rem, 1.6vw, 1.12rem); margin: 0; text-wrap: pretty; }

.legal-meta {
  display: flex; flex-wrap: wrap; gap: 0.7rem 2rem; margin-top: 1.8rem;
  padding-top: 1.5rem; border-top: 1px solid rgba(215, 185, 136, 0.22);
  font-size: 0.82rem; color: var(--on-dark-muted);
}
.legal-meta b { color: var(--gold-soft); font-weight: 500; }

/* ---------- Layout ---------- */
.legal-layout {
  display: grid; grid-template-columns: 262px minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-block: clamp(2.8rem, 7vw, 5.5rem);
  align-items: start;
}

/* ---------- Table of contents ---------- */
.legal-toc-wrap { position: sticky; top: 106px; }
.legal-toc h2 {
  font-family: var(--font-ui); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--maroon); margin: 0 0 1rem;
}
.legal-toc ol { list-style: none; margin: 0; padding: 0; }
.legal-toc a {
  display: block; padding: 0.5rem 0.85rem; border-left: 2px solid var(--line);
  color: var(--muted); font-size: 0.9rem; line-height: 1.35;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), padding-left 0.3s var(--ease);
}
.legal-toc a:hover { color: var(--ink); }
.legal-toc a.is-active { color: var(--maroon); border-color: var(--maroon); padding-left: 1.05rem; font-weight: 500; }

/* Mobile accordion TOC */
.toc-acc {
  display: none; margin-bottom: 2rem;
  border: 1px solid var(--line); border-radius: 16px; background: var(--white); overflow: hidden;
}
.toc-acc summary {
  list-style: none; cursor: pointer; min-height: 54px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.2rem; font-size: 0.76rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--maroon);
}
.toc-acc summary::-webkit-details-marker { display: none; }
.toc-acc summary svg { width: 16px; height: 16px; transition: transform 0.35s var(--ease); flex: none; }
.toc-acc[open] summary svg { transform: rotate(180deg); }
.toc-acc ol { list-style: none; margin: 0; padding: 0 1.2rem 0.6rem; }
.toc-acc a {
  display: flex; align-items: center; min-height: 46px; padding: 0.5rem 0;
  color: var(--muted); border-bottom: 1px solid var(--line);
}
.toc-acc li:last-child a { border-bottom: 0; }

/* ---------- Notice / callout ---------- */
.legal-notice {
  display: flex; gap: 0.9rem; align-items: flex-start;
  background: color-mix(in srgb, var(--gold) 11%, var(--white));
  border: 1px solid color-mix(in srgb, var(--gold) 42%, transparent);
  border-left: 4px solid var(--gold);
  border-radius: 14px; padding: 1.1rem 1.3rem; margin: 0 0 2.6rem;
}
.legal-notice svg { width: 22px; height: 22px; flex: none; color: var(--maroon); margin-top: 1px; }
.legal-notice p { margin: 0; font-size: 0.95rem; color: var(--maroon-deep); line-height: 1.5; }

/* ---------- Document prose ---------- */
.legal-doc { max-width: var(--measure); }
.legal-doc > section { scroll-margin-top: 108px; padding-top: 0.4rem; margin-bottom: 1.6rem; }
.legal-doc h2 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.5rem, 2.8vw, 2rem); line-height: 1.12;
  margin: 2.4rem 0 0.9rem; padding-top: 1.6rem; border-top: 1px solid var(--line);
}
.legal-doc section:first-of-type h2 { border-top: 0; padding-top: 0; margin-top: 0.5rem; }
.legal-doc h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.25rem; margin: 1.6rem 0 0.5rem; }
.legal-doc p { color: var(--muted); margin: 0 0 1rem; hanging-punctuation: first; }
.legal-doc ul, .legal-doc ol { margin: 0 0 1.2rem; padding-left: 1.35rem; color: var(--muted); }
.legal-doc li { margin-bottom: 0.5rem; padding-left: 0.15rem; line-height: 1.55; }
.legal-doc li::marker { color: var(--gold); }
.legal-doc strong { color: var(--ink); font-weight: 600; }
.legal-doc a { color: var(--maroon); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.legal-doc a:hover { text-decoration-color: var(--maroon); }

.legal-doc .toc-heading { margin: 0 0 0.4rem; }

.legal-table { width: 100%; border-collapse: collapse; margin: 0 0 1.4rem; font-size: 0.92rem; }
.legal-table caption { text-align: left; font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--maroon); margin-bottom: 0.6rem; }
.legal-table th, .legal-table td { text-align: left; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--line); color: var(--muted); vertical-align: top; }
.legal-table th { color: var(--ink); font-weight: 600; }
.legal-table tr:last-child td { border-bottom: 0; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: clamp(16px, 4vw, 30px); bottom: clamp(16px, 4vw, 30px); z-index: 90;
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--maroon); color: var(--cream); box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(0.9);
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease), visibility 0.4s var(--ease), background-color 0.3s var(--ease);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--maroon-deep); transform: translateY(-2px); }
.to-top svg { width: 20px; height: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .legal-layout { grid-template-columns: 1fr; }
  .legal-toc-wrap { position: static; }
  .legal-toc { display: none; }
  .toc-acc { display: block; }
}

@media (max-width: 560px) {
  .legal-hero { padding-top: 120px; }
  .legal-meta { gap: 0.5rem 1.4rem; }
  .legal-doc h2 { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-progress { transition: none; }
  .to-top { transition: none; }
}
