/* ============================================================
   UHC-Inspired Theme
   References:
   - UHC Quickstart Guide (2025): UHC Blue #002677, White #FFFFFF, Sky Blue #D9F6FA
   - UHC style guidance: Arial body/subheads, Georgia headlines
   ============================================================ */
:root {
  --uhc-blue: #002677;
  --uhc-blue-bright: #0057b8;
  --uhc-sky: #d9f6fa;
  --uhc-white: #ffffff;
  --uhc-ink: #333333;
  --uhc-gray-700: #4b5563;
  --uhc-gray-500: #6b7280;
  --uhc-gray-300: #d1d5db;
  --uhc-gray-200: #e5e7eb;
  --uhc-gray-100: #f3f4f6;

  --warning-bg: #8b1f1f;
  --warning-text: #fff6f6;

  --sidebar-bg: #ffffff;
  --sidebar-text: #1f2f46;
  --sidebar-muted: #6b7280;
  --sidebar-hover: #f2f7ff;
  --sidebar-active-bg: #e9f1ff;
  --sidebar-active: var(--uhc-blue);
  --sidebar-width: 280px;

  --content-bg: #f8fafc;
  --content-bg-alt: #f4f7fb;
  --content-text: var(--uhc-ink);
  --content-max-width: 920px;
  --section-border: #dce4f0;
  --section-label-color: #1f4f9d;

  --edu-notice-bg: #e9f8fc;
  --edu-notice-border: #66b5d2;
  --edu-notice-text: #17455b;

  --accent: var(--uhc-blue);
  --accent-light: var(--uhc-blue-bright);
  --accent-bg: #edf3ff;

  --link-color: #0047a8;
  --link-hover: #00347a;
  --code-bg: #0e2148;
  --code-text: #f3f7ff;
  --table-header-bg: var(--uhc-blue);
  --table-header-text: #ffffff;
  --table-row-alt: #f7f9fd;

  --shadow-sm: 0 2px 10px rgba(0, 38, 119, 0.07);
  --shadow-md: 0 10px 28px rgba(0, 38, 119, 0.14);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-sans: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  color: var(--content-text);
  background: var(--content-bg);
  line-height: 1.65;
}

/* ============================================================
   Reading Progress Bar
   ============================================================ */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0%;
  background: linear-gradient(90deg, var(--uhc-blue), var(--uhc-blue-bright));
  z-index: 1200;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ============================================================
   Warning Banner
   ============================================================ */
#warning-banner {
  position: relative;
  background: #eef6ff;
  color: #23446f;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 0.78rem;
  line-height: 1.4;
  border-bottom: 1px solid #d6e5f8;
}

.warning-icon {
  font-size: 0.92rem;
  flex-shrink: 0;
  color: #2d5d9f;
}

/* ============================================================
   Layout
   ============================================================ */
#page-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   Sidebar (clean, UHC-like utility nav)
   ============================================================ */
#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--section-border);
}

#sidebar::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-thumb {
  background: #cfd8e6;
  border-radius: 999px;
}

#sidebar-header {
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--section-border);
  background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
}

#site-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--uhc-blue);
  letter-spacing: 0.02em;
}

#site-subtitle {
  font-size: 0.72rem;
  color: var(--sidebar-muted);
  margin-top: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#nav-links {
  list-style: none;
  padding: 10px 0;
  flex: 1;
}

.nav-group-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: #667085;
  padding: 14px 20px 5px;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.84rem;
  transition: background 0.16s ease, color 0.16s ease;
  border-left: 3px solid transparent;
  line-height: 1.35;
}

.nav-num {
  display: inline-block;
  width: 24px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #6f7f96;
  font-family: var(--font-mono);
  margin-right: 8px;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #0c3f8e;
}

.nav-link.active {
  color: var(--uhc-blue);
  background: var(--sidebar-active-bg);
  border-left-color: var(--sidebar-active);
  font-weight: 700;
}

.nav-link.active .nav-num {
  color: var(--uhc-blue);
}

#sidebar-footer {
  padding: 12px 20px 14px;
  border-top: 1px solid var(--section-border);
  font-size: 0.72rem;
  color: var(--uhc-gray-500);
  line-height: 1.55;
}

/* ============================================================
   Mobile Nav Toggle
   ============================================================ */
#mobile-nav-toggle {
  display: none;
  position: fixed;
  bottom: 78px;
  right: 16px;
  z-index: 920;
  width: 44px;
  height: 44px;
  background: var(--uhc-blue);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: var(--shadow-md);
}

#mobile-nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}

/* ============================================================
   Content Area
   ============================================================ */
#content-area {
  flex: 1;
  min-width: 0;
  padding-bottom: 24px;
}

/* ============================================================
   Hero
   ============================================================ */
#hero {
  background:
    linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
  color: var(--content-text);
  padding: 56px 32px 40px;
  border-bottom: 1px solid var(--section-border);
  display: flex;
  justify-content: center;
}

.hero-inner {
  max-width: 760px;
  text-align: left;
}

