/* Writing: article pages. Same tokens, nav, buttons and footer as portfolio.html; this file only adds what an article needs.
   Dark only, on purpose. One accent (amber), one radius scale. */
:root {
  color-scheme: dark;
  --bg: #0e0f11;
  --surface: #16181b;
  --surface-2: #1d2024;
  --text: #ecedee;
  --muted: #a0a6ad;
  --prose: #c4c9ce;
  --line: #2a2d32;
  --accent: #f59e4b;
  --on-accent: #14161a;
  --accent-text: #f59e4b;
  --tint: rgba(245, 158, 75, 0.09);
  --r: 12px;
  --max: 1240px;
  --display: "Cabinet Grotesk", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --font-mono: var(--mono);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* The diagrams inside the posts were drawn with a light palette (--ink-*, --cobalt-*, --red-*).
     Their markup is untouched; these map the old scale onto the dark theme, light to dark, blue to amber. */
  --ink-0: #16181b;
  --ink-50: #1d2024;
  --ink-100: #272a30;
  --ink-200: #343840;
  --ink-300: #444a53;
  --ink-400: #5d646d;
  --ink-500: #8a9098;
  --ink-600: #aab0b7;
  --ink-800: #ecedee;
  --ink-900: #f6f7f8;
  --cobalt-100: rgba(245, 158, 75, 0.14);
  --cobalt-200: rgba(245, 158, 75, 0.34);
  --cobalt-500: #f59e4b;
  --cobalt-700: #f7b06c;
  --red-50: rgba(255, 106, 77, 0.14);
  --red-500: #ff6a4d;
  --red-700: #ff9a82;
}

* {
  box-sizing: border-box;
  margin: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--display);
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 20px;
}

@media (min-width: 768px) {
  .wrap {
    padding-inline: 40px;
  }
}

h1,
h2,
h3 {
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

p {
  color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 22px;
  border-radius: var(--r);
  font-weight: 700;
  white-space: nowrap;
  transition:
    transform 0.3s var(--ease),
    background 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

/* ---------- Skip link, reading progress ---------- */
.skip {
  position: absolute;
  left: 12px;
  top: -64px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: var(--r);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  transition: top 0.2s;
}

.skip:focus {
  top: 12px;
}

.skip:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

main:focus {
  outline: none;
}

.read-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 30;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  pointer-events: none;
}

/* ---------- Nav (same as the portfolio) ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav .wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
}

.brand img {
  width: 28px;
  height: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 20px;
  height: 30px;
  color: var(--accent);
  font-family: "Bubblegum Sans", cursive;
  font-size: 1.16rem;
  font-weight: 400;
  letter-spacing: -0.1em;
  line-height: 1;
}

.brand-name {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-transform: lowercase;
  white-space: nowrap;
}

.brand-tld {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.76em;
  font-weight: 500;
  letter-spacing: -0.08em;
}

.nav ul {
  display: none;
  list-style: none;
  padding: 0;
  gap: 28px;
}

.nav ul a {
  position: relative;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav ul a:hover,
.nav ul a[aria-current] {
  color: var(--text);
}

.nav ul a::after {
  content: "";
  position: absolute;
  inset: auto 0 -6px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.4s var(--ease);
}

.nav ul a[aria-current]::after {
  transform: scaleX(1);
}

@media (min-width: 768px) {
  .nav ul {
    display: flex;
  }
}

.nav .btn {
  height: 40px;
  padding: 0 16px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.nav-toggle:hover {
  background: var(--surface-2);
}

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
}

@media (max-width: 767px) {
  .nav ul {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 4px 20px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }

  .nav.open ul {
    display: flex;
  }

  .nav ul a {
    display: flex;
    align-items: center;
    min-height: 48px;
    font-size: 1.05rem;
  }

  .nav ul li + li a {
    border-top: 1px solid var(--line);
  }

  .nav ul li a::after {
    display: none;
  }

  .nav ul li a[aria-current] {
    color: var(--accent-text);
  }
}

/* ---------- Article ---------- */
.article {
  padding-block: clamp(40px, 6vw, 72px) clamp(72px, 10vw, 140px);
}

.article-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.article-grid > div:first-child {
  max-width: 720px;
}

@media (min-width: 1100px) {
  .article-grid {
    grid-template-columns: minmax(0, 720px) 240px;
    justify-content: space-between;
    gap: 64px;
  }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-bottom: 24px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.back-link i {
  transition: transform 0.3s var(--ease);
}

.back-link:hover {
  color: var(--text);
}

.back-link:hover i {
  transform: translateX(-3px);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  font: 500 0.8rem/1.4 var(--mono);
  color: var(--muted);
}

.article-meta .tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.article-meta a.tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--accent-text);
  transition: color 0.2s;
}

