/* ==========================================================================
   Global Reset & Layout Foundation
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  overflow-x: clip;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--surface, #f0faf6);
  color: var(--fg, #111c19);
  font-family: var(--font-body, 'Geist', system-ui, sans-serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

img, svg {
  vertical-align: middle;
}

/* ==========================================================================
   Header & Sticky Navigation
   ========================================================================== */
.site-header {
  position: relative;
  z-index: 50;
  box-shadow: inset 0 -1px 0 var(--border, rgba(11, 63, 59, 0.10));
  background: var(--surface, #f0faf6);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.site-header__inner {
  max-width: var(--page-max, 1440px);
  min-height: 56px;
  padding: 10px var(--gutter, 24px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Brand Monogram & Name */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading, 'Geist', sans-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--fg, #111c19);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--accent-gradient, #227f79);
  color: var(--fg-inverse, #ffffff);
  border-radius: var(--radius-sm, 6px);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(34, 127, 121, 0.25);
}

.brand__mark-short {
  display: none;
}

.brand__mark-long {
  display: inline;
}

/* Navigation Menu */
.site-menu {
  display: flex;
  align-items: center;
}

.site-menu__list {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-heading, 'Geist', sans-serif);
  font-size: 14px;
  font-weight: 500;
}

.site-menu__list a {
  display: block;
  padding: 6px 0;
  color: var(--fg, #111c19);
  transition: color 0.15s ease;
}

.site-menu__list a:hover {
  color: var(--accent, #227f79);
}

.site-menu__list .current-menu-item > a {
  color: var(--accent, #227f79);
  font-weight: 600;
}

/* Header Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading, 'Geist', sans-serif);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.button--sm {
  font-size: 13px;
  padding: 8px 16px;
}

.button--lg {
  font-size: 15px;
  padding: 12px 24px;
}

.button--primary {
  background: var(--accent, #227f79);
  color: var(--fg-inverse, #ffffff);
}

.button--primary:hover {
  background: var(--accent-hover, #1a6a65);
}

.button--inverse {
  background: var(--fg-inverse, #ffffff);
  color: var(--fg, #111c19);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(11, 63, 59, 0.06));
}

.button--inverse:hover {
  background: var(--accent-subtle, #d6efea);
}

.button--accent-outline {
  border-color: var(--border-control, #227f79);
  color: var(--fg, #111c19);
  background: transparent;
}

.button--accent-outline:hover {
  border-color: var(--accent, #227f79);
  background: var(--accent-subtle, #d6efea);
}

/* Safe Contrast on Dark Surfaces */
:is(.home-hero, .home-cta-footer, .site-footer, [data-theme="dark"]) .button--accent-outline {
  border-color: rgba(255, 255, 255, 0.3) !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

:is(.home-hero, .home-cta-footer, .site-footer, [data-theme="dark"]) .button--accent-outline:hover {
  border-color: rgba(255, 255, 255, 0.6) !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.18) !important;
}

/* Global Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading, 'Geist', sans-serif);
  font-size: 12px;
  font-weight: 550;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-deep, #e2f1ea);
  color: var(--fg, #111c19);
  border: 1px solid var(--border, rgba(11, 63, 59, 0.12));
}

.badge--pill {
  border-radius: 999px;
  padding: 5px 12px;
}

.site-menu__cta {
  margin-left: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.site-menu__cta .cta-arrow {
  transition: transform 0.15s ease;
}

.site-menu__cta:hover .cta-arrow {
  transform: translateX(3px);
}

.site-header-backdrop,
.site-menu__drawer-footer {
  display: none;
}

/* ==========================================================================
   Universal Desktop Sticky & Frosted-Glass Header (All Pages)
   ========================================================================== */
@media (min-width: 1024px) {
  /* 1. All Pages: Sticky positioning on desktop with strictly constant height */
  .sticky-header .site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                backdrop-filter 0.25s ease,
                border-color 0.25s ease;
  }

  /* 2. Top-of-page overlay for dark-hero pages (Home, About, Contact)
        Uses negative margin so it stays in document flow without ANY position jump */
  .nav-overlay .site-header {
    margin-bottom: -56px;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: none;
  }

  .nav-overlay .site-header:not(.is-stuck) .brand,
  .nav-overlay .site-header:not(.is-stuck) .site-menu__list a {
    color: var(--fg-inverse, #ffffff);
  }

  .nav-overlay .site-header:not(.is-stuck) .site-menu__list a:hover {
    color: var(--accent-subtle, #d6efea);
  }

  .nav-overlay .site-header:not(.is-stuck) .site-menu__cta {
    background: rgba(255, 255, 255, 0.12);
    color: var(--accent-subtle, #d6efea);
  }

  /* 3. Universal Frosted-Glass Sticky State when scrolled (> 12px) on ALL PAGES
        Height and padding remain strictly CONSTANT so zero layout shift occurs */
  .site-header.is-stuck {
    background: rgba(240, 250, 246, 0.88) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-bottom: 1px solid rgba(11, 63, 59, 0.09) !important;
    box-shadow: 0 4px 20px -2px rgba(11, 63, 59, 0.06), 0 1px 3px rgba(11, 63, 59, 0.04) !important;
  }

  .site-header.is-stuck .brand,
  .site-header.is-stuck .site-menu__list a {
    color: var(--fg, #111c19) !important;
  }

  .site-header.is-stuck .site-menu__list a:hover {
    color: var(--accent, #227f79) !important;
  }
}

/* Mobile Toggle */
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  cursor: pointer;
  place-items: center;
  position: relative;
  border-radius: var(--radius-sm, 8px);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.nav-toggle:active {
  background: rgba(11, 63, 59, 0.08);
  border-color: rgba(11, 63, 59, 0.12);
}

.nav-toggle .icon {
  position: absolute;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-toggle .icon-menu {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.nav-toggle .icon-x {
  opacity: 0;
  transform: rotate(-90deg) scale(0.65);
  pointer-events: none;
}

.nav-toggle[aria-expanded="true"] .icon-menu {
  opacity: 0;
  transform: rotate(90deg) scale(0.65);
  pointer-events: none;
}

.nav-toggle[aria-expanded="true"] .icon-x {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  pointer-events: auto;
}

/* Mobile Drawer & Ambient Backdrop (< 1024px) */
@media (max-width: 1023px) {
  /* Prevent background bounce without breaking sticky or scroll anchoring */
  html.menu-open body {
    overflow: hidden;
    touch-action: none;
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 105;
    background: var(--surface, #f0faf6);
    box-shadow: inset 0 -1px 0 var(--border, rgba(11, 63, 59, 0.10)), 0 2px 8px rgba(11, 63, 59, 0.04);
  }

  /* When menu is open, guarantee header stays firmly fixed at top of viewport */
  html.menu-open .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 105;
  }

  .nav-toggle {
    display: grid;
    z-index: 106;
  }

  /* Ambient Backdrop Dimmer */
  .site-header-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 28, 25, 0.50);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
    z-index: 95;
    pointer-events: none;
  }

  html.menu-open .site-header-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Frosted Glass Seamless Mobile Menu Sheet - Viewport Fixed */
  .site-menu {
    display: flex;
    position: fixed;
    top: var(--header-h, 58px);
    left: 0;
    right: 0;
    background: rgba(240, 250, 246, 0.98);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(11, 63, 59, 0.12);
    border-top: 1px solid rgba(11, 63, 59, 0.06);
    border-radius: 0 0 24px 24px;
    padding: 14px 18px 20px;
    box-shadow: 0 24px 48px -12px rgba(11, 63, 59, 0.22), 0 6px 16px rgba(11, 63, 59, 0.08);
    flex-direction: column;
    align-items: stretch;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transform-origin: top center;
    transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.24s;
    pointer-events: none;
    max-height: calc(100vh - var(--header-h, 58px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 100;
  }

  .site-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .site-menu__list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .site-menu__list li {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .site-menu__list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
    font-size: 15.5px;
    font-weight: 550;
    color: var(--fg, #111c19);
    padding: 12px 14px;
    border-radius: 10px;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  }

  @media (hover: hover) {
    .site-menu__list a:hover {
      background: rgba(17, 107, 101, 0.05);
      color: var(--accent, #116b65);
    }
  }

  .site-menu__list a:active {
    background: rgba(17, 107, 101, 0.10);
    transform: scale(0.99);
  }

  .site-menu__list .current-menu-item > a {
    background: rgba(17, 107, 101, 0.08);
    color: var(--accent, #116b65);
    font-weight: 650;
  }

  .site-menu__list .current-menu-item > a::after {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent, #116b65);
    box-shadow: 0 0 8px rgba(17, 107, 101, 0.5);
    flex-shrink: 0;
  }

  .site-menu__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-left: 0;
    margin-top: 10px;
    width: 100%;
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 650;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(17, 107, 101, 0.25);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease;
  }

  .site-menu__cta:active {
    transform: scale(0.985);
  }

  .site-menu__drawer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(11, 63, 59, 0.08);
    font-size: 11.5px;
    color: var(--fg-muted, #4f6863);
  }

  .drawer-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 550;
    color: #116b65;
  }

  .drawer-status__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  }

  .drawer-tz {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 11px;
    opacity: 0.8;
  }
}

/* ==========================================================================
   Footer Styling
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border, rgba(11, 63, 59, 0.10));
  background: var(--surface, #f0faf6);
  font-family: var(--font-heading, 'Geist', sans-serif);
  padding: 48px 0 24px;
}

.site-footer__inner {
  max-width: var(--page-max, 1440px);
  margin-inline: auto;
  padding: 0 var(--gutter, 24px);
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.site-footer__columns {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
}

@media (max-width: 768px) {
  .site-footer__columns {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.site-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.site-footer__text {
  font-family: var(--font-body, 'Geist', sans-serif);
  font-size: 15px;
  color: var(--fg-muted, #364b47);
  line-height: 1.6;
  margin: 0;
  max-width: 440px;
}

.social-links {
  display: flex;
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.social-links__link {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm, 6px);
  color: var(--fg-muted, #364b47);
  background: var(--accent-subtle, #d6efea);
  transition: all 0.15s ease;
}

.social-links__link:hover {
  background: var(--accent, #227f79);
  color: var(--fg-inverse, #ffffff);
}

.site-footer__heading {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-caps, 0.08em);
  color: var(--fg, #111c19);
  margin: 0 0 16px;
}

.site-footer__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 14px;
}

.site-footer__list a {
  color: var(--fg-muted, #364b47);
  transition: color 0.15s ease;
}

.site-footer__list a:hover {
  color: var(--accent, #227f79);
}

.site-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--border, rgba(11, 63, 59, 0.10));
  font-size: 13px;
  color: var(--fg-ghost, #879693);
}

.site-footer__copyright {
  margin: 0;
}

.scroll-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent, #005a36);
  color: var(--fg-inverse, #ffffff);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.9);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.scroll-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.scroll-top:hover {
  background: var(--accent-hover, #004429);
  color: #ffffff;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
}

.scroll-top:active {
  transform: translateY(0) scale(0.96);
}

@media (max-width: 768px) {
  .scroll-top {
    right: 16px;
    bottom: 16px;
    width: 38px;
    height: 38px;
  }
}

/* ==========================================================================
   Page Hero (Internal Pages Foundation)
   ========================================================================== */
.page-hero {
  isolation: isolate;
  background: var(--fg, #111c19);
  color: var(--fg-inverse, #ffffff);
  text-align: center;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: clamp(96px, 12vw, 140px) 20px clamp(48px, 6vw, 72px);
  display: flex;
  position: relative;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page-hero:before {
  content: "";
  z-index: -1;
  background: linear-gradient(180deg, rgba(11, 63, 59, 0.94) 0%, rgba(17, 28, 25, 0.98) 100%);
  position: absolute;
  inset: 0;
}

.page-hero__copy {
  --hero-floor: clamp(300px, 188.6px + 28.57vw, 680px);
  align-items: center;
  gap: inherit;
  width: fit-content;
  min-width: min(100%, var(--hero-floor));
  flex-direction: column;
  max-width: 100%;
  display: flex;
  margin: 0 auto;
}

.page-hero__eyebrow {
  font-family: var(--font-heading, 'Geist', sans-serif);
  font-size: var(--text-xs, 13px);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-subtle, #d6efea);
  margin: 0 0 6px;
}

.page-hero__title {
  font-family: var(--font-heading, 'Geist', sans-serif);
  font-size: var(--h1-size, clamp(26px, 20px + 2vw, 54px));
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--fg-inverse, #ffffff);
  text-wrap: balance;
  margin: 0;
}

.page-hero__text {
  font-family: var(--font-body, 'Geist', sans-serif);
  font-size: clamp(16px, 15px + 0.3vw, 19px);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
  margin: 8px 0 0;
  text-wrap: pretty;
  width: 0;
  min-width: min(100%, max(var(--hero-floor), var(--hero-measure, 100%)));
}

/* ==========================================================================
   Accessibility & Layout Containers
   ========================================================================== */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

.container,
.container-wide {
  width: 100%;
  max-width: var(--page-max);
  padding-inline: var(--gutter-wide);
  margin-inline: auto;
}



/* ==========================================================================
   Technical Article Reading Progress & Code Copy
   ========================================================================== */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent, #227f79);
  z-index: 1000;
  transition: width 0.1s linear;
}

.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2f1ea;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.15s ease;
}

pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.code-copy-btn.is-copied {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
  opacity: 1;
}

/* ==========================================================================
   Universal Top 1% Scrollbar Architecture (Unified Across Mobile, Tablet & Desktop)
   Standardized 6px teal pill styling across Code Blocks, Tables, Trac Views, Filters
   ========================================================================== */

/* Universal Standard CSS Scrollbars (Firefox & Modern Standards) */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 127, 121, 0.45) transparent;
}

/* Universal WebKit Scrollbar (Chrome, Safari, Edge, Mobile WebKit) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb {
  background: rgba(34, 127, 121, 0.40);
  border-radius: 999px;
  transition: background-color 0.2s ease;
}

::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:active {
  background: #227f79;
}

/* Dark Containers: Code Blocks & Dark Surfaces */
pre,
pre code,
.prose pre,
.wp-block-code pre {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(52, 211, 153, 0.45) rgba(255, 255, 255, 0.06);
}

pre::-webkit-scrollbar,
pre code::-webkit-scrollbar,
.prose pre::-webkit-scrollbar,
.wp-block-code pre::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

pre::-webkit-scrollbar-track,
pre code::-webkit-scrollbar-track,
.prose pre::-webkit-scrollbar-track,
.wp-block-code pre::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  margin-inline: 8px;
}

pre::-webkit-scrollbar-thumb,
pre code::-webkit-scrollbar-thumb,
.prose pre::-webkit-scrollbar-thumb,
.wp-block-code pre::-webkit-scrollbar-thumb {
  background: rgba(52, 211, 153, 0.45);
  border-radius: 999px;
  transition: background-color 0.2s ease;
}

pre::-webkit-scrollbar-thumb:hover,
pre code::-webkit-scrollbar-thumb:hover,
.prose pre::-webkit-scrollbar-thumb:hover,
.wp-block-code pre::-webkit-scrollbar-thumb:hover {
  background: #34d399;
}
