/* ==========================================================================
   Static Blog — single-file stylesheet
   No external resources, no imports, system fonts only.
   Palette: bg #fbfaf7 · fg #1f1d1a · accent #1d6f56 · muted #6b6862 · card #fff
   ========================================================================== */

/* --- Design tokens ------------------------------------------------------- */
:root {
  --bg: #fbfaf7;
  --fg: #1f1d1a;
  --accent: #1d6f56;
  --accent-strong: #18583f;
  --muted: #6b6862;
  --card: #ffffff;
  --border: #e7e3da;
  --border-soft: #efece4;
  --code-bg: #f4f2ec;
  --selection: rgba(29, 111, 86, 0.16);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --measure: 720px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(31, 29, 26, 0.04),
    0 4px 16px rgba(31, 29, 26, 0.05);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
}

/* --- Reset / base -------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-feature-settings: "kern", "liga", "clig", "calt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection {
  background: var(--selection);
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* --- Layout container ---------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

/* --- Links --------------------------------------------------------------- */
a {
  color: var(--accent);
  text-decoration: none;
  text-decoration-color: rgba(29, 111, 86, 0.35);
  text-underline-offset: 0.18em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- Header / nav -------------------------------------------------------- */
.site-header {
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(8px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  min-height: 4rem;
  flex-wrap: wrap;
}

.site-title {
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
  white-space: nowrap;
}

.site-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav a:hover {
  color: var(--fg);
  background-color: var(--border-soft);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

/* --- Main wrapper -------------------------------------------------------- */
main {
  flex: 1 0 auto;
  padding-block: var(--space-12);
}

/* --- Post list ----------------------------------------------------------- */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.post-list > li {
  margin: 0;
}

.post-list article,
.post-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.post-list article:hover,
.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(31, 29, 26, 0.05),
    0 10px 28px rgba(31, 29, 26, 0.08);
  border-color: #ddd8cd;
}

.post-list h2,
.post-card h2 {
  margin: 0 0 var(--space-2);
  font-size: 1.375rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.post-list h2 a {
  color: var(--fg);
}

.post-list h2 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
  font-size: 0.875rem;
  color: var(--muted);
}

.post-meta time {
  font-variant-numeric: tabular-nums;
}

.post-excerpt {
  margin: 0;
  color: var(--muted);
}

.read-more {
  display: inline-block;
  margin-top: var(--space-4);
  font-size: 0.9375rem;
  font-weight: 600;
}

.read-more::after {
  content: " →";
  transition: margin-left 0.15s ease;
}

.read-more:hover::after {
  margin-left: 0.15em;
}

/* Tags / badges */
.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent-strong);
  background-color: rgba(29, 111, 86, 0.08);
  padding: 0.15em 0.6em;
  border-radius: 999px;
}

/* --- Article ------------------------------------------------------------- */
article {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-header {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  margin: 0 0 var(--space-3);
  font-size: clamp(1.75rem, 4vw + 1rem, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}

/* Headings inside body copy */
article h2 {
  margin: var(--space-12) 0 var(--space-4);
  font-size: 1.625rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 700;
}

article h3 {
  margin: var(--space-8) 0 var(--space-3);
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 650;
}

article h2 + h3 {
  margin-top: var(--space-4);
}

/* Body text */
article p {
  margin: 0 0 var(--space-6);
}

article > :first-child {
  margin-top: 0;
}

/* Lists */
article ul,
article ol {
  margin: 0 0 var(--space-6);
  padding-left: 1.5em;
}

article li {
  margin-bottom: var(--space-2);
}

article li::marker {
  color: var(--accent);
}

article ul ul,
article ol ol,
article ul ol,
article ol ul {
  margin-top: var(--space-2);
  margin-bottom: 0;
}

/* Blockquote */
article blockquote {
  margin: var(--space-8) 0;
  padding: var(--space-2) var(--space-6);
  border-left: 4px solid var(--accent);
  background-color: var(--card);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
  font-style: italic;
}

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

article blockquote cite {
  display: block;
  margin-top: var(--space-3);
  font-style: normal;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
}

/* Inline code */
code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

:not(pre) > code {
  background-color: var(--code-bg);
  color: var(--accent-strong);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  white-space: nowrap;
}

/* Code blocks */
pre {
  margin: var(--space-8) 0;
  padding: var(--space-4) var(--space-6);
  background-color: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.6;
  font-size: 0.9375rem;
  -webkit-overflow-scrolling: touch;
  tab-size: 2;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--fg);
  font-size: 0.875rem;
  white-space: pre;
}

/* Horizontal rule */
hr {
  margin: var(--space-12) 0;
  border: 0;
  height: 1px;
  background-color: var(--border);
}

/* Tables */
article table {
  width: 100%;
  margin: var(--space-8) 0;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

article th,
article td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

article th {
  font-weight: 650;
  color: var(--fg);
  border-bottom: 2px solid var(--border);
}

article tbody tr:hover {
  background-color: var(--border-soft);
}

/* Figures / images */
article figure {
  margin: var(--space-8) 0;
}

article img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

article figcaption {
  margin-top: var(--space-3);
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
}

/* --- Footer -------------------------------------------------------------- */
.site-footer {
  flex-shrink: 0;
  margin-top: var(--space-12);
  border-top: 1px solid var(--border);
  background-color: var(--card);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer .container {
  padding-block: var(--space-8);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--accent);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

/* --- Utilities ----------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -3rem;
  background: var(--accent);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 100;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: var(--space-4);
}

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 640px) {
  body {
    font-size: 1rem;
    line-height: 1.65;
  }

  .container {
    padding-inline: var(--space-4);
  }

  main {
    padding-block: var(--space-8);
  }

  .site-header .container {
    min-height: auto;
    padding-block: var(--space-3);
  }

  .post-list article,
  .post-card {
    padding: var(--space-4);
  }

  article h2 {
    margin-top: var(--space-8);
  }

  pre {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
  }
}

/* --- Optional dark mode -------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1815;
    --fg: #ece9e2;
    --accent: #4fb892;
    --accent-strong: #6fc9a6;
    --muted: #a39e94;
    --card: #232019;
    --border: #36322a;
    --border-soft: #2c2922;
    --code-bg: #26231c;
    --selection: rgba(79, 184, 146, 0.22);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3),
      0 4px 16px rgba(0, 0, 0, 0.35);
  }

  body {
    -webkit-font-smoothing: antialiased;
  }

  a {
    text-decoration-color: rgba(79, 184, 146, 0.4);
  }

  :not(pre) > code {
    color: var(--accent-strong);
  }

  .tag {
    color: var(--accent-strong);
    background-color: rgba(79, 184, 146, 0.14);
  }

  .post-list article:hover,
  .post-card:hover {
    border-color: #454036;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3),
      0 10px 28px rgba(0, 0, 0, 0.45);
  }

  article img {
    opacity: 0.92;
  }

  .skip-link {
    color: #14130f;
  }
}