/* ==========================================================================
   GoodCap Capital — Legal document layout (Phase 10; reusable for Privacy,
   Refund, Disclaimer and Fees pages). Document-style, no decorative motion.
   ========================================================================== */

.lg-page { background: #fff; }

/* Reading progress under the sticky header */
.lg-progress { position: sticky; top: var(--header-h); z-index: 90; height: 3px; background: transparent; }
.lg-progress span { display: block; height: 100%; background: var(--gc-gradient-text); transform-origin: left; transform: scaleX(0); }

/* ---------- Hero ---------- */
.lg-hero { background: var(--gc-mist); border-bottom: 1px solid var(--gc-line); padding: clamp(28px, 4vw, 52px) 0 clamp(24px, 3.5vw, 40px); }
.lg-hero__inner { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 32px; }
.lg-hero h1 { font-size: clamp(2rem, 3.6vw, 3rem); letter-spacing: -0.032em; margin: 14px 0 12px; }
.lg-hero__meta { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 0.875rem; font-weight: 600; color: var(--gc-muted); }
.lg-hero__meta > span { display: inline-flex; align-items: center; gap: 8px; }
.lg-hero__meta .icon { width: 17px; height: 17px; color: var(--gc-blue); }

/* ---------- Layout ---------- */
.lg-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 0; padding-bottom: var(--section-y); }
.lg-layout > * { min-width: 0; }
@media (min-width: 1024px) { .lg-layout { grid-template-columns: 300px minmax(0, 1fr); gap: 64px; padding-top: 48px; } }
@media (min-width: 1280px) { .lg-layout { grid-template-columns: 320px minmax(0, 1fr); gap: 88px; } }

/* ---------- TOC ---------- */
.lg-toc { position: sticky; top: calc(var(--header-h) + 3px); z-index: 20; align-self: start; }
@media (max-width: 1023px) {
  .lg-toc { margin: 0 calc(var(--gutter) * -1); padding: 10px var(--gutter); background: rgba(255, 255, 255, 0.97); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--gc-line); }
}
@media (min-width: 1024px) { .lg-toc { top: calc(var(--header-h) + 28px); } }

