/* =============================================
   ENGRAM THEME — MAIN STYLESHEET
   ============================================= */

:root {
  --color-bg: #ffffff;
  --color-bg-subtle: #f5f6f6;
  --color-bg-muted: #edeeee;
  --color-border: #e2e4e4;
  --color-text: #2b2e2d;
  --color-text-muted: #71767a;
  --color-text-light: #9aa0a3;
  --color-accent: #5b8a72;
  --color-accent-hover: #4a7460;
  --color-accent-light: #e6efe9;
  --color-peach: #f3ddd8;
  --color-lavender: #e4e1f2;
  --color-sky: #dcebf2;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --max-w: 1160px;
  --nav-h: 64px;
  --sidebar-w: 280px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }

/* --- Layout --- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--color-text);
}
h1 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.95rem; }
p { color: var(--color-text); line-height: 1.75; }
code, pre { font-family: var(--font-mono); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1.5px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}
.btn-outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-outline:hover {
  background: var(--color-bg-subtle);
}
.btn-outline-accent {
  background: var(--color-bg);
  color: var(--color-accent);
  border-color: var(--color-accent);
}
.btn-outline-accent:hover {
  background: var(--color-accent-light);
}

/* =============================================
   NAVIGATION
   ============================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--color-border);
  height: var(--nav-h);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 40px;
  height: var(--nav-h);
}
.site-logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.site-logo .logo-main {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
.site-logo .logo-by {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--color-text-light);
  letter-spacing: 0.01em;
}
.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  flex: 1;
  margin-left: auto;
}
.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-menu > li {
  margin: 0;
  position: relative;
}
.nav-menu > li > a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--color-text);
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-menu > li > a:hover {
  color: var(--color-text);
  background: var(--color-bg-subtle);
}
.nav-menu > li.current-menu-item > a,
.nav-menu > li.current-menu-ancestor > a,
.nav-menu > li.current_page_item > a {
  color: var(--color-text);
  background: var(--color-bg-subtle);
  font-weight: 600;
}
.nav-menu > li.current-menu-item > a::after,
.nav-menu > li.current_page_item > a::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  background: var(--color-accent);
  border-radius: 1px 1px 0 0;
}
.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.nav-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0;
  color: var(--color-text);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.nav-mobile-toggle:hover {
  background: var(--color-bg-subtle);
  border-color: #d4d7d7;
}
.nav-mobile-toggle .nav-icon-close { display: none; }
.nav-mobile-toggle[aria-expanded="true"] .nav-icon-open { display: none; }
.nav-mobile-toggle[aria-expanded="true"] .nav-icon-close { display: block; }

/* =============================================
   HERO — SPLIT MANIFESTO
   ============================================= */
