/************************
 * THEME VARIABLES
 ************************/

:root {
  /* Light theme (default) */

  --brand-accent: #ffa500;
  --brand-primary: #001F3F;

  --body-bg: radial-gradient(ellipse at left, #6366f1, #a5b4fc, #e0e7ff);
  --gradiant-style: linear-gradient(135deg, #e0f2fe, #ffffff, #ffedcc);

  --bg: #f5f7fa;
  --bg-alt: #fdfcfb;
  --text: #1c1c1c;
  --muted: #333333;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --border: #e5e7eb;
  --border-dark: #1f2937;

  --radius-lg: 12px;
  --radius-md: 8px;

  --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.06);
  --header-bg: rgba(255, 255, 255, 0.92);
  --sidebar-bg: rgba(255, 255, 255, 0.96);

  --pill-bg: #f9fafb;
  --pill-border: #e5e7eb;
  --callout-bg: #eff6ff;
  --callout-border: #2563eb;

  --box-design: 0px 1px 0px rgba(0, 31, 63, 0.17),
    0px 1px 1px 0px rgba(0, 31, 63, 0.17);

  --container-width: 1440px;

  --fs-xs: 0.75rem;
  /* 12px */
  --fs-sm: 0.875rem;
  /* 14px */
  --fs-md: 1rem;
  /* 16px */
  --fs-lg: 1.25rem;
  /* 20px */
  --fs-xl: 1.75rem;
  /* 28px */
}

/* System dark-mode defaults (when no explicit data-theme is set) */
@media (prefers-color-scheme: dark) {
  :root {
    --brand-primary: var(--brand-accent);
    --body-bg: radial-gradient(circle at top left, #131417, #131417 40%, #131417);
    --gradiant-style: linear-gradient(135deg, #131417, #131417, #131417);

    --bg: #131417;
    --bg-alt: #131417;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --accent: #60a5fa;
    --accent-soft: #1d4ed8;
    --border: #1f2937;

    --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.7);
    --header-bg: #131417;
    --sidebar-bg: #131417;

    --pill-bg: #020617;
    --pill-border: #1f2937;
    --callout-bg: #131417;
    --callout-border: #c7d6ff;

    --box-design: 0px 1px 0px rgba(255, 250, 242, 0.17),
      0px 1px 1px 0px rgba(255, 250, 242, 0.17);
  }
}

/* Explicit overrides when theme is forced via JS */
[data-theme="light"] {
  --body-bg: radial-gradient(ellipse at left, #6366f1, #a5b4fc, #e0e7ff);
  --gradiant-style: linear-gradient(135deg, #e0f2fe, #ffffff, #ffedcc);

  --bg: #f5f7fa;
  --bg-alt: #fdfcfb;
  --text: #1c1c1c;
  --muted: #333333;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --border: #e5e7eb;

  --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.06);
  --header-bg: rgba(255, 255, 255, 0.92);
  --sidebar-bg: rgba(255, 255, 255, 0.96);

  --pill-bg: #f9fafb;
  --pill-border: #e5e7eb;
  --callout-bg: #eff6ff;
  --callout-border: #2563eb;

  --box-design: 0px 1px 0px rgba(0, 31, 63, 0.17),
    0px 1px 1px 0px rgba(0, 31, 63, 0.17);
}

[data-theme="dark"] {
  --brand-primary: var(--brand-accent);
  --body-bg: radial-gradient(circle at top left, #131417, #131417 40%, #131417);
  --gradiant-style: linear-gradient(135deg, #131417, #131417, #131417);

  --bg: #131417;
  --bg-alt: #131417;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #60a5fa;
  --accent-soft: #1d4ed8;
  --border: #1f2937;

  --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.7);
  --header-bg: #131417;
  --sidebar-bg: #131417;

  --pill-bg: #131417;
  --pill-border: #1f2937;
  --callout-bg: #131417;
  --callout-border: #c7d6ff;

  --box-design: 0px 1px 0px rgba(255, 250, 242, 0.17),
    0px 1px 1px 0px rgba(255, 250, 242, 0.17);
}

/************************
 * RESET & BASE
 ************************/

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

body {
  min-height: 100vh;
  /*
    Creates issue with document pages navigarion using Id.
    display: flex;
    */
  flex-direction: column;
  margin: 0;
  font-family: "Open Sans", sans-serif;
  background: var(--body-bg);
  color: var(--text);
  font-size: var(--fs-md);
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: none;
  color: var(--brand-primary);
}

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

/************************
 * GLOBAL LAYOUT
 ************************/

main {
  flex: 1;
  min-height: 400px;
}

.page {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 32px 16px 48px;
}

.animated-gradient {
  background: var(--gradiant-style);
  background-size: 450% 450%;
  animation: animated-gradient 10s ease infinite;
}

@keyframes animated-gradient {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/************************
 * HEADER & NAV
 ************************/

.site-header {
  width: 100%;
  box-shadow: var(--box-design);
  background-color: var(--bg-alt);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  height: 50px;
}

.logo {
  display: flex;
  align-items: center;
}

.logo-img {
  height: 50px;
  width: auto;
  display: block;
}

/* Default: show light logo */
.logo-img-dark {
  display: none;
}

/* Explicit dark theme */
[data-theme="dark"] .logo-img-light {
  display: none;
}

[data-theme="dark"] .logo-img-dark {
  display: block;
}

/* Explicit light theme */
[data-theme="light"] .logo-img-light {
  display: block;
}

[data-theme="light"] .logo-img-dark {
  display: none;
}

/* System dark mode (no explicit theme) */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .logo-img-light {
    display: none;
  }

  html:not([data-theme]) .logo-img-dark {
    display: block;
  }
}

/* Desktop nav */
.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: auto;
  font-weight: 600;
  background-color: var(--bg-alt);
}

.nav-links a {
  color: var(--text);
  position: relative;
  white-space: nowrap;
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  height: 2px;
  width: 100%;
  transform: translateX(-50%) scaleX(0);
  transition: transform 220ms ease;
  background: var(--brand-accent);
  font-weight: 600;
}

.nav-links a:hover::after,
.nav-links a.active::after,
.nav-links a:focus-visible::after {
  transform: translateX(-50%) scaleX(1);
}

.header-btn:hover {
  color: #000;
}

.header-btn {
  margin-left: 8px;
  padding: 8px 18px;
  background: var(--brand-accent);
  color: #000;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  height: 100%;
  display: flex;
  align-items: center;
}

/* Mobile nav toggle (hamburger) */
.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
  cursor: pointer;
  margin-left: auto;
}

.nav-toggle-label span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 4px 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/************************
 * BADGE NAV (TOP DOCS)
 ************************/

.badge-nav {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--pill-border);
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 8px;
}

.badge-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-link {
  font-size: var(--fs-sm);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  box-shadow: var(--box-design);
}

.badge-link:hover {
  background: var(--callout-bg);
  color: var(--accent);
  text-decoration: none;
}

.badge-link-primary {
  border-color: var(--callout-border);
  background: var(--callout-bg);
  color: var(--accent);
  font-weight: 500;
}

/************************
 * TYPOGRAPHY & HEADERS
 ************************/

h1 {
  font-size: var(--fs-xl);
}

h2,
h3 {
  font-size: var(--fs-lg);
}

h4,
h5 {
  font-size: var(--fs-md);
}

h6 {
  font-size: var(--fs-sm);
}

p {
  font-size: var(--fs-md);
}

/************************
 * DOCUMENT HEAD & LAYOUT
 ************************/

.document-head {
  background: var(--header-bg);
}

.document-head p {
  margin: 0;
  color: var(--muted);
  max-width: 800px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.header-tag {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--muted);
  background: var(--pill-bg);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--pill-border);
  box-shadow: var(--box-design);
}

