/*
 * Phase 3C visual pass, enacting docs/title.png + docs/blog.png in full:
 * sticky masthead (wordmark / nav / counter), display-scale hero with a
 * text-free isometric panel composition, content-left / rail-right grid,
 * monogram identity card, post pages with contents rail, hairline footer.
 * Type: Hanken Grotesk (variable, self-hosted) + IBM Plex Mono details.
 * Markup contract: src/site/templates.ts (.frame > .masthead / main /
 * .site-footer; main > [.hero] + .page-grid > .content-col + .rail).
 */

/* ---- fonts (self-hosted, latin subsets) ---- */

@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/hanken-grotesk-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Hanken Grotesk";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/hanken-grotesk-italic-latin.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/plex-mono-400-latin.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/plex-mono-600-latin.woff2") format("woff2");
}

/* ---- design tokens ---- */

:root {
  --bg: #05080e;
  --surface: #0a101b;
  --surface-2: #0d1422;
  --inset: #070b12;
  --border: #182233;
  --border-strong: #263650;
  --heading: #f0f5fb;
  --text: #c2cddc;
  --muted: #8a98ad;
  --faint: #5c6b82;
  --accent: #5b9dff;
  --accent-bright: #84b6ff;
  --accent-strong: #2f7df6;
  --accent-ghost: rgba(91, 157, 255, 0.09);
  --line-glow: rgba(47, 125, 246, 0.55);
  --radius: 14px;
  --radius-lg: 18px;
  --font-body: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --shadow-card: 0 18px 40px -24px rgba(0, 0, 0, 0.85);
  --shadow-pop: 0 22px 44px -20px rgba(13, 38, 76, 0.55);
  --masthead-h: 4.25rem;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--masthead-h) + 1rem);
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 520px at 78% -10%, rgba(47, 125, 246, 0.13), transparent 60%),
    radial-gradient(900px 460px at -14% 4%, rgba(47, 125, 246, 0.05), transparent 58%),
    radial-gradient(1000px 700px at 50% 115%, rgba(20, 50, 110, 0.12), transparent 60%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Film-grain wash — keeps the large dark fields from banding flat. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: rgba(47, 125, 246, 0.4);
  color: var(--heading);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 150ms ease;
}

a:hover {
  color: var(--accent-bright);
}

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

.frame {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

/* Shared accent helpers. */
.mark-io {
  color: var(--accent);
}

.read-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--accent-strong), transparent);
}

/* ---- masthead ---- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2rem;
  min-height: var(--masthead-h);
  margin: 0 -2rem;
  padding: 0 2rem;
  /* Near-opaque instead of backdrop-filter: the page field is uniformly
     dark, so glass blur adds nothing — and blur on a sticky element
     miscomposites in headless Chromium (breaks our own verification). */
  background: rgba(5, 8, 14, 0.94);
  border-bottom: 1px solid rgba(24, 34, 51, 0.85);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--heading);
}

.wordmark:hover {
  color: var(--heading);
}

/* Logo glyph: rotated accent square with a glow — no image assets. */
.wordmark::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 3px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, var(--accent-bright), var(--accent-strong));
  box-shadow: 0 0 12px var(--line-glow);
  flex: none;
}

.wordmark:hover::before {
  box-shadow: 0 0 18px rgba(47, 125, 246, 0.9);
}

.site-nav {
  margin-left: auto;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.35rem;
}

.site-nav a {
  position: relative;
  display: block;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 150ms ease, background 150ms ease;
}

.site-nav a:hover {
  color: var(--heading);
  background: rgba(13, 20, 34, 0.9);
}

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

.hit-counter-pill {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.32rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(10, 16, 27, 0.7);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  transition: opacity 400ms ease, border-color 150ms ease;
}

.hit-counter-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 8px var(--line-glow);
  animation: pulse 2.6s ease-in-out infinite;
}

.hit-counter-pill:has(.hit-counter:empty) {
  opacity: 0;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(47, 125, 246, 0.4); }
  50% { box-shadow: 0 0 10px rgba(47, 125, 246, 0.9); }
}

