:root {
  color-scheme: dark light;
  --ink: #111111;
  --paper: #f7f7f4;
  --surface: #ffffff;
  --muted: #b9b9b9;
  --text-muted: #616161;
  --border: #e7e7e2;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.nav,
.hero-inner,
.article,
.footer-inner {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
}

/* ─── Dark hero header (matches rich-template posts) ─── */
.hero {
  position: relative;
  overflow: hidden;
  padding: 132px 24px 68px;
  background: radial-gradient(circle at 88% 22%, rgba(255,255,255,0.08) 0 170px, transparent 172px),
              linear-gradient(135deg, #0d0d0d 0%, #151515 54%, #232323 100%);
  color: #ffffff;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: radial-gradient(circle, #ffffff 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(90deg, transparent 0%, #000000 12%, #000000 80%, transparent 100%);
}

.hero-inner {
  max-width: 900px;
  padding-top: 0;
}

.hero h1 {
  font-size: clamp(46px, 8vw, 92px);
  line-height: 0.95;
}

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

.hero .dek {
  margin: 26px 0 0;
  color: #d8d8d8;
  font-size: clamp(21px, 3vw, 30px);
  line-height: 1.35;
}

.hero .meta {
  margin-top: 28px;
  color: #d0d0d0;
}

header.hero + main {
  padding-top: 72px;
}

/* ─── Post-to-post navigation ─── */
.post-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
  max-width: 1140px;
  margin: 0 auto;
  padding: 40px 24px 56px;
  border-top: 1px solid var(--border);
}

.post-nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 340px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 120ms ease;
}

.post-nav-link:hover {
  border-color: var(--ink);
  box-shadow: 0 4px 18px rgba(0,0,0,0.09);
  transform: translateY(-2px);
}

.post-nav-arrow {
  flex: 0 0 auto;
  font-size: 20px;
  color: var(--text-muted);
  transition: color 180ms ease;
}

.post-nav-link:hover .post-nav-arrow {
  color: var(--ink);
}

.post-nav-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.post-nav-hint {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.post-nav-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.post-nav-next {
  margin-left: auto;
  flex-direction: row-reverse;
  text-align: right;
}

.nav {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: none;
  gap: 24px;
  padding: 14px max(24px, calc((100vw - 1120px) / 2 + 24px));
  overflow: hidden;
  border-bottom: 1px solid transparent;
  background: #111111;
  color: #ffffff;
  backdrop-filter: blur(18px);
  transition: border-color 180ms ease, background 180ms ease;
}

.nav::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: radial-gradient(circle, #ffffff 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(90deg, transparent 0%, #000000 12%, #000000 80%, transparent 100%);
  transition: opacity 180ms ease;
}

.nav.nav-scrolled {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  background: #111111;
}

.nav.nav-scrolled::before {
  opacity: 0.06;
}

.brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
  color: inherit;
  text-decoration: none;
  font-size: 26px;
  font-weight: 800;
}

.brand svg {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
}