.article-meta a.tag:hover {
  color: var(--text);
}

.article h1 {
  margin-top: 16px;
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  letter-spacing: -0.035em;
}

.article-lead {
  margin-top: 24px;
  max-width: none;
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--muted);
}

/* ---------- Prose ---------- */
.prose {
  margin-top: 48px;
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--prose);
}

.prose p {
  color: inherit;
  max-width: none;
}

.prose > * + * {
  margin-top: 24px;
}

.prose h2 {
  margin-top: 72px;
  font-size: clamp(1.6rem, 2.8vw, 2.1rem);
  color: var(--text);
  scroll-margin-top: 96px;
}

.prose h3 {
  margin-top: 48px;
  font-size: 1.3rem;
  color: var(--text);
}

.prose h2 + h3 {
  margin-top: 24px;
}

.prose strong {
  color: var(--text);
  font-weight: 700;
}

.prose a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: rgba(245, 158, 75, 0.4);
  text-underline-offset: 4px;
  transition: text-decoration-color 0.2s;
}

.prose a:hover {
  text-decoration-color: var(--accent);
}

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

.prose li + li {
  margin-top: 8px;
}

.prose li::marker {
  color: var(--accent-text);
}

.prose :not(pre) > code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font: 500 0.88em/1.4 var(--mono);
  overflow-wrap: anywhere;
}

.prose figure {
  margin-inline: 0;
}

.prose figcaption {
  margin-top: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Code ---------- */
.code-block {
  position: relative;
}

.prose pre {
  margin: 0;
  padding: 24px;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  color: #d6dade;
  font: 400 0.875rem/1.7 var(--mono);
  overflow-x: auto;
  scrollbar-color: var(--line) transparent;
}

.code-block pre {
  padding-top: 52px;
}

.prose pre .k {
  color: var(--accent-text);
}

.prose pre .s {
  color: #9fd89a;
}

.prose pre .c {
  color: #7f858d;
  font-style: italic;
}

.code-copy {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font: 500 0.75rem/1 var(--mono);
  cursor: pointer;
  transition:
    color 0.2s,
    background 0.2s;
}

.code-copy:hover {
  color: var(--text);
  background: var(--line);
}

/* ---------- Callout, tables, figures ---------- */
.callout {
  padding: 22px 24px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r) var(--r) 0;
  background: linear-gradient(90deg, var(--tint), transparent 90%), var(--surface);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--prose);
}

.callout b {
  display: block;
  margin-bottom: 6px;
  font: 500 0.75rem/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-text);
}

.prose .table-wrap {
  overflow-x: auto;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.5;
}

