/* ============================================================================
   zed theme — components
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable;
  background: var(--bg); transition: background-color .2s ease; }

body {
  margin: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "liga" 1, "calt" 1;
  transition: background-color .2s ease, color .2s ease;
}
::selection { background: var(--selection); }

img, svg, video { max-width: 100%; height: auto; display: block; }
hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

a { color: var(--link); text-decoration: none; text-underline-offset: 3px;
    text-decoration-thickness: 1px; transition: color .15s ease; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ---- Headings (agrandir display) --------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 2.2em 0 .6em;
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h1:first-child, h2:first-child { margin-top: 0; }

/* ---- Layout ------------------------------------------------------------ */
/* Content-height wrapper: the endless footer (a sibling region after .wrapper —
   see footer.html) handles anchoring the footer to the bottom of the viewport,
   so the content area itself just sizes to its content. */
.wrapper { display: flex; flex-direction: column; }
.wrapper > section { flex: 0 0 auto; }

.container {
  width: 100%;
  max-width: var(--wide-width);
  margin-inline: auto;
  padding-inline: 1.5rem;
}
.measure { max-width: var(--content-width); margin-inline: auto; }

/* ---- Top nav ----------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
  /* Pin the blurred bar to its own GPU layer. Without this the backdrop blur
     is re-rasterized on every scroll frame, and again when the .wrapper
     transform settles on drawer close — both surface as a one-frame flicker. */
  transform: translateZ(0);
}
.site-header .container {
  display: flex; align-items: center; gap: 1.25rem;
  height: 64px; max-width: var(--wide-width);
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  letter-spacing: -0.02em; color: var(--text);
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand .avatar { width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--border); }
.nav { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.nav a {
  color: var(--text-muted); font-family: var(--font-sans); font-size: var(--text-sm);
  padding: .4rem .7rem; border-radius: 8px; transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

.theme-toggle {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; margin-left: .25rem;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ---- Index: centered serif hero (zed "From The Blog" style) ------------ */
.index-hero { padding: 3.6rem 0 2.2rem; max-width: var(--content-width);
  margin-inline: auto; text-align: center; }
.index-hero h1 {
  font-family: var(--font-serif); font-weight: 400; color: var(--link);
  font-size: var(--text-3xl); margin: 0 0 .5rem; letter-spacing: -0.01em;
}
.index-hero p { color: var(--text-muted); font-size: var(--text-lg); margin: 0; }

.post-grid {
  display: grid; gap: 1.25rem; padding-bottom: 4rem;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}
.post-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.4rem 1.5rem 1.5rem;
  overflow: hidden; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.post-card::before {           /* zed accent strip */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: .8; transform: scaleX(0); transform-origin: left;
  transition: transform .25s ease;
}
.post-card:hover {
  border-color: var(--border-strong); transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.post-card:hover::before { transform: scaleX(1); }
.post-card .post-date {
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--text-faint); letter-spacing: .02em; margin-bottom: .5rem;
}
.post-card h2 {
  font-size: var(--text-lg); margin: 0 0 .5rem; line-height: 1.2;
}
.post-card h2 a { color: var(--text); }
.post-card h2 a:hover { color: var(--link); text-decoration: none; }
.post-card .excerpt {
  color: var(--text-muted); font-size: var(--text-sm); margin: 0 0 1rem;
  line-height: 1.55; flex: 1;
}
.post-card .tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-chip {
  font-family: var(--font-sans); font-size: var(--text-xs);
  color: var(--text-muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: .15rem .6rem;
}
.tag-chip:hover { color: var(--text); border-color: var(--border-strong);
  text-decoration: none; }

/* ---- Article ----------------------------------------------------------- */
.article { padding: 3.5rem 0 4rem; }
.article-header { max-width: var(--content-width); margin: 0 auto 2.5rem; }
.article-header .post-date {
  font-family: var(--font-mono); font-size: var(--text-sm);
  color: var(--text-faint); margin-bottom: .9rem;
}
.article-header h1 {
  font-size: var(--text-3xl); margin: 0; letter-spacing: -0.03em;
}
.article-body { max-width: var(--content-width); margin-inline: auto; }
.article-body > * { margin-top: 0; }
.article-body p,
.article-body ul,
.article-body ol,
.article-body blockquote { margin: 0 0 1.4rem; }
.article-body p,
.article-body li { color: var(--text); }
.article-body li { margin-bottom: .4rem; }
.article-body strong { font-weight: 700; }
.article-body a { font-weight: 700; }

.article-body blockquote {
  border-left: 3px solid var(--accent); padding: .2rem 0 .2rem 1.4rem;
  color: var(--text-muted); font-family: var(--font-serif); font-style: italic;
  font-size: var(--text-lg);
}
.article-body img { border-radius: var(--radius); margin: 2rem auto; border: 1px solid var(--border); }
.article-body h2 { padding-top: .4rem; }

/* inline code + blocks (Lilex) */
.article-body code, .post-card code, code {
  font-family: var(--font-mono); font-size: .9em;
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 5px; padding: .12em .38em;
}
.article-body pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem; overflow-x: auto;
  font-size: var(--text-sm); line-height: 1.55; margin: 0 0 1.6rem;
}
.article-body pre code { background: none; border: none; padding: 0; font-size: inherit; }
.highlight { margin: 0 0 1.6rem; }
.highlight pre { margin: 0; }

.article-tags { max-width: var(--content-width); margin: 3rem auto 0;
  padding-top: 1.6rem; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.article-tags .label { color: var(--text-faint); font-size: var(--text-sm);
  font-family: var(--font-sans); margin-right: .25rem; }

/* ---- Archives / tags pages --------------------------------------------- */
.page-body { padding: 3.5rem 0 4rem; max-width: var(--content-width); margin-inline: auto; }
.page-body h1 { font-size: var(--text-3xl); margin: 0 0 2rem; }
.archive-year { font-size: var(--text-xl); margin: 2.2rem 0 1rem; color: var(--text); }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li { display: flex; gap: 1rem; padding: .55rem 0;
  border-bottom: 1px solid var(--border); }
.archive-list .d { font-family: var(--font-mono); font-size: var(--text-sm);
  color: var(--text-faint); min-width: 5.5rem; }
.tagcloud { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---- Pagination -------------------------------------------------------- */
.pagination { display: flex; justify-content: center; gap: .4rem;
  margin: 2rem 0 4rem; padding: 0; list-style: none; }
.pagination a, .pagination span {
  font-family: var(--font-sans); font-size: var(--text-sm);
  padding: .45rem .8rem; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-muted); }
.pagination a:hover { color: var(--text); border-color: var(--border-strong);
  text-decoration: none; }
.pagination .active { color: var(--text); background: var(--surface-2);
  border-color: var(--border-strong); }
.pagination .disabled { opacity: .4; }

/* ---- Footer: zed's accent-blue band ------------------------------------- */
/* noise texture + white/14 tick rails + serif column heads + divided link
   columns + a giant outlined wordmark on a downward-fading scanline pattern,
   cropped by the bottom edge — all lifted from zed's footer markup. */
/* endless footer: a tall reveal region; the sticky .ef-inner panel pins to fill the
   viewport as the page content scrolls up past it. No overflow on the region itself
   (overflow:clip/hidden/auto on a sticky ancestor breaks the sticky). */
.site-footer.endless { position: relative; height: 200vh; color: #e3e4e7; }
@media (max-width: 720px) { .site-footer.endless { height: 130vh; } }
.ef-inner {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: clip; isolation: isolate;
  padding-top: clamp(2rem, 7vh, 5rem);
  border-top: 1px solid var(--rail);
  background: var(--accent); color: #e3e4e7; font-size: var(--text-sm);
}
.site-footer .noise {
  position: absolute; inset: 0; pointer-events: none;
  background: url("../noise.webp") repeat; background-size: 180px;
  opacity: .05;
}
.site-footer .container { position: relative; display: block; }

/* white tick rails at the content edges, like zed's text-white/14 rails */
.f-rail {
  position: absolute; top: 0; bottom: 0; width: 1px;
  display: flex; flex-direction: column; color: rgba(255, 255, 255, .14);
}
.f-rail-l { left:  calc(50% - min(100vw, var(--wide-width)) / 2 + 1.5rem); }
.f-rail-r { right: calc(50% - min(100vw, var(--wide-width)) / 2 + 1.5rem); }
.f-rail i { display: block; width: 1px; background-color: currentColor; }
.f-rail i.dash {
  background-color: transparent;
  background-image: repeating-linear-gradient(to bottom,
    currentColor 0, currentColor 4px, transparent 4px, transparent 8px);
}

/* brand at the left end, link rows at the right end — mirrors the header.
   The inline padding insets the text off the footer tick-rails so the "M"
   and trailing links don't sit flush against the lines. */
.footer-compact {
  padding: 2.5rem 1.5rem 1.75rem;
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: flex-start; gap: 1rem 3rem;
}
.f-cols { display: flex; flex-direction: column; gap: .55rem; }
.f-line {
  display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline;
  justify-content: flex-end; font-size: var(--text-sm); margin: 0;
}
.f-brand-line { font-family: var(--font-serif); color: #fff;
  justify-content: flex-start; }
.f-dim { color: rgba(255, 255, 255, .65); font-family: var(--font-body);
  font-size: var(--text-xs); }
.f-label {
  font-family: var(--font-mono); font-size: .625rem; text-transform: uppercase;
  letter-spacing: .12em; color: rgba(255, 255, 255, .55); margin-right: .5rem;
}
@media (max-width: 720px) {
  .footer-compact { flex-direction: column; padding: 1.75rem 0 1.25rem; }
  .f-line, .f-cols { justify-content: flex-start; align-items: flex-start; }
}
.site-footer a {
  color: #e3e4e7; text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, .2); text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.site-footer a:hover { color: #fff; text-decoration-color: #fff; }
.site-footer .ext { color: rgba(255, 255, 255, .5); margin-left: .45rem; }

/* outlined wordmark over fading scanlines + hatch, bleeding off the bottom */
.footer-mark {
  position: relative; display: flex; justify-content: center; align-items: flex-end;
  margin: 0; padding: 0; overflow: clip;
}
.footer-mark::before {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(to bottom,
    rgba(255, 255, 255, .18) 0, rgba(255, 255, 255, .18) 1px,
    transparent 1px, transparent 10px);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
          mask-image: linear-gradient(to bottom, #000, transparent);
  opacity: .5;
}
.footer-mark::after {
  content: ""; position: absolute; inset: 0; opacity: .18;
  background-image: repeating-linear-gradient(45deg,
    rgba(255, 255, 255, .2) 0, rgba(255, 255, 255, .2) 1.5px,
    transparent 1.5px, transparent 4px);
}
.footer-mark span {
  position: relative; font-family: var(--font-serif);
  font-size: clamp(2.5rem, 16vw, 14rem); line-height: .92; letter-spacing: -.03em;
  color: rgba(255, 255, 255, .035);
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, .26);
  margin-bottom: -.06em; /* slight crop off the bottom edge */
  opacity: .9; user-select: none; white-space: nowrap;
}

/* subtle reveal: the wordmark rises + fades in driven by --ef (0..1), set by
   endless-footer.js from the footer region's scroll progress. Works in every
   browser (scroll-driven CSS timelines freeze on a pinned/sticky element); if the
   script never runs, --ef falls back to 1 so the wordmark is simply shown. */
.ef-inner .footer-mark span {
  opacity: calc(.16 + .74 * var(--ef, 1));
  transform: translateY(calc((1 - var(--ef, 1)) * 34px));
  will-change: opacity, transform;
}
@media (prefers-reduced-motion: reduce) {
  .ef-inner .footer-mark span { opacity: .9; transform: none; }
}

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 640px) {
  .index-hero { padding: 2.5rem 0 1.5rem; }
  .post-grid { grid-template-columns: 1fr; }
  .nav a { padding: .4rem .5rem; }
  .article-header h1 { font-size: var(--text-2xl); }
  .site-footer .colophon { margin-left: 0; width: 100%; }
}

/* ============================================================================
   zed gridlines — graph-paper backdrop + framed content rails + crosshairs
   ========================================================================== */
/* zed's exact values, lifted from their markup:
   grid texture  = 10px cells, text-accent-blue/15 (light) / blue-300/5 (dark)
   rails/nodes   = offgray-100 / offgray-900
   hatch         = 45deg lines, 4px apart, offgray-200/70 / blue-400/10
   hero hatch    = 8px corner pattern, blue-500/50, fades to bottom
   row hover     = border blue-300, bg blue-50/50 / blue-700/5
   row underline = accent-blue/20 -> /80 on hover */
:root, :root[data-theme="light"] {
  --grid:  rgba(19, 72, 220, .15);
  --rail:  #ced1d6;
  --hatch: rgba(192, 195, 202, .7);
  --hatch-op: .3;
  --heroline: rgba(48, 128, 255, .5);
  --hero-op: .2;
  --rowborder: #90c5ff;
  --rowbg: rgba(239, 246, 255, .5);
  --tdec: rgba(19, 72, 220, .2);
  --tdec-hover: rgba(19, 72, 220, .8);
  --chip-green-b: rgba(123, 241, 168, .5); --chip-green-bg: rgba(185, 248, 207, .1); --chip-green-t: #0d542b;
  --chip-blue-b: #90c5ff; --chip-blue-bg: rgba(190, 219, 255, .1); --chip-blue-t: #193cb8;
}
:root[data-theme="dark"] {
  --grid:  rgba(144, 197, 255, .06);
  --rail:  #35383f;
  --hatch: rgba(84, 162, 255, .10);
  --hatch-op: .6;
  --heroline: rgba(48, 128, 255, .5);
  --hero-op: .16;
  --rowborder: rgba(144, 197, 255, .2);
  --rowbg: rgba(20, 71, 230, .05);
  --tdec: rgba(144, 197, 255, .2);
  --tdec-hover: rgba(84, 162, 255, .8);
  --chip-green-b: rgba(5, 223, 114, .15); --chip-green-bg: rgba(0, 100, 50, .05); --chip-green-t: #b9f8cf;
  --chip-blue-b: rgba(84, 162, 255, .15); --chip-blue-bg: rgba(25, 60, 184, .05); --chip-blue-t: #bedbff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grid:  rgba(144, 197, 255, .06);
    --rail:  #35383f;
    --hatch: rgba(84, 162, 255, .10);
    --hatch-op: .6;
    --heroline: rgba(48, 128, 255, .5);
    --hero-op: .16;
    --rowborder: rgba(144, 197, 255, .2);
    --rowbg: rgba(20, 71, 230, .05);
    --tdec: rgba(144, 197, 255, .2);
    --tdec-hover: rgba(84, 162, 255, .8);
    --chip-green-b: rgba(5, 223, 114, .15); --chip-green-bg: rgba(0, 100, 50, .05); --chip-green-t: #b9f8cf;
    --chip-blue-b: rgba(84, 162, 255, .15); --chip-blue-bg: rgba(25, 60, 184, .05); --chip-blue-t: #bedbff;
  }
}

/* No overflow on body/html — a non-visible overflow here makes body the scroll
   container in Safari/Firefox and breaks the footer's position: sticky reveal.
   Full-bleed elements clip themselves (.divider-hatch, .ef-inner, .footer-mark). */

/* ---- page frame: edge gutters with the 10px grid texture ---------------- */
.page-frame { pointer-events: none; }
.pf-gutter {
  position: fixed; top: 0; bottom: 0; width: 48px; z-index: -1;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 10px 10px;
}
.pf-l { left: 0; } .pf-r { right: 0; }

/* ---- tick rails: 1px columns of seeded solid/dashed segments ------------ */
.pf-rail {
  position: fixed; top: 0; bottom: 0; width: 1px; z-index: -1;
  display: flex; flex-direction: column; color: var(--rail);
}
.pf-rail i { display: block; width: 1px; background-color: currentColor; }
.pf-rail i.dash {
  background-color: transparent;
  background-image: repeating-linear-gradient(to bottom,
    currentColor 0, currentColor 4px, transparent 4px, transparent 8px);
}
.pf-rail-l { left:  calc(50vw - min(100vw, var(--wide-width)) / 2 + 1.5rem); }
.pf-rail-r { right: calc(50vw - min(100vw, var(--wide-width)) / 2 + 1.5rem); }

/* ---- diamond nodes at section corners ----------------------------------- */
.z-sec { position: relative; }
/* inset a section's content off the page tick-rails (mirrors the footer); the
   rails are hidden on mobile, so drop the inset there too. */
.z-inset { padding-inline: 1.5rem; }
@media (max-width: 720px) { .z-inset { padding-inline: 0; } }
.znode {
  position: absolute; z-index: 9; width: 6px; height: 6px;
  transform: rotate(45deg); border: 1px solid var(--rail);
  background: var(--bg); display: block;
}
.znode.tl { top: -3.5px;    left: -3.5px; }
.znode.tr { top: -3.5px;    right: -3.5px; }
.znode.bl { bottom: -3.5px; left: -3.5px; }
.znode.br { bottom: -3.5px; right: -3.5px; }
.site-header .container { position: relative; }

/* ---- hatched divider strip between sections ------------------------------ */
.divider-hatch {
  height: 14px; width: 100vw; margin-inline: calc(50% - 50vw);
  border-top: 1px solid var(--rail); border-bottom: 1px solid var(--rail);
  background-image: repeating-linear-gradient(45deg,
    var(--hatch) 0, var(--hatch) 1.5px, transparent 1.5px, transparent 4px);
  background-clip: content-box; padding-block: 1px;
  opacity: var(--hatch-op);
}

/* ---- hero corner-hatch that fades downward (zed's 8px pattern) ----------- */
.index-hero { position: relative; isolation: isolate; }
.hero-hatch {
  position: absolute; inset: 0; z-index: -1; max-height: 190px;
  opacity: var(--hero-op); pointer-events: none;
  background-image:
    linear-gradient(to right, var(--heroline) 1px, transparent 1px),
    linear-gradient(to bottom, var(--heroline) 1px, transparent 1px);
  background-size: 8px 8px; background-position: -1px -1px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(255,255,255,.68), transparent);
          mask-image: linear-gradient(to bottom, rgba(255,255,255,.68), transparent);
}

@media (max-width: 720px) {
  .pf-gutter, .pf-rail, .znode, .f-rail { display: none; }
}

/* ============================================================================
   zed/Vaul-style mobile drawer
   The page (.wrapper) scales to 0.98, nudges down 0.25rem, and gains rounded
   top corners while the bottom sheet is open — zed's exact transition:
   400ms cubic-bezier(0.32, 0.72, 0, 1), origin center top.
   ========================================================================== */
.menu-toggle {
  display: none; place-items: center;
  width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text-muted); cursor: pointer;
}
.menu-toggle svg { width: 18px; height: 18px; }
.menu-toggle .i-x { display: none; }
body.drawer-open .menu-toggle .i-x { display: block; }
body.drawer-open .menu-toggle .i-menu { display: none; }

.wrapper {
  transform-origin: center top;
  transition: transform 400ms cubic-bezier(.32, .72, 0, 1),
              border-radius 400ms cubic-bezier(.32, .72, 0, 1);
}
body.drawer-open { background: #000; overflow: hidden; }
body.drawer-open .wrapper {
  transform: scale(.98) translateY(.25rem);
  border-top-left-radius: .5rem; border-top-right-radius: .5rem;
  overflow: clip; background: var(--bg); will-change: transform;
}

.drawer-scrim {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0, 0, 0, .32); opacity: 0; pointer-events: none;
  transition: opacity 400ms cubic-bezier(.32, .72, 0, 1);
}
body.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }

.mobile-drawer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  max-height: 80vh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border); border-bottom: none;
  border-top-left-radius: 12px; border-top-right-radius: 12px;
  padding: 0 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 400ms cubic-bezier(.32, .72, 0, 1);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .25);
}
body.drawer-open .mobile-drawer { transform: translateY(0); }
.drawer-handle {
  display: block; width: 36px; height: 4px; border-radius: 2px;
  background: var(--border-strong); margin: .6rem auto .9rem;
}
.mobile-drawer ul { list-style: none; margin: 0; padding: 0; }
/* zed.dev drawer rows: label left, chevron pushed right, hover fill. */
.mobile-drawer a {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem .75rem; border-radius: 8px;
  font-family: var(--font-sans); font-size: var(--text-base); color: var(--text);
}
.mobile-drawer a:hover, .mobile-drawer a:focus-visible {
  background: var(--surface-2); color: var(--text); text-decoration: none;
}
.mobile-drawer .i-chevron {
  flex: none; width: 18px; height: 18px; margin-left: auto; color: var(--text-faint);
}
.mobile-drawer .drawer-sep hr {
  border: 0; border-top: 1px solid var(--border); margin: .4rem .25rem;
}

