/*
  Custom styles for legal Markdown pages.
  These styles are linked by pandoc via build.sh as /legal.css.
  Tweak freely to match your brand.
*/

/* Base layout */
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

body {
  margin: 0 auto;
  padding: 2rem 1.25rem;
  max-width: 860px;
  line-height: 1.65;
  color: #1f2937; /* gray-800 */
  background: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
}

/* Top navigation */
.legal-topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid #e5e7eb;
  margin: -2rem -1.25rem 1.5rem; /* stretch full width */
}
.legal-topnav .brand { font-weight: 600; color: #111827; text-decoration: none; margin-right: 0.75rem; }
.legal-topnav .links a { color: #374151; text-decoration: none; margin-right: 0.75rem; }
.legal-topnav .links a:hover, .legal-topnav .links a[aria-current="page"] { color: #111827; text-decoration: underline; }

/* Two-column layout with sticky TOC */
.legal-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
}
.legal-aside { position: sticky; top: 3.25rem; height: calc(100vh - 4rem); overflow: auto; border-right: 1px solid #f3f4f6; padding-right: 1rem; }
.legal-main { min-width: 0; }

/* TOC */
.legal-toc { font-size: 0.9rem; }
.legal-toc .toc-title { font-weight: 600; color: #111827; margin-bottom: 0.5rem; }
.legal-toc ul { list-style: none; margin: 0; padding-left: 0.25rem; }
.legal-toc li { margin: 0.2rem 0; }
.legal-toc a {
  color: #374151;
  text-decoration: none;
  /* Clamp long entries to two lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  hyphens: auto;
  word-break: break-word;
}
.legal-toc a:hover { text-decoration: underline; }

/* Stronger hierarchical indentation with visual guide rails */
.legal-toc ul ul {
  margin-left: 1rem;      /* level 2 indent */
  padding-left: 0.75rem;
  border-left: 1.5px solid #e5e7eb; /* subtle rail */
}
.legal-toc ul ul ul {
  margin-left: 1rem;      /* level 3 additional indent */
  padding-left: 0.75rem;
  border-left: 1.5px solid #eef2f7;
}
.legal-toc ul ul ul ul {
  margin-left: 1rem;      /* level 4 additional indent */
  padding-left: 0.75rem;
  border-left: 1.5px solid #f3f4f6;
}

/* Footer */
.legal-footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; color: #6b7280; }
.legal-footer .container { display: flex; gap: 0.75rem; align-items: center; }
.legal-footer a { color: inherit; }
.legal-footer .sep { opacity: 0.6; }

/* Responsive adjustments */
@media (max-width: 960px) {
  .legal-layout { grid-template-columns: 1fr; }
  .legal-aside { position: static; height: auto; border-right: 0; padding-right: 0; }
}

/* Headings */
h1, h2, h3, h4, h5, h6 { color: #111827; margin-top: 1.8em; line-height: 1.25; }
h1 { font-size: 2rem; margin-top: 0; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

/* Typography */
p { margin: 0.85em 0; }
strong { color: #0f172a; }
em { color: #1f2937; }

/* Links */
a { color: #0ea5e9; text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

/* Lists */
ul, ol { padding-left: 1.25rem; margin: 0.85em 0; }
li { margin: 0.25em 0; }

/* Code */
code { background: #f3f4f6; padding: 0.1em 0.35em; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.95em; }
pre { background: #0b1021; color: #e5e7eb; padding: 1rem; border-radius: 8px; overflow: auto; }
pre code { background: transparent; padding: 0; color: inherit; }

/* Blockquotes */
blockquote { margin: 1.25em 0; padding: 0.75em 1em; border-left: 4px solid #d1d5db; color: #374151; background: #f9fafb; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 1em 0; }
th, td { border: 1px solid #e5e7eb; padding: 0.5rem 0.75rem; text-align: left; }
thead th { background: #f3f4f6; }

/* Horizontal rule */
hr { border: 0; border-top: 1px solid #e5e7eb; margin: 2rem 0; }

/* Images */
img { max-width: 100%; height: auto; }

/* Pandoc-specific helpers */
.title, .author, .date { display: block; text-align: left; margin: 0.25em 0; color: #374151; }

/* Prevent sticky header overlap on anchor jumps */
.legal-main :is(h1,h2,h3,h4,h5,h6) { scroll-margin-top: 80px; }

/* Heading anchors */
.heading-anchor {
  margin-left: 0.4em;
  color: #9ca3af;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease-in-out, color 0.15s ease-in-out;
}
h1:hover .heading-anchor,
h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor,
h5:hover .heading-anchor,
h6:hover .heading-anchor { opacity: 1; }
.heading-anchor:hover,
.heading-anchor:focus { color: #6b7280; opacity: 1; outline: none; }

/* Heading anchors */
.heading-anchor {
  margin-left: 0.4em;
  color: #9ca3af;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease-in-out, color 0.15s ease-in-out;
}
h1:hover .heading-anchor,
h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor,
h5:hover .heading-anchor,
h6:hover .heading-anchor { opacity: 1; }
.heading-anchor:hover { color: #6b7280; }
