/* ==========================================================================
   apstack Blog — Sunlit Surface to Bioluminescent Abyss Design System
   Aligned with ../apwebsite/src/styles/home.css & globals.css
   ========================================================================== */

:root {
  --font-serif: "Fraunces", "Iowan Old Style", ui-serif, Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;

  /* apwebsite ocean tokens */
  --paper: #fbfdff;
  --quiet: #eef5fc;
  --hero-top: #f4faff;
  --hero-mid: #eaf5fe;
  --hero-bottom: #deeffc;
  --ink: #0c1d36;
  --muted: #465b75;
  --line: #c9d9eb;
  --line-soft: rgba(160, 192, 224, 0.48);
  --blue: #1558b0;
  --blue-bright: #1e88e5;
  --cyan: #29b6f6;
  --reef-glow: #38c3e0;
  --blue-fill: #e4f1ff;
  --on-blue: #ffffff;
  --deep-sea: #071d3a;
  --deep-sea-mid: #0c2c54;
  --harbor: #e1eef9;
  --harbor-deep: #d4e5f6;
  --dark: #071528;
  --on-dark: #eaf3ff;
  --on-dark-muted: #9eb9d9;
  --dark-line: #1f3c63;
  --shadow-card: 0 12px 32px -12px rgba(12, 29, 54, 0.11), 0 2px 6px rgba(12, 29, 54, 0.04);
  --shadow-card-hover: 0 22px 44px -14px rgba(21, 88, 176, 0.2), 0 4px 12px rgba(12, 29, 54, 0.06);
  --header-height: 66px;

  /* MkDocs Material overrides */
  --md-text-font: var(--font-sans);
  --md-code-font: var(--font-mono);
  --md-primary-fg-color: #1558b0;
  --md-primary-fg-color--light: #1e88e5;
  --md-primary-fg-color--dark: #0a2c54;
  --md-primary-bg-color: #ffffff;
  --md-accent-fg-color: #1e88e5;
  --md-default-bg-color: #fbfdff;
  --md-default-fg-color: #0c1d36;
  --md-default-fg-color--light: #465b75;
  --md-default-fg-color--lighter: #6b809a;
  --md-default-fg-color--lightest: rgba(160, 192, 224, 0.22);
  --md-typeset-a-color: #1558b0;
  --md-code-bg-color: #eef5fc;
  --md-code-fg-color: #0c2c54;
  --md-footer-bg-color: #e1eef9;
  --md-footer-fg-color: #0c1d36;
}

html {
  scroll-behavior: smooth;
  background-color: var(--paper);
}

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

.ap-wrap {
  width: min(100% - 64px, 1200px);
  margin-inline: auto;
}

/* ---------- Motion Keyframes ---------- */
@keyframes oceanCausticFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(18px, -12px, 0) scale(1.06); }
}

@keyframes oceanSwellDrift {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-24px, 5px, 0); }
}

@keyframes oceanSwellDriftReverse {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(22px, -4px, 0); }
}

@keyframes oceanCrestBreathe {
  0%, 100% { opacity: 0.88; transform: translate3d(0, 0, 0); }
  50% { opacity: 1; transform: translate3d(0, -6px, 0); }
}

/* ---------- Frosted Sea-Glass Header (from ../apwebsite Navbar) ---------- */
.md-header.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: auto;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.md-header.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(247, 251, 255, 0.86);
  backdrop-filter: blur(18px) saturate(165%);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
  border-bottom: 1px solid rgba(182, 206, 232, 0.58);
  box-shadow: 0 4px 20px -10px rgba(12, 29, 54, 0.08);
  pointer-events: none;
}

.site-header .header-layout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 65px;
  align-items: center;
  gap: 0 clamp(12px, 2vw, 24px);
}

.header-brand-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.site-header .brand,
.site-footer .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ink);
}