.hero-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: #18519d;
  margin-bottom: 14px;
  font-weight: 700;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 3.5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--uhc-blue);
  margin-bottom: 16px;
}

.hero-accent {
  color: #1e4f98;
}

.hero-subtitle {
  font-size: 1rem;
  line-height: 1.75;
  color: #374151;
  margin-bottom: 24px;
  max-width: 66ch;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.8rem;
  color: #475467;
  margin-bottom: 26px;
}

.hero-meta-divider {
  width: 1px;
  background: #c9d5e6;
}

.hero-cta {
  display: inline-block;
  padding: 11px 20px;
  background: var(--uhc-blue);
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background 0.2s ease, transform 0.2s ease;
}

.hero-cta:hover {
  background: #003fa0;
  transform: translateY(-1px);
}

/* ============================================================
   Sections
   ============================================================ */
.content-section {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 18px;
  padding: 38px 28px 44px;
  border: 1px solid var(--section-border);
  border-radius: var(--radius-md);
  background: var(--uhc-white);
  box-shadow: var(--shadow-sm);

  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.content-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.content-section:nth-of-type(even) {
  background: #fcfdff;
}

.content-section::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: linear-gradient(90deg, var(--uhc-blue), #3a7ad1);
}

.content-section > .section-label,
.content-section > h2,
.content-section > .edu-notice,
.content-section > .summary-grid,
.content-section > .content {
  width: 100%;
  max-width: var(--content-max-width);
}

.section-label {
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--section-label-color);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-label::before {
  content: "";
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: var(--uhc-blue);
}

.content-section > h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.2vw, 2rem);
  font-weight: 700;
  color: var(--uhc-blue);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--uhc-gray-200);
  line-height: 1.25;
}

.edu-notice {
  background: var(--edu-notice-bg);
  border: 1px solid var(--edu-notice-border);
  border-left: 4px solid var(--edu-notice-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 24px;
  font-size: 0.84rem;
  color: var(--edu-notice-text);
  line-height: 1.6;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.summary-card {
  background: #fff;
  border: 1px solid #dfe7f3;
  border-radius: var(--radius-sm);
  padding: 14px;
}

.summary-card-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  margin-bottom: 6px;
  font-weight: 700;
}

.summary-card-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #123a78;
  line-height: 1.4;
}

.content.loading::before {
  content: "";
  display: block;
  height: 210px;
  background: linear-gradient(90deg, #f0f5fc 25%, #e5edf8 50%, #f0f5fc 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.content.error::before {
  content: "Unable to load content. Serve with a local HTTP server (e.g. python3 -m http.server).";
  display: block;
  color: #a41e22;
  font-size: 0.84rem;
  padding: 12px 14px;
  background: #fff2f2;
  border: 1px solid #f4b9bb;
  border-radius: 6px;
}

/* ============================================================
   Markdown
   ============================================================ */
.content {
  font-size: 1rem;
}

.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
  color: var(--uhc-blue);
  margin-top: 1.9rem;
  margin-bottom: 0.65rem;
  line-height: 1.35;
}

.content h1,
.content h2,
.content h3 {
  font-family: var(--font-display);
}

.content h1 {
  font-size: 1.42rem;
  border-bottom: 1px solid var(--uhc-gray-200);
  padding-bottom: 0.45rem;
}

.content h2 {
  font-size: 1.2rem;
  margin-top: 2.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--uhc-gray-200);
}

.content h2:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.content h3 {
  font-size: 1.06rem;
  color: #1c4f9a;
}

.content h4 {
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5a6575;
}

.content p {
  margin-bottom: 1.02rem;
  line-height: 1.75;
  max-width: 72ch;
}

.content ul,
.content ol {
  margin: 0.7rem 0 1.18rem 1.45rem;
}

.content li {
  margin-bottom: 0.35rem;
  line-height: 1.7;
  max-width: 72ch;
}

.content a {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px solid #9fb8de;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.content a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
}

.content a[target="_blank"]::after {
  content: " \2197";
  font-size: 0.72em;
  opacity: 0.6;
}

.content code {
  font-family: var(--font-mono);
  background: #eef3fb;
  border: 1px solid #dbe4f3;
  border-radius: 4px;
  padding: 0.12em 0.38em;
  font-size: 0.84em;
  color: #8d2652;
}

.content pre {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius-sm);
  border: 1px solid #243d6f;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 1.35rem 0;
  font-size: 0.84rem;
  line-height: 1.68;
}

.content pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.table-wrapper {
  overflow-x: auto;
  margin: 1.3rem 0;
  border: 1px solid #dde6f4;
  border-radius: var(--radius-sm);
}

.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.content thead th {
  background: var(--table-header-bg);
  color: var(--table-header-text);
  padding: 10px 13px;
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
}

.content tbody tr:nth-child(even) {
  background: var(--table-row-alt);
}

.content tbody tr:hover {
  background: #ebf2ff;
}

