/* ─── TOKENS ─────────────────────────────────────────────── */
:root,
[data-theme="dark"] {
  --bg: #0a0c0f;
  --bg-alt: #0f1115;
  --surface: #141720;
  --surface-2: #1c2028;
  --border: #252932;
  --border-2: #1e2230;

  --text: #dde1ea;
  --text-muted: #73798a;
  --text-dim: #454c5e;

  --accent: #c4a46b;
  --accent-dim: rgba(196, 164, 107, 0.10);
  --accent-mid: rgba(196, 164, 107, 0.25);

  --stable: #6ba3c4;
  --stable-dim: rgba(107, 163, 196, 0.12);
  --history: #8a7fc4;
  --history-dim: rgba(138, 127, 196, 0.10);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', 'Fira Mono', monospace;

  --radius: 6px;
  --radius-lg: 10px;
  --nav-h: 76px;
  --nav-bg: rgba(10, 12, 15, 0.85);
  --code-bg: #080a0e;
}

[data-theme="light"] {
  --bg: #fdfdfc;
  --bg-alt: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f0f0ed;
  --border: #e5e5e1;
  --border-2: #d1d1cd;

  --text: #2d2d2a;
  --text-muted: #5e5e5a;
  --text-dim: #8c8c88;

  --accent: #b88846;
  /* slightly darker gold for white bg */
  --accent-dim: rgba(184, 136, 70, 0.10);
  --accent-mid: rgba(184, 136, 70, 0.25);

  --stable: #39799e;
  --stable-dim: rgba(57, 121, 158, 0.10);
  --history: #635a96;
  --history-dim: rgba(99, 90, 150, 0.10);

  --nav-bg: rgba(253, 253, 252, 0.85);
  --code-bg: #f6f6f4;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
}

ul {
  list-style: none;
}

code,
pre {
  font-family: var(--font-mono);
}

/* ─── LAYOUT ─────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1180px;
  padding-inline: 1.5rem;
  margin-inline: auto;
}

.section {
  padding: clamp(5rem, 10vw, 9rem) 0;
}

.section-alt {
  background: var(--bg-alt);
}

/* ─── NAV ────────────────────────────────────────────────── */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

#nav.scrolled {
  border-color: var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  height: 100%;
  width: 100%;
  max-width: 1180px;
  padding-inline: 1.5rem;
  margin-inline: auto;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 1.15rem;
}

.logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.logo-text {
  font-weight: 500;
  letter-spacing: -0.02em;
  font-size: 1.25rem;
}

.nav-menu-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: space-between;
}

.nav-links {
  display: flex;
  gap: 2rem;
  margin-left: 1.5rem;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

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

.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-right: 1rem;
  border-right: 1px solid var(--border);
}

.ctrl-select {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  outline: none;
  transition: 0.2s;
}

.ctrl-select:hover,
.ctrl-select:focus {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.ctrl-select option {
  background: var(--bg);
  color: var(--text);
}

.ctrl-btn {
  display: flex;
  align-items: center;
  margin-left: 0.2rem;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: 0.2s;
}

.ctrl-btn:hover {
  color: var(--accent);
  background: var(--surface);
}

[data-theme="dark"] .moon {
  display: none;
}

[data-theme="light"] .sun {
  display: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: 0.3s;
}

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-2);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--accent);
  color: #0a0c0f;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.88;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* ─── HERO ───────────────────────────────────────────────── */
#hero {
  padding-top: calc(var(--nav-h) + clamp(4rem, 8vw, 7rem));
  padding-bottom: clamp(4rem, 8vw, 7rem);
  position: relative;
  overflow: hidden;
}

#hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 70% 50% at 80% 40%, rgba(196, 164, 107, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 20% 60%, rgba(107, 163, 196, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  width: 100%;
  max-width: 1180px;
  padding-inline: 1.5rem;
  margin-inline: auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(3rem, 6vw, 5.5rem);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1.75rem;
}

.hero-headline em {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  max-width: 44ch;
  line-height: 1.75;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.hero-meta .sep {
  opacity: 0.4;
}

/* Terminal */
.hero-terminal {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  min-width: 0;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.r {
  background: #ff6060;
}

.dot.y {
  background: #e6b53c;
}

.dot.g {
  background: #57c47a;
}

.terminal-title {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.terminal-body {
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.85;
  white-space: pre;
}

.terminal-body .c {
  color: var(--text-dim);
}

.terminal-body .cmd {
  color: var(--accent);
}

.terminal-body .out {
  color: #7f9080;
}

.terminal-body .acc {
  color: var(--accent);
}

.hero-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}

/* ─── SECTION LABELS ─────────────────────────────────────── */
.section-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 3rem;
}

.section-intro {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 65ch;
  margin-bottom: 3rem;
  line-height: 1.8;
}

.section-intro code {
  background: var(--surface);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.85em;
  color: var(--accent);
}

/* ─── PROBLEM ────────────────────────────────────────────── */
.problem-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 3rem;
}

.problem-item {
  padding: 2.5rem;
  border-right: 1px solid var(--border);
  transition: background 0.3s;
}