/* You can add a dot span here if you wish later */
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

/* Grid: main content + sidebar */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(240px, 1.5fr);
  gap: 24px;
}

.subtle-title {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

/************************
 * SEARCH & THEME TOGGLE
 ************************/

.search-input-wrapper {
  position: relative;
  min-width: 220px;
  flex: 1 1 240px;
  max-width: 320px;
}

#docs-search-input {
  width: 100%;
  padding: 6px 70px 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  outline: none;
  box-shadow: var(--box-design);
}

#docs-search-input::placeholder {
  color: var(--muted);
}

#docs-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.search-kbd {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--fs-xs);
  color: var(--muted);
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 2px 5px;
  background: var(--bg);
  pointer-events: none;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  box-shadow: var(--box-design);
}

.theme-toggle-btn {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 4px 7px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
}

.theme-toggle-btn.is-active {
  background: var(--accent-soft);
  color: #1d4ed8;
  font-weight: 600;
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/************************
 * CARDS & CONTENT BLOCKS
 ************************/

.section-card {
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  padding: 20px 18px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--box-design);
}

.section-card h2 {
  margin-top: 0;
  margin-bottom: 6px;
}

.section-card h3 {
  margin-top: 16px;
  margin-bottom: 4px;
}

.section-card p {
  margin: 4px 0 10px;
  color: var(--muted);
}