.brand-mark-frame {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 4px;
  border-radius: 11px;
  background: linear-gradient(145deg, #ffffff 0%, #e4f3ff 100%);
  border: 1px solid rgba(41, 182, 246, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 6px 16px -6px rgba(21, 88, 176, 0.32);
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 220ms ease, border-color 220ms ease;
}

.brand:hover .brand-mark-frame {
  transform: translateY(-1px);
  border-color: rgba(41, 182, 246, 0.65);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 10px 22px -6px rgba(21, 88, 176, 0.42);
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  object-fit: contain;
  display: block;
}

.brand-wordmark {
  font-size: 1.25rem;
  font-weight: 740;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.brand-note {
  padding-left: 10px;
  border-left: 1px solid var(--line);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 620;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color 150ms ease;
}

.brand-note:hover {
  color: var(--blue-bright);
}

.site-header .nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px 20px;
  font-size: 0.87rem;
  font-weight: 520;
}

.site-header .nav-links > a {
  text-decoration: none;
  color: var(--muted);
  transition: color 150ms ease;
  padding: 6px 2px;
}

.site-header .nav-links > a:hover,
.site-header .nav-links > a.is-active {
  color: var(--blue);
  text-decoration: none;
}

.site-header .nav-links > a.is-active {
  font-weight: 640;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  padding: 6px 2px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: color 150ms ease;
}

.nav-dropdown-trigger:hover,
.nav-dropdown-trigger[aria-expanded="true"] {
  color: var(--blue);
}

.nav-dropdown-chevron {
  flex: 0 0 auto;
  transition: transform 180ms ease;
}

.nav-dropdown[data-open="true"] .nav-dropdown-chevron {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  min-width: 236px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(182, 206, 232, 0.85);
  border-radius: 14px;
  box-shadow: 0 20px 44px -14px rgba(12, 29, 54, 0.18), 0 4px 12px rgba(12, 29, 54, 0.06);
}

.nav-dropdown-menu[hidden] {
  display: none !important;
}

.nav-dropdown[data-align="start"] .nav-dropdown-menu {
  left: 0;
  right: auto;
}

.nav-dropdown-group + .nav-dropdown-group {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(201, 217, 235, 0.65);
}

.nav-dropdown-group-label {
  padding: 4px 10px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 680;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.81rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}

.nav-dropdown-item-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.nav-dropdown-emblem {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  object-fit: contain;
}

.nav-dropdown-menu a:hover {
  background: var(--blue-fill);
  color: var(--blue);
  text-decoration: none;
}

.nav-dropdown-external {
  flex: 0 0 auto;
  opacity: 0.45;
  transition: opacity 140ms ease;
}

.nav-dropdown-menu a:hover .nav-dropdown-external {
  opacity: 1;
}

.site-header .nav-links a.nav-github {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border: 1px solid rgba(182, 206, 232, 0.85);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 580;
  text-decoration: none;
  box-shadow: 0 2px 8px -4px rgba(12, 29, 54, 0.14);
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.site-header .nav-links a.nav-github:hover {
  border-color: var(--blue);
  background: var(--blue-fill);
  color: var(--blue);
  transform: translateY(-1px);
  text-decoration: none;
}

/* Header Search pill & Mobile toggle */
.header-utilities {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ap-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid rgba(182, 206, 232, 0.85);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 520;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.ap-search-trigger:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-fill);
}

.ap-search-kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--quiet);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1;
}

.nav-menu-toggle {
  display: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: var(--ink);
}

/* Keep Material search overlay styling clean & ocean-themed */
.site-header .md-search {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 0;
  z-index: 80;
  pointer-events: none;
}

[data-md-toggle="search"]:checked ~ .md-header .md-search {
  pointer-events: auto;
}

