/**
 * Blog surfaces: the writing index and the post pages.
 *
 * Shares the landing page's system — Times for prose, Arial Black for display,
 * black/white with yellow and green as the only accents — so the blog reads as
 * part of the site rather than a bolted-on subdomain.
 */

:root {
  --white: #fff;
  --black: #000;
  --link: #0000e7;
  --yellow: #ffef00;
  --green: #00d16f;
  --rule: #000;
  --muted: #444;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 300px;
  scroll-behavior: smooth;
}

body.blog-body {
  min-width: 300px;
  margin: 0;
  background:
    linear-gradient(90deg, transparent calc(100% - 22px), var(--yellow) calc(100% - 22px) calc(100% - 16px), transparent calc(100% - 16px)),
    var(--white);
  color: var(--black);
  font-family: "Times New Roman", Times, serif;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  background: var(--yellow);
  color: var(--black);
}

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

button {
  font: inherit;
}

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

::selection {
  background: var(--yellow);
  color: var(--black);
}

.visually-hidden {
  position: absolute;
  overflow: hidden;
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 10px;
  padding: 8px;
  transform: translateY(-180%);
  background: var(--black);
  color: var(--white);
  font: 12px/1 "Courier New", monospace;
}

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

.blog-page {
  width: min(100% - 52px, 1080px);
  margin: 0 auto;
  padding: 20px 0 70px;
  font-size: 18px;
  line-height: 1.35;
}

.blog-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  margin-bottom: 62px;
  font: 12px/1.45 "Courier New", monospace;
}

/* ---------- index ---------- */

.blog-masthead h1 {
  margin: 0;
  font: 900 clamp(4.5rem, 13vw, 11rem)/0.7 Arial, Helvetica, sans-serif;
  letter-spacing: -0.09em;
}

.blog-masthead__lead {
  max-width: 52ch;
  margin: 26px 0 10px;
  font-size: clamp(1.3rem, 2.4vw, 2rem);
  line-height: 1.15;
}

.blog-masthead__note {
  margin: 0 0 58px;
  font: 13px/1.45 "Courier New", monospace;
}

.post-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--rule);
}

.post-filter__search input {
  width: min(38vw, 260px);
  padding: 6px 8px;
  border: 1px solid var(--black);
  background: var(--white);
  color: var(--black);
  font: 12px/1.3 "Courier New", monospace;
}

.post-filter__search input::placeholder {
  color: var(--muted);
}

.post-filter__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.post-filter__tags button {
  padding: 4px 8px;
  border: 1px solid var(--black);
  background: var(--white);
  color: var(--black);
  cursor: pointer;
  font: 11px/1.2 "Courier New", monospace;
  text-transform: lowercase;
}

.post-filter__tags button:hover {
  background: var(--yellow);
}

.post-filter__tags button.is-active {
  background: var(--black);
  color: var(--white);
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list__entry {
  display: grid;
  grid-template-columns: 118px minmax(220px, 0.85fr) 1fr;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px dotted var(--rule);
}

.post-list__entry:first-child {
  border-top: 1px dotted var(--rule);
}

.post-list__entry[hidden] {
  display: none;
}

.post-list__date,
.post-list__summary,
.post-list__stats,
.post-list h3 {
  margin: 0;
}

.post-list__date {
  font: 11px/1.9 "Courier New", monospace;
}

.post-list h3 {
  font: 700 clamp(1.15rem, 2.1vw, 1.6rem)/1.1 Arial, Helvetica, sans-serif;
  letter-spacing: -0.02em;
}

.post-list h3::before {
  color: var(--green);
  content: "→ ";
}

.post-list h3 a {
  color: var(--link);
  text-decoration: none;
}

.post-list h3 a:hover {
  text-decoration: underline;
}

.post-list__summary {
  font-size: 15px;
}

.post-list__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  font: 11px/1.4 "Courier New", monospace;
}

.post-list__tags,
.post-header__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list__tags li,
.post-header__tags li {
  padding: 1px 5px;
  background: var(--yellow);
  font: 10px/1.5 "Courier New", monospace;
}

.post-list__empty {
  padding: 26px 0;
  font: 13px/1.5 "Courier New", monospace;
}