@media (max-width: 720px) {
  .site-header .nav { display: none; }
  .menu-toggle { display: inline-grid; }
  /* .nav carries the margin-left:auto spacer; once it's hidden the brand must
     take its place, or the toggles collapse against the name. */
  .site-header .brand { margin-right: auto; }
}

/* ============================================================================
   zed listing — category sidebar + dense post rows with dotted leaders
   ========================================================================== */
.blog-layout {
  /* minmax(0, 1fr) — a bare 1fr has min-width:auto, which inherits the
     min-content of the longest nowrap row title and blows the grid out
     past the container (719px column in a 437px grid on mobile). */
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 168px);
  gap: 2.6rem 3rem; align-items: start; padding: 2.4rem 0 4rem;
}
.sidebar, .post-main { min-width: 0; }
.post-row, .row-title { min-width: 0; }
/* posts on the left, categories sidebar on the right. grid-row:1 keeps both in
   the same row — without it, sparse auto-placement bumps post-main (col 1, but
   later in source than the col-2 sidebar) down into row 2, leaving a big gap. */
.post-main { grid-column: 1; grid-row: 1; }
.sidebar { position: sticky; top: 84px; grid-column: 2; grid-row: 1; }
.sidebar h3 {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 400;
  text-transform: uppercase; letter-spacing: .14em; color: var(--text-faint);
  margin: 0 0 .9rem; padding-left: 1rem;
}
.sidebar ul { list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; }
.sidebar a {
  display: block; padding: .22rem 1rem;
  border-left: 1px solid transparent;
  color: var(--text-muted); font-family: var(--font-sans); font-size: var(--text-sm);
}
.sidebar a:hover {
  color: var(--text); text-decoration: none;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.sidebar a.active {
  color: var(--link);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-left-color: color-mix(in srgb, var(--accent) 50%, transparent);
}

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

/* zed row: the whole row is the link; title underlined with low-alpha accent;
   solid hairline leader that hides on hover; hover = blue border + tint +
   diagonal hatch fading in from the right. */
.post-row {
  position: relative; isolation: isolate;
  display: flex; align-items: center; gap: .85rem;
  min-height: 42px; padding: .5rem .5rem; border-radius: 6px;
  border: 1px solid transparent; color: var(--text);
}
.post-row::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0;
  background-image: repeating-linear-gradient(45deg,
    var(--hatch) 0, var(--hatch) 1.5px, transparent 1.5px, transparent 4px);
  -webkit-mask-image: linear-gradient(to left, rgba(255,255,255,.68), transparent);
          mask-image: linear-gradient(to left, rgba(255,255,255,.68), transparent);
}
.post-row:hover {
  border-color: var(--rowborder); background: var(--rowbg);
  text-decoration: none; color: var(--text);
}
.post-row:hover::before { opacity: .6; }
.row-head { display: inline-flex; align-items: center; gap: .6rem; min-width: 0; flex: 0 1 auto; }
.row-title {
  font-family: var(--font-body); font-size: var(--text-sm); color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: underline; text-decoration-color: var(--tdec);
  text-underline-offset: 3px; text-decoration-thickness: 1px;
  transition: text-decoration-color .15s ease;
}
.post-row:hover .row-title { text-decoration-color: var(--tdec-hover); }
.row-leader {
  flex: 1 1 auto; min-width: 1.5rem; height: 0;
  border-top: 1px solid var(--rail); opacity: .7;
}
.post-row:hover .row-leader { visibility: hidden; }
.row-meta { display: inline-flex; align-items: center; gap: .6rem; flex: none; }
.row-chip {
  font-family: var(--font-mono); font-size: .625rem; line-height: 1;
  padding: .25rem .3rem .2rem; border-radius: 3px; white-space: nowrap;
  border: 1px solid var(--border); color: var(--text-muted);
  background: var(--surface-2);
}
.row-chip.green { border-color: var(--chip-green-b); background: var(--chip-green-bg); color: var(--chip-green-t); }
.row-chip.blue  { border-color: var(--chip-blue-b);  background: var(--chip-blue-bg);  color: var(--chip-blue-t); }
.post-row .date, .card-meta .date {
  font-family: var(--font-mono); font-size: .625rem; color: var(--text-faint);
  white-space: nowrap; letter-spacing: .01em;
}