.prose th,
.prose td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.prose th {
  font: 500 0.75rem/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: var(--surface-2);
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose td:first-child {
  color: var(--text);
  font-weight: 700;
}

.prose figure > svg.diagram {
  display: block;
  width: 100%;
  height: auto;
  padding: 16px;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

/* A wide diagram keeps a readable size on phones and scrolls sideways instead of shrinking its text to nothing. */
@media (max-width: 680px) {
  .prose figure:has(> svg.diagram) {
    overflow-x: auto;
    border-radius: var(--r);
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
  }

  .prose figure > svg.diagram {
    min-width: 560px;
  }
}

.state-grid,
.state-homes {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.state-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.prose .state-grid,
.prose .state-homes {
  padding-left: 0;
}

.state-grid li,
.state-homes li {
  margin: 0 !important;
}

.state-grid li {
  display: grid;
  gap: 8px;
}

.state-grid svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.state-grid span {
  font: 500 0.75rem/1.4 var(--mono);
  color: var(--muted);
  text-align: center;
}

.state-homes {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.state-homes li {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 18px;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--prose);
}

.state-homes b {
  font: 500 0.75rem/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-text);
}

.state-homes strong {
  color: var(--text);
}

@media (max-width: 680px) {
  .state-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .state-homes {
    grid-template-columns: minmax(0, 1fr);
  }
}

.prose .badge-figure {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.prose .badge-figure img {
  flex: none;
  width: 72px;
  height: 72px;
}

.prose .badge-figure figcaption {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.prose .badge-figure strong {
  display: block;
  margin-bottom: 4px;
}

/* ---------- Contents list ---------- */
.toc {
  display: none;
}

@media (min-width: 1100px) {
  .toc {
    position: sticky;
    top: 96px;
    display: grid;
    gap: 14px;
    margin-top: 172px;
  }
}

.toc h2 {
  font: 500 0.75rem/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.toc-track {
  position: relative;
}

.toc ol {
  list-style: none;
  padding: 0 0 0 16px;
  display: grid;
  gap: 4px;
  border-left: 1px solid var(--line);
}

.toc a {
  display: block;
  padding: 4px 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  transition: color 0.2s;
}

.toc a:hover,
.toc a[aria-current="true"] {
  color: var(--text);
}

.toc-bar {
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 0;
  border-radius: 2px;
  background: var(--accent);
  transform: translateY(var(--bar-y, 0));
  opacity: 0;
  transition:
    transform 0.4s var(--ease),
    height 0.4s var(--ease),
    opacity 0.2s;
}

.toc-bar.is-on {
  opacity: 1;
}

/* ---------- End of article ---------- */
.article-end {
  margin-top: 72px;
  display: grid;
  gap: 32px;
}

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

.pager a {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  transition: color 0.2s;
}

.pager a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 65%, transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s var(--ease);
}

.pager a:hover::after {
  transform: scaleX(1);
}

.pager .next {
  text-align: right;
}

.pager .next::after {
  transform-origin: right;
  background: linear-gradient(270deg, var(--accent) 65%, transparent);
}

.pager .next:only-child {
  grid-column: 2;
}

.pager span {
  font: 500 0.75rem/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-text);
}

.pager strong {
  font-size: 1.1rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}

@media (max-width: 680px) {
  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager .next {
    text-align: left;
  }

  .pager .next:only-child {
    grid-column: 1;
  }
}

.article-cta {
  color: var(--muted);
}

.article-cta a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  color: var(--accent-text);
  font-weight: 700;
  transition: color 0.2s;
}

.article-cta a:hover {
  color: var(--text);
}

.article-cta a i {
  transition: transform 0.3s var(--ease);
}

.article-cta a:hover i {
  transform: translate(2px, -2px);
}


/* ---------- Writing list page ---------- */
.eyebrow {
  display: block;
  margin-bottom: 20px;
  font: 500 0.75rem/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-text);
}

.list-page {
  padding-block: clamp(40px, 6vw, 72px) clamp(72px, 10vw, 140px);
}

.list-page h1 {
  max-width: 16ch;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  letter-spacing: -0.035em;
}

.list-page .lede {
  margin-top: 20px;
  max-width: 62ch;
  font-size: 1.125rem;
}

.post-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0 28px;
  margin-top: 40px;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 0.9rem/1 var(--mono);
  cursor: pointer;
  transition: color 0.2s;
}

.chip span {
  font-size: 0.75rem;
  opacity: 0.7;
}

.chip:hover {
  color: var(--text);
}

.chip[aria-pressed="true"] {
  color: var(--accent-text);
}

.chip[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 2px;
  background: var(--accent);
}

.post-count {
  margin-top: 8px;
  font: 500 0.8rem/1.4 var(--mono);
  color: var(--muted);
}

.posts {
  list-style: none;
  padding: 0;
  margin-top: 24px;
}

.posts.filterable {
  border-bottom: 1px solid var(--line);
}

.posts li {
  position: relative;
  isolation: isolate;
  border-top: 1px solid var(--line);
}

.posts li[hidden] {
  display: none;
}

.posts a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "date go"
    "t t"
    "meta meta";
  gap: 10px 16px;
  align-items: start;
  padding: 28px 0;
}

@media (min-width: 900px) {
  .posts a {
    grid-template-columns: 110px minmax(0, 1fr) 210px 24px;
    grid-template-areas: "date t meta go";
    gap: 0 32px;
    padding: 32px 0;
  }
}

.posts time {
  grid-area: date;
  padding-top: 6px;
  font: 500 0.85rem/1.4 var(--mono);
  color: var(--muted);
}

.ptitle {
  grid-area: t;
}

.posts h2 {
  max-width: none;
  font-size: 1.4rem;
}

.posts p {
  max-width: 62ch;
  padding-top: 8px;
}

.pmeta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding-top: 6px;
  font: 500 0.8rem/1.4 var(--mono);
  color: var(--muted);
}

.pmeta b {
  font-weight: 500;
  color: var(--accent-text);
}

@media (min-width: 900px) {
  .pmeta {
    flex-direction: column;
    gap: 2px;
  }
}

.posts .go {
  grid-area: go;
  justify-self: end;
  padding-top: 4px;
  font-size: 20px;
  color: var(--muted);
  transition:
    transform 0.3s var(--ease),
    color 0.2s;
}

.posts a:hover .go {
  transform: translateX(4px);
  color: var(--accent-text);
}

