@font-face {
  font-family: 'Franklin';
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
  src: url('/static/fonts/franklin.woff2') format('woff2');
}
@font-face {
  font-family: 'Plex Mono';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('/static/fonts/plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Plex Mono';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('/static/fonts/plex-mono-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Aaaiight';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('/static/fonts/aaaiight.woff2') format('woff2');
}

:root {
  --bg: #1d2021;
  --surface: #282828;
  --ink: #fbf1c7;
  --ink-dim: #a89984;
  --border: #3c3836;
  --orange: #d65d0e;
  --yellow: #d79921;
  --aqua: #689d6a;
  --blue: #458588;
  --purple: #b16286;
  --red: #cc241d;
  --chip-fg-orange: #fbf1c7;
  --chip-fg-yellow: #282828;
  --chip-fg-aqua: #282828;
  --chip-fg-blue: #fbf1c7;
  --chip-fg-red: #fbf1c7;
  --chip-fg-purple: #fbf1c7;
}

/* Opt-in only, set by the theme toggle. */
:root[data-theme="light"] {
  --bg: #fbf1c7;
  --surface: #ebdbb2;
  --ink: #282828;
  --ink-dim: #665c54;
  --border: #d5c4a1;
  --orange: #af3a03;
  --yellow: #b57614;
  --aqua: #127d3b;
  --blue: #076678;
  --purple: #86135b;
  --red: #9d0006;
  --chip-fg-orange: #fbf1c7;
  --chip-fg-yellow: #fbf1c7;
  --chip-fg-aqua: #fbf1c7;
  --chip-fg-blue: #fbf1c7;
  --chip-fg-red: #fbf1c7;
  --chip-fg-purple: #fbf1c7;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Franklin', ui-sans-serif, system-ui, sans-serif;
  margin: 0;
  line-height: 1.55;
  font-size: 1.02rem;
}

.mono { font-family: 'Plex Mono', ui-monospace, monospace; }

pre {
  overflow-x: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-family: 'Plex Mono', ui-monospace, monospace;
  font-size: 0.85rem;
  line-height: 1.45;
}

pre code { font-family: inherit; font-size: inherit; }

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  font-size: 0.95rem;
}
.post-body th,
.post-body td {
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  text-align: left;
}
.post-body th {
  font-family: 'Plex Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: var(--surface);
}
.post-body blockquote {
  margin: 1.75rem 0;
  padding: 0.1rem 1.25rem;
  border-left: 3px solid var(--orange);
  color: var(--ink-dim);
}
.post-body blockquote p { margin: 0.6rem 0; }

/* [class~="x"] matches x as any one token in a space-separated class list. */
.syntax-highlighting [class~="comment"] { color: var(--ink-dim); font-style: italic; }
.syntax-highlighting [class~="string"] { color: var(--aqua); }
.syntax-highlighting [class~="keyword"],
.syntax-highlighting [class~="storage"] { color: var(--red); }
.syntax-highlighting [class~="entity"][class~="name"],
.syntax-highlighting [class~="support"] { color: var(--yellow); }
.syntax-highlighting [class~="constant"] { color: var(--purple); }
.syntax-highlighting [class~="variable"][class~="parameter"],
.syntax-highlighting [class~="variable"][class~="language"] { color: var(--blue); }

.wrap {
  max-width: 78rem;
  margin: 0 auto;
  padding: 2.75rem 2rem 5rem;
}

header.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.wordmark {
  font-family: 'Aaaiight', cursive;
  font-weight: 400;
  font-size: clamp(1.35rem, 2.8vw, 1.9rem);
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
}

.wordmark .sep { margin: 0 0.35em; opacity: 0.7; }

.nav-strip { display: flex; gap: 4px; }

@media (pointer: coarse) {
  .nav-strip {
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    /* Padding keeps the skewed chips' pointy corners from being
       clipped; negative margin cancels the resulting shift. */
    padding: 0 0.75rem;
    margin: 0 -0.75rem;
  }
  .nav-strip::-webkit-scrollbar { display: none; }
}

@media (pointer: fine) {
  .nav-strip { flex-wrap: wrap; }
}

.nav-chip {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 0.5rem 1.15rem;
  transform: skewX(-14deg);
  text-decoration: none;
  font-family: 'Plex Mono', ui-monospace, monospace;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: filter 0.15s ease;
}

.nav-chip span { display: inline-block; transform: skewX(14deg); }

@media (max-width: 480px) {
  .nav-chip { padding: 0.42rem 0.75rem; font-size: 0.66rem; letter-spacing: 0.03em; }
}

.nav-chip:hover, .nav-chip:focus-visible { filter: brightness(1.15); color: #282828; outline: none; }
.nav-chip:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }

.theme-toggle {
  border: none;
  font: inherit;
  cursor: pointer;
}

.theme-toggle .theme-icon { transform: skewX(14deg); }

/* data-theme-pref picks which icon shows; data-theme drives the
   actual palette swap -- a "system" pref that resolves to dark
   leaves data-theme unset, same as an explicit dark choice. */
.theme-icon { display: none; }
.theme-icon-dark { display: block; }
:root[data-theme-pref="light"] .theme-icon-dark,
:root[data-theme-pref="system"] .theme-icon-dark {
  display: none;
}
:root[data-theme-pref="light"] .theme-icon-light {
  display: block;
}
:root[data-theme-pref="system"] .theme-icon-system {
  display: block;
}

.chip-orange, .tab-orange { background: var(--orange); color: var(--chip-fg-orange); }
.chip-yellow, .tab-yellow { background: var(--yellow); color: var(--chip-fg-yellow); }
.chip-aqua, .tab-aqua { background: var(--aqua); color: var(--chip-fg-aqua); }
.chip-blue, .tab-blue { background: var(--blue); color: var(--chip-fg-blue); }
.tab-red { background: var(--red); color: var(--chip-fg-red); }
.chip-purple, .tab-purple { background: var(--purple); color: var(--chip-fg-purple); }

.tab, .tag {
  height: 1.8rem;
  margin: 0;
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  transform: skewX(-14deg);
  font-family: 'Plex Mono', ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border);
}

