/* Csharpp JSC — bilingual helper (used by aerp.html too) and the legal page layout.
   Builds on the tokens and components in styles.css. */
html[lang="en"] .legal-vi,
html[lang="vi"] .legal-en { display: none !important; }

.legal-main {
  padding-top: clamp(2.5rem, 1.6rem + 3.8vw, 5.5rem);
  padding-bottom: clamp(4rem, 3rem + 4vw, 7.5rem);
}

.legal-layout {
  display: grid;
  grid-template-areas: "head" "toc" "article";
  row-gap: clamp(2rem, 1.6rem + 1.6vw, 3.5rem);
}
.legal-head { grid-area: head; min-width: 0; }
.legal-toc-nav { grid-area: toc; min-width: 0; }
.legal-article { grid-area: article; min-width: 0; }

@media (min-width: 1100px) {
  .legal-layout {
    grid-template-areas: "head toc" "article toc";
    grid-template-columns: minmax(0, 760px) 280px;
    grid-template-rows: auto 1fr;
    justify-content: space-between;
    column-gap: 96px;
  }
  .legal-toc-nav {
    align-self: start;
    position: sticky;
    top: calc(var(--header-h) + 32px);
    max-height: calc(100vh - var(--header-h) - 64px);
    overflow-y: auto;
  }
}

.legal-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 500;
}
.legal-back:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--signal); text-decoration-thickness: 3px; text-underline-offset: 6px; }

.legal-title {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 1.55rem + 4.9vw, 5.5rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-wrap: balance;
}
.legal-meta { margin-top: 20px; color: var(--muted); font-size: var(--fs-small); }
.legal-lead { max-width: 40rem; margin-top: 20px; font-size: var(--fs-lead); line-height: 1.65; }

/* Table of contents */
.legal-toc { border-top: 1px solid var(--ink); font-size: var(--fs-small); }
.legal-toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.legal-toc summary::-webkit-details-marker { display: none; }
.legal-toc summary::after { content: "+"; font-size: 1.25rem; font-weight: 500; line-height: 1; }
.legal-toc[open] summary::after { content: "\2212"; }
.legal-toc a {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 10px 0;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  line-height: 1.45;
}
.legal-toc li:last-child a { border-bottom: 1px solid var(--hairline); }
.legal-toc a::before {
  content: "";
  flex: none;
  width: 10px; height: 10px;
  margin-top: 0.4em;
  border-radius: 50%;
  background: transparent;
}
.legal-toc a:hover { color: var(--ink); }
.legal-toc a[aria-current="true"] { color: var(--ink); font-weight: 600; }
.legal-toc a[aria-current="true"]::before { background: var(--signal); }
@media (min-width: 1100px) {
  .legal-toc summary { cursor: default; pointer-events: none; }
  .legal-toc summary::after { display: none; }
}

/* Article typography */
.legal-article section { margin-bottom: clamp(2.5rem, 2rem + 2vw, 3.5rem); scroll-margin-top: calc(var(--header-h) + 24px); }
.legal-article h2 {
  margin-bottom: 16px;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.legal-article p, .legal-article li { font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem); line-height: 1.75; }
.legal-article p { margin-bottom: 16px; }
.legal-article ul { margin: 0 0 16px; padding-left: 1.25em; list-style: square; }
.legal-article li::marker { color: var(--muted); }
.legal-article li + li { margin-top: 6px; }
.legal-article a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; overflow-wrap: anywhere; }
.legal-article a:hover { text-decoration-color: var(--signal); text-decoration-thickness: 3px; }
.legal-article strong { font-weight: 600; }
.legal-note { margin: 0 0 16px; padding: 4px 0 4px 16px; border-left: 2px solid var(--ink); }
.legal-note p { margin: 0; }