.hero-split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
}
.hero-split .hero-left {
  padding: 110px 60px;
}
.hero-split .hero-right {
  background: var(--color-bg-subtle);
  border-left: 1px solid var(--color-border);
  padding: 110px 50px;
}
.hero-split h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-bottom: 24px;
}
.hero-split h1 .hl {
  color: var(--color-accent);
}
.hero-split .hero-sub {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  max-width: 400px;
  margin-bottom: 32px;
}
.hero-split .spec-row {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}
.hero-split .spec-row:first-child {
  padding-top: 0;
}
.hero-split .spec-row:last-child {
  border-bottom: none;
}
.hero-split .spec-k {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hero-split .spec-v {
  font-weight: 600;
}
@media (max-width: 900px) {
  .hero-split { grid-template-columns: 1fr; }

  .hero-split .hero-left {
    padding: 40px 20px 28px;
  }
  .hero-split h1 {
    font-size: 1.6rem;
    margin-bottom: 12px;
  }
  .hero-split .hero-sub {
    font-size: 0.9rem;
    margin-bottom: 20px;
  }
  .hero-split .btn {
    padding: 9px 16px;
    font-size: 0.85rem;
  }

  .hero-split .hero-right {
    border-left: none;
    border-top: 1px solid var(--color-border);
    padding: 4px 0 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .hero-split .spec-row {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
    padding: 14px 20px !important;
    border-bottom: 1px solid var(--color-border);
  }
  .hero-split .spec-row:nth-child(odd) {
    border-right: 1px solid var(--color-border);
  }
  .hero-split .spec-row:last-child {
    grid-column: 1 / -1;
    border-right: none;
    border-bottom: none;
  }
  .hero-split .spec-k {
    font-size: 0.68rem;
  }
  .hero-split .spec-v {
    font-size: 0.82rem;
  }
}

/* =============================================
   WHAT IS ENGRAM
   ============================================= */
.what-is-wrap {
  position: relative;
  background: var(--color-bg-subtle);
}
.what-is-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(#c7cbc9 1px, transparent 1px),
    linear-gradient(90deg, #c7cbc9 1px, transparent 1px);
  background-size: 8px 8px;
  -webkit-mask-image:
    linear-gradient(to right, black 0%, transparent 8%, transparent 92%, black 100%),
    linear-gradient(to bottom, black 0%, transparent 8%, transparent 92%, black 100%);
  mask-image:
    linear-gradient(to right, black 0%, transparent 8%, transparent 92%, black 100%),
    linear-gradient(to bottom, black 0%, transparent 8%, transparent 92%, black 100%);
  -webkit-mask-composite: source-over;
  mask-composite: add;
  pointer-events: none;
}
.what-is {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 96px 24px;
}
.what-is .wi-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.what-is .wi-heading {
  display: block;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 36px;
}
.what-is p {
  color: var(--color-text);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 24px;
}
.what-is p:last-child {
  margin-bottom: 0;
}
.what-is strong {
  font-weight: 400;
  color: inherit;
}

/* Collapse / read-more */
.what-is-collapse {
  position: relative;
}
.what-is-body {
  overflow: hidden;
  transition: max-height 0.4s ease;
}
.what-is-fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 110px;
  background: linear-gradient(to bottom, transparent, var(--color-bg-subtle) 80%);
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.what-is-collapse.expanded .what-is-fade {
  opacity: 0;
}
.what-is-toggle {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -20px auto 0;
  background: var(--color-accent);
  border: 1px solid var(--color-accent);
  color: #ffffff;
  cursor: pointer;
}
.what-is-toggle:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}
.what-is-toggle svg {
  transition: transform 0.3s ease;
}
.what-is-collapse.expanded .what-is-toggle svg {
  transform: rotate(180deg);
}

@media (max-width: 900px) {
  .what-is { padding: 56px 20px; }
  .what-is p { font-size: 0.98rem; }
}

/* =============================================
   WHY ENGRAM — DARK BOX
   ============================================= */
.why-engram {
  background: #1e201f;
}
.why-engram-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 96px 24px;
}
.why-engram .we-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: #8fb8a0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.why-engram .we-heading {
  display: block;
  color: #ffffff;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  max-width: 640px;
  margin-bottom: 48px;
}
.why-engram .we-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.12);
}
.why-engram .we-reason {
  background: #1e201f;
  padding: 32px 28px;
}
.why-engram .we-reason h3 {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.why-engram .we-reason p {
  color: rgba(255,255,255,0.62);
  font-size: 0.95rem;
  line-height: 1.7;
}
@media (max-width: 900px) {
  .why-engram-inner { padding: 64px 20px; }
  .why-engram .we-grid { grid-template-columns: 1fr; }
}

/* =============================================
   PROBLEM / SOLUTION — STACKED CONNECTOR
   ============================================= */
.problem-solution {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 96px 24px;
}
.problem-solution .ps-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.problem-solution .ps-heading {
  display: block;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  max-width: 640px;
  margin-bottom: 56px;
}
.problem-solution .ps-item {
  display: grid;
  grid-template-columns: 40px 1fr;
}
.problem-solution .ps-connector-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.problem-solution .ps-dot {
  width: 10px;
  height: 10px;
  background: #b5564a;
  margin-top: 6px;
  flex-shrink: 0;
}
.problem-solution .ps-line {
  width: 1px;
  flex: 1;
  background: var(--color-border);
  margin: 8px 0;
}
.problem-solution .ps-content {
  padding-bottom: 48px;
}
.problem-solution .ps-problem h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.problem-solution .ps-problem p {
  color: var(--color-text);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 20px;
}
.problem-solution .ps-fixes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.problem-solution .ps-fix-box {
  border: 1px solid var(--color-border);
  padding: 20px 22px;
}
.problem-solution .ps-fix-box .ps-fix-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.problem-solution .ps-fix-box p {
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.65;
  margin: 0;
}
@media (max-width: 900px) {
  .problem-solution { padding: 64px 20px; }
  .problem-solution .ps-fixes { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .problem-solution .ps-item { grid-template-columns: 24px 1fr; }
}

/* =============================================
   INTEGRATIONS
   ============================================= */
.integrations {
  background: var(--color-accent);
}
.integrations-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 96px 24px;
}
.integrations .int-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.integrations .int-heading {
  display: block;
  color: #ffffff;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  max-width: 700px;
  margin-bottom: 56px;
}
.integrations .int-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.integrations .int-block {
  min-width: 0;
  background: #111112;
  border: 1px solid #262a30;
  box-shadow: 0 8px 36px rgba(220,224,222,0.4);
}
.integrations .int-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 12px 18px;
  border-bottom: 1px solid #262a30;
}
.integrations .int-bar > span:first-child {
  margin-right: auto;
}
.integrations .int-bar span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: #e2e8f0;
}
.integrations .int-bar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
}
.integrations .int-bar .int-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.integrations .int-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid #33383f;
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #9aa4b0;
  cursor: pointer;
  flex-shrink: 0;
}
.integrations .int-copy:hover {
  border-color: #4a5058;
  color: #e2e8f0;
}
.integrations .int-copy.copied {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.integrations .int-copy svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.integrations .int-block {
  position: relative;
}
.integrations .int-block pre {
  padding: 20px 22px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.85;
  color: #e2e8f0;
}
.integrations .int-block .cm { color: rgba(226,232,240,0.4); }
.integrations .int-block .kw { color: #c792ea; }
.integrations .int-block .fn { color: #82aaff; }
.integrations .int-block .str { color: #c3e88d; }
@media (max-width: 900px) {
  .integrations-inner { padding: 64px 20px; }
  .integrations .int-grid { grid-template-columns: 1fr; }
  .integrations .int-block pre { font-size: 0.75rem; padding: 16px 16px; }
  .integrations .int-copy .int-copy-label { display: none; }
  .integrations .int-copy { padding: 6px 8px; }
}

/* =============================================
   WHAT ENGRAM REPLACES
   ============================================= */
.replaces-wrap {
  background: var(--color-bg-subtle);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.replaces {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 96px 24px;
}
.replaces .rp-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.replaces .rp-heading {
  display: block;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  max-width: 640px;
  margin-bottom: 48px;
}

/* Slider — one slide per view */
.replaces .rp-slider-wrap {
  position: relative;
}
.replaces .rp-slider {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.replaces .rp-slider::-webkit-scrollbar {
  display: none;
}
.replaces .rp-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}
.replaces .rp-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
}
.replaces .rp-box {
  padding: 22px 24px;
}
.replaces .rp-box-today {
  background: var(--color-bg);
  border: 2px solid var(--color-accent);
  border-right: none;
}
.replaces .rp-box-engram {
  background: var(--color-accent);
}
.replaces .rp-box-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.replaces .rp-box-today .rp-box-label {
  color: var(--color-accent);
}
.replaces .rp-box-today p {
  color: var(--color-text);
}
.replaces .rp-box-today strong {
  color: var(--color-accent-hover);
}
.replaces .rp-box-engram .rp-box-label {
  color: rgba(255,255,255,0.75);
}
.replaces .rp-box-engram p,
.replaces .rp-box-engram strong {
  color: #ffffff;
}
.replaces .rp-box p {
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0;
}
.replaces .rp-box-today code {
  font-size: 0.87em;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  padding: 1px 5px;
}
.replaces .rp-box-engram code {
  font-size: 0.87em;
  background: rgba(255,255,255,0.15);
  color: #ffffff;
  padding: 1px 5px;
}

/* Nav: side arrows + dots below */
.replaces .rp-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  flex-shrink: 0;
  z-index: 2;
  box-shadow: var(--shadow-sm);
}
.replaces .rp-nav-prev {
  left: -20px;
}
.replaces .rp-nav-next {
  right: -20px;
}
.replaces .rp-nav-btn:hover {
  background: var(--color-bg-subtle);
}
.replaces .rp-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.replaces .rp-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}
@media (max-width: 900px) {
  .replaces .rp-nav-prev {
    left: 0;
  }
  .replaces .rp-nav-next {
    right: 0;
  }
}
.replaces .rp-dot {
  width: 7px;
  height: 7px;
  background: var(--color-border);
  border: none;
  padding: 0;
  cursor: pointer;
}
.replaces .rp-dot.active {
  background: var(--color-accent);
}

@media (max-width: 900px) {
  .replaces { padding: 64px 20px; }
}
@media (max-width: 640px) {
  .replaces .rp-compare { grid-template-columns: 1fr; }
  .replaces .rp-box-today { border-right: 2px solid var(--color-accent); border-bottom: none; }
}

/* =============================================
   ARCHITECTURE — STEP MAP
   ============================================= */
.architecture {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 96px 24px;
}
.architecture .arch-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.architecture .arch-heading {
  display: block;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  max-width: 700px;
  margin-bottom: 16px;
}
.step-map {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  position: relative;
}
.step-map::before {
  content: '';
  position: absolute;
  top: 19px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--color-border);
}
.step-item {
  position: relative;
  padding-right: 20px;
}
.step-num {
  position: relative;
  z-index: 1;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  border: 2px solid var(--color-accent);
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 20px;
}
.step-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.35;
}
.step-item p {
  font-size: 0.83rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}