.site-header .md-search__inner {
  width: min(calc(100% - 32px), 34rem);
  margin: 4.5rem auto 0;
  float: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

[data-md-toggle="search"]:checked ~ .md-header .md-search__inner {
  opacity: 1;
  transform: translateY(0);
}

.site-header .md-search__form {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  box-shadow: var(--shadow-card-hover);
  color: var(--ink);
}

.site-header .md-search__input {
  color: var(--ink);
}

.site-header .md-search__input::placeholder {
  color: var(--muted);
}

.site-header .md-search__icon {
  color: var(--muted);
}

.site-header .md-search__output {
  border-radius: 0 0 12px 12px;
  border: 1px solid var(--line);
  border-top: 0;
  box-shadow: var(--shadow-card-hover);
}

/* ---------- Offset main container for fixed 66px header ---------- */
.md-container {
  padding-top: var(--header-height);
  background: var(--paper);
}

.md-main {
  background: var(--paper);
}

.md-main__inner {
  margin-top: 0;
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
}

.md-grid {
  max-width: 1200px;
}

/* Hide default Material left nav sidebar on blog index/tags (categories are in hero bar) */
.md-sidebar--primary:not(.md-sidebar--post) {
  display: none;
}

/* ---------- Sunlit Ocean Blog Hero ---------- */
.ap-blog-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--hero-top) 0%, var(--hero-mid) 56%, var(--hero-bottom) 100%);
  border-bottom: 1px solid rgba(182, 206, 232, 0.55);
}

.ocean-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.ocean-caustic {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  animation: oceanCausticFloat 14s ease-in-out infinite;
}

.ocean-caustic-1 {
  width: 480px;
  height: 300px;
  top: -110px;
  right: 6%;
  opacity: 0.75;
  background: radial-gradient(circle, rgba(41, 182, 246, 0.24) 0%, rgba(30, 136, 229, 0.08) 52%, transparent 74%);
}

.ocean-caustic-2 {
  width: 440px;
  height: 280px;
  top: 18%;
  left: -8%;
  background: radial-gradient(circle, rgba(56, 195, 224, 0.16) 0%, rgba(21, 88, 176, 0.05) 55%, transparent 75%);
  animation-delay: -5s;
}

.ocean-crest-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.85;
}

.ocean-logo-echo {
  animation: oceanCrestBreathe 10s ease-in-out infinite;
}

.ocean-swell-back {
  animation: oceanSwellDrift 18s ease-in-out infinite;
}

.ocean-swell-mid {
  animation: oceanSwellDriftReverse 14s ease-in-out infinite;
}

.ap-blog-hero-inner {
  position: relative;
  z-index: 1;
  padding-block: clamp(32px, 4.4vw, 56px) clamp(28px, 3.8vw, 44px);
}

.ap-hero-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 16px;
}

.ap-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(41, 182, 246, 0.28);
  box-shadow: 0 6px 18px -10px rgba(21, 88, 176, 0.22);
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 660;
}

.ap-eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #29b6f6, #1558b0);
  box-shadow: 0 0 0 3px rgba(41, 182, 246, 0.2);
}

.ap-rss-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(160, 192, 224, 0.65);
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 560;
  text-decoration: none;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.ap-rss-pill:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: #ffffff;
}

.ap-blog-hero-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1.12;
  color: var(--ink);
}

.ap-blog-hero-title span {
  background: linear-gradient(112deg, #0f479e 0%, #1976d2 48%, #0ea5e9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ap-blog-hero-desc {
  margin: 14px 0 0;
  max-width: 44rem;
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--muted);
}

.ap-blog-hero-desc strong {
  color: var(--ink);
  font-weight: 620;
}

.ap-category-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
}

.ap-cat-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(160, 192, 224, 0.72);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 560;
  text-decoration: none;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.ap-cat-pill:hover {
  border-color: var(--blue);
  background: #ffffff;
  color: var(--blue);
  transform: translateY(-1px);
}

.ap-cat-pill.is-active {
  background: linear-gradient(135deg, #1350a4 0%, #196fd0 58%, #1e88e5 100%);
  border-color: rgba(21, 88, 176, 0.9);
  color: #ffffff;
  box-shadow: 0 8px 20px -8px rgba(21, 88, 176, 0.48);
}

.ap-cat-pill-subtle {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
}

/* ---------- Blog Listing Grid & Ocean Post Cards ---------- */
.ap-blog-listing {
  width: 100%;
}

.ap-blog-listing-inner {
  margin: 0 !important;
  padding: 0 0.8rem !important;
}

.ap-post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.ap-post-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(182, 206, 232, 0.72);
  box-shadow: var(--shadow-card);
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 220ms ease, border-color 220ms ease;
}