.problem-item:last-child {
  border-right: none;
}

.problem-item:hover {
  background: var(--surface);
}

.problem-num {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 300;
  color: var(--text-dim);
  line-height: 1;
  margin-bottom: 1rem;
}

.problem-item h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
}

.problem-item p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.problem-statement {
  border-left: 2px solid var(--accent);
  padding: 1.5rem 2rem;
  background: var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.problem-statement p {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text-muted);
}

/* ─── PRINCIPLES ─────────────────────────────────────────── */
.principles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2.5rem;
}

.principle {
  background: var(--bg-alt);
  padding: 2rem 2rem 2rem 1.75rem;
  border-left: 3px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}

.principle:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.principle-rank {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
}

.principle h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
}

.principle p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.75;
}

.priority-chain {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1.25rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.pc-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.pc-chain {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pc-chain span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pc-chain .arr {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ─── ARCH ───────────────────────────────────────────────── */
.arch-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.arch-diagram {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.layer {
  padding: 0.9rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  border-bottom: none;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.layer:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.layer:last-child {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border-bottom: 1px solid var(--border);
}

.layer.layer-core {
  background: var(--accent-dim);
  border-color: var(--accent-mid);
  flex-direction: column;
  gap: 0.5rem;
}

.layer-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.layer-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.layer-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.layer-pipes {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.layer-pipes span {
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--accent-mid);
  border-radius: 100px;
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-dim);
}

.layer-arrow {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 0.2rem 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.arch-callouts {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.callout {
  padding: 1.5rem;
  border-left: 2px solid var(--border);
  padding-left: 1.25rem;
  transition: border-color 0.3s;
}

.callout:hover {
  border-color: var(--accent);
}

.callout h4 {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.callout p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.8;
}

/* ─── DUAL LAYER ─────────────────────────────────────────── */
.dual-layer {
  display: flex;
  gap: 0;
  align-items: stretch;
  margin-bottom: 4rem;
}

.layer-sep {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.5rem;
}

.vs-line {
  flex: 1;
  width: 1px;
  background: var(--border);
}

.vs-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.layer-card {
  flex: 1;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.layer-card.stable {
  background: var(--stable-dim);
  border-color: rgba(107, 163, 196, 0.2);
}

.layer-card.history {
  background: var(--history-dim);
  border-color: rgba(138, 127, 196, 0.2);
}

.lc-header {
  margin-bottom: 1.25rem;
}

.lc-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.stable .lc-badge {
  background: rgba(107, 163, 196, 0.15);
  color: var(--stable);
}

.history .lc-badge {
  background: rgba(138, 127, 196, 0.15);
  color: var(--history);
}

.lc-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.lc-types {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.lc-types span {
  padding: 0.2rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.lc-traits li {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
  padding-left: 1rem;
  position: relative;
}

.lc-traits li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--text-dim);
}

/* Judge chain */
.memory-judge-intro {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
  align-items: center;
  padding: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.mj-text h3 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 300;
  margin-bottom: 0.75rem;
}

.mj-text p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.mj-text em {
  font-style: italic;
  color: var(--text);
}

.mj-chain {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.chain-step {
  flex: 1;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg);
  border-right: none;
}

.chain-step:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.chain-step:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
  border-right: 1px solid var(--border);
}

.chain-arr {
  display: flex;
  align-items: center;
  padding: 0 0.25rem;
  color: var(--text-dim);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.cs-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.cs-label {
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.cs-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─── RECALL FLOW ────────────────────────────────────────── */
.recall-flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 3rem;
}

.rf-step {
  padding: 1.75rem 1.25rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--surface);
  transition: background 0.2s;
}

.rf-step:last-child {
  border-right: none;
}

.rf-step:nth-child(5),
.rf-step:nth-child(6),
.rf-step:nth-child(7),
.rf-step:nth-child(8) {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

.rf-step:hover {
  background: var(--surface-2);
}

.rf-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-dim);
  line-height: 1;
}

.rf-label {
  font-size: 0.875rem;
  font-weight: 500;
}

.rf-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}


.rp-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.rp-label code {
  background: var(--surface);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  color: var(--accent);
  font-size: 0.85em;
}

.rp-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.rp-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  background: var(--surface);
  gap: 1rem;
}

.rp-row:last-child {
  border-bottom: none;
}

.rp-row.header {
  background: var(--surface-2);
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rp-row .mode {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bar-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.bar-cell span {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.bar {
  height: 4px;
  border-radius: 2px;
  min-width: 4px;
}

.bar.stable {
  background: var(--stable);
}

.bar.history {
  background: var(--history);
}

.rp-row .dim {
  color: var(--text-dim);
  font-size: 0.78rem;
}

/* ─── API ────────────────────────────────────────────────── */
.api-layout {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2.5rem;
}

.api-nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  overflow-x: auto;
}

.api-tab {
  padding: 0.9rem 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.api-tab:hover {
  color: var(--text);
}

.api-tab.active {
  color: var(--accent);
  border-color: var(--accent);
}

.api-panels {
  background: var(--surface);
}

.api-panel {
  display: none;
  padding: 2rem;
}

.api-panel.active {
  display: block;
}

.endpoint {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.endpoint.mt {
  margin-top: 2rem;
}

.method {
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.method.get {
  background: rgba(107, 163, 196, 0.12);
  color: #7ab3d0;
}

.method.post {
  background: rgba(107, 196, 130, 0.12);
  color: #7ac49a;
}

.method.patch {
  background: rgba(196, 164, 107, 0.12);
  color: var(--accent);
}

.method.delete {
  background: rgba(196, 107, 107, 0.10);
  color: #c47a7a;
}

.path {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text);
}

.ep-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.8;
  margin-bottom: 0.5rem;
  white-space: pre;
  display: block;
  max-width: 100%;
  box-sizing: border-box;
}

.code-block .c {
  color: var(--text-dim);
}

.code-block .key {
  color: #7ab3d0;
}

.code-block .str {
  color: #a3c27a;
}

.code-block .num {
  color: var(--accent);
}

.code-block .bool {
  color: #c47a7a;
}

.error-codes h4 {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.ec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.ec-item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  flex-wrap: wrap;
}

.ec-item code {
  font-size: 0.75rem;
  color: var(--accent);
  white-space: nowrap;
  background: var(--accent-dim);
  padding: 0.15em 0.5em;
  border-radius: 3px;
}

.ec-item span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ─── DEPLOY ─────────────────────────────────────────────── */
.deploy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.deploy-steps {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.step {
  display: flex;
  gap: 1.5rem;
  padding-bottom: 2.5rem;
  position: relative;
  min-width: 0;
}

.step::before {
  content: '';
  position: absolute;
  left: calc(1.5rem + 1px);
  top: 3rem;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.step:last-child::before {
  display: none;
}

.step-num {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--accent);
  z-index: 1;
}

.step-content {
  padding-top: 0.5rem;
  min-width: 0;
  flex: 1;
}

.step-content h4 {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.deploy-info {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.di-card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  min-width: 0;
}

.di-card h4 {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.di-card ul li {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-left: 1rem;
  position: relative;
  line-height: 1.9;
}

.di-card ul li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.repo-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.repo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.repo-lang {
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.repo-lang.java {
  background: rgba(196, 164, 107, 0.15);
  color: var(--accent);
}

.repo-lang.ts {
  background: rgba(107, 163, 196, 0.15);
  color: var(--stable);
}

.repo-lang.react {
  background: rgba(138, 127, 196, 0.15);
  color: var(--history);
}

.repo-lang.docker {
  background: rgba(107, 196, 180, 0.12);
  color: #7ac4b8;
}

.repo-name {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
}

.repo-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* ─── FOOTER ─────────────────────────────────────────────── */
#footer {
  border-top: 1px solid var(--border);
  padding: 4rem 0 2rem;
  background: var(--bg-alt);
}

.footer-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4rem;
  width: 100%;
  max-width: 1180px;
  padding-inline: 1.5rem;
  margin-inline: auto;
  margin-bottom: 3rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.footer-brand .logo-img {
  height: 80px;
  width: auto;
  object-fit: contain;
}

.footer-name {
  font-size: 1.1rem;
  font-weight: 500;
}

.footer-tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-left: auto;
}

.fl-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.fl-title {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.fl-group a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.fl-group a:hover {
  color: var(--text);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
  width: min(1180px, 100% - 3rem);
  margin-inline: auto;
}

/* ─── ANIMATION ──────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: none;
}

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .arch-layout {
    grid-template-columns: 1fr;
  }

  .deploy-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .dual-layer {
    flex-direction: column;
  }

  .layer-sep {
    flex-direction: row;
    padding: 1rem 0;
  }

  .vs-line {
    flex: 1;
    height: 1px;
    width: auto;
  }

  .memory-judge-intro {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-menu-wrapper {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-inner.open-menu .nav-menu-wrapper {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
    gap: 1.5rem;
    z-index: 99;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  }

  .nav-inner.open-menu .nav-links {
    flex-direction: column;
    align-items: flex-start;
    margin-left: 0;
    width: 100%;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-inner.open-menu .nav-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
    margin-left: 0;
    gap: 0.75rem;
  }

  .problem-grid {
    grid-template-columns: 1fr;
  }

  .problem-item {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .problem-item:last-child {
    border-bottom: none;
  }

  .principles-grid {
    grid-template-columns: 1fr;
  }

  .recall-flow {
    grid-template-columns: repeat(2, 1fr);
  }

  .ec-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-links {
    grid-template-columns: repeat(3, 1fr);
    margin-left: 0;
    gap: 1rem;
  }

  .mj-chain {
    flex-direction: column;
  }

  .chain-step {
    border-right: 1px solid var(--border);
    border-bottom: none;
    border-radius: 0;
  }

  .chain-step:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .chain-step:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .chain-arr {
    justify-content: center;
  }

  .rp-row {
    grid-template-columns: 100px 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .recall-flow {
    grid-template-columns: 1fr;
  }

  .ec-grid {
    grid-template-columns: 1fr;
  }

  .rp-row {
    grid-template-columns: 1fr;
  }

  .rp-row.header {
    display: none;
  }
}