﻿/* Shared contents navigation for public information and policy pages. */
.document-page {
  overflow-x: clip;
}
.document-toc-bar,
.document-toc-sheet {
  display: none;
}

html.document-toc-open {
  overflow: hidden;
}

html.document-toc-open body {
  position: fixed;
  top: var(--document-toc-scroll-top, 0);
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

@media (max-width: 900px) {
  .document-page > funify-site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    padding-top: env(safe-area-inset-top);
  }

  [data-document-layout][data-document-toc='ready'] {
    padding-top: 8px;
  }

  [data-document-layout][data-document-toc='ready'] .document-toc-bar {
    margin-bottom: calc(8px - var(--document-toc-layout-gap, 28px));
  }

  [data-document-layout][data-document-toc='ready'] [id] {
    scroll-margin-top: var(--document-toc-offset, 132px);
  }

  [data-document-layout][data-document-toc='ready'] .features-docs-nav {
    display: none;
  }

  .document-toc-bar,
  .document-toc-sheet {
    --document-toc-ink: var(--landing-ink, #172337);
    --document-toc-muted: var(--landing-muted, #697586);
    --document-toc-line: var(--landing-line, #e5e9ef);
    --document-toc-panel: var(--landing-panel, #fff);
    box-sizing: border-box;
    border: 1px solid var(--document-toc-line);
    background: var(--document-toc-panel);
    color: var(--document-toc-ink);
  }

  .document-toc-bar {
    position: sticky;
    top: calc(var(--document-toc-header-height, 0px) + max(8px, env(safe-area-inset-top)));
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    margin-bottom: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgb(23 35 55 / 4%);
    font: inherit;
    text-align: left;
  }

  .document-toc-bar-status {
    display: flex;
    flex: 1;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
  }

  .document-toc-bar-current,
  .document-toc-bar-total,
  .document-toc-bar-separator {
    flex: none;
    color: var(--document-toc-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
  }

  .document-toc-bar-current {
    color: var(--landing-accent, #2563eb);
    font-weight: 600;
  }

  .document-toc-bar-title {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    text-overflow: ellipsis;
  }

  .document-toc-bar > svg {
    flex: none;
    width: 18px;
    height: 18px;
    color: var(--landing-accent, #2563eb);
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
  }

  .document-toc-sheet {
    position: fixed;
    inset: auto 0 0;
    width: min(560px, calc(100% - 24px));
    max-width: none;
    max-height: min(72dvh, 560px);
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 40px rgb(0 0 0 / 16%);
    opacity: 0;
    transform: translateY(24px);
    transition:
      transform 200ms ease,
      opacity 160ms ease;
  }

  .document-toc-sheet[open] {
    display: flex;
    flex-direction: column;
  }

  .document-toc-sheet.is-open {
    opacity: 1;
    transform: translateY(0);
  }

  .document-toc-sheet::backdrop {
    background: rgb(13 17 23 / 38%);
  }

  .document-toc-sheet-heading {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding: 6px 8px 6px 20px;
    border-bottom: 1px solid var(--document-toc-line);
  }

  .document-toc-sheet-heading h2 {
    min-width: 0;
    margin: 0;
    color: inherit;
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.4;
  }

  .document-toc-sheet-close {
    display: grid;
    flex: none;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--document-toc-muted);
  }

  .document-toc-sheet-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
  }

  .document-toc-sheet-links {
    display: grid;
    flex: 1 1 auto;
    gap: 2px;
    min-height: 0;
    padding: 8px 8px max(16px, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .document-toc-sheet-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--document-toc-ink);
    font-size: 13px;
    line-height: 1.6;
  }

  .document-toc-sheet-number {
    flex: none;
    min-width: 22px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
  }

  .document-toc-sheet-title {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .document-toc-sheet-link[aria-current='location'] {
    background: color-mix(in srgb, var(--landing-accent, #2563eb) 9%, transparent);
    color: var(--landing-accent, #2563eb);
    font-weight: 600;
  }

  .document-toc-sheet-link:hover,
  .document-toc-sheet-close:hover {
    background: color-mix(in srgb, var(--document-toc-muted) 8%, transparent);
  }

  .document-toc-sheet-link:focus-visible,
  .document-toc-sheet-close:focus-visible {
    outline: 2px solid var(--landing-accent, #2563eb);
    outline-offset: -2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .document-toc-sheet {
    transition: none;
  }
}