.ap-post-card:hover {
  transform: translateY(-3px);
  border-color: rgba(30, 136, 229, 0.45);
  box-shadow: var(--shadow-card-hover);
}

.ap-post-card__media {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--quiet);
  border-bottom: 1px solid rgba(201, 217, 235, 0.6);
}

.ap-post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ap-post-card:hover .ap-post-card__media img {
  transform: scale(1.03);
}

.ap-post-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 20px 22px 22px;
}

.ap-post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 10px;
  font-size: 0.77rem;
  color: var(--muted);
}

.ap-post-cat {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--blue-fill);
  border: 1px solid rgba(30, 136, 229, 0.24);
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 620;
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease;
}

.ap-post-cat:hover {
  background: var(--blue);
  color: #ffffff;
}

.ap-post-date,
.ap-post-readtime {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--muted);
}

.ap-post-dot {
  color: var(--line);
}

.ap-post-card__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.18rem;
  font-weight: 710;
  line-height: 1.32;
  letter-spacing: -0.022em;
  color: var(--ink);
}

.ap-post-card__title a {
  color: inherit;
  text-decoration: none;
  transition: color 150ms ease;
}

.ap-post-card__title a:hover {
  color: var(--blue);
}

.ap-post-card__excerpt {
  margin: 10px 0 0;
  font-size: 0.9rem;
  line-height: 1.62;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ap-post-card__footer {
  margin-top: auto;
  padding-top: 16px;
}

.ap-post-readmore {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 640;
  text-decoration: none;
  transition: color 150ms ease;
}

.ap-post-readmore svg {
  transition: transform 180ms ease;
}

.ap-post-card:hover .ap-post-readmore svg {
  transform: translateX(3px);
}

/* Featured first card on homepage spans both columns */
.ap-post-card--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
}

.ap-post-card--featured .ap-post-card__media {
  aspect-ratio: auto;
  min-height: 290px;
  height: 100%;
  border-bottom: 0;
  border-right: 1px solid rgba(201, 217, 235, 0.6);
}

.ap-post-card--featured .ap-post-card__body {
  padding: 28px 30px;
  justify-content: center;
}

.ap-post-card--featured .ap-post-card__title {
  font-size: clamp(1.38rem, 2.2vw, 1.75rem);
  line-height: 1.24;
}

.ap-post-card--featured .ap-post-card__excerpt {
  font-size: 0.96rem;
  -webkit-line-clamp: 4;
}

/* Pagination */
.ap-pagination {
  margin-top: 2.25rem;
  display: flex;
  justify-content: center;
}

.ap-pagination .md-pagination {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ap-pagination .md-pagination__link,
.ap-pagination .md-pagination__current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.ap-pagination .md-pagination__current {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.ap-pagination .md-pagination__link:hover {
  border-color: var(--blue);
  background: var(--blue-fill);
  color: var(--blue);
}

/* ---------- Single Article Page ---------- */
.ap-post-page .md-sidebar--post {
  padding-top: 0.5rem;
}

.ap-post-page .md-sidebar--post .md-nav__link {
  color: var(--muted);
  font-size: 0.8rem;
}

.ap-post-page .md-sidebar--post .ap-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-weight: 640;
}

.ap-post-page .md-sidebar--post .md-author img {
  border-radius: 9px;
  padding: 2px;
  background: #ffffff;
  border: 1px solid rgba(41, 182, 246, 0.3);
}

.ap-article-mobile-meta {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 1rem;
}

.ap-article-back-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--blue) !important;
  font-size: 0.78rem;
  font-weight: 620;
  text-decoration: none !important;
}

.ap-post-cover {
  margin: 0 0 1.75rem !important;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(182, 206, 232, 0.78);
  box-shadow: var(--shadow-card);
  background: var(--quiet);
}

.ap-post-cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Editorial typography aligned with apwebsite */
.md-typeset {
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--ink);
}

.md-typeset h1 {
  font-family: var(--font-sans);
  font-size: clamp(1.75rem, 3.1vw, 2.35rem);
  font-weight: 760;
  letter-spacing: -0.036em;
  line-height: 1.18;
  color: var(--ink);
  margin-bottom: 1rem;
}