.content tbody td {
  padding: 9px 13px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
  line-height: 1.6;
}

.content blockquote {
  border-left: 4px solid var(--uhc-blue);
  margin: 1.3rem 0;
  padding: 12px 16px;
  background: var(--accent-bg);
  border-radius: 0 6px 6px 0;
  color: #184786;
  font-style: italic;
}

.content blockquote.callout-warning {
  border-left-color: #c07d08;
  background: #fff8ea;
  color: #6b4b05;
  font-style: normal;
}

.content blockquote.callout-unverified {
  border-left-color: #b42318;
  background: #fff2f1;
  color: #842111;
  font-style: normal;
}

.content hr {
  border: none;
  margin: 2rem auto;
  width: 72px;
  height: 2px;
  background: #c7d7ef;
}

.content strong {
  font-weight: 700;
  color: #123d7a;
}

/* ============================================================
   Collapsibles
   ============================================================ */
.content details {
  border: 1px solid #dce5f4;
  border-radius: var(--radius-sm);
  margin: 0.7rem 0;
  overflow: hidden;
  background: #fff;
}

.content details summary {
  padding: 13px 15px;
  font-size: 1.01rem;
  font-weight: 700;
  color: #123d7a;
  cursor: pointer;
  background: #f8fbff;
  transition: background 0.15s ease;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
}

.content details summary::-webkit-details-marker {
  display: none;
}

.content details summary::marker {
  display: none;
  content: "";
}

.content details summary::before {
  content: "\25B6";
  font-size: 0.62rem;
  color: #60718d;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.content details[open] summary::before {
  transform: rotate(90deg);
}

.content details[open] summary {
  border-bottom: 1px solid #dce5f4;
}

.content details summary:hover {
  background: #f0f6ff;
}

.content details .details-body {
  padding: 14px 15px;
}

.expand-collapse-btn {
  display: inline-block;
  padding: 7px 14px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--uhc-blue);
  background: #edf3ff;
  border: 1px solid #c9dbf6;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 13px;
}

.expand-collapse-btn:hover {
  background: #e2edff;
}

/* ============================================================
   Mini TOC
   ============================================================ */
.mini-toc {
  background: #f6f9ff;
  border: 1px solid #d9e4f4;
  border-radius: var(--radius-sm);
  padding: 14px 15px;
  margin-bottom: 22px;
}

.mini-toc-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #5d6f8c;
  margin-bottom: 8px;
}

.mini-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 20px;
}

.mini-toc li {
  margin-bottom: 4px;
  break-inside: avoid;
}

.mini-toc li a {
  font-size: 0.82rem;
  color: var(--link-color);
  text-decoration: none;
  line-height: 1.6;
  border-bottom: none;
}

.mini-toc li a:hover {
  text-decoration: underline;
}

.mini-toc li a::after {
  content: none !important;
}

.mini-toc .mini-toc-sub {
  padding-left: 14px;
}

/* ============================================================
   Back To Top
   ============================================================ */
#back-to-top {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--uhc-blue);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  transform: translateY(10px);
  z-index: 820;
  box-shadow: var(--shadow-md);
}

#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#back-to-top:hover {
  background: #003fa0;
}

/* ============================================================
   Footer
   ============================================================ */
#page-footer {
  margin: 18px;
  border: 1px solid #d6e0ef;
  border-radius: var(--radius-md);
  background: #f7f9fc;
  color: #4b5563;
  padding: 28px 20px;
  font-size: 0.78rem;
  line-height: 1.7;
  display: flex;
  justify-content: center;
}

.footer-inner {
  max-width: var(--content-max-width);
  text-align: center;
}

#page-footer p + p {
  margin-top: 6px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  :root {
    --sidebar-width: 260px;
  }

  .content-section {
    margin: 12px;
    padding: 34px 20px 40px;
  }

  #page-footer {
    margin: 12px;
  }

  .mini-toc ul {
    columns: 1;
  }
}

@media (max-width: 768px) {
  #warning-banner {
    padding: 8px 12px;
    font-size: 0.72rem;
  }

  #page-layout {
    flex-direction: column;
    min-height: auto;
  }

  #sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    width: min(82vw, 280px);
    height: 100%;
    z-index: 900;
    transition: left 0.25s ease;
    padding-top: 56px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.25);
  }

  #sidebar.open {
    left: 0;
  }

  #mobile-nav-toggle {
    display: flex;
  }

  #hero {
    padding: 44px 18px 34px;
  }

  .hero-title {
    font-size: 1.88rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .hero-meta {
    gap: 8px;
  }

  .hero-meta-divider {
    display: none;
  }

  .content-section {
    margin: 8px;
    padding: 28px 14px 32px;
  }

  .content-section > h2 {
    font-size: 1.36rem;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .content p,
  .content li {
    max-width: 100%;
  }

  .content details summary {
    font-size: 0.96rem;
  }

  #back-to-top {
    right: 14px;
    bottom: 16px;
  }

  #page-footer {
    margin: 8px;
    padding: 22px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