.tab span, .tag span { display: inline-block; transform: skewX(14deg); }

.tab a { color: inherit; text-decoration: none; }
.tab a:hover, .tab a:focus-visible { filter: brightness(1.15); color: #282828; outline: none; }
.tab a:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }

a.tag { text-decoration: none; }
a.tag:hover, a.tag:focus-visible { filter: brightness(1.15); color: #282828; outline: none; }
a.tag:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }

.tab { position: absolute; top: -0.9rem; left: 1.1rem; z-index: 1; }

.tag-row {
  position: absolute;
  top: -0.9rem;
  left: 1.1rem;
  z-index: 1;
  display: flex;
  gap: 4px;
}

.post-tags {
  display: flex;
  gap: 4px;
}

.post-meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
}
.post-meta-row .section-label,
.post-meta-row .post-tags {
  margin: 0;
}

.band { display: flex; height: 7px; margin-bottom: 3rem; }
.band span { flex: 1; }
.band span:nth-child(1) { background: var(--red); }
.band span:nth-child(2) { background: var(--orange); }
.band span:nth-child(3) { background: var(--yellow); }
.band span:nth-child(4) { background: var(--aqua); }
.band span:nth-child(5) { background: var(--blue); }
.band span:nth-child(6) { background: var(--purple); }

h1 {
  font-size: clamp(2.1rem, 4.2vw, 3.1rem);
  font-weight: 900;
  line-height: 1.05;
  margin: 0 0 0.85rem;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h2 { font-weight: 800; font-size: 1.4rem; letter-spacing: -0.01em; }
h3 { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }

.lede {
  color: var(--ink-dim);
  font-size: 1.1rem;
  max-width: 46rem;
  margin: 0 0 3rem;
}

.panel-wrap, .entry-wrap { position: relative; }

.spec-panel {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 1.75rem 1.4rem 1.25rem;
}

.spec-panel dt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Plex Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 0.25rem;
}
.spec-panel dt:not(:first-child) { margin-top: 1rem; }

.swatch {
  width: 0.55rem;
  height: 0.55rem;
  flex: none;
}

.spec-panel dd {
  margin: 0;
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--ink);
}
.spec-panel dd a { color: inherit; text-decoration: none; }
.spec-panel dd a:hover, .spec-panel dd a:focus-visible { color: var(--orange); }

.spec-panel dd.spec-panel-desc {
  margin: 0.15rem 0 0;
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--ink-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 1.1rem; margin: 2rem 0 3rem; }
.tag-cloud-item { display: flex; align-items: center; gap: 0.4rem; }
.tag-count {
  font-family: 'Plex Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--ink-dim);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 1.9rem 1.75rem 1.5rem;
}

.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }

.post-body h2 {
  position: relative;
  /* Fixed height + flex centering, not padding tuned to font metrics. */
  display: inline-flex;
  align-items: center;
  height: 2.6rem;
  margin: 2.5rem 0 1.15rem;
  padding: 0 1.15rem;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.post-body h2::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: skewX(-14deg);
  border: 1px solid var(--border);
}