@media (max-width: 720px) {
  .blog-layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  /* single column on mobile: undo the desktop row/column placement so the
     category nav stacks above the posts (source order) instead of overlapping. */
  .sidebar, .post-main { grid-column: auto; grid-row: auto; }
  .sidebar { position: static; }

  /* zed.dev structured category nav: one horizontal scroll row of equal cells
     with bottom borders + a right-edge fade hinting more scroll into view. */
  .sidebar h3 {
    text-align: center; padding: 0 0 .6rem; margin: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar ul {
    flex-direction: row; flex-wrap: nowrap; overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 80%, transparent);
            mask-image: linear-gradient(to right, #000 80%, transparent);
  }
  .sidebar ul::-webkit-scrollbar { display: none; }
  .sidebar li { flex: 1 0 auto; }
  .sidebar a {
    text-align: center; white-space: nowrap;
    border-left: 0; border-bottom: 1px solid var(--border);
  }
  .sidebar a.active {
    border-left-color: transparent;
    border-bottom-color: color-mix(in srgb, var(--accent) 50%, transparent);
  }

  /* article rows: stack title over meta on phones; drop the dotted leader. */
  .post-row { flex-direction: column; align-items: flex-start; gap: .3rem; }
  .row-head { flex: 0 0 auto; max-width: 100%; }
  .row-title { white-space: normal; overflow: visible; text-overflow: clip; }
  .row-leader { display: none; }
  .row-meta { flex: none; }
}

/* ============================================================================
   zed featured cards (generated covers) + avatars
   ========================================================================== */
.feature-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem;
  padding: 1.6rem 0;
}
.feature-card {
  display: flex; flex-direction: column; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.feature-card:hover {
  border-color: var(--border-strong); transform: translateY(-2px);
  box-shadow: var(--shadow); text-decoration: none;
}
/* zed card: cover sits on a diagonal-hatch mat with padding; serif title */
.cover-wrap {
  display: block; padding: 8px; position: relative;
  background-image: repeating-linear-gradient(45deg,
    var(--hatch) 0, var(--hatch) 1.5px, transparent 1.5px, transparent 4px);
}
.cover {
  width: 100%; aspect-ratio: 16 / 9; height: auto; display: block;
  border-radius: 4px; border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.card-body { display: flex; flex-direction: column; gap: .4rem;
  padding: .9rem 1rem 1rem; border-top: 1px solid var(--border); }
.card-title {
  font-family: var(--font-serif); font-weight: 400; font-size: .9375rem;
  line-height: 1.3; letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feature-card:hover .card-title { color: var(--link); }
.card-excerpt {
  color: var(--text-muted); font-size: var(--text-sm); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  display: flex; align-items: center; gap: .5rem; margin-top: .3rem;
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-faint);
}
.card-meta .byline { color: var(--text-muted); }
.card-meta .date { margin-left: auto; white-space: nowrap; }

/* avatars: round gravatar, rounded-square favicon (blogmarks) */
.avatar {
  width: 20px; height: 20px; border-radius: 50%; flex: none; object-fit: cover;
  border: 1px solid var(--border); background: var(--surface-2);
}
.avatar.fav { border-radius: 5px; padding: 2px; background: var(--surface);
  object-fit: contain; image-rendering: -webkit-optimize-contrast; }

/* listing rows: small avatar after the title + featured chip */
.post-row .avatar { width: 17px; height: 17px; align-self: center; }
.post-row .chip.featured {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent-2) 42%, transparent);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
}