/* ---- hero (landing) ---- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: 2rem;
  padding: 4.5rem 0 3.5rem;
}

/* Faded dot-grid field behind the panel art. */
.hero::before {
  content: "";
  position: absolute;
  top: 0;
  right: -6%;
  width: 62%;
  height: 100%;
  pointer-events: none;
  background-image: radial-gradient(rgba(94, 162, 255, 0.13) 1px, transparent 1.5px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(70% 70% at 60% 45%, #000 30%, transparent 75%);
  mask-image: radial-gradient(70% 70% at 60% 45%, #000 30%, transparent 75%);
}

.hero-title {
  margin: 0 0 1.1rem;
  font-size: clamp(3.1rem, 6.5vw, 4.6rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.02;
  color: var(--heading);
}

.hero-title .mark-io {
  background: linear-gradient(110deg, var(--accent-bright), var(--accent-strong));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .subtitle {
  margin: 0;
  max-width: 46ch;
  font-size: clamp(1.08rem, 1.6vw, 1.28rem);
  font-weight: 450;
  line-height: 1.65;
  color: var(--muted);
}

/* The art's stacked code panels, rebuilt as pure CSS (text-free). */
.hero-art {
  position: relative;
  height: 320px;
  perspective: 1500px;
}

.hero-glow {
  position: absolute;
  top: 50%;
  left: 55%;
  width: 340px;
  height: 240px;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(47, 125, 246, 0.22), transparent 70%);
  filter: blur(6px);
}

.panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 280px;
  padding: 1.1rem 1.2rem;
  border-radius: 14px;
  border: 1px solid rgba(70, 110, 175, 0.4);
  background: linear-gradient(160deg, rgba(16, 26, 44, 0.92), rgba(8, 13, 22, 0.85));
  box-shadow:
    inset 0 1px 0 rgba(141, 185, 255, 0.12),
    0 30px 50px -30px rgba(0, 0, 0, 0.9);
}

.panel i,
.panel b {
  display: block;
  height: 7px;
  border-radius: 4px;
  margin: 9px 0;
  background: rgba(132, 168, 220, 0.18);
}

.panel i:nth-child(odd) { width: 82%; }
.panel i:nth-child(even) { width: 58%; }
.panel i:nth-child(3n) { width: 38%; }

.panel b {
  width: 70%;
  background: linear-gradient(90deg, var(--accent-strong), rgba(47, 125, 246, 0.25));
  box-shadow: 0 0 12px var(--line-glow);
}

.panel-1 {
  transform: translate(-50%, -50%) rotateX(46deg) rotateZ(-16deg) translateZ(60px);
  animation: float-a 7s var(--ease-out) infinite alternate;
}

.panel-2 {
  transform: translate(-58%, -38%) rotateX(46deg) rotateZ(-16deg) translateZ(0);
  opacity: 0.75;
  animation: float-b 7s var(--ease-out) infinite alternate;
}

.panel-3 {
  transform: translate(-66%, -26%) rotateX(46deg) rotateZ(-16deg) translateZ(-60px);
  opacity: 0.45;
  animation: float-c 7s var(--ease-out) infinite alternate;
}

@keyframes float-a {
  to { transform: translate(-50%, -54%) rotateX(46deg) rotateZ(-16deg) translateZ(60px); }
}

@keyframes float-b {
  to { transform: translate(-58%, -41%) rotateX(46deg) rotateZ(-16deg) translateZ(0); }
}

@keyframes float-c {
  to { transform: translate(-66%, -28%) rotateX(46deg) rotateZ(-16deg) translateZ(-60px); }
}

/* ---- page grid: content + rail ---- */

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2.5rem;
  align-items: start;
  padding: 2.2rem 0 4rem;
}

/* Landing: hero already provided the headline — tighten the grid's top. */
.hero + .page-grid {
  padding-top: 0.5rem;
}

.page-title {
  margin: 0.8rem 0 1.6rem;
  font-size: clamp(2rem, 3.6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--heading);
}

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

.post-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.7rem 1.35rem;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow-card);
  transition: border-color 180ms ease, transform 180ms var(--ease-out), box-shadow 180ms ease;
}

