/* Blog pages — self-contained. index.html keeps its own inline CSS and the
   Material components; article pages load nothing but this file, so the
   Django palette is redeclared here rather than shared. */

:root {
  color-scheme: light dark;
  --content-w: 720px;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
}

html.light {
  --primary: #0c4b33;
  --on-primary: #ffffff;
  --primary-container: #0c4b33;
  --on-primary-container: #dcf2e6;
  --secondary-container: #cfe8da;
  --on-secondary-container: #0c4b33;
  --background: #f2f9f5;
  --surface-lowest: #ffffff;
  --surface-high: #dcece2;
  --on-background: #14201a;
  --on-surface-variant: #44564d;
  --outline-variant: #c3dbcf;
  --code-bg: #10231c;
  --code-fg: #e7f0ea;
  --code-accent: #6fd0a6;
  --code-border: transparent;
}

html.dark {
  --primary: #44b78b;
  --on-primary: #04281b;
  --primary-container: #0c4b33;
  --on-primary-container: #cbeedd;
  --secondary-container: #131c18;
  --on-secondary-container: #cbeedd;
  --background: #0b120f;
  --surface-lowest: #070d0b;
  --surface-high: #1a241f;
  --on-background: #e6eee9;
  --on-surface-variant: #b1c2b9;
  --outline-variant: #2b3a33;
  --code-bg: #070d0b;
  --code-fg: #e6eee9;
  --code-accent: #44b78b;
  --code-border: #2b3a33;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Roboto', system-ui, -apple-system, sans-serif;
  background: var(--background);
  color: var(--on-background);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }

/* ---------- header ---------- */
header.bar {
  /* djangoproject.com header green, in both themes */
  background: #0c4b33;
  color: #ffffff;
}
.bar-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #ffffff;
  text-decoration: none;
}
.brand .leaf { font-size: 1.4rem; line-height: 1; }
.bar-actions { display: flex; align-items: center; gap: 0.9rem; }
.bar-link {
  color: #a3e0c4;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.bar-link:hover { color: #ffffff; text-decoration: underline; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #cfeade;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.14); color: #ffffff; }
.icon-btn svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }
html.light .icon-btn .i-sun, html.dark .icon-btn .i-moon { display: none; }

/* ---------- layout ---------- */
main, footer {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

.kicker {
  font: 500 0.75rem/1.5 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 0.75rem;
}
.kicker a { color: inherit; text-decoration: none; }
.kicker a:hover { text-decoration: underline; }

h1 {
  font-size: clamp(1.75rem, 4.5vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
h2 {
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  margin: 2.25rem 0 0.75rem;
}
p { margin: 0 0 1.1rem; }
.lede { font-size: 1.15rem; color: var(--on-surface-variant); }

ul, ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
li { margin-bottom: 0.35rem; }

code {
  font: 400 0.875em/1.5 var(--mono);
  background: var(--surface-high);
  border-radius: 0.25rem;
  padding: 0.1em 0.35em;
}

pre {
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--code-border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font: 400 0.85rem/1.7 var(--mono);
  margin: 0 0 1.25rem;
}
pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
pre .c { color: var(--code-accent); }

/* ---------- the "what breaks" callout ---------- */
.gotcha {
  border-left: 3px solid var(--primary);
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  border-radius: 0 0.75rem 0.75rem 0;
  padding: 1.1rem 1.35rem;
  margin: 0 0 1.25rem;
}
.gotcha p:last-child { margin-bottom: 0; }
.gotcha strong { font-weight: 600; }

/* ---------- closing CTA ---------- */
.cta {
  background: var(--primary-container);
  color: var(--on-primary-container);
  border-radius: 1rem;
  padding: 1.5rem 1.75rem;
  margin-top: 2.5rem;
}
.cta p { margin-bottom: 0.75rem; }
.cta p:last-child { margin-bottom: 0; }
.cta a { color: inherit; text-decoration: underline; }
.cta pre {
  background: rgba(0, 0, 0, 0.28);
  border: 0;
  color: inherit;
  margin: 0 0 0.9rem;
  font-size: 0.8rem;
}

.meta { font-size: 0.85rem; color: var(--on-surface-variant); margin-bottom: 2rem; }

/* ---------- article index ---------- */
.group { margin-bottom: 2.5rem; }
.group h2 { margin-top: 0; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  border-top: 1px solid var(--outline-variant);
  padding: 1rem 0;
  margin: 0;
}
.post-list a {
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
}
.post-list a:hover { text-decoration: underline; }
.post-list p {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  color: var(--on-surface-variant);
}
footer {
  border-top: 1px solid var(--outline-variant);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--on-surface-variant);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}
