/* Clean mobile-first global styles */
:root {
  --bg: #f7fafc;
  --text: #0f1724;
  --muted: #6b7280;
  --accent: #c0392b;
  --card: #ffffff;
  --gap: 1rem;
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */
.site-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--card);
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid rgba(15, 23, 36, 0.06);
}

.site-header-top {
  display: flex;
  align-items: center;
  gap: 0.6rem
}

.site-header h1 {
  font-size: 1rem;
  margin: 0;
  font-weight: 700
}

/* Nav toggle (hamburger) */
.site-nav-toggle {
  background: transparent;
  border: 0;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px
}

/* Site nav (mobile: hidden until opened) */
.site-nav {
  display: none
}

body.nav-open .site-nav {
  display: block;
  position: fixed;
  left: 0;
  right: 0;
  top: 56px;
  background: var(--card);
  padding: 0.75rem 1rem;
  box-shadow: 0 6px 18px rgba(15, 23, 36, 0.08);
  z-index: 40;
}

.site-nav a[data-link] {
  display: block;
  padding: 0.5rem 0;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600
}

.site-nav a[data-link]:hover {
  background: rgba(192, 57, 43, 0.06);
  color: var(--accent)
}

/* Main app area */
main#app {
  max-width: 1100px;
  margin: 1rem auto;
  padding: 0 1rem 1rem 1rem
}

/* Document layout: content + TOC */
.doc-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem
}

/* Breadcrumbs */
.breadcrumbs {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.8rem;
  padding: 0.45rem 0.6rem;
  background: rgba(15, 23, 36, 0.02);
  border-radius: 6px
}

.breadcrumbs a[data-link] {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600
}

.breadcrumbs a[data-link]:hover {
  text-decoration: underline
}

/* TOC styling */
.doc-toc .toc {
  background: transparent;
  border-left: none;
  padding: 0
}

.doc-toc .toc .toc-title {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem
}

.doc-toc .toc ol {
  padding-left: 0;
  margin: 0;
  list-style: none
}

.doc-toc .toc a {
  display: block;
  padding: 0.25rem 0;
  color: var(--text);
  text-decoration: none
}

.doc-toc .toc a:hover {
  color: var(--accent)
}

/* Policy list (index) */
#policy-list {
  list-style: none;
  padding-left: 0
}

#policy-list li {
  margin-bottom: 0.5rem
}

#policy-list li a {
  color: var(--accent);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 6px;
  display: inline-block
}

#policy-list li a:hover {
  background: rgba(192, 57, 43, 0.06)
}

/* Policy fragment header: stack metadata (always) */
.doc-content>section>header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start
}

.doc-content>section>header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem
}

/* Utilities */
.muted {
  color: var(--muted)
}

/* Larger screens: horizontal header, nav visible, two-column doc layout */
@media (min-width:800px) {
  .site-header {
    padding: 0.85rem 1.25rem
  }

  .site-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between
  }

  .site-nav {
    display: flex;
    gap: 0.5rem
  }

  .site-nav-toggle {
    display: none
  }

  body.nav-open .site-nav {
    position: static;
    box-shadow: none
  }

  .doc-layout {
    flex-direction: row;
    align-items: stretch;
    height: 100%
  }

  .doc-toc {
    flex: 0 0 260px;
    margin-left: 1.25rem;
    align-self: flex-start
  }

  .doc-toc .toc {
    background: var(--card);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(15, 23, 36, 0.04)
  }

  .doc-toc .toc .toc-title {
    margin: 0 0 0.5rem 0
  }

  .doc-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0
  }

  main#app {
    padding: 0 1rem 1rem 1rem;
  }

  /* Split-pane: TOC stays put, only policy text scrolls */
  body:has(.doc-layout) {
    display: flex;
    flex-direction: column;
    overflow: hidden
  }

  body:has(.doc-layout) main#app {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    margin-bottom: 0
  }
}

/* Print tweaks */
@media print {
  body.nav-open {
    overflow: visible
  }

  .site-nav {
    display: none
  }

  .doc-toc {
    position: static
  }
}