.step-item code {
  font-size: 0.87em;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  padding: 1px 4px;
}
@media (max-width: 900px) {
  .architecture { padding: 64px 20px; }
  .step-map {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .step-map::before {
    top: 0;
    bottom: 0;
    left: 19px;
    right: auto;
    width: 1px;
    height: auto;
  }
  .step-item {
    padding-right: 0;
    padding-left: 56px;
  }
  .step-num {
    position: absolute;
    top: 0;
    left: 0;
    margin-bottom: 0;
  }
}

/* =============================================
   FINAL CTA
   ============================================= */
.final-cta {
  position: relative;
  background: #0f1110;
  background-image:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  text-align: center;
  padding: 110px 24px;
  border-top: 1px solid rgba(255,255,255,0.15);
  border-bottom: 1px solid rgba(255,255,255,0.15);
  overflow: hidden;
}
.final-cta::before,
.final-cta::after {
  content: '';
  position: absolute;
  top: 20px;
  width: 12px;
  height: 12px;
  border-top: 1px solid rgba(255,255,255,0.35);
}
.final-cta::before {
  left: 20px;
  border-left: 1px solid rgba(255,255,255,0.35);
}
.final-cta::after {
  right: 20px;
  border-right: 1px solid rgba(255,255,255,0.35);
}
.final-cta .cta-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-accent);
  letter-spacing: 0.02em;
  margin-bottom: 24px;
}
.final-cta h2 {
  color: #f4f4f2;
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 3.2vw, 2.3rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  max-width: 720px;
  margin: 0 auto 48px;
  line-height: 1.4;
}
.final-cta .btn {
  position: relative;
  border-radius: 0;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.9rem;
  padding: 16px 32px;
  border-width: 2px;
}
.final-cta .btn-primary {
  background: var(--color-accent);
  border-color: #f4f4f2;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 7px 7px 0 rgba(244,244,242,0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.final-cta .btn-primary:hover {
  background: var(--color-accent-hover);
  transform: translate(-3px, -3px);
  box-shadow: 10px 10px 0 rgba(244,244,242,0.25);
}
@media (max-width: 640px) {
  .final-cta { padding: 72px 20px; background-size: 28px 28px; }
  .final-cta .btn { width: 100%; justify-content: center; padding: 15px 24px; font-size: 0.82rem; }
  .final-cta .btn-primary { box-shadow: 5px 5px 0 rgba(244,244,242,0.25); }
  .final-cta .btn-primary:hover { transform: none; box-shadow: 5px 5px 0 rgba(244,244,242,0.25); }
}

