:root {
  --ink: #1d2522;
  --muted: #5c655e;
  --forest: #315846;
  --forest-deep: #203d31;
  --water: #1f5c68;
  --moss: #6b7138;
  --paper: #f1efe6;
  --paper-raised: #faf8ef;
  --line: #b8b6aa;
  --clay: #a9462c;
  --focus: #e6b03d;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --max: 74rem;
  --measure: 43rem;
  --radius: 0.35rem;
  --shadow: 0 1rem 2.5rem rgba(25, 37, 31, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(29, 37, 34, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 37, 34, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font: 1rem / 1.62 var(--sans);
}

button,
input,
textarea { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover { color: var(--water); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 0.75rem;
  left: 0.75rem;
  transform: translateY(-180%);
  padding: 0.55rem 0.75rem;
  color: #fff;
  background: var(--forest-deep);
  font: 0.78rem var(--mono);
}

.skip-link:focus { transform: translateY(0); }

.shell {
  width: min(calc(100% - 2.5rem), var(--max));
  margin-inline: auto;
}

.masthead nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px dashed var(--line);
  font: 0.78rem var(--mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.masthead a {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  text-decoration: none;
}

.masthead .nav-links a { padding-inline: 0.12rem; }

.masthead .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem 0.65rem;
}

.masthead [aria-current="page"] {
  color: var(--forest);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: var(--moss);
  text-underline-offset: 0.32em;
}

.wordmark {
  color: var(--forest);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.blog-hero {
  max-width: 55rem;
  padding: clamp(4rem, 9vw, 7.75rem) 0 clamp(2.5rem, 5vw, 4rem);
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--water);
  font: 0.76rem var(--mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
}

h1 {
  max-width: 14ch;
  margin-bottom: 1.3rem;
  font-size: clamp(3rem, 7.3vw, 6.5rem);
}

h2 { font-size: clamp(2rem, 4vw, 3rem); }

.lede {
  max-width: var(--measure);
  margin: 0;
  font-size: clamp(1.12rem, 1.7vw, 1.35rem);
}

.boundary,
.comment-note {
  max-width: 50rem;
  margin: 1.5rem 0 0;
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--clay);
  background: rgba(255, 255, 255, 0.48);
  box-shadow: inset 0 0 0 1px rgba(184, 182, 170, 0.45);
}

.is-empty .blog-hero { padding-bottom: 2.5rem; }

.tools {
  padding: 1.4rem 0 2.25rem;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.tools[hidden] { display: none; }

.control-group + .control-group { margin-top: 1rem; }

label,
.control-label {
  display: block;
  margin-bottom: 0.5rem;
  font: 0.78rem var(--mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  padding: 0.78rem 0.9rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

input::placeholder,
textarea::placeholder { color: #687068; }

textarea {
  min-height: 10rem;
  resize: vertical;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.filter,
button {
  min-height: 2.7rem;
  border: 1px solid var(--forest);
  border-radius: var(--radius);
  background: transparent;
  color: var(--forest-deep);
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  font: 0.76rem / 1.15 var(--mono);
  letter-spacing: 0.03em;
}

.filter:hover { border-color: var(--water); color: var(--water); }

.filter[aria-pressed="true"],
button[type="submit"] {
  border-color: var(--forest);
  background: var(--forest);
  color: #fff;
}

.filters-tags .filter { border-style: dashed; }

button[type="submit"]:hover { background: var(--forest-deep); }

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 3rem 0 1.1rem;
}

.count {
  margin: 0;
  color: var(--water);
  font: 0.75rem var(--mono);
}

.post-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.post-card,
.empty {
  background: var(--paper);
  padding: clamp(1.35rem, 3vw, 2rem);
}

.post-card {
  display: flex;
  min-height: 19rem;
  flex-direction: column;
  gap: 0.9rem;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.post-card:hover {
  position: relative;
  z-index: 1;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}

.post-card h3 { font-size: clamp(1.65rem, 2.5vw, 2.25rem); }
.post-card h3 a { text-decoration: none; }

.post-meta {
  margin: 0;
  color: var(--water);
  font: 0.74rem / 1.4 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.post-summary { margin: 0; max-width: 44rem; }

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
}

.tag {
  color: var(--forest);
  font: 0.72rem var(--mono);
  text-decoration: underline;
  text-decoration-color: var(--moss);
  text-underline-offset: 0.25em;
}

.article-header .post-meta a { white-space: nowrap; }

.empty {
  max-width: 50rem;
  margin: 2rem 0;
  border: 1px solid var(--line);
  box-shadow: 0 0.75rem 1.8rem rgba(25, 37, 31, 0.04);
}

.empty h3 { font-size: 1.7rem; }
.empty p:last-child { margin-bottom: 0; }

.post-list > .empty {
  grid-column: 1 / -1;
  margin: 0;
  border: 0;
  box-shadow: none;
}

.article-shell {
  width: min(calc(100% - 2.5rem), 54rem);
  padding: clamp(3.5rem, 8vw, 6rem) 0;
}

.article-header {
  max-width: var(--measure);
  margin-bottom: 2.2rem;
  padding-bottom: 2.2rem;
  border-bottom: 1px solid var(--ink);
}

.article-header h1 {
  max-width: 17ch;
  font-size: clamp(2.8rem, 6vw, 5.2rem);
}

.article-body {
  max-width: var(--measure);
  font-size: clamp(1.05rem, 1.5vw, 1.14rem);
}

.article-body > * + * { margin-top: 1.2rem; }
.article-body h2 { margin-top: 3.2rem; font-size: clamp(1.8rem, 3vw, 2.4rem); }
.article-body h3 { margin-top: 2.4rem; font-size: 1.55rem; }
.article-body ul { padding-left: 1.25rem; }
.article-body li + li { margin-top: 0.45rem; }

.article-body blockquote {
  margin: 1.8rem 0;
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--water);
  color: #31413b;
}

.article-body code {
  border-radius: 0.2rem;
  background: #e6e4da;
  padding: 0.1rem 0.25rem;
  font: 0.9em var(--mono);
}

.comments {
  max-width: var(--measure);
  margin-top: 4.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ink);
}

.comment-list { display: grid; gap: 0.8rem; }

.comment {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.48);
}

.comment p { margin: 0; }
.comment-author { margin-bottom: 0.4rem !important; color: var(--water); font: 0.76rem var(--mono); }

.comment-form {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.5rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.48);
}

.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

#comment-status[data-state="error"] { color: #8a321d; }
#comment-status[data-state="ready"] { color: var(--forest); }

footer {
  padding: 2rem 0 3rem;
  color: var(--muted);
  font: 0.78rem / 1.65 var(--mono);
}

@media (max-width: 650px) {
  .shell,
  .article-shell { width: min(calc(100% - 1.5rem), var(--max)); }

  .masthead nav,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .masthead .nav-links { justify-content: flex-start; }
  .blog-hero { padding-top: 3.5rem; }
  h1 { font-size: clamp(2.75rem, 15vw, 4.25rem); line-height: 0.98; }
  .section-head { padding-top: 2.5rem; }
  .post-list { grid-template-columns: 1fr; }
  .post-card { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .post-card { transition: none; }
}