/* ---- blogmark (link post): quote + commentary inline, set apart from rows --- */
.blogmark {
  position: relative; margin: .5rem 0; padding: .8rem 1rem .7rem 1.05rem;
  border: 1px solid var(--border);
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 8px; background: var(--surface);
}
.bm-head { display: flex; align-items: center; gap: .55rem; color: var(--text); }
.bm-head:hover { text-decoration: none; }
.bm-title {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--font-body); font-weight: 600; font-size: var(--text-sm); color: var(--text);
  text-decoration: underline; text-decoration-color: var(--tdec);
  text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.bm-head:hover .bm-title { color: var(--link); text-decoration-color: var(--tdec-hover); }
.bm-head .date { flex: none; }
.bm-body { margin: .5rem 0 .3rem; font-size: var(--text-sm); color: var(--text-muted); line-height: 1.55; }
.bm-body > :first-child { margin-top: 0; }
.bm-body > :last-child { margin-bottom: 0; }
.bm-body p { margin: .3rem 0; }
.bm-body blockquote {
  margin: .2rem 0 .5rem; padding: .15rem 0 .15rem .85rem;
  border-left: 2px solid var(--border-strong); color: var(--text); font-style: italic;
}
.bm-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .9rem; }
.bm-source, .bm-via {
  font-family: var(--font-mono); font-size: .7rem; color: var(--text-faint);
  letter-spacing: .01em;
}
.bm-source:hover, .bm-via:hover { color: var(--link); text-decoration: none; }