.lg-jump {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  min-height: 52px; padding: 6px 14px; border-radius: 14px; border: 1px solid var(--gc-line); background: #fff; text-align: left;
}
.lg-jump small { display: block; font-size: 0.75rem; font-weight: 700; color: var(--gc-muted); }
.lg-jump b { display: block; font-size: 0.9375rem; color: var(--gc-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70vw; }
.lg-jump .icon { width: 20px; height: 20px; color: var(--gc-muted); flex-shrink: 0; transition: transform .25s var(--ease); }
.lg-jump[aria-expanded="true"] .icon { transform: rotate(180deg); }
@media (min-width: 1024px) { .lg-jump { display: none; } }

.lg-toc__panel { display: none; }
.lg-toc__panel.is-open { display: block; max-height: min(64vh, 520px); overflow-y: auto; margin-top: 10px; padding: 14px; border-radius: 16px; border: 1px solid var(--gc-line); background: #fff; box-shadow: var(--sh-lg); }
@media (min-width: 1024px) {
  .lg-toc__panel, .lg-toc__panel.is-open { display: block; max-height: calc(100vh - var(--header-h) - 56px); overflow-y: auto; margin: 0; padding: 0 8px 0 0; border: 0; box-shadow: none; background: none; scrollbar-width: thin; }
}
.lg-toc__title { font-size: 0.875rem; font-weight: 800; color: var(--gc-ink); margin-bottom: 10px; }
@media (max-width: 1023px) { .lg-toc__title { display: none; } }
.lg-toc__filter { position: relative; margin-bottom: 10px; }
.lg-toc__filter .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--gc-muted); pointer-events: none; }
.lg-toc__filter input { width: 100%; height: 44px; padding: 0 12px 0 36px; border-radius: 12px; border: 1px solid var(--gc-line); background: #fff; font-size: 0.9rem; -webkit-appearance: none; appearance: none; }
.lg-toc__filter input:focus { outline: none; border-color: var(--gc-blue); box-shadow: 0 0 0 3px rgba(2, 128, 231, 0.14); }
.lg-toc__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.lg-toc__list li[hidden] { display: none; }
.lg-toc__list a {
  display: grid; grid-template-columns: 28px 1fr; gap: 6px; align-items: baseline;
  min-height: 36px; padding: 7px 10px; border-radius: 10px; border-left: 2px solid transparent;
  font-size: 0.8125rem; font-weight: 600; line-height: 1.4; color: var(--gc-muted);
  transition: background-color .15s, color .15s, border-color .15s;
}
.lg-toc__list a:hover { background: var(--gc-mist); color: var(--gc-ink); }
.lg-toc__list a.is-active { background: var(--gc-tint); color: var(--gc-navy); border-left-color: var(--gc-blue); }
.lg-toc__num { font-variant-numeric: tabular-nums; color: #94a3b8; font-weight: 700; }
.lg-toc__list a.is-active .lg-toc__num { color: var(--gc-blue); }
.lg-toc__text { font-size: 0.78rem; letter-spacing: 0.01em; }
.lg-toc__empty { font-size: 0.8125rem; color: var(--gc-muted); padding: 8px 10px; }

/* ---------- Legal typography ---------- */
.lg-main { max-width: 820px; padding-top: 28px; }
@media (min-width: 1024px) { .lg-main { padding-top: 0; } }
.legal { font-size: 1.0625rem; line-height: 1.75; color: var(--gc-text); }
.legal:focus { outline: none; }
.legal h2 {
  scroll-margin-top: 84px;               /* added to html's scroll-padding (header + 16px) — clears the mobile Jump bar */
  display: flex; gap: 12px; align-items: baseline;
  font-size: clamp(1.05rem, 1.5vw, 1.2rem); letter-spacing: 0.01em; line-height: 1.35; color: var(--gc-ink);
  margin: 0 0 16px; padding-top: 34px; border-top: 1px solid var(--gc-line);
}
@media (min-width: 1024px) { .legal h2 { scroll-margin-top: 16px; } }
.legal h2:focus { outline: none; }
.legal h2:focus-visible { outline: 3px solid var(--gc-cyan); outline-offset: 4px; }
.legal .lg-section:first-child h2, .legal > h2:first-child { border-top: 0; padding-top: 0; }
.lg-num { flex-shrink: 0; min-width: 2.2em; color: var(--gc-blue); font-variant-numeric: tabular-nums; }
.legal h3 { font-size: 1.0625rem; margin: 22px 0 10px; color: var(--gc-ink); letter-spacing: -0.005em; }
.legal p { margin: 0 0 16px; }
.legal p:last-child { margin-bottom: 0; }
.legal ol, .legal ul { margin: 0 0 18px; padding-left: 1.4em; }
.legal ul { list-style: disc; }
.legal ol { list-style: decimal; }
.legal li { margin-bottom: 8px; padding-left: 4px; }
.legal li::marker { color: var(--gc-blue); font-weight: 700; }
.legal strong, .legal b { color: var(--gc-ink); font-weight: 700; }
.legal a { color: var(--gc-blue); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.lg-section { padding-bottom: 30px; }

/* Preview-only placeholder (removed when the real text is in place) */
.lg-slot { padding: 16px 18px; border-radius: 12px; border: 1.5px dashed var(--gc-line-blue); background: var(--gc-mist); }
.lg-slot p { font-size: 0.9rem; color: var(--gc-muted); font-style: italic; margin: 0; }

/* Related policies */
.lg-related { margin-top: 24px; padding: 24px; border-radius: 20px; background: var(--gc-mist); border: 1px solid var(--gc-line); }
.lg-related h2 { font-size: 1.125rem; margin-bottom: 14px; }
.lg-related ul { display: grid; gap: 8px; margin-bottom: 16px; }
@media (min-width: 640px) { .lg-related ul { grid-template-columns: 1fr 1fr; } }
.lg-related ul a { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 12px; background: #fff; border: 1px solid var(--gc-line); font-weight: 700; color: var(--gc-navy); font-size: 0.9375rem; }
.lg-related ul a:hover { border-color: var(--gc-blue); color: var(--gc-blue); }
.lg-related ul .icon { width: 18px; height: 18px; color: var(--gc-blue); }
.lg-related > p { font-size: 0.9375rem; color: var(--gc-muted); }
.lg-related > p a { color: var(--gc-blue); font-weight: 700; }

/* Back to top */
.lg-top {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 80;
  display: inline-flex; align-items: center; gap: 6px; height: 48px; padding: 0 16px; border-radius: 14px;
  background: var(--gc-navy); color: #fff; font-weight: 700; font-size: 0.875rem; box-shadow: var(--sh-lg);
  transition: transform .2s var(--ease), background-color .2s;
}
.lg-top:hover { transform: translateY(-2px); background: var(--gc-royal); }
.lg-top[hidden] { display: none; }
.lg-top .icon { width: 18px; height: 18px; }

/* ---------- Print ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  .topbar, .site-header, .drawer, .skip-link, .lg-progress, .lg-toc, .lg-hero__tools, .lg-top, .lg-related ul, .site-footer, .breadcrumb { display: none !important; }
  body, .lg-page { background: #fff !important; color: #000; }
  .lg-hero { background: none; border: 0; padding: 0 0 12px; }
  .lg-hero h1 { font-size: 22pt; margin: 0 0 6pt; color: #000; }
  .lg-layout { display: block; padding: 0; }
  .lg-main { max-width: none; padding: 0; }
  .container { padding: 0; max-width: none; }
  .legal { font-size: 11pt; line-height: 1.55; color: #000; }
  .legal h2 { font-size: 12.5pt; color: #000; border-top: 0.5pt solid #999; padding-top: 10pt; break-after: avoid; page-break-after: avoid; }
  .lg-num { color: #000; }
  .legal p, .legal li { orphans: 3; widows: 3; }
  .legal a { color: #000; text-decoration: none; }
  .lg-related { background: none; border: 0.5pt solid #999; break-inside: avoid; }
  .lg-slot { background: none; }
}
