/* =============================================================
   Altair Documentation — Shared Stylesheet
   Matches the Constellation landing design language exactly.
   Tokens sourced from apps/web/src/styles/theme.css (light mode).
   ============================================================= */

/* -- CSS Variables (light mode only — docs always light) -- */
:root {
  --doc-bg: 38 30% 96%;
  --doc-fg: 225 45% 14%;
  --doc-card: 38 30% 97%;
  --doc-border: 30 14% 84%;
  --doc-primary: 225 45% 14%;
  --doc-radius: 0.625rem;
  --doc-shadow-sm: 0 1px 2px 0 hsl(225 45% 14% / 0.03);
  --doc-shadow-lg:
    0 8px 24px -4px hsl(225 45% 14% / 0.08),
    0 2px 8px -2px hsl(225 45% 14% / 0.04);
  --doc-navbar-h: 64px;
  --doc-max-w: 1224px;
  --doc-content-w: 760px;
  --doc-toc-w: 220px;
  --doc-col-gap: 80px;
}

/* -- Reset -- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* -- Base -- */
html {
  scroll-behavior: smooth;
}

body {
  font-family:
    "Outfit",
    -apple-system,
    BlinkMacSystemFont,
    system-ui,
    sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: hsl(var(--doc-fg) / 0.8);
  background: hsl(var(--doc-bg));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* -- Typography -- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family:
    "Space Grotesk",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: hsl(var(--doc-fg));
  line-height: 1.25;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(20px, 2.5vw, 26px);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  scroll-margin-top: 88px;
}

h3 {
  font-size: 1.05rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: hsl(var(--doc-fg) / 0.9);
}

p {
  margin-bottom: 0.85rem;
}

a {
  color: hsl(var(--doc-fg));
  text-decoration: underline;
  text-decoration-color: hsl(var(--doc-fg) / 0.2);
  text-underline-offset: 3px;
  transition: text-decoration-color 150ms;
}
a:hover {
  text-decoration-color: hsl(var(--doc-fg) / 0.6);
}

strong {
  color: hsl(var(--doc-fg));
  font-weight: 600;
}

code {
  font-family: "JetBrains Mono", "SF Mono", Monaco, monospace;
  font-size: 0.875em;
  background: hsl(var(--doc-card));
  padding: 2px 6px;
  border-radius: 4px;
}

ul,
ol {
  margin: 0.5rem 0 1.25rem 1.5rem;
}
li {
  margin-bottom: 0.4rem;
}

/* -- Layout -- */
.doc-page {
  max-width: var(--doc-max-w);
  margin: 0 auto;
  padding: 0 20px;
}

.doc-header {
  padding-top: max(calc(var(--doc-navbar-h) + 56px), 14vh);
  padding-bottom: 0;
}

.doc-eyebrow {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: hsl(var(--doc-fg) / 0.3);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
}

.doc-title {
  margin-top: 12px;
}

.doc-meta {
  margin-top: 8px;
  font-size: 13px;
  color: hsl(var(--doc-fg) / 0.4);
}

.doc-divider {
  margin-top: 2.5rem;
  border: none;
  border-top: 1px solid hsl(var(--doc-fg) / 0.08);
}

.doc-grid {
  margin-top: 3rem;
  display: block;
}

@media (min-width: 1024px) {
  .doc-grid {
    display: grid;
    grid-template-columns: minmax(0, var(--doc-content-w)) var(--doc-toc-w);
    column-gap: var(--doc-col-gap);
  }
}

article {
  max-width: var(--doc-content-w);
}

article section {
  margin-top: 0.25rem;
}

/* -- Breadcrumb -- */
.doc-breadcrumb {
  font-size: 13px;
  color: hsl(var(--doc-fg) / 0.4);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}
.doc-breadcrumb a {
  color: hsl(var(--doc-fg) / 0.5);
  text-decoration: none;
  transition: color 150ms;
}
.doc-breadcrumb a:hover {
  color: hsl(var(--doc-fg));
}
.doc-breadcrumb .doc-bc-sep {
  margin: 0 8px;
  color: hsl(var(--doc-fg) / 0.2);
  font-size: 12px;
}

/* -- Table of Contents (sticky right column) -- */
.doc-toc {
  display: none;
}