/* blogmark permalink header: Source link under the title */
.article-source { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; margin: .6rem 0 0; }
.article-source .bm-source {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted);
}
.article-source .bm-source:hover { color: var(--link); }
.article-source .avatar { width: 18px; height: 18px; }

@media (max-width: 860px) { .feature-grid { grid-template-columns: 1fr; } }

/* ---- landing "latest from the blog" teaser band -------------------------- */
.blog-teaser {
  display: flex; flex-direction: column; gap: 1rem; align-items: flex-start;
  padding: 1.6rem 0 .4rem;
}
.blog-teaser hgroup { max-width: 34rem; }
.blog-teaser h2 {
  font-family: var(--font-serif); font-weight: 400; font-size: 1.5rem;
  line-height: 1.2; letter-spacing: -0.01em; color: var(--link); margin: 0 0 .4rem;
}
.blog-teaser p { color: var(--text-muted); margin: 0; line-height: 1.5; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: .15rem; flex: none;
  padding: .5rem .65rem .5rem .85rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-family: var(--font-sans); font-size: var(--text-sm); white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-ghost:hover {
  border-color: var(--border-strong); background: var(--surface-2);
  color: var(--text); text-decoration: none;
}
.btn-ghost .i-chevron { flex: none; width: 16px; height: 16px; color: var(--text-faint); }
@media (min-width: 721px) {
  .blog-teaser {
    flex-direction: row; align-items: center; justify-content: space-between;
  }
}
