/* ============================================================
 * Sapling Health — Legal site
 * legal.saplinghealth.com
 * Mirrors the in-app design system: Inter, deep forest green
 * accents, predominantly neutral surfaces, restrained motion.
 * ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Brand */
  --sapling-green-900: #073622;
  --sapling-green-700: #0a4a2e;
  --sapling-green-100: #d9e8e1;
  --sapling-green-tint: rgba(7, 54, 34, 0.05);
  --sapling-green-tint-strong: rgba(7, 54, 34, 0.1);

  /* Neutrals */
  --white: #ffffff;
  --gray-50:  #fafafa;
  --gray-100: #f5f5f5;
  --gray-150: #ebebeb;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Cascadia Mono', monospace;

  /* Radii */
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;

  /* Shadow — only the signature hover lift */
  --shadow-card-hover: 0 0 0 1px rgba(0,0,0,0.03), 0 4px 8px rgba(0,0,0,0.04), 0 24px 48px rgba(0,0,0,0.06);
}

/* ============================================================
 * Base
 * ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-900);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}

a { color: var(--sapling-green-900); text-decoration: none; }
a:hover { color: var(--sapling-green-700); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }

::selection {
  background: var(--sapling-green-tint-strong);
  color: var(--sapling-green-900);
}

/* ============================================================
 * Header
 * ============================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--gray-200);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand:hover { text-decoration: none; }

.brand-logo { height: 22px; width: auto; display: block; }

.brand-divider {
  width: 1px;
  height: 18px;
  background: var(--gray-300);
}

.brand-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-500);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav-link {
  display: inline-block;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  border-radius: var(--radius-md);
  transition: color 150ms ease, background-color 150ms ease;
}

.header-nav-link:hover {
  color: var(--gray-900);
  background: var(--gray-100);
  text-decoration: none;
}

.header-nav-link.is-active {
  color: var(--sapling-green-900);
  background: var(--sapling-green-tint);
}

/* ============================================================
 * Layout — document with side TOC
 * ============================================================ */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 32px 96px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 64px;
  align-items: start;
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 40px 24px 72px;
  }
}

/* ============================================================
 * Side Table of Contents
 * ============================================================ */
.toc {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

@media (max-width: 960px) {
  .toc {
    position: static;
    max-height: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 16px;
    background: var(--gray-50);
  }
}

.toc-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin: 0 0 12px;
  padding-left: 12px;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: section;
}

.toc li { counter-increment: section; }

.toc a {
  display: flex;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--gray-500);
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.toc a::before {
  content: counter(section) ".";
  font-variant-numeric: tabular-nums;
  color: var(--gray-400);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 18px;
}

.toc a:hover {
  color: var(--gray-900);
  background: var(--gray-50);
  text-decoration: none;
}

.toc a.is-active {
  color: var(--sapling-green-900);
  border-left-color: var(--sapling-green-900);
  background: var(--sapling-green-tint);
  font-weight: 500;
}

.toc a.is-active::before { color: var(--sapling-green-900); }

/* ============================================================
 * Article (the actual document)
 * ============================================================ */
.doc {
  max-width: 720px;
}

.doc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 8px;
  background: var(--sapling-green-tint);
  color: var(--sapling-green-900);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 9999px;
  margin-bottom: 20px;
}

.doc-eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--sapling-green-900);
}

.doc-title {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--gray-900);
  margin: 0 0 20px;
}

@media (max-width: 600px) {
  .doc-title { font-size: 30px; }
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 28px;
  padding: 16px 0;
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  margin: 0 0 40px;
}

.doc-meta-item { display: flex; flex-direction: column; gap: 2px; }

.doc-meta-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.doc-meta-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-900);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
 * Prose
 * ============================================================ */
.prose { color: var(--gray-700); font-size: 15px; line-height: 1.7; }

.prose .lede {
  font-size: 17px;
  line-height: 1.6;
  color: var(--gray-700);
  margin: 0 0 32px;
}

.prose section { scroll-margin-top: 96px; }

.prose section + section { margin-top: 56px; }

.prose h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--gray-900);
  margin: 0 0 20px;
  padding-top: 8px;
}

.prose h2 .num {
  font-size: 13px;
  font-weight: 500;
  color: var(--sapling-green-900);
  background: var(--sapling-green-tint);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  font-variant-numeric: tabular-nums;
  position: relative;
  top: -3px;
}

.prose h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 28px 0 8px;
  letter-spacing: -0.005em;
}

.prose p { margin: 0 0 16px; }

.prose p:last-child { margin-bottom: 0; }

.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }

.prose li { margin-bottom: 6px; }

.prose li::marker { color: var(--gray-400); }

.prose strong { color: var(--gray-900); font-weight: 600; }

.prose em { color: var(--gray-900); }

/* "Definition" pattern: bold lead-in followed by dot then prose */
.prose .term {
  color: var(--gray-900);
  font-weight: 600;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--gray-100);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--gray-800);
}

/* Callout */
.callout {
  background: var(--sapling-green-tint);
  border-left: 2px solid var(--sapling-green-900);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 14px;
  color: var(--gray-700);
}

.callout strong { color: var(--sapling-green-900); }

/* ============================================================
 * Anchor link on heading hover
 * ============================================================ */
.prose h2 .anchor {
  opacity: 0;
  margin-left: 6px;
  font-size: 14px;
  font-weight: 400;
  color: var(--gray-400);
  transition: opacity 150ms ease, color 150ms ease;
  text-decoration: none;
  align-self: center;
}

.prose h2:hover .anchor { opacity: 1; }
.prose h2 .anchor:hover { color: var(--sapling-green-900); text-decoration: none; }

/* ============================================================
 * Coming-soon placeholder (BAA page)
 * ============================================================ */
.placeholder {
  margin-top: 8px;
  padding: 56px 40px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-2xl);
  text-align: center;
}

.placeholder-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sapling-green-900);
}

.placeholder h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 8px;
  letter-spacing: -0.015em;
}

.placeholder p {
  font-size: 14px;
  color: var(--gray-500);
  margin: 0 auto;
  max-width: 460px;
  line-height: 1.6;
}

.placeholder .links {
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 9999px;
  font-size: 12px;
}

.placeholder .links a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 9999px;
  color: var(--gray-600);
  font-weight: 500;
  transition: background 150ms ease, color 150ms ease;
}

.placeholder .links a:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  text-decoration: none;
}

.placeholder .links .sep { color: var(--gray-300); padding: 0 2px; }

/* ============================================================
 * Footer
 * ============================================================ */
.footer {
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-left { display: flex; align-items: center; gap: 12px; }

.footer-icon { width: 18px; height: 18px; }

.footer-text {
  font-size: 12px;
  color: var(--gray-500);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.footer-links a {
  color: var(--gray-500);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  transition: color 150ms ease, background 150ms ease;
}

.footer-links a:hover {
  color: var(--gray-900);
  background: var(--gray-100);
  text-decoration: none;
}

.footer-links .sep { color: var(--gray-300); }

/* ============================================================
 * Mobile cleanup
 * ============================================================ */
@media (max-width: 600px) {
  .header-inner { padding: 14px 20px; }
  .brand-tag { display: none; }
  .header-nav-link { padding: 6px 10px; font-size: 12px; }
  .doc-meta { gap: 0 20px; }
  .placeholder { padding: 40px 20px; }
}