/* =============================================
   PAGE LAYOUTS
   ============================================= */

/* No sidebar */
.layout-full {
  padding: 56px 0 80px;
}

/* With sidebar */
.layout-sidebar {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: 48px;
  padding: 56px 0 80px;
  align-items: start;
}
.layout-sidebar .main-content {
  min-width: 0;
}
.layout-sidebar .sidebar-area {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
}

/* =============================================
   SIDEBAR MOBILE BEHAVIOUR
   ============================================= */
.sidebar-open-btn {
  display: none;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  background: var(--color-accent);
  color: #fff;
  border: none;
  padding: 12px 8px;
  writing-mode: vertical-rl;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  line-height: 1;
}
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: 1.5px solid var(--color-border);
  padding: 6px 10px;
  font-size: 1rem;
  line-height: 1;
  color: var(--color-text);
  cursor: pointer;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 190;
}

/* =============================================
   SIDEBAR WIDGETS
   ============================================= */
.widget {
  margin-bottom: 32px;
}
.widget-title,
.widget h2,
.widget h3,
.widget .wp-block-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-light);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}
.widget ul li {
  border-bottom: 1px solid var(--color-border);
}
.widget ul li a {
  display: block;
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  transition: color 0.13s;
}
.widget ul li a:hover { color: var(--color-accent); }

/* =============================================
   POST / PAGE CONTENT
   ============================================= */