.post-list__empty button {
  border: 0;
  background: none;
  color: var(--link);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

/* ---------- post ---------- */

/* A post keeps the same rail as the index and the front door, so the nav does
   not jump inward when you open one. Only the prose narrows to a readable
   measure. */
.blog-page--post {
  width: min(100% - 52px, 1080px);
}

.blog-page--post > *:not(.blog-nav) {
  width: min(100%, 820px);
  margin-left: auto;
  margin-right: auto;
}

.post-header {
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 4px solid var(--rule);
}

.post-header__meta {
  display: inline-block;
  margin: 0 0 18px;
  padding: 3px 6px;
  background: var(--yellow);
  font: 700 11px/1.2 "Courier New", monospace;
  text-transform: lowercase;
}

.post-header h1 {
  margin: 0;
  font: 900 clamp(2.4rem, 7vw, 4.6rem)/0.92 Arial, Helvetica, sans-serif;
  letter-spacing: -0.05em;
  overflow-wrap: break-word;
}

.post-header__summary {
  max-width: 54ch;
  margin: 22px 0 0;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.3;
  color: var(--muted);
}

.post-header__tags {
  margin-top: 18px;
}

.post-legacy {
  margin: 18px 0 0;
  font: 11px/1.5 "Courier New", monospace;
  color: var(--muted);
}

.post-cover {
  margin: 0 0 40px;
}

.post-cover img {
  display: block;
  width: 100%;
  border: 1px solid var(--black);
}

.post-outline {
  margin-bottom: 40px;
  padding: 14px 16px;
  border: 1px solid var(--black);
  background: #fafafa;
}

.post-outline__title {
  margin: 0 0 8px;
  font: 700 11px/1.2 "Courier New", monospace;
  text-transform: lowercase;
}

.post-outline ol {
  margin: 0;
  padding-left: 1.4em;
  font: 13px/1.7 "Courier New", monospace;
}

.post-body {
  font-size: 19px;
  line-height: 1.55;
}

.post-body > :first-child {
  margin-top: 0;
}

.post-body p {
  margin: 0 0 1.15em;
  overflow-wrap: break-word;
}

.post-body h2,
.post-body h3,
.post-body h4 {
  margin: 1.9em 0 0.55em;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.post-body h2 {
  display: inline-block;
  padding: 2px 7px 4px;
  background: var(--black);
  color: var(--white);
  font-size: clamp(1.5rem, 3.4vw, 2.3rem);
  font-weight: 800;
}

.post-body h3 {
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  font-weight: 700;
}

.post-body h4 {
  font-size: 1.1rem;
  font-weight: 700;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.15em;
  padding-left: 1.5em;
}

.post-body li {
  margin: 0.3em 0;
}

.post-body blockquote {
  margin: 1.6em 0;
  padding: 4px 0 4px 22px;
  border-left: 5px solid var(--black);
  font-size: 1.05em;
  font-style: italic;
}

.post-body blockquote p:last-child {
  margin-bottom: 0;
}

.post-body figure {
  margin: 2em 0;
}

.post-body img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--black);
  background: #f2f2f2;
}

.post-body figcaption {
  margin-top: 5px;
  font: 11px/1.4 "Courier New", monospace;
  color: var(--muted);
}

.post-body a {
  overflow-wrap: anywhere;
}

.post-body code {
  padding: 1px 4px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  font: 0.85em/1.4 "Courier New", monospace;
}

.post-body pre {
  overflow-x: auto;
  margin: 1.6em 0;
  padding: 14px 16px;
  border: 1px solid var(--black);
  background: #fafafa;
}

.post-body pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  line-height: 1.5;
}

.post-body hr {
  height: 3px;
  margin: 2.4em 0;
  border: 0;
  background: var(--black);
}

.post-body table {
  width: 100%;
  margin: 1.6em 0;
  border-collapse: collapse;
  font-size: 0.9em;
}

.post-body th,
.post-body td {
  padding: 7px 9px;
  border: 1px solid var(--black);
  text-align: left;
}

.post-body th {
  background: var(--yellow);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.85em;
  text-transform: lowercase;
}

.post-neighbours {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 60px;
  padding-top: 20px;
  border-top: 3px solid var(--rule);
}

.post-neighbours__link {
  font: 700 15px/1.25 Arial, Helvetica, sans-serif;
  text-decoration: none;
}

.post-neighbours__link:hover {
  text-decoration: underline;
}

.post-neighbours__link--older {
  text-align: right;
}

.post-neighbours__link span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font: 10px/1.2 "Courier New", monospace;
  text-transform: lowercase;
}

.post-back {
  margin: 30px 0 0;
  font: 13px/1.5 "Courier New", monospace;
}

/* ---------- footer ---------- */

.blog-footer {
  margin-top: 90px;
  padding: 20px 0;
  border-top: 8px double var(--rule);
}

.blog-footer__statement {
  max-width: 40ch;
  margin: 0 0 14px;
  font: 700 clamp(1.5rem, 3.4vw, 2.6rem)/1 Arial, Helvetica, sans-serif;
  letter-spacing: -0.045em;
}

.blog-footer p:last-child {
  margin: 0;
  font: 13px/1.7 "Courier New", monospace;
}

@media (max-width: 760px) {
  body.blog-body {
    background:
      linear-gradient(90deg, transparent calc(100% - 13px), var(--yellow) calc(100% - 13px) calc(100% - 8px), transparent calc(100% - 8px)),
      var(--white);
  }

  .blog-page,
  .blog-page--post {
    width: calc(100% - 34px);
    padding-top: 14px;
    font-size: 16px;
  }

  .blog-nav {
    margin-bottom: 42px;
  }

  .post-list__entry {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .post-filter {
    justify-content: flex-start;
  }

  .post-filter__search input {
    width: 100%;
  }

  .post-body {
    font-size: 17px;
  }

  .post-neighbours {
    grid-template-columns: 1fr;
  }

  .post-neighbours__link--older {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