@media (min-width: 1024px) {
  .doc-toc {
    display: block;
    position: sticky;
    top: calc(var(--doc-navbar-h) + 24px);
    align-self: start;
    max-height: calc(100vh - var(--doc-navbar-h) - 48px);
    overflow-y: auto;
    border-left: 1px solid hsl(var(--doc-fg) / 0.06);
    padding-left: 20px;
  }
}

.doc-toc-label {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: hsl(var(--doc-fg) / 0.3);
  margin-bottom: 14px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
}

.doc-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-toc li {
  margin: 0;
}

.doc-toc a {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: hsl(var(--doc-fg) / 0.5);
  text-decoration: none;
  padding-left: 14px;
  border-left: 1px solid transparent;
  margin-left: -21px;
  transition:
    padding-left 150ms,
    color 150ms;
}

.doc-toc a:hover {
  color: hsl(var(--doc-fg));
}

.doc-toc a.active {
  color: hsl(var(--doc-fg));
  padding-left: 24px;
  border-left: 1px solid hsl(var(--doc-fg) / 0.8);
}

/* -- Tables -- */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1rem 0 1.5rem;
  font-size: 0.9rem;
  border: 1px solid hsl(var(--doc-fg) / 0.06);
  border-radius: var(--doc-radius);
  overflow: hidden;
}

th,
td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid hsl(var(--doc-fg) / 0.06);
}

th {
  background: hsl(var(--doc-card));
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--doc-fg) / 0.6);
}

tr:last-child td {
  border-bottom: none;
}

@media (max-width: 640px) {
  .doc-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table {
    font-size: 0.85rem;
  }
  th,
  td {
    padding: 8px 12px;
  }
}

/* -- FAQ items -- */
.faq-item {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid hsl(var(--doc-fg) / 0.06);
}
.faq-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

/* -- CTA block -- */
.cta-block {
  background: hsl(var(--doc-card));
  border: 1px solid hsl(var(--doc-fg) / 0.06);
  border-radius: 12px;
  padding: 24px 28px;
  margin: 2.5rem 0 2rem;
}
.cta-block p {
  margin-bottom: 0.5rem;
}
.cta-block p:last-child {
  margin-bottom: 0;
}
.cta-block a {
  font-weight: 600;
  text-decoration-color: hsl(var(--doc-fg) / 0.3);
}

/* -- Disclaimer -- */
.disclaimer {
  font-size: 13px;
  color: hsl(var(--doc-fg) / 0.3);
  border-top: 1px solid hsl(var(--doc-fg) / 0.08);
  padding-top: 1.25rem;
  margin-top: 2.5rem;
}

/* =============================================================
   NAVBAR — Static replica of FullNavbar (LandingNavbar.tsx)
   ============================================================= */
.doc-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--doc-navbar-h);
  background: hsl(var(--doc-bg) / 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.doc-nav-inner {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
}

.doc-nav-logo {
  position: absolute;
  left: 88px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: hsl(var(--doc-fg));
}

.doc-nav-logo span {
  font-family:
    "Outfit",
    -apple-system,
    BlinkMacSystemFont,
    system-ui,
    sans-serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.doc-nav-actions {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-nav-news {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-family: "Outfit", sans-serif;
  font-weight: 500;
  padding: 8px 8px;
  color: hsl(var(--doc-fg));
  text-decoration: none;
  transition: opacity 150ms;
}
.doc-nav-news:hover {
  opacity: 0.6;
  text-decoration: none;
  color: hsl(var(--doc-fg));
}

.doc-nav-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-size: 14px;
  font-family: "Outfit", sans-serif;
  font-weight: 500;
  padding: 8px 20px;
  border: 1px solid hsl(var(--doc-primary) / 0.18);
  background: transparent;
  color: hsl(var(--doc-fg));
  text-decoration: none;
  transition: all 150ms;
}
.doc-nav-login:hover {
  background: hsl(var(--doc-fg) / 0.05);
  text-decoration: none;
}

.doc-nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-size: 14px;
  font-family: "Outfit", sans-serif;
  font-weight: 500;
  padding: 8px 20px;
  border: none;
  background: hsl(var(--doc-fg));
  color: hsl(var(--doc-bg));
  text-decoration: none;
  cursor: pointer;
  transition: opacity 150ms;
}
.doc-nav-cta:hover {
  opacity: 0.85;
  text-decoration: none;
  color: hsl(var(--doc-bg));
}

/* Help dropdown trigger */
.doc-nav-help-wrap {
  position: relative;
}

.doc-nav-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: hsl(var(--doc-fg) / 0.7);
  cursor: pointer;
  transition: all 150ms;
}
.doc-nav-help-btn:hover {
  color: hsl(var(--doc-fg));
  background: hsl(var(--doc-fg) / 0.05);
}