.md-typeset h2 {
  font-family: var(--font-sans);
  font-size: 1.42rem;
  font-weight: 710;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-top: 2.1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(201, 217, 235, 0.65);
}

.md-typeset h3 {
  font-family: var(--font-sans);
  font-size: 1.12rem;
  font-weight: 680;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.md-typeset a {
  color: var(--blue);
  text-underline-offset: 0.22em;
}

.md-typeset a:hover {
  color: var(--blue-bright);
}

.md-typeset blockquote {
  border-left: 3px solid var(--blue-bright);
  background: var(--quiet);
  padding: 0.85rem 1.15rem;
  border-radius: 0 10px 10px 0;
  color: var(--muted);
}

.md-typeset code {
  font-family: var(--font-mono);
  background: var(--quiet);
  color: #0f3e72;
  border: 1px solid rgba(182, 206, 232, 0.55);
  border-radius: 6px;
  padding: 0.1em 0.38em;
  font-size: 0.84em;
}

/* Deep-abyss code blocks matching apwebsite */
.md-typeset pre > code {
  background: var(--dark);
  color: var(--on-dark);
  border: 1px solid var(--dark-line);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  box-shadow: 0 14px 30px -16px rgba(2, 10, 24, 0.45);
}

.md-typeset .highlight .filename {
  background: #0d213d;
  color: var(--on-dark-muted);
  border-bottom: 1px solid var(--dark-line);
  border-radius: 12px 12px 0 0;
  font-family: var(--font-mono);
}

.md-typeset .highlight .md-clipboard {
  color: var(--on-dark-muted);
}

.md-typeset .highlight .md-clipboard:hover {
  color: var(--reef-glow);
}

/* Highlight syntax colors readable on #071528 deep sea code background */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: #7e9ec2; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kt { color: #79dcff; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd { color: #9ae6b4; }
.highlight .nf, .highlight .nc, .highlight .fm { color: #93c5fd; }
.highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo { color: #fcd34d; }
.highlight .nb, .highlight .bp { color: #a5f1ff; }
.highlight .o, .highlight .p { color: #cbd5e1; }
.highlight .na, .highlight .nt { color: #67e8f9; }

/* Tags */
.md-typeset .md-tags {
  margin-bottom: 1rem;
}

.md-typeset .md-tag {
  background: var(--quiet);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.22rem 0.65rem;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.md-typeset .md-tag:hover {
  background: var(--blue-fill);
  border-color: var(--blue);
  color: var(--blue);
}

/* TOC sidebar */
.md-sidebar--secondary .md-nav__title {
  color: var(--ink);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.md-sidebar--secondary .md-nav__link {
  color: var(--muted);
  font-size: 0.78rem;
}

.md-sidebar--secondary .md-nav__link--active,
.md-sidebar--secondary .md-nav__link:hover {
  color: var(--blue);
}

/* ---------- Giscus Comments Section ---------- */
.ap-comments {
  margin-top: 3rem;
  padding: 24px 26px 26px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(182, 206, 232, 0.78);
  box-shadow: var(--shadow-card);
}

.ap-comments__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  margin-bottom: 1.15rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(201, 217, 235, 0.65);
}

.md-typeset .ap-comments__title {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  font-size: 1.18rem;
  font-weight: 710;
  color: var(--ink);
}

.ap-comments__note {
  margin: 0 !important;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------- Post Prev/Next Pager ---------- */
.ap-post-pager-wrap {
  background: var(--paper);
  padding-block: 0.5rem 1.5rem;
}

.ap-post-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.ap-pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  text-decoration: none;
  box-shadow: 0 6px 20px -12px rgba(12, 29, 54, 0.12);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.ap-pager-link:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.ap-pager-next {
  text-align: right;
  align-items: flex-end;
}

.ap-pager-dir {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--blue);
}

.ap-pager-title {
  font-size: 0.92rem;
  font-weight: 660;
  color: var(--ink);
  line-height: 1.35;
}

/* ---------- Wave Divider & Harbor Footer (from ../apwebsite) ---------- */
.wave {
  position: relative;
  width: 100%;
  height: clamp(46px, 5.5vw, 82px);
  overflow: hidden;
  line-height: 0;
}

.wave svg {
  display: block;
  width: 100%;
  height: 100%;
}

.wave-to-footer {
  background: var(--paper);
  --wave-fill: var(--harbor);
  --wave-crest: rgba(30, 136, 229, 0.34);
}

.wave-layer-back {
  animation: oceanSwellDrift 20s ease-in-out infinite;
}

.wave-layer-mid {
  animation: oceanSwellDriftReverse 15s ease-in-out infinite;
}

.md-footer.site-footer {
  background: linear-gradient(180deg, var(--harbor) 0%, var(--harbor-deep) 100%);
  color: var(--ink);
  line-height: 1.6;
}

.site-footer .footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) repeat(3, minmax(0, 1fr));
  gap: 24px 28px;
  padding-block: 28px 32px;
}

.site-footer .footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer .footer-grid li + li {
  margin-top: 6px;
}

.site-footer .footer-summary {
  color: var(--muted);
  font-size: 0.86rem;
}

.site-footer .footer-summary p {
  margin: 10px 0 0;
  max-width: 22em;
}

.site-footer h2 {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0 0 10px;
}

.site-footer .footer-nav a {
  display: inline-block;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 150ms ease;
}

.site-footer .footer-nav a:hover,
.site-footer .footer-bottom a:hover {
  color: var(--blue);
  text-decoration: underline;
}

.site-footer .footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding-block: 14px 20px;
  color: var(--muted);
  border-top: 1px solid rgba(154, 190, 224, 0.55);
  font-size: 0.79rem;
}

.site-footer .footer-bottom a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer .footer-bottom .back-to-top {
  margin-inline-start: auto;
  font-weight: 600;
  color: var(--blue);
}

/* Back-to-top floating button polish */
.md-top {
  background: rgba(255, 255, 255, 0.94);
  color: var(--blue);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  top: 78px;
}

.md-top:hover {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
}

/* ---------- Responsive Breakpoints (matching ../apwebsite) ---------- */
@media (max-width: 1219px) {
  .ap-article-mobile-meta {
    display: flex;
  }
}

@media (max-width: 980px) {
  .site-header .header-layout {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .nav-menu-toggle {
    display: grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
  }

  .site-header .nav-links {
    display: none;
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .site-header .nav-links[data-open="true"] {
    display: grid;
    justify-content: stretch;
    gap: 0;
    border-top: 1px solid var(--line);
    padding-block: 8px 14px;
    max-height: calc(100dvh - 66px);
    overflow: auto;
  }

  .site-header .nav-links > a {
    display: block;
    min-height: 44px;
    padding: 12px 4px;
  }

  .site-header .nav-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    padding: 12px 4px;
  }

  .site-header .nav-dropdown-menu {
    position: static;
    min-width: 0;
    margin: 0 0 8px 8px;
    padding: 2px 0 2px 12px;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    backdrop-filter: none;
  }

  .site-header .nav-links a.nav-github {
    display: inline-flex;
    width: fit-content;
    min-height: 40px;
    margin-top: 6px;
    padding: 8px 14px;
  }

  .ap-post-card--featured {
    grid-template-columns: 1fr;
  }

  .ap-post-card--featured .ap-post-card__media {
    aspect-ratio: 16 / 9;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid rgba(201, 217, 235, 0.6);
  }
}

@media (max-width: 760px) {
  .ap-wrap {
    width: calc(100% - 36px);
  }

  .ap-post-grid {
    grid-template-columns: 1fr;
  }

  .ap-post-pager {
    grid-template-columns: 1fr;
  }

  .ap-search-label,
  .ap-search-kbd {
    display: none;
  }

  .ap-search-trigger {
    padding: 8px;
  }

  .site-footer .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .site-footer .footer-summary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .ap-wrap {
    width: calc(100% - 28px);
  }

  .brand-wordmark {
    font-size: 1.125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .ocean-caustic,
  .ocean-logo-echo,
  .ocean-swell-back,
  .ocean-swell-mid,
  .wave-layer-back,
  .wave-layer-mid {
    animation: none;
  }
}
