/* Standalone stylesheet for the static blog pages (/blog, /blog/<slug>).
   Kept in public/ so pages can link an unhashed URL; mirrors the SPA landing
   design system in src/style.css: same type-scale tokens, header/topbar,
   card idioms, and footer, so the pages read as one site. */
:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #0d1117;
  color: #e6edf3;

  /* Landing type scale (src/style.css .landing). Every font-size on these
     pages maps to one of these steps. */
  --text-fine: 13px;
  --text-small: 14px;
  --text-body: 16px;
  --text-lede: 18px;
  --text-h3: 18px;
  --text-h2: clamp(26px, 3vw, 32px);
  --text-h1: clamp(36px, 5vw, 54px);
  /* One vertical rhythm + one card padding, as on the landing. */
  --gap-section: 96px;
  --card-pad: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: var(--text-body);
}

main {
  flex: 1;
}

a {
  color: #58a6ff;
}

:focus-visible {
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* ---- Header: same topbar idiom as the landing ---- */

.topbar {
  border-bottom: 1px solid #21262d;
}

.topbar-rail {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  font-weight: 700;
  color: #e6edf3;
  text-decoration: none;
  /* Lifts the header touch target to >= 24px. */
  padding: 4px 0;
}

.brand:hover {
  color: #58a6ff;
}

.brand-mark {
  font-family: ui-monospace, monospace;
  color: #3fb950;
  margin-right: 2px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.spacer {
  flex: 1;
}

.nav-link {
  color: #e6edf3;
  text-decoration: none;
  padding: 6px 0;
  font-size: var(--text-body);
}

.nav-link:hover {
  color: #58a6ff;
}

/* Same button idiom as the SPA (src/style.css). */
.button {
  font: inherit;
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: #30363d;
}

.button.primary {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

.button.primary:hover {
  background: #388bfd;
}

/* ---- Blog index: band-style title block + the landing's blog-card grid ---- */

.blog-index {
  padding-top: 40px;
  padding-bottom: 24px;
}

.blog-index h1 {
  font-size: var(--text-h1);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  text-wrap: balance;
}

.band-sub {
  margin: 0;
  font-size: var(--text-lede);
  line-height: 1.6;
  color: #8b949e;
  max-width: 56ch;
}

/* Sections after the page head share the landing band rhythm:
   hairline divider, then breathing room. */

.band {
  margin-top: 56px;
  border-top: 1px solid #21262d;
  padding-top: 40px;
}

.band h2 {
  font-size: var(--text-h2);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

/* A card grid that opens a band sits right under the divider. */
.band .cards:first-child {
  margin-top: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: var(--card-pad);
}

.card h3 {
  margin: 0 0 8px;
  font-size: var(--text-h3);
}

.card p {
  margin: 0;
  font-size: var(--text-body);
  line-height: 1.6;
  color: #8b949e;
}

.card-link {
  color: inherit;
  text-decoration: none;
}

.card-link:hover {
  border-color: #58a6ff;
}

.card-link h3 {
  color: #58a6ff;
}

.card-meta {
  display: block;
  margin-top: 12px;
  font-size: var(--text-fine);
  color: #8b949e;
}

/* ---- Post pages: 760px reading column inside the same shell ---- */

.post {
  max-width: 760px;
  margin: 0 auto;
  padding-top: 40px;
  padding-bottom: 24px;
}

.post h1 {
  font-size: var(--text-h1);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  text-wrap: balance;
}

.post-meta {
  margin: 0 0 32px;
  color: #8b949e;
  font-size: var(--text-small);
}

.prose {
  line-height: 1.7;
  font-size: var(--text-body);
}

.prose h2 {
  font-size: var(--text-h2);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 44px 0 14px;
}

.prose h3 {
  font-size: var(--text-h3);
  margin: 32px 0 10px;
}

.prose p {
  margin: 0 0 16px;
}

.prose ul,
.prose ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.prose li {
  margin-bottom: 6px;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: #30363d;
}

.prose a:hover {
  text-decoration-color: #58a6ff;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-small);
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 1px 5px;
}

.prose pre {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.6;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--text-small);
}

.prose blockquote {
  margin: 0 0 16px;
  padding: 2px 18px;
  border-left: 3px solid #30363d;
  color: #8b949e;
}

.prose img {
  max-width: 100%;
  border-radius: 6px;
}

.prose hr {
  border: none;
  border-top: 1px solid #21262d;
  margin: 36px 0;
}

.post-cta {
  margin-top: 44px;
  border: 1px solid #30363d;
  background: #161b22;
  border-radius: 6px;
  padding: var(--card-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.post-cta p {
  margin: 4px 0 0;
  color: #8b949e;
  font-size: var(--text-body);
}

.post-cta .button {
  flex-shrink: 0;
}

/* Keep reading is a .band in the markup: divider, heading, then cards. */

/* ---- Footer: same row as the landing footer ---- */

.landing-footer {
  margin-top: var(--gap-section);
  border-top: 1px solid #21262d;
}

.footer-row {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: var(--text-fine);
  color: #8b949e;
}

.footer-nav {
  margin-left: auto;
  display: flex;
  gap: 16px;
  /* Break between links, never inside a label ("How it / works"). */
  flex-wrap: wrap;
  row-gap: 2px;
}

.footer-nav a {
  color: #8b949e;
  padding: 6px 0;
  display: inline-block;
  white-space: nowrap;
}

.footer-nav a:hover {
  color: #58a6ff;
}

.foot-brand {
  font-weight: 700;
  font-size: var(--text-small);
  color: #e6edf3;
}

@media (max-width: 900px) {
  :root {
    --gap-section: 56px;
  }

  .band {
    margin-top: 32px;
    padding-top: 24px;
  }
}

@media (max-width: 640px) {
  .post {
    padding-top: 28px;
  }

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

  /* Wrap the nav onto a second row instead of hiding it, as on the landing. */
  .topbar-rail {
    flex-wrap: wrap;
    row-gap: 0;
  }

  .site-nav {
    order: 3;
    width: 100%;
    padding-bottom: 4px;
    gap: 18px;
    flex-wrap: wrap;
    row-gap: 2px;
  }

  /* Tap targets: keep nav rows ~44px tall on touch screens. */
  .nav-link {
    padding: 12px 0;
  }

  .footer-nav a {
    padding: 12px 0;
    /* Keep link rows >= 40px tall on touch screens. */
    line-height: 1.4;
  }

  .post-cta {
    flex-direction: column;
    align-items: flex-start;
  }
}