.doc-nav-help-btn svg {
  width: 20px;
  height: 20px;
}

/* Help dropdown menu */
.doc-nav-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  padding: 8px 0;
  min-width: 220px;
  border-radius: 16px;
  background: hsl(var(--doc-bg) / 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 0 0 1px hsl(var(--doc-border) / 0.5),
    var(--doc-shadow-lg);
  z-index: 60;
}

.doc-nav-menu.open {
  display: block;
}

.doc-nav-menu-divider {
  height: 1px;
  margin: 6px 0;
  background: hsl(var(--doc-border) / 0.3);
}

.doc-nav-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 14px;
  color: hsl(var(--doc-fg) / 0.8);
  text-decoration: none;
  transition:
    color 100ms,
    background 100ms;
}
.doc-nav-menu a:hover {
  color: hsl(var(--doc-fg));
  background: hsl(var(--doc-fg) / 0.05);
  text-decoration: none;
}

.doc-nav-menu a svg {
  width: 16px;
  height: 16px;
  color: hsl(var(--doc-fg) / 0.4);
  flex-shrink: 0;
}

/* Mobile navbar */
@media (max-width: 768px) {
  .doc-nav-logo {
    left: 20px;
    gap: 8px;
  }
  .doc-nav-logo svg {
    width: 26px;
    height: auto;
  }
  .doc-nav-logo span {
    font-size: 20px;
    letter-spacing: -0.025em;
  }
  .doc-nav-news {
    display: none;
  }
  .doc-nav-login span,
  .doc-nav-cta span.doc-nav-cta-full {
    display: none;
  }
  .doc-nav-cta span.doc-nav-cta-short {
    display: inline;
  }
}

@media (min-width: 769px) {
  .doc-nav-cta span.doc-nav-cta-short {
    display: none;
  }
}

/* =============================================================
   FOOTER — Static replica of Footer.tsx
   ============================================================= */
.doc-footer {
  padding: 64px 20px;
  border-top: 1px solid hsl(var(--doc-fg) / 0.06);
}

.doc-footer-inner {
  max-width: var(--doc-max-w);
  margin: 0 auto;
}

.doc-footer-grid {
  display: grid;
  gap: 40px;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .doc-footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 40px 64px;
  }
}

@media (min-width: 1024px) {
  .doc-footer-grid {
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 64px;
  }
}

.doc-footer-brand {
  display: flex;
  flex-direction: column;
}

.doc-footer-brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: hsl(var(--doc-fg));
  text-decoration: none;
}

.doc-footer-brand-logo span {
  font-family:
    "Outfit",
    -apple-system,
    BlinkMacSystemFont,
    system-ui,
    sans-serif;
  font-size: 16px;
  font-weight: 600;
}

.doc-footer-brand p {
  font-size: 14px;
  margin-top: 12px;
  color: hsl(var(--doc-fg) / 0.4);
  line-height: 1.55;
  max-width: 280px;
}

.doc-footer-s7 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  margin-top: 20px;
  transition: opacity 150ms;
}
.doc-footer-s7:hover {
  opacity: 0.7;
}
.doc-footer-s7 .doc-s7-label {
  font-size: 13px;
  color: hsl(var(--doc-fg) / 0.4);
}
.doc-footer-s7 .doc-s7-name {
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--doc-fg));
}
.doc-footer-s7 svg {
  width: 12px;
  height: 12px;
  color: hsl(var(--doc-fg) / 0.3);
}

/* Column label */
.doc-footer-col-label {
  font-size: 14px;
  font-weight: 500;
  color: hsl(var(--doc-fg));
  margin-bottom: 12px;
}