.section-card.search-hit {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

/* Pills inside sections */
.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
  padding: 0;
  list-style: none;
}

.pill-list li {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  color: var(--muted);
}

/* Quick links grid */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.quick-link {
  border-radius: var(--radius-md);
  border: 1px solid var(--pill-border);
  padding: 10px 11px;
  background: var(--pill-bg);
  box-shadow: var(--box-design);
}

.quick-link strong {
  display: block;
  margin-bottom: 2px;
}

.quick-link small {
  display: block;
  color: var(--muted);
}

/* Tight lists */
.list-tight {
  margin: 4px 0 8px;
  padding-left: 18px;
}

.list-tight li {
  margin-bottom: 2px;
}

/************************
 * SIDEBAR
 ************************/

.sidebar-card {
  background: var(--sidebar-bg);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 16px 14px;
  box-shadow: var(--box-design);
  margin-bottom: 16px;
}

.sidebar-card h3 {
  margin: 0 0 4px;
}

.sidebar-card p {
  margin: 4px 0;
  color: var(--muted);
}

.sidebar-card ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.sidebar-card ul li {
  margin-bottom: 3px;
}

/* Small badge */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-sm);
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  color: var(--muted);
  gap: 4px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

/* Callout */
.callout {
  border-radius: var(--radius-md);
  border: 1px solid var(--callout-border);
  background: var(--callout-bg);
  padding: 10px 11px;
  margin-top: 10px;
  color: var(--callout-border);
  box-shadow: var(--box-design);
}

.callout strong {
  display: block;
  margin-bottom: 2px;
}

.muted {
  color: var(--muted);
}

/************************
 * DOC FOOTER (INSIDE PAGE)
 ************************/

footer {
  margin-top: 28px;
  padding-top: 16px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.footer-brand {
  max-width: 420px;
}

.footer-tagline {
  color: var(--muted);
  font-style: italic;
}

.footer-meta {
  margin-top: 10px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

/************************
 * RESPONSIVE
 ************************/

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .header-controls {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .header-inner {
    padding: 10px 12px;
  }

  /* Show hamburger, hide desktop nav initially */
  .nav-toggle-label {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 12px 12px;
    gap: 8px;
    display: none;
    /* hidden until toggle */
  }

  .nav-links a {
    width: 100%;
    padding: 8px 4px;
  }

  .header-btn {
    display: none;
  }

  /* When checkbox is checked, show menu */
  .nav-toggle:checked~.nav-links {
    display: flex;
  }

  /* Animate hamburger into X */
  .nav-toggle:checked+.nav-toggle-label span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .nav-toggle:checked+.nav-toggle-label span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle:checked+.nav-toggle-label span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  /* Footer & cards padding tweaks for mobile */
  .page {
    padding: 16px 8px 32px;
  }

  .section-card {
    padding: 16px 12px;
  }

  .footer-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-column {
    max-width: 100%;
  }
}