.post-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-pop);
}

/* Featured card: accent hairline across the top + richer field. */
.post-card.featured {
  background: linear-gradient(180deg, rgba(16, 26, 44, 0.65), var(--surface) 55%);
}

.post-card.featured::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-strong), rgba(47, 125, 246, 0.05));
}

.card-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.card-title a {
  color: var(--heading);
}

.card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.post-card:hover .card-title a {
  color: var(--accent-bright);
}

.card-excerpt {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.65;
}

.card-meta {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* ---- rail ---- */

.rail {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  min-width: 0;
}

.rail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem 1.3rem;
  box-shadow: var(--shadow-card);
}

.rail-title {
  margin: 0 0 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--faint);
}

/* Identity card. */
.identity-card {
  background:
    radial-gradient(120% 80% at 20% -10%, rgba(47, 125, 246, 0.13), transparent 55%),
    linear-gradient(180deg, #0e1626 0%, var(--surface) 70%);
  border-color: var(--border-strong);
}

.identity-head {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin-bottom: 0.85rem;
}

.monogram {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 16px;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--heading);
  background: linear-gradient(150deg, #2f63c4 0%, #1d3f87 55%, #122448 100%);
  box-shadow:
    inset 0 1px 0 rgba(141, 185, 255, 0.35),
    0 8px 22px -10px rgba(47, 125, 246, 0.55);
}

.tile-name {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--heading);
}

.tile-name a {
  color: inherit;
}

.tile-name a:hover {
  color: var(--accent);
}

.tile-role {
  margin: 0.1rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.tile-bio {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.89rem;
  line-height: 1.6;
}

.tile-links {
  margin: 0;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.tile-link {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.3rem 0.95rem;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(7, 11, 18, 0.6);
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 150ms var(--ease-out);
}

.tile-link:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: var(--accent-ghost);
  transform: translateY(-1px);
}

/* Tech card. */
.tech-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tech-list li {
  position: relative;
  padding: 0.34rem 0 0.34rem 1.15rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
}

.tech-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.82em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 7px var(--line-glow);
}

/* Contents (post TOC) — sticky below the masthead. */
.toc {
  position: sticky;
  top: calc(var(--masthead-h) + 1.25rem);
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
  margin: 0.15rem 0;
}

.toc a {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.3rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 8px;
  font-size: 0.89rem;
  line-height: 1.45;
  color: var(--muted);
  transition: color 150ms ease, background 150ms ease;
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--faint);
  transition: color 150ms ease;
}

.toc a:hover {
  color: var(--heading);
  background: rgba(13, 20, 34, 0.85);
}

.toc a:hover::before {
  color: var(--accent);
}

/* More-posts card. */
.more-posts ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.more-posts li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0;
}

.more-posts li + li {
  border-top: 1px solid var(--border);
}

.more-posts a {
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.more-posts a:hover {
  color: var(--accent-bright);
}

/* ---- article typography ---- */

.prose {
  max-width: 70ch;
}

.back-link-row {
  margin: 0.4rem 0 1.6rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  transition: color 150ms ease;
}

/* Leading chevron, glyph-free. */
.back-link::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 150ms var(--ease-out);
}

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

.back-link:hover::before {
  transform: rotate(45deg) translate(2px, -2px);
}

.post-meta {
  margin: 0 0 0.4rem;
}

/* Posts use H1s as section heads; only the leading H1 is the title. */
.prose h1 {
  font-size: clamp(2rem, 3.6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin: 0.3rem 0 1.4rem;
  color: var(--heading);
}

.prose h1:not(:first-of-type) {
  position: relative;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  margin: 3rem 0 0.9rem;
  padding-left: 1.05rem;
}

/* Section heads carry a small accent tick — the art's blue keylines. */
.prose h1:not(:first-of-type)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.32em;
  bottom: 0.18em;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent-strong), rgba(47, 125, 246, 0.15));
  box-shadow: 0 0 10px rgba(47, 125, 246, 0.35);
}

/* Lede: the paragraph directly under a post title reads larger and lighter. */
.post-body > h1:first-of-type + p {
  font-size: 1.16rem;
  line-height: 1.7;
  font-weight: 450;
  color: #aebdcf;
}

.prose h2 {
  margin: 2.4rem 0 0.8rem;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--heading);
}

.prose h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--heading);
}

.prose p {
  margin: 0.95rem 0;
}

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

.prose a {
  text-decoration: underline;
  text-decoration-color: rgba(91, 157, 255, 0.4);
  text-underline-offset: 3px;
  transition: text-decoration-color 150ms ease, color 150ms ease;
}

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

.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.12em 0.4em;
  color: #a9c8f1;
}

.prose pre {
  position: relative;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  box-shadow: var(--shadow-card);
}

/* Code-block header treatment: traffic dots + the fence's language tag. */
.prose pre[data-lang] {
  padding-top: 3.1rem;
}

.prose pre[data-lang]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.1rem;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(4px 4px at 1.2rem 50%, #2c3c57 98%, transparent),
    radial-gradient(4px 4px at 2.1rem 50%, #2c3c57 98%, transparent),
    radial-gradient(4px 4px at 3rem 50%, #2c3c57 98%, transparent),
    rgba(10, 16, 27, 0.7);
}

.prose pre[data-lang]::after {
  content: attr(data-lang);
  position: absolute;
  top: 0.55rem;
  right: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.65;
  color: #b9c8dc;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.9rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
  font-style: italic;
}

.prose blockquote p {
  margin: 0.35rem 0;
}

.prose ol,
.prose ul {
  padding-left: 1.6rem;
  margin: 1rem 0;
}

.prose li {
  margin: 0.45rem 0;
}

.prose li::marker {
  color: var(--accent);
  font-weight: 600;
}

.prose hr {
  border: none;
  height: 1px;
  margin: 2.5rem 0;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

/* ---- contact ---- */

.contact-channels {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}

.contact-channels li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 1.35rem;
  margin-bottom: 0.85rem;
  transition: border-color 170ms ease, transform 170ms var(--ease-out);
}

.contact-channels li:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.channel-label {
  flex: 0 0 6rem;
  font-family: var(--font-mono);
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.contact-channels a {
  word-break: break-all;
}

/* ---- 404 ---- */

.not-found {
  padding: 7rem 0;
  text-align: center;
}

.not-found h1 {
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--heading);
}

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

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.4rem 0 1.7rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.footer-mark .mark-io {
  color: var(--accent);
}

.footer-links {
  display: flex;
  gap: 1.4rem;
}

.footer-links a {
  color: var(--faint);
}

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

/* ---- entrance choreography ---- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-title,
.hero .subtitle,
.hero-art,
.page-grid,
.not-found {
  animation: rise 650ms var(--ease-out) both;
}

.hero .subtitle { animation-delay: 90ms; }
.hero-art { animation-delay: 160ms; }
.hero + .page-grid { animation-delay: 230ms; }

/* ---- responsive ---- */

@media (max-width: 1020px) {
  .page-grid {
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 1.8rem;
  }
}

@media (max-width: 880px) {
  .frame {
    padding: 0 1.1rem;
  }

  .masthead {
    margin: 0 -1.1rem;
    padding: 0 1.1rem;
    gap: 1rem;
  }

  .site-nav a {
    padding: 0.45rem 0.7rem;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 2.6rem 0 1.6rem;
  }

  .hero::before,
  .hero-art {
    display: none;
  }

  .page-grid {
    grid-template-columns: 1fr;
    gap: 1.6rem;
    padding-bottom: 3rem;
  }

  .rail {
    order: 1;
  }

  .toc {
    position: static;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }
}

@media (max-width: 560px) {
  .hit-counter-pill {
    display: none;
  }

  .masthead {
    gap: 0.5rem;
  }

  .wordmark {
    font-size: 1.05rem;
    gap: 0.45rem;
  }

  .site-nav a {
    padding: 0.4rem 0.55rem;
    font-size: 0.86rem;
  }

  .channel-label {
    flex-basis: 4.6rem;
  }
}

@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;
  }
}