.doc-footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-footer-links a {
  font-size: 14px;
  color: hsl(var(--doc-fg) / 0.4);
  text-decoration: none;
  transition: opacity 150ms;
}
.doc-footer-links a:hover {
  opacity: 0.7;
  text-decoration: none;
}

/* Divider */
.doc-footer-divider {
  margin-top: 48px;
  border: none;
  border-top: 1px solid hsl(var(--doc-fg) / 0.08);
}

/* Bottom row */
.doc-footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.doc-footer-copy {
  font-size: 13px;
  color: hsl(var(--doc-fg) / 0.25);
}

/* =============================================================
   HUB / INDEX PAGES — Card grids, link lists, payer sections
   ============================================================= */

/* Hub pages use full-width content (no TOC grid) */
.doc-hub-content {
  margin-top: 3rem;
  max-width: 100%;
}

/* Intro paragraph */
.intro {
  font-size: 15px;
  line-height: 1.65;
  color: hsl(var(--doc-fg) / 0.6);
  max-width: 680px;
  margin-bottom: 2.5rem;
}

/* Card grids — used by denials, regulations, specialties */
.code-grid,
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .code-grid,
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .code-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Individual cards */
.code-card,
.card {
  display: block;
  padding: 16px 20px;
  border-radius: 12px;
  background: hsl(var(--doc-card) / 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid hsl(var(--doc-fg) / 0.06);
  text-decoration: none;
  color: hsl(var(--doc-fg) / 0.8);
  transition:
    border-color 200ms,
    box-shadow 200ms,
    transform 200ms;
}

.code-card:hover,
.card:hover {
  border-color: hsl(var(--doc-primary) / 0.18);
  box-shadow: var(--doc-shadow-lg);
  transform: translateY(-1px);
  text-decoration: none;
  color: hsl(var(--doc-fg));
}

.code-id {
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: hsl(var(--doc-fg));
  margin-bottom: 4px;
}

.code-desc {
  font-size: 13px;
  line-height: 1.45;
  color: hsl(var(--doc-fg) / 0.5);
}

/* Payer sections */
.payer-section {
  margin-bottom: 2rem;
}

.payer-name {
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: hsl(var(--doc-fg));
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid hsl(var(--doc-fg) / 0.06);
}

/* State sections */
.state-section {
  margin-bottom: 1.75rem;
}

.state-section h2 {
  font-size: 18px;
  margin-top: 0;
  margin-bottom: 8px;
}

.state-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.state-section li {
  margin: 0;
}

.state-section a {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  background: hsl(var(--doc-card) / 0.55);
  border: 1px solid hsl(var(--doc-fg) / 0.06);
  font-size: 14px;
  color: hsl(var(--doc-fg) / 0.7);
  text-decoration: none;
  transition:
    border-color 200ms,
    color 200ms,
    box-shadow 200ms;
}

.state-section a:hover {
  border-color: hsl(var(--doc-primary) / 0.18);
  color: hsl(var(--doc-fg));
  box-shadow: var(--doc-shadow-sm);
  text-decoration: none;
}

/* Section headings inside hub pages */
.doc-hub-content h2 {
  font-size: clamp(18px, 2vw, 22px);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 8px;
  border-bottom: 1px solid hsl(var(--doc-fg) / 0.06);
}

.doc-hub-content h2:first-child {
  margin-top: 0;
}

/* Hub page link lists (glossary index, modifiers index) */
.doc-hub-content ul {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.doc-hub-content ul li {
  margin: 0;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  color: hsl(var(--doc-fg) / 0.6);
  transition: background 150ms;
  border: 1px solid transparent;
}

.doc-hub-content ul li:hover {
  background: hsl(var(--doc-fg) / 0.03);
  border-color: hsl(var(--doc-fg) / 0.06);
}

.doc-hub-content ul li a {
  color: hsl(var(--doc-fg));
  font-weight: 500;
  text-decoration: none;
}

.doc-hub-content ul li a:hover {
  text-decoration-color: hsl(var(--doc-fg) / 0.4);
}

/* Specialty section headings */
.section-heading {
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: hsl(var(--doc-fg));
  margin-top: 2rem;
  margin-bottom: 12px;
}