.post-body h2:nth-of-type(6n+1) { color: var(--chip-fg-red); }
.post-body h2:nth-of-type(6n+1)::before { background: var(--red); }
.post-body h2:nth-of-type(6n+2) { color: var(--chip-fg-orange); }
.post-body h2:nth-of-type(6n+2)::before { background: var(--orange); }
.post-body h2:nth-of-type(6n+3) { color: var(--chip-fg-yellow); }
.post-body h2:nth-of-type(6n+3)::before { background: var(--yellow); }
.post-body h2:nth-of-type(6n+4) { color: var(--chip-fg-aqua); }
.post-body h2:nth-of-type(6n+4)::before { background: var(--aqua); }
.post-body h2:nth-of-type(6n+5) { color: var(--chip-fg-blue); }
.post-body h2:nth-of-type(6n+5)::before { background: var(--blue); }
.post-body h2:nth-of-type(6n) { color: var(--chip-fg-purple); }
.post-body h2:nth-of-type(6n)::before { background: var(--purple); }

main.layout {
  display: grid;
  grid-template-columns: 20rem minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}
main.layout aside.rail { display: flex; flex-direction: column; gap: 2.5rem; }

.linktree {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 2.5rem;
  margin-top: 3rem;
  clear: both;
}

.linktree .panel { position: relative; transition: border-color 0.15s ease; }
.linktree .panel a::after {
  content: "";
  position: absolute;
  /* Extends over the straddling tab label too, so it's part of the
     click target rather than dead space above the card. */
  inset: -0.9rem 0 0 0;
}
.linktree .panel:has(a:hover),
.linktree .panel:has(a:focus-visible) { border-color: var(--orange); }

.panel-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-top: 1rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--ink-dim);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.linktree .panel:has(.panel-go:hover) .panel-go,
.linktree .panel:has(.panel-go:focus-visible) .panel-go {
  color: var(--orange);
  border-color: var(--orange);
}

.ascii-portrait-wrap {
  float: left;
  margin: 0 2rem 1.5rem 0;
}

@media (max-width: 860px) {
  .ascii-portrait-wrap {
    float: none;
    margin: 0 0 2rem;
    text-align: center;
  }
}

.ascii-portrait {
  display: inline-block;
  font-family: 'Plex Mono', ui-monospace, monospace;
  font-size: 0.6rem;
  font-weight: 400;
  line-height: 1;
  /* Narrows the glyphs to match the portrait's original aspect ratio. */
  letter-spacing: -0.12em;
  white-space: nowrap;
  max-width: 100%;
  overflow-x: auto;
  /* Explicit, not the default visible -- otherwise this axis gets
     silently promoted to auto next to overflow-x: auto. */
  overflow-y: hidden;
  text-align: left;
}

.entries { display: flex; flex-direction: column; gap: 2.5rem; }
.entry {
  position: relative;
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 0.4rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 1.9rem 1.5rem 1.25rem;
  transition: border-color 0.15s ease;
}
/* Stretched-link: the title's own <a> covers the whole card. */
.entry-body h2 a::after { content: ""; position: absolute; inset: 0; }
.entry:has(.entry-body h2 a:hover),
.entry:has(.entry-body h2 a:focus-visible) { border-color: var(--orange); }
.entry-date {
  font-family: 'Plex Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
  padding-top: 0.2rem;
}
.entry-body h2 { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; margin: 0 0 0.45rem; }
.entry-body h2 a { color: var(--ink); text-decoration: none; transition: color 0.15s ease; }
.entry-body h2 a:hover, .entry-body h2 a:focus-visible { color: var(--orange); outline: none; }
.entry-body p { margin: 0; color: var(--ink-dim); font-size: 0.96rem; max-width: 42rem; }

@media (max-width: 860px) {
  main.layout { grid-template-columns: 1fr; }
  .entry { grid-template-columns: 1fr; }
  .entry-date { padding-top: 0; }
}

.layout {
  display: grid;
  grid-template-columns: 20rem minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}
.rail { display: flex; flex-direction: column; gap: 2.5rem; }

.archive-note { font-size: 0.9rem; color: var(--ink-dim); margin: 0; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .band { display: none; }
  header.top { margin-bottom: 2rem; }
}

.section-label {
  font-family: 'Plex Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 1.25rem;
}

.section-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 0 0 2rem;
}
.section-row .section-label { margin: 0; }
.section-row-link {
  font-family: 'Plex Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 1rem;
  margin-top: 2.5rem;
}
.pagination .section-label { margin: 0; text-align: center; }
.pagination a.section-row-link:last-child { justify-self: end; }

a { color: var(--ink); outline-offset: 2px; transition: color 0.15s ease; }
a:hover, a:focus-visible { color: var(--orange); outline: none; }
a:focus-visible { outline: 1px solid var(--orange); }

footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: 'Plex Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--ink-dim);
}