.entry-header { margin-bottom: 36px; }
.entry-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 0.8125rem;
  color: var(--color-text-light);
}
.entry-category {
  display: inline-block;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-light);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 3px 9px;
}
.entry-content { max-width: 720px; }
.entry-content h2 { font-size: 1.5rem; margin: 40px 0 12px; }
.entry-content h3 { font-size: 1.15rem; margin: 28px 0 10px; }
.entry-content p { margin-bottom: 18px; font-size: 1rem; }
.entry-content a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
.entry-content ul, .entry-content ol { padding-left: 24px; margin-bottom: 18px; }
.entry-content ul { list-style: disc; }
.entry-content ol { list-style: decimal; }
.entry-content li { color: var(--color-text-muted); line-height: 1.75; margin-bottom: 6px; }
.entry-content img { margin: 24px 0; }
.entry-content code {
  font-size: 0.875em;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  padding: 2px 6px;
  color: var(--color-text);
}
.entry-content pre {
  background: #111112;
  padding: 20px 24px;
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid #222;
}
.entry-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
  font-size: 0.875rem;
  line-height: 1.85;
}
.entry-content blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 12px 20px;
  background: var(--color-accent-light);
  margin: 20px 0;
}
.entry-content blockquote p { color: var(--color-text); margin: 0; }

/* --- Part parent pages --- */
.part-lead {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  line-height: 1.75;
  margin-bottom: 8px;
}
.part-learn-list li {
  color: var(--color-text);
}
.part-chapter-list,
.entry-content ol.part-chapter-list {
  list-style: none;
  padding-left: 0;
  margin-top: 8px;
}
.part-chapter-list li {
  margin-bottom: 0;
  border-bottom: 1px solid var(--color-border);
}
.part-chapter-list li:last-child { border-bottom: none; }
.part-chapter-list a {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 12px 4px;
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.13s, background 0.13s;
}
.part-chapter-list a:hover {
  color: var(--color-accent);
  background: var(--color-bg-subtle);
}
.part-chapter-list .part-ch-num {
  flex-shrink: 0;
  min-width: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-light);
}

/* =============================================
   KB TOPIC NAV (knowledge-base sidebar)
   ============================================= */
.kb-nav-all {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}
.kb-nav-all:hover { color: var(--color-accent); }
.kb-nav-section {
  border-bottom: 1px solid var(--color-border);
}
.kb-nav-section:first-of-type {
  border-top: 1px solid var(--color-border);
}
.kb-nav-section-title {
  display: block;
  padding: 12px 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  list-style: none;
}
.kb-nav-section-title::-webkit-details-marker { display: none; }
.kb-nav-section-title::before {
  content: '+';
  display: inline-block;
  width: 14px;
  color: var(--color-text-light);
  font-family: var(--font-mono);
}
.kb-nav-section[open] > .kb-nav-section-title::before {
  content: '\2212';
}
.kb-nav-list {
  padding-bottom: 8px;
}
.kb-nav-list li { margin: 0; }
.kb-nav-link {
  display: block;
  padding: 6px 0 6px 14px;
  font-size: 0.83rem;
  line-height: 1.4;
  color: var(--color-text-muted);
  border-left: 2px solid transparent;
}
.kb-nav-link:hover {
  color: var(--color-text);
  border-left-color: var(--color-border);
}
.kb-nav-link.is-active {
  color: var(--color-accent);
  border-left-color: var(--color-accent);
  font-weight: 600;
}

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 56px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-bottom: 48px;
}
.footer-col-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-light);
  margin-bottom: 14px;
}
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  transition: color 0.13s;
}
.footer-col ul li a:hover { color: var(--color-text); }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  font-size: 0.8125rem;
  color: var(--color-text-light);
}
.footer-bottom a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 960px) {
  .layout-sidebar {
    grid-template-columns: 1fr;
  }

  /* Sidebar becomes off-canvas */
  .sidebar-area {
    position: fixed !important;
    top: 0;
    right: -100%;
    width: min(var(--sidebar-w), 85vw);
    height: 100vh;
    background: var(--color-bg);
    border-left: 1px solid var(--color-border);
    overflow-y: auto;
    padding: 48px 20px 32px;
    z-index: 200;
    transition: right 0.25s ease;
  }
  .sidebar-area.open {
    right: 0;
  }

  .sidebar-open-btn { display: flex; }
  .sidebar-close-btn { display: flex; }
  .sidebar-overlay.visible { display: block; }
}

@media (max-width: 860px) {
  .nav-inner {
    gap: 16px;
  }
  .nav-mobile-toggle { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex: none;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 12px 32px rgba(43, 46, 45, 0.08);
    padding: 12px 24px 20px;
  }
  .nav-links.open {
    display: block;
  }
  .nav-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .nav-menu > li > a {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    border-radius: 8px;
  }
  .nav-menu > li.current-menu-item > a::after,
  .nav-menu > li.current_page_item > a::after {
    display: none;
  }
  .nav-menu > li.current-menu-item > a,
  .nav-menu > li.current_page_item > a {
    background: var(--color-accent-light);
    color: var(--color-accent-hover);
  }
}

@media (max-width: 640px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}