/* Same hover as every list on the portfolio: a warm wash and an amber line across the top edge. */
.posts li::before {
  content: "";
  position: absolute;
  inset: 0 -24px;
  z-index: -1;
  background: linear-gradient(90deg, var(--tint), transparent 85%);
  opacity: 0;
  transform: translateX(-16px);
  transition:
    opacity 0.5s,
    transform 0.7s var(--ease);
}

.posts li::after {
  content: "";
  position: absolute;
  left: -24px;
  right: -24px;
  top: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 65%, transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s var(--ease);
}

@media (hover: hover) {
  .posts li:hover::before {
    opacity: 1;
    transform: none;
  }

  .posts li:hover::after {
    transform: scaleX(1);
  }
}


/* ---------- Writing list: pagination ---------- */
.post-filter {
  scroll-margin-top: 88px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 32px;
}

.pagination[hidden] {
  display: none;
}

.pagination .pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 4px;
}

.pagination button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 0.9rem/1 var(--mono);
  cursor: pointer;
  transition: color 0.2s;
}

.pagination button:hover:not(:disabled) {
  color: var(--text);
}

.pagination button[aria-current="page"] {
  color: var(--accent-text);
}

.pagination button[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  height: 2px;
  background: var(--accent);
}

.pagination button:disabled {
  opacity: 0.35;
  cursor: default;
}

.pagination .step {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  padding: 0;
}

.pagination .step i {
  transition: transform 0.3s var(--ease);
}

.pagination .step.prev:hover:not(:disabled) i {
  transform: translateX(-3px);
}

.pagination .step.next:hover:not(:disabled) i {
  transform: translateX(3px);
}

.pagination .gap {
  min-width: 24px;
  text-align: center;
  color: var(--muted);
  font: 500 0.9rem/1 var(--mono);
}

@media (max-width: 520px) {
  .pagination .step span {
    display: none;
  }
}

/* ---------- Footer (same as the portfolio) ---------- */
footer {
  border-top: 1px solid var(--line);
  padding-block: 28px;
  color: var(--muted);
  font-size: 0.9rem;
}

.foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
}

.foot-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.foot-brand .brand-name {
  color: var(--text);
}

.foot-brand img {
  width: 24px;
  height: 24px;
}

.foot-brand .brand-mark {
  width: 22px;
  height: 28px;
  font-size: 0.84rem;
}

.foot-brand .brand-name {
  font-size: 1.1rem;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 4px;
}

.foot-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding-inline: 8px;
  transition: color 0.2s;
}

.foot-links a:hover {
  color: var(--text);
}

.foot-links .sep {
  display: none;
  width: 1px;
  height: 16px;
  background: var(--line);
}

@media (min-width: 900px) {
  .foot-links .sep {
    display: block;
  }
}

@media (max-width: 899px) {
  footer {
    padding-bottom: 84px;
  }
}

@media (min-width: 900px) and (max-width: 1340px) {
  .foot-row {
    padding-right: 88px;
  }
}

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 25;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font-size: 20px;
  box-shadow:
    0 0 0 1px var(--line),
    0 8px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.3s,
    transform 0.3s var(--ease),
    visibility 0.3s,
    color 0.2s;
}

.to-top.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  color: var(--accent-text);
  transform: translateY(-2px);
}

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

  .btn,
  .to-top,
  .back-link i,
  .article-cta a i,
  .toc-bar,
  .pager a::after,
  .chip,
  .search-clear,
  .post-search,
  .pagination button,
  .pagination .step i,
  .posts .go,
  .posts li::before,
  .posts li::after {
    transition: none;
  }
}

/* ---------- Writing list: search ---------- */
.post-search {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 420px;
  margin-top: 40px;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.2s;
}

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

.post-search:focus-within {
  border-color: var(--accent);
}

.post-search > i {
  flex: none;
  color: var(--muted);
  font-size: 1.1rem;
}

.post-search input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--text);
  font: 500 0.95rem/1 var(--mono);
}

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

.post-search input:focus {
  outline: none;
}

.post-search input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -12px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.2s;
}

.search-clear[hidden] {
  display: none;
}

.search-clear:hover {
  color: var(--text);
}

.post-search + .post-filter {
  margin-top: 16px;
}

/* ---------- Writing: feed link, related notes ---------- */
.feed-link {
  margin-top: 16px;
}

.feed-link a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--muted);
  font: 500 0.8rem/1 var(--mono);
  transition: color 0.2s;
}

.feed-link a:hover {
  color: var(--accent-text);
}

.related {
  margin-top: 64px;
}

.related h2 {
  font: 500 0.8rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.related .posts {
  margin-top: 8px;
  border-bottom: 1px solid var(--line);
}