.nav-links {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.nav-links a {
  color: inherit;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links .active {
  color: #ffffff;
}

.nav-links .nav-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #ffffff;
  transition: padding 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.nav-links .nav-cta::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -8px;
  left: 0;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
  opacity: 0.7;
  transition: opacity 180ms ease;
}

.nav.nav-scrolled .nav-cta {
  padding: 0 13px;
  border-color: rgba(255, 255, 255, 0.22);
  background: #ffffff;
  color: var(--ink);
}

.nav.nav-scrolled .nav-cta::after {
  opacity: 0;
}

.menu-toggle {
  position: relative;
  z-index: 2;
  display: none;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  cursor: pointer;
}

.menu-toggle span {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 160ms ease, opacity 160ms ease, top 160ms ease;
}

.nav.nav-open .menu-toggle {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.menu-toggle span:nth-child(1) {
  top: 14px;
}

.menu-toggle span:nth-child(2) {
  top: 20px;
}

.menu-toggle span:nth-child(3) {
  top: 26px;
}

.nav.nav-open .menu-toggle span:nth-child(1) {
  top: 20px;
  transform: rotate(45deg);
}

.nav.nav-open .menu-toggle span:nth-child(2) {
  opacity: 0;
}

.nav.nav-open .menu-toggle span:nth-child(3) {
  top: 20px;
  transform: rotate(-45deg);
}

.article {
  max-width: 820px;
  padding: 142px 24px 86px;
}

.article-shell {
  display: grid;
  grid-template-columns: minmax(0, 760px) 260px;
  gap: 56px;
  align-items: start;
  max-width: 1140px;
  margin: 0 auto;
  padding: 142px 24px 86px;
}

.article-shell .article {
  max-width: none;
  margin: 0;
  padding: 0;
}

.aside {
  position: sticky;
  top: 104px;
  display: grid;
  gap: 18px;
}

.toc {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.toc strong {
  display: block;
  margin-bottom: 14px;
  color: #7d8594;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.toc a {
  display: block;
  padding: 8px 0 8px 16px;
  border-left: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease;
}

.toc a:hover {
  color: var(--ink);
}

.toc a.active {
  border-left-color: var(--ink);
  color: var(--ink);
  font-weight: 700;
}

@media (max-width: 980px) {
  .article-shell {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .aside {
    display: none;
  }
}

.back-link {
  display: inline-flex;
  margin-bottom: 36px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 16px;
  color: #7d8594;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.025em;
}

.dek {
  margin: 22px 0 0;
  color: var(--text-muted);
  font-size: clamp(19px, 2.3vw, 25px);
  line-height: 1.5;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 700;
}

.content {
  margin-top: 48px;
}

.content h2 {
  margin: 44px 0 14px;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.08;
}

.content h2.will-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.content h2.will-reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.content p,
.content li {
  color: #252525;
  font-size: 19px;
  line-height: 1.76;
}

.content p {
  margin: 0 0 22px;
}

.content ul {
  display: grid;
  gap: 10px;
  margin: 0 0 28px;
  padding-left: 24px;
}

.note {
  margin: 38px 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1.58;
}

.footer {
  padding: 34px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer a {
  text-decoration: none;
}

@media (max-width: 680px) {
  .nav {
    align-items: center;
    gap: 16px;
    overflow: visible;
    padding: 12px 18px;
  }

  .nav-links {
    position: absolute;
    top: calc(100% + 10px);
    right: 14px;
    display: none;
    width: min(248px, calc(100vw - 28px));
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    background: rgba(17, 17, 17, 0.92);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.38);
    color: #d9d9d9;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
    backdrop-filter: blur(18px);
  }

  .nav-links a {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 12px;
  }

  .nav-links a:hover,
  .nav-links .active {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
  }

  .nav.nav-open .nav-links,
  .menu-toggle {
    display: flex;
  }

  .nav-links .nav-cta {
    justify-content: center;
    min-height: 44px;
    margin-top: 4px;
    padding: 0 14px;
    border-color: rgba(255, 255, 255, 0.18);
    background: #ffffff;
    color: var(--ink);
  }

  .nav-links .nav-cta::after {
    opacity: 0;
  }

  .nav.nav-open .nav-links {
    width: 232px;
    max-width: calc(100vw - 24px);
    gap: 4px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(17, 17, 17, 0.94);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.15;
  }

  .nav.nav-open .nav-links a {
    min-height: 38px;
    align-items: center;
    padding: 0 12px;
    border-radius: 10px;
  }

  .nav.nav-open .nav-links a:hover {
    background: transparent;
  }

  .nav.nav-open .nav-links .active {
    background: rgba(255, 255, 255, 0.06);
  }

  .nav.nav-open .nav-links .nav-cta {
    min-height: 40px;
    margin-top: 2px;
    font-size: 14px;
  }

  .article {
    padding: 118px 20px 68px;
  }

  .article-shell {
    padding: 118px 20px 68px;
  }

  h1 {
    font-size: 43px;
  }

  .content p,
  .content li {
    font-size: 18px;
  }

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