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

:root {
  --bg: #0f1117;
  --surface: #181c27;
  --surface-alt: #1e2235;
  --border: #2a2f45;
  --accent: #4f8ef7;
  --accent-soft: rgba(79, 142, 247, 0.12);
  --warn: #e8a44a;
  --warn-soft: rgba(232, 164, 74, 0.1);
  --text: #d8dce8;
  --text-muted: #7a8099;
  --text-dim: #4a5070;
  --code-bg: #141720;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  padding: 3rem 1.5rem 6rem;
}

article {
  max-width: 720px;
  margin: 0 auto;
}

/* ── Header ── */

.post-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 2.5rem;
  margin-bottom: 3rem;
}

.post-tag {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  color: #eef0f8;
  margin-bottom: 1rem;
}

.post-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ── Sections ── */

section {
  margin-bottom: 3rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #eef0f8;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

p {
  margin-bottom: 1rem;
  color: var(--text);
}

p:last-child {
  margin-bottom: 0;
}

ul, ol {
  padding-left: 1.4rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
}

li strong {
  color: #eef0f8;
}

/* ── Post figure ── */

.post-figure {
  margin: 0 0 3rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.post-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.post-figure.half {
  width: 50%;
  margin-left: auto;
  margin-right: auto;
}

.post-figure.half img {
  width: 100%;
}

/* ── Architecture diagram ── */

.arch-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.arch-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  width: 100%;
  max-width: 340px;
}

.arch-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
}

.arch-sublabel {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.2rem;
  line-height: 1.3;
}

.arch-arrow {
  color: var(--text-dim);
  font-size: 1.2rem;
  transform: rotate(90deg);
}

/* ── Code blocks ── */

.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 1.25rem 0;
}

.code-label {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.45rem 1rem;
  letter-spacing: 0.03em;
}

pre {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  padding: 1rem;
  overflow-x: auto;
  color: #b8c0d8;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-alt);
  color: #a3d4ff;
  padding: 0.15em 0.45em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ── Callout (drive failure) ── */

.callout {
  background: var(--warn-soft);
  border: 1px solid rgba(232, 164, 74, 0.25);
  border-radius: 10px;
  padding: 1.75rem;
}

.callout h2 {
  color: var(--warn);
  border-bottom-color: rgba(232, 164, 74, 0.2);
}

.recovery-note {
  margin-top: 1.25rem;
  padding: 0.9rem 1.1rem;
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--warn);
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
  color: #c8ccd8;
  font-style: italic;
}

/* ── Takeaways list ── */

.takeaways {
  list-style: none;
  padding-left: 0;
}

.takeaways li {
  padding: 0.55rem 0.75rem 0.55rem 2rem;
  position: relative;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.takeaways li:last-child {
  border-bottom: none;
}

.takeaways li::before {
  content: "→";
  position: absolute;
  left: 0.4rem;
  color: var(--accent);
  font-weight: 600;
}

/* ── Responsive ── */

@media (max-width: 600px) {
  .arch-node {
    max-width: unset;
  }
}
