/* ============================================================
   Josué Aldana-Aguilar. Drawing-sheet theme.
   The page is an engineering sheet: a bordered white plate on grey
   paper, ruled bands, a title block, and one signal colour.
   Two families (IBM Plex Sans + IBM Plex Mono), one accent.
   Work is one band per domain; projects sit in a 2-column grid.

   Every color the site uses is declared in :root below, including the
   channel triplets the partial-alpha values need. Nothing downstream
   hard-codes a color, so retheming means editing that block only.

   NOTE, because it differs from the old true-black theme: the amber
   exists at TWO lightnesses now. --accent is the dark, text-safe one
   (6.4:1 on the plate) used for links, DOIs and anything a reader has
   to read. --accent-mark is the bright one, used only for filled ticks,
   glows and the closed breaker — never behind text. Change one and you
   almost always want to change the other.
   ============================================================ */

:root {
  --paper:     #f1f2f4;   /* the ground the sheet sits on */
  --bg:        #f1f2f4;   /* alias of --paper, kept so nothing downstream breaks */
  --bg-2:      #ffffff;   /* the sheet itself */
  --bg-3:      #f7f8f9;   /* subtle fill: strips, hovers, code blocks */
  --band:      #edeef1;   /* the ruled label strips */
  --line:      #d7dae0;   /* hairline */
  --line-2:    #b4b9c2;   /* stronger hairline */
  --ink:       #14161a;   /* primary text */
  --ink-dim:   #565a63;   /* secondary text — 6.9:1 on the plate */
  --ink-faint: #6e737e;   /* captions, meta — 4.8:1, the floor for 10-12px */

  /* Two accents with a rule, not two accents for variety:
       --accent   the physical side — current, plant, hardware, and every
                  interactive affordance (links, buttons, hovers).
       --accent-2 the measured side — telemetry, models, live state.
     The signal-chain strip changes from one to the other at the CT, which is
     exactly where measurement starts. If a new element is neither, it is grey. */
  --accent:      #8a5200;   /* signal amber, text weight */
  --accent-mark: #f0a500;   /* signal amber, mark weight — fills and glows */
  --accent-2:    #0e7490;   /* measurement teal */
  --live:        var(--accent-2);   /* ongoing state reads as measured state */
  /* Navy: the structural colour of the home page (side column, section
     bands). Never behind body copy on white; text on it is white or the two
     tints below, both ≥ 6.5:1 on --navy. */
  --navy:        #14284B;
  --navy-2:      #1d3561;   /* hover / pressed on navy */
  --navy-line:   #2f4777;   /* hairlines drawn on navy */
  --on-navy:     #ffffff;
  --on-navy-dim: #c5cede;
  --on-navy-faint: #9fb0cc;

  /* Channel triplets for the same colors. Everything that needs an accent at
     partial alpha goes through these, so retheming the site means editing
     this block and nothing else. Keep them in sync with the hex values above.
     --accent-rgb tracks --accent-mark, because every alpha use is a glow or a
     wash, never text. */
  --bg-rgb:       255 255 255;
  --accent-rgb:   240 165 0;
  --accent-2-rgb: 14 116 144;
  --live-rgb:     var(--accent-2-rgb);
  --accent-hi:    #a66300;  /* accent, one step up: link and button hover */
  --on-accent:    #ffffff;  /* text that sits on top of a filled --accent */
  --on-ink:       #ffffff;  /* text that sits on top of a filled --ink */
  --ink-hi:       #000000;  /* ink, one step down: primary button hover */

  --header-h: 61px;         /* the 60px header row plus its own rule; the
                               sticky bands and every anchor offset track it,
                               so it changes with the header and nowhere else */
  --radius: 0;              /* a drawing sheet has no rounded corners */
  --sheet-w: 1240px;
  --pad: 56px;              /* the sheet's inner margin — the content column */
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --body: "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- the sheet ----------
   Everything lives on one bordered plate. The header is sticky inside it, so
   past the first scroll the plate's top edge is simply the header — the frame
   is a desktop affordance, not something the layout depends on. */
.sheet {
  max-width: var(--sheet-w);
  margin: 28px auto;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
}

/* The content column. The sheet caps the width; .wrap only insets it, which is
   what lets bands and rows run edge to edge of the plate while their labels
   stay on the column. */
.wrap { padding: 0 var(--pad); }

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

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--on-accent); padding: 10px 16px;
  font-family: var(--mono); font-size: 13px; z-index: 200;
}
.skip-link:focus { left: 12px; top: 12px; }

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

::selection { background: var(--accent); color: var(--on-accent); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgb(var(--bg-rgb) / 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; height: 60px;
}
.brand { font-weight: 600; font-size: 15px; letter-spacing: -0.012em; }

.site-nav { display: flex; gap: 26px; }
.site-nav a {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim);
  transition: color 0.2s ease;
}
.site-nav a:hover { color: var(--ink); }

/* ---------- scroll progress ----------
   Sits on the header's bottom rule and energizes it as you read. It rides
   inside the header rather than being viewport-fixed, so it stays glued to
   that rule whether the header is stuck or still sitting on the paper. */
.scroll-line {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  pointer-events: none;
}
.scroll-line span {
  display: block; height: 100%; background: var(--accent-mark);
  transform: scaleX(0); transform-origin: 0 50%;
}

/* ---------- hero ----------
   Blueprint grid, faded out downwards so the headline never sits on ruling. */
.hero { position: relative; padding: 60px 0 52px; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 32px 100%;
  -webkit-mask-image: linear-gradient(#000 22%, rgb(0 0 0 / 0.35) 62%, transparent 96%);
  mask-image: linear-gradient(#000 22%, rgb(0 0 0 / 0.35) 62%, transparent 96%);
}
.hero-inner {
  position: relative;
  display: grid; grid-template-columns: 1fr 300px; gap: 64px; align-items: start;
}
.eyebrow {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--ink-faint); margin: 0 0 22px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--accent-mark); }

/* Display scale. The jump from 11px labels to a headline this size is doing
   most of the work; anything in between flattens it back out. */
.hero-title {
  font-weight: 600; font-size: clamp(2.4rem, 6vw, 4.1rem);
  line-height: 1.03; letter-spacing: -0.038em; margin: 0 0 34px;
  max-width: 15ch; text-wrap: balance;
}

/* "now" strip: a spec-sheet row rather than another bordered box, since the
   title block, project grid and contact list downstream are all boxed already. */
.now {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 32px; max-width: 760px; border-top: 1px solid var(--line-2);
}
.now-item { position: relative; padding: 16px 26px 0 0; }
.now-item + .now-item { padding-left: 26px; border-left: 1px solid var(--line); }

/* short amber tick sitting on the top rule, one per item */
.now-item::before {
  content: ""; position: absolute; top: -2px; left: 0;
  width: 22px; height: 2px; background: var(--accent-mark);
}
.now-item + .now-item::before { left: 26px; }

.now dt {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.15em; color: var(--ink-faint); margin-bottom: 6px;
}
.now dd { margin: 0; font-size: 0.94rem; color: var(--ink); line-height: 1.5; }
.now dd a { color: var(--accent); border-bottom: 1px solid transparent; }
.now dd a:hover { border-bottom-color: var(--accent); }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  font-family: var(--mono); font-size: 13px;
  padding: 12px 22px; border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 500; }
.btn-primary:hover { background: var(--ink-hi); }
.btn-ghost { border-color: var(--line-2); color: var(--ink-dim); }
.btn-ghost:hover { border-color: var(--ink-faint); color: var(--ink); }

/* ---------- portrait + title block ----------
   A real drawing carries a title block: who drew it, where, which sheet. It is
   the one piece of chrome on the page that is purely of the trade, and it is
   what makes the sheet read as a sheet rather than as a light theme. */
.hero-photo { margin: 0; }
.photo-frame { position: relative; display: block; width: max-content; }
.photo-frame::before, .photo-frame::after {
  content: ""; position: absolute; width: 18px; height: 18px; pointer-events: none;
}
.photo-frame::before { top: -7px; left: -7px; border-top: 2px solid var(--accent-mark); border-left: 2px solid var(--accent-mark); }
.photo-frame::after { bottom: -7px; right: -7px; border-bottom: 2px solid var(--accent-mark); border-right: 2px solid var(--accent-mark); }
.hero-photo img {
  display: block; width: 300px; height: 300px;
  object-fit: cover; border-radius: var(--radius);
  filter: grayscale(1) contrast(1.05); background: var(--band);
}

.titleblock {
  margin-top: 18px; border: 1px solid var(--line-2);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tb-cell { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.tb-cell:nth-child(odd) { border-right: 1px solid var(--line); }
.tb-cell:nth-last-child(-n+2) { border-bottom: none; }
.tb-cell dt {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em;
  color: var(--ink-faint);
}
.tb-cell dd { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--ink); }

/* ---------- generic section ---------- */
.section { padding: 64px 0; border-top: 1px solid var(--line); }

/* Sections whose structure comes from bands and rows instead of padding. */
.sec-flush { padding: 0; border-top: none; }

.section[id], .hero[id] { scroll-margin-top: calc(var(--header-h) + 49px); }

.section-sub { color: var(--ink-dim); margin: 8px 0 0; max-width: 52ch; font-size: 0.94rem; }

/* ---------- section bands ----------
   Full-bleed rules with the label sitting on the content column. These are
   what divide the page, so sections no longer carry their own border.

   Each band sticks under the header for as long as its own section is on
   screen, then the next one pushes it out. Scrolling gets a running label of
   where you are, and the page stops feeling like one flat column. */
.band {
  position: sticky; top: var(--header-h); z-index: 50;
  background: var(--band);
  border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line);
}
.band-inner { display: flex; align-items: center; gap: 11px; height: 42px; }
.band-dot {
  width: 6px; height: 6px; background: var(--accent-mark); flex: 0 0 auto;
}
.band-label {
  font-family: var(--mono); font-size: 11px; font-weight: 400;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-dim); margin: 0;
}

/* ---------- signal chain strip ----------
   The diagram itself is self-contained in index.html; this is only the strip
   it sits in. Recessed against the plate so the drawing reads as an inset
   detail rather than as more page. */
.signal-diagram {
  background: var(--bg-3);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 30px 0 24px; overflow: hidden;
}

/* ---------- statement ----------
   padding-block, never the `padding` shorthand: these elements also carry
   .wrap, whose inline padding IS the content column. The shorthand zeroes it
   and the section slides out to the sheet's edge. Same for every rule below
   that targets a .wrap element. */
.statement-inner { padding-block: 54px 58px; }
/* The measure is wide on purpose. At 32ch this sat in 553px of a 1126px
   column, so the empty right half read as truncated text rather than as a
   margin — and it forced six lines with an orphan. 50ch is still a display
   measure, not body copy: it keeps the block to four lines and leaves a
   right margin that looks chosen. `ch` scales with the clamped font size, so
   it narrows with it and stops binding at phone widths. */
.statement {
  margin: 0; font-size: clamp(1.24rem, 2.5vw, 1.8rem);
  line-height: 1.45; letter-spacing: -0.018em; max-width: 50ch;
  font-weight: 400; text-wrap: pretty;
}
/* Emphasis lives here, not in the headline, so the page has one loud moment.
   A wash rather than an underline: on paper an underline reads as a link. */
.statement em {
  font-style: normal;
  box-shadow: inset 0 -0.34em 0 rgb(var(--accent-rgb) / 0.34);
}

/* ---------- domain rows ---------- */
.domain { border-bottom: 1px solid var(--line); }
.domain-projects + .domain { border-top: 1px solid var(--line); }
.domain-inner {
  display: grid; grid-template-columns: 64px 1fr auto;
  gap: 24px; align-items: center; padding-block: 24px;
}
.domain-glyph {
  width: 64px; height: 64px; display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  color: var(--accent);
}
.domain-glyph svg { width: 30px; height: 30px; display: block; }
.domain-text h3 {
  font-weight: 600; font-size: clamp(1.15rem, 2.4vw, 1.44rem);
  letter-spacing: -0.022em; margin: 0 0 2px;
}
.domain-text p { margin: 0; color: var(--ink-dim); font-size: 0.88rem; }
.domain-count {
  font-family: var(--mono); font-size: 13px; color: var(--ink-faint);
  letter-spacing: 0.1em;
}

/* ---------- glyphs come alive on hover ----------
   Each one does what its symbol actually does: the disconnector closes, the
   IC pulses, the prompt blinks. No row background change, because the rows
   are headings and shouldn't look clickable. */
.domain-glyph { transition: border-color 0.25s ease; }
.domain:hover .domain-glyph { border-color: rgb(var(--accent-rgb) / 0.65); }

.glyph-blade {
  transform-box: view-box; transform-origin: 8.1px 11.2px;
  transition: transform 0.4s cubic-bezier(0.34, 0.8, 0.3, 1);
}
.domain:hover .glyph-blade { transform: rotate(35deg); }

.glyph-chip { transform-box: fill-box; transform-origin: center; }
.domain:hover .glyph-chip { animation: chip-pulse 1.5s ease-in-out infinite; }
@keyframes chip-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}

.glyph-caret { opacity: 0; }
.domain:hover .glyph-caret { animation: caret 1.05s steps(1) infinite; }
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.domain-projects { padding-block: 24px 40px; }

/* ---------- project grid ----------
   Each card is a bordered detail cell, the way a drawing sheet parks its
   enlarged views. On the black theme these were borderless and the hairline
   gaps were the structure; on paper that reads as nothing at all, so the
   border comes back and the gap opens up. */
.projects {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
}
.project {
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 0 18px 16px;
  display: flex; flex-direction: column;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.project:hover {
  border-color: var(--line-2);
  box-shadow: 0 6px 20px -14px rgb(0 0 0 / 0.4);
}

/* ---------- project thumbnails ----------
   One schematic per project, drawn in the feeder's vocabulary: grey symbols
   carry the structure, a single amber element carries the point. No stock
   imagery — each one is the thing the project actually produces.

   Full bleed across the top of the cell via negative margins, so the drawing
   meets the cell's own border on three sides.

   The viewBox is 440x140 with preserveAspectRatio="slice", so width drives the
   scale and the strip shows a horizontal band through the middle of the box.
   Which band depends ENTIRELY on the strip's aspect ratio, not on its pixel
   height — so the height is derived from a ratio rather than fixed. 440/80
   shows viewBox y 30..110 at every card width; a fixed height re-crops the
   drawings every time the column changes and silently clips them.

   Keep drawing inside the y 38..106 band: that is the contract, and 30..110
   is the margin that absorbs the few existing schematics which stray a little
   past it. */
.thumb {
  display: block; width: calc(100% + 36px);
  aspect-ratio: 440 / 80; height: auto;
  margin: 0 -18px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--line-2);
  transition: color 0.25s ease;
}
.project:hover .thumb { color: var(--ink-faint); }

.th-acc { stroke: var(--accent); }
.th-acc-f { fill: var(--accent); stroke: none; }
.th-acc, .th-acc-f { transition: filter 0.25s ease; }
.project:hover .th-acc,
.project:hover .th-acc-f { filter: drop-shadow(0 0 5px rgb(var(--accent-rgb) / 0.85)); }
.th-fill { fill: var(--bg-3); }

/* Thumbnails whose amber idea is a measurement or a model output rather than
   a piece of plant carry .thumb-2 and switch to the second accent. Scrolling
   the work section then reads warm through Electrical Engineering and cool
   through Data Science, without a single label saying so. */
.thumb-2 .th-acc { stroke: var(--accent-2); }
.thumb-2 .th-acc-f { fill: var(--accent-2); }
.project:hover .thumb-2 .th-acc,
.project:hover .thumb-2 .th-acc-f { filter: drop-shadow(0 0 5px rgb(var(--accent-2-rgb) / 0.7)); }

/* The detail designation, the way a drawing numbers its views. Nothing counts
   them automatically — see the README before adding a card. */
.desig {
  display: block; margin: 14px 0 8px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em;
  color: var(--ink-faint);
}

.project h4 {
  font-weight: 600; font-size: 1.02rem; letter-spacing: -0.012em;
  margin: 0 0 8px; line-height: 1.28;
}
.project > p { color: var(--ink-dim); font-size: 0.86rem; margin: 0 0 16px; flex: 1; }

.stack { list-style: none; display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; }
.stack li {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
  color: var(--ink-dim); background: var(--bg-3);
  border: 1px solid var(--line); padding: 3px 7px; border-radius: var(--radius);
}

.project p.p-link { flex: 0 0 auto; margin: 14px 0 0; }
.p-link a {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  border-bottom: 1px solid transparent; transition: border-color 0.2s ease, color 0.2s ease;
}
.p-link a:hover { color: var(--accent-hi); border-bottom-color: var(--accent-hi); }
.p-link a span { display: inline-block; transition: transform 0.2s ease; }
.p-link a:hover span { transform: translateX(3px); }

/* ---------- project status + context ----------
   Designation on the left, status on the right, on one line above the title.
   Amber dot = still being built (the physical-side accent: work in the
   field), teal = finished and measured. */
.work-head { margin: 22px 0 24px; }
.work-head-2 { margin-top: 48px; }
.p-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 14px 0 8px;
}
.p-meta .desig { margin: 0; }
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-dim);
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.status-wip::before { background: var(--accent-mark); }
.status-done::before { background: var(--accent-2); }
.project > p.p-ctx {
  flex: 0 0 auto; margin: -6px 0 14px;
  font-family: var(--mono); font-size: 11px; color: var(--ink-faint);
}

/* ---------- rows: current learning, education, certifications ----------
   when | what | where, on hairlines. Plain text on purpose, so these never
   compete with the project cards. */
.learning { margin-top: 44px; }
.learning-title, .exp-sub {
  font-family: var(--mono); font-size: 11px; font-weight: 400;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint);
  margin: 0 0 10px;
}
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-2); }
.row {
  display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) auto; gap: 6px 20px;
  align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.row-when { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.row-what { color: var(--ink); font-size: 0.92rem; }
.row-where { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); text-align: right; }
.rows-tight .row { grid-template-columns: 6.5rem minmax(0, 1fr); padding: 9px 0; }
.rows-tight .row-where { grid-column: 2; text-align: left; }
.rows-tight .row-what { font-size: 0.88rem; }

/* ---------- experience ---------- */
.exp-body { padding-block: 46px 54px; }
.exp-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 34px;
}
.btn-note { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--ink-faint); margin-left: 6px; }
.exp-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px; }
.exp-col > .exp-sub:not(:first-child) { margin-top: 34px; }
.exp {
  position: relative; padding: 14px 0 18px;
  border-top: 1px solid var(--line-2);
}
.exp::before {
  content: ""; position: absolute; top: -2px; left: 0;
  width: 22px; height: 2px; background: var(--accent-mark);
}
.exp + .exp { margin-top: 6px; }
.exp-when { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); margin: 0 0 4px; }
.exp h5 { font-size: 1.02rem; font-weight: 600; margin: 0; color: var(--ink); letter-spacing: -0.01em; }
.exp-org { margin: 2px 0 10px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); }
.exp ul { margin: 0; padding-left: 1.05rem; }
.exp li { color: var(--ink-dim); font-size: 0.88rem; line-height: 1.55; margin-bottom: 6px; }
.exp li::marker { color: var(--line-2); }
.exp strong { color: var(--ink); font-weight: 600; }
.skills { margin: 0; border-top: 1px solid var(--line-2); }
.skills > div { padding: 11px 0; border-bottom: 1px solid var(--line); }
.skills dt { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); margin-bottom: 7px; }
.skills dd { margin: 0; color: var(--ink-dim); font-size: 0.88rem; }

@media (max-width: 900px) {
  .exp-grid { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 720px) {
  .row { grid-template-columns: 1fr; gap: 2px; }
  .row-where { text-align: left; }
  .rows-tight .row { grid-template-columns: 1fr; }
  .rows-tight .row-where { grid-column: 1; }
}

/* Five nav links do not fit beside the name on a phone; the two that are
   only a scroll away drop out first. */
@media (max-width: 560px) {
  .site-nav .nav-opt { display: none; }
}

/* Used by .avail-dot in the contact block — the only status signal left. */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgb(var(--live-rgb) / 0.45); }
  70% { box-shadow: 0 0 0 5px rgb(var(--live-rgb) / 0); }
  100% { box-shadow: 0 0 0 0 rgb(var(--live-rgb) / 0); }
}

/* ---------- publications ----------
   A real table, because it is real tabular data: the year and DOI columns are
   only useful if they line up down the page. Hairlines are the structure, no
   outer box. */
.pubs-body { padding-block: 46px 54px; }
.pubs-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 26px;
}
.pubs-title {
  font-weight: 600; font-size: clamp(1.3rem, 2.4vw, 1.56rem);
  line-height: 1.2; letter-spacing: -0.022em; margin: 0;
}
.pubs-head a {
  font-family: var(--mono); font-size: 12.5px; color: var(--accent);
  border-bottom: 1px solid rgb(var(--accent-rgb) / 0.4);
  transition: border-color 0.2s ease;
}
.pubs-head a:hover { border-bottom-color: var(--accent); }

/* The DOI column cannot wrap without looking broken, so on narrow screens the
   table scrolls inside its own box instead of forcing the page sideways. */
.table-scroll { overflow-x: auto; }

.pubs {
  width: 100%; border-collapse: collapse;
  font-size: 0.88rem; text-align: left;
}
.pubs th, .pubs td {
  padding: 13px 18px 13px 0; vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.pubs thead th {
  font-family: var(--mono); font-weight: 400; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-faint); padding-bottom: 10px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.pubs tbody tr { transition: background 0.2s ease; }
.pubs tbody tr:hover { background: var(--bg-3); }
.pubs tbody th {
  font-weight: 500; color: var(--ink); letter-spacing: -0.01em;
  min-width: 24ch; padding-left: 14px; padding-right: 26px;
  box-shadow: inset 3px 0 0 transparent; transition: box-shadow 0.2s ease;
}
.pubs tbody tr:hover th { box-shadow: inset 3px 0 0 var(--accent-mark); }
.pc-year {
  font-family: var(--mono); color: var(--ink-dim);
  white-space: nowrap; width: 1%;
}
.pc-venue { color: var(--ink-dim); min-width: 18ch; }
.pc-doi { width: 1%; }
.pc-doi a {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint);
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.pc-doi a:hover { color: var(--accent); border-bottom-color: var(--accent); }

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

/* ---------- writing ----------
   The home page shows the newest few and links out; articles/index.html reuses
   the same list for the full archive. Same rhythm as the publications block so
   the two closing sections read as a pair. */
.writing-body { padding-block: 46px 54px; }
.writing-head { margin-bottom: 26px; }
.writing-title {
  font-weight: 600; font-size: clamp(1.3rem, 2.4vw, 1.56rem);
  line-height: 1.2; letter-spacing: -0.022em; margin: 0;
}

.articles { list-style: none; margin: 0; padding: 0; }
.article-row { border-top: 1px solid var(--line); }
.article-row:first-child { border-top: 1px solid var(--line-2); }
.article-row:last-child { border-bottom: 1px solid var(--line); }
.article-row a {
  display: grid; grid-template-columns: 112px 1fr;
  column-gap: 24px; row-gap: 5px;
  padding: 20px 0; align-items: baseline;
  transition: opacity 0.2s ease;
}
.article-row a:hover { opacity: 0.72; }
/* build.mjs emits the date, title and summary as three SIBLINGS, not as a
   nested block — so the last two are placed into the second column explicitly
   or the summary wraps under the date. */
.article-row time {
  grid-column: 1; grid-row: 1;
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-faint);
}
.a-title {
  grid-column: 2; display: block;
  font-weight: 600; font-size: 1.06rem; letter-spacing: -0.018em;
}
.a-desc {
  grid-column: 2; display: block;
  color: var(--ink-dim); font-size: 0.88rem; max-width: 76ch;
}
.articles-empty {
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint); margin: 0;
  border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line);
  padding: 18px 0;
}
.articles-more { margin: 16px 0 0; font-family: var(--mono); font-size: 12.5px; }
.articles-more a {
  color: var(--accent); border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.articles-more a:hover { border-bottom-color: var(--accent); }
.articles-more a span { display: inline-block; transition: transform 0.2s ease; }
.articles-more a:hover span { transform: translateX(3px); }

/* ---------- closing: contact ----------
   The page's closing move, so it carries the hero's ruling rather than
   another plain column: an invitation on the left, the actual addresses on
   the right, with email promoted out of the list. */
.contact-body { position: relative; padding: 56px 0 60px; }
.contact-body::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 32px 100%;
  -webkit-mask-image: linear-gradient(transparent 8%, rgb(0 0 0 / 0.3) 46%, rgb(0 0 0 / 0.6) 100%);
  mask-image: linear-gradient(transparent 8%, rgb(0 0 0 / 0.3) 46%, rgb(0 0 0 / 0.6) 100%);
}
.contact-grid {
  position: relative;   /* lifts the content off the ruling above */
  display: grid; grid-template-columns: 1fr 460px; gap: 64px; align-items: start;
}

/* Availability pill. Reuses the teal "measured state" signal, so it reads as
   state rather than as a second accent. */
.avail {
  display: inline-flex; align-items: center; gap: 9px; margin: 0 0 18px;
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--accent-2);
  border: 1px solid rgb(var(--accent-2-rgb) / 0.35); border-radius: 20px;
  padding: 4px 12px;
}
.avail-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--live);
  animation: pulse 2.2s ease-out infinite;
}

/* Display scale, same as the hero: this is a closing statement, not a
   subheading over a list. */
.contact-title {
  font-weight: 600; font-size: clamp(1.9rem, 4.2vw, 2.7rem);
  line-height: 1.06; letter-spacing: -0.035em; margin: 0 0 12px;
  max-width: 9ch; text-wrap: balance;
}
.contact-meta {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-faint);
  margin: 22px 0 0;
}

/* ---------- email panel ----------
   The one primary action on the page, so it gets the ink border every other
   box on the sheet does not, plus the portrait's corner brackets on hover. */
.mail { position: relative; }
.mail::before, .mail::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  pointer-events: none; opacity: 0; transition: opacity 0.22s ease;
}
.mail::before {
  top: -5px; left: -5px;
  border-top: 2px solid var(--accent-mark); border-left: 2px solid var(--accent-mark);
}
.mail::after {
  bottom: -5px; right: -5px;
  border-bottom: 2px solid var(--accent-mark); border-right: 2px solid var(--accent-mark);
}
.mail:hover::before, .mail:hover::after,
.mail:focus-within::before, .mail:focus-within::after { opacity: 1; }

.mail-link {
  display: block; padding: 20px 22px 18px;
  background: var(--bg-2); border: 1px solid var(--ink);
  border-radius: var(--radius);
  transition: box-shadow 0.22s ease;
}
.mail-link:hover { box-shadow: 0 12px 30px -20px rgb(0 0 0 / 0.75); }
.mail-addr {
  display: block; margin: 7px 0 12px;
  font-family: var(--mono); font-size: clamp(0.92rem, 2vw, 1.04rem);
  color: var(--ink); letter-spacing: -0.015em; word-break: break-all;
}
.mail-go {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 12.5px; color: var(--accent);
}
.mail-go span { transition: transform 0.2s ease; }
.mail-link:hover .mail-go span { transform: translateX(4px); }

/* Rendered hidden; assets/main.js reveals it only where the clipboard API
   is actually available. */
.mail-copy {
  position: absolute; top: 12px; right: 12px;
  font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-faint);
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: 4px 9px; cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.mail-copy:hover { color: var(--ink); border-color: var(--ink-faint); }
.mail-copy[data-done] { color: var(--live); border-color: rgb(var(--live-rgb) / 0.5); }

/* ---------- profile rows ----------
   Hairline rows, so the email panel above stays the only filled thing here. */
.contact-links {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: flex; flex-direction: column;
  border-bottom: 1px solid var(--line);
}
.contact-links li { border-top: 1px solid var(--line); }
.contact-links a {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; padding: 14px 12px 14px 2px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.contact-links a:hover { background: var(--bg-3); box-shadow: inset 3px 0 0 var(--accent-mark); }
.contact-links a::after {
  content: "\2197"; font-family: var(--mono); font-size: 12px;
  color: var(--accent); opacity: 0.35;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.contact-links a:hover::after { opacity: 1; transform: translate(2px, -2px); }
.cc-k {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--ink-faint); flex: 0 0 auto;
}
.cc-v {
  font-family: var(--mono); font-size: 0.82rem; color: var(--ink);
  margin-left: auto; text-align: right; word-break: break-word;
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line-2); background: var(--band); padding: 20px 0; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; font-size: 13.5px; color: var(--ink-dim);
}
.footer-meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }
/* The separator in the footer meta is a link to the private working document.
   It inherits everything so it stays punctuation to the eye — no colour, no
   underline, no pointer — and only the focus ring gives it away, which is the
   one case where hiding it would be wrong. */
.footer-dot {
  color: inherit; text-decoration: none; cursor: default;
  padding: 0 2px; margin: 0 -2px;
}
.footer-dot:hover { color: inherit; }
.footer-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================================
   Article pages (articles/*.html)
   ============================================================ */
.post { padding: 56px 0 72px; }
.post-inner { max-width: 660px; margin: 0 auto; }
.post-back {
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
  display: inline-block; margin-bottom: 28px;
}
.post-back:hover { color: var(--ink); }
.post-meta {
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
  display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 14px;
}
.post h1 {
  font-weight: 600; font-size: clamp(1.7rem, 3.4vw, 2.2rem);
  line-height: 1.18; letter-spacing: -0.028em; margin: 0 0 26px;
}
.post-body { font-size: 1.02rem; }
.post-body p { color: var(--ink-dim); margin: 0 0 20px; }
.post-body h2 {
  font-weight: 600; font-size: 1.18rem; color: var(--ink);
  letter-spacing: -0.012em; margin: 36px 0 14px;
}
.post-body ul, .post-body ol { color: var(--ink-dim); margin: 0 0 20px; padding-left: 22px; }
.post-body li { margin-bottom: 8px; }
.post-body a { color: var(--accent); border-bottom: 1px solid rgb(var(--accent-rgb) / 0.4); }
.post-body a:hover { border-bottom-color: var(--accent); }
.post-body code {
  font-family: var(--mono); font-size: 0.88em;
  background: var(--bg-3); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: var(--radius);
}
.post-body pre {
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  overflow-x: auto; margin: 0 0 20px;
}
.post-body pre code { background: none; border: none; padding: 0; }

/* Code blocks with a copy button.
   The wrapper owns the margin so the bar and the <pre> read as one object, and
   the <pre> loses its own bottom margin and its top corners. The bar is only
   rendered for fenced blocks, so an indented code block still styles as before. */
.code-wrap { margin: 0 0 20px; }
.code-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 34px;
  padding: 0 12px 0 18px;
  background: var(--bg-2); border: 1px solid var(--line); border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
.code-lang {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-faint);
}
/* Pushes the button right when the fence declared no language. */
.code-bar > .code-copy:only-child { margin-left: auto; }
.code-copy {
  font-family: var(--mono); font-size: 11.5px;
  color: var(--ink-dim); background: none;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 3px 10px; cursor: pointer;
}
.code-copy:hover { color: var(--ink); border-color: var(--ink-faint); }
.code-copy[data-done] { color: var(--accent); border-color: var(--accent); }
.code-wrap pre {
  margin: 0; border-radius: 0 0 var(--radius) var(--radius);
}
.post-body blockquote {
  margin: 0 0 20px; padding-left: 18px;
  border-left: 2px solid var(--accent-mark); color: var(--ink-faint);
}
.post-body img { max-width: 100%; height: auto; border-radius: var(--radius); }
.post-body h3 {
  font-weight: 600; font-size: 1.02rem; color: var(--ink);
  letter-spacing: -0.012em; margin: 28px 0 10px;
}
.post-body strong { color: var(--ink); font-weight: 600; }
.post-body hr { border: 0; border-top: 1px solid var(--line); margin: 34px 0; }

/* Markdown tables get the same hairline treatment as .pubs — structure from
   rules, no outer box. The build wraps each one in .table-scroll, so a table
   too wide for the 660px column scrolls inside itself instead of pushing the
   whole page sideways. */
.post-body .table-scroll { margin: 0 0 20px; }
.post-body table {
  width: 100%; border-collapse: collapse;
  font-size: 0.87rem; text-align: left;
}
.post-body th, .post-body td {
  padding: 10px 16px 10px 0; vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.post-body thead th {
  font-family: var(--mono); font-weight: 400; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-faint); white-space: nowrap;
  border-bottom: 1px solid var(--line-2);
}
.post-body tbody td { color: var(--ink-dim); }
.post-body tbody td:first-child { color: var(--ink); white-space: nowrap; }
.post-body tbody td code { white-space: nowrap; }

/* ---------- scroll reveal ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.5s ease, transform 0.5s ease; }
  .reveal.in { opacity: 1; transform: none; }

  /* Cards in a grid arrive in sequence rather than as one block. */
  .projects .project:nth-child(2) { transition-delay: 0.07s; }
  .projects .project:nth-child(3) { transition-delay: 0.14s; }
  .projects .project:nth-child(4) { transition-delay: 0.21s; }
}

/* ---------- responsive ----------
   The sheet loses its paper margin and border first, because on a phone the
   frame is just wasted width. */
@media (max-width: 1100px) {
  :root { --pad: 40px; }
}
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 32px; }
  .hero-photo { order: -1; display: flex; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
  .hero-photo img { width: 160px; height: 160px; }
  .titleblock { margin-top: 0; flex: 1 1 260px; align-self: flex-start; }
  .contact-grid { grid-template-columns: 1fr; gap: 34px; }
  .contact-title { max-width: 14ch; }
}
@media (max-width: 720px) {
  :root { --pad: 24px; }
  .sheet { margin: 0; border: none; }
  .projects { grid-template-columns: 1fr; }

  /* stacked: each item keeps its own top rule and tick, no vertical dividers */
  .now { grid-template-columns: 1fr; border-top: none; }
  .now-item { padding: 16px 0 4px; border-top: 1px solid var(--line-2); }
  .now-item + .now-item { padding-left: 0; border-left: none; }
  .now-item + .now-item::before { left: 0; }
  .domain-inner { grid-template-columns: 44px 1fr auto; gap: 18px; padding-block: 22px; }
  .domain-glyph { width: 44px; height: 44px; }
  .domain-glyph svg { width: 20px; height: 20px; }
  .domain-projects { padding-block: 22px 34px; }
  .statement-inner { padding-block: 42px 46px; }
  .article-row a { grid-template-columns: 1fr; row-gap: 4px; }
  .article-row time, .a-title, .a-desc { grid-column: 1; }
}
@media (max-width: 620px) {
  :root { --pad: 20px; }
  .site-nav { gap: 14px; }
  /* portrait over title block, not beside it */
  .hero-photo { flex-direction: column; gap: 16px; }
  .titleblock { flex: none; width: 100%; max-width: 320px; }
  .hero { padding: 44px 0 40px; }
  .hero-photo img { width: 120px; height: 120px; }
  .section { padding: 48px 0; }
  .pubs-body, .writing-body { padding-block: 40px 46px; }
  /* stacked label over value, with the arrow parked in the corner instead of
     becoming a third line */
  .contact-links a {
    position: relative; flex-direction: column; align-items: flex-start;
    gap: 3px; padding-right: 36px;
  }
  .cc-v { text-align: left; margin-left: 0; }
  .contact-links a::after { position: absolute; top: 13px; right: 12px; }
  .contact-body { padding: 44px 0 52px; }
  .footer-inner { flex-direction: column; gap: 8px; text-align: center; }
}

/* ---------- study notes ----------
   The second voice in an article: the site's own notes, written while studying,
   in a different register from the body around them. Authored as a fenced
   container in markdown (`::: nota` … `:::`) rather than raw HTML, so writing
   one costs a line — see scripts/markdown.mjs.

   It is an <aside role="note"> carrying its own label, so a screen reader
   announces one landmark and reads the label as part of it. That is why there
   is no <h2> above it in the markdown: a heading plus a labelled aside says the
   same thing twice.

   The left rule is the measurement teal rather than the amber, matching the
   accent rule in style.css: a note is the measured side of the page, not the
   physical one. */
.study-note {
  margin: 28px 0;
  padding: 18px 22px 4px;
  background: var(--bg-3);
  border-left: 3px solid var(--accent-2);
}
.study-note-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 10px;
}
/* The note's own body is a touch smaller and darker than the article's, so the
   change of voice is legible before you read a word of it. */
.study-note p,
.study-note li {
  color: var(--ink);
  font-size: 0.95rem;
}
.study-note > :last-child { margin-bottom: 14px; }
.study-note pre { background: var(--bg-2); }

/* ---------- math ----------
   KaTeX ships its own stylesheet; everything here is the seam between it and
   the sheet. Only articles with `math: true` load it at all.

   A display formula wider than the 660px article column scrolls inside its own
   box, exactly like a wide table — the page body must never scroll sideways on
   a phone. overflow-y stays visible so tall constructs (fractions, big
   operators) are not clipped by the horizontal scroller. */
.post-body .katex-display {
  overflow-x: auto;
  overflow-y: visible;
  padding: 6px 0 10px;
  margin: 22px 0;
}
/* KaTeX renders both an HTML copy and a MathML one; the MathML is for screen
   readers and is hidden visually by KaTeX's own CSS. Do not "fix" a perceived
   duplicate by hiding .katex-mathml — that is the accessible copy. */
.post-body .katex { font-size: 1.05em; }
.study-note .katex { font-size: 1em; }

/* ---------- series index ----------
   The running order of a multi-part series, including the parts that are not
   written yet. An unwritten entry is a <div> rather than an <a>, so there is no
   dead link to click, and the status chip says which is which. */
.serie { list-style: none; margin: 28px 0 0; padding: 0; counter-reset: none; }
.serie-row { border-top: 1px solid var(--line); margin: 0; }
.serie-row:last-child { border-bottom: 1px solid var(--line); }
.serie-row > a,
.serie-row > div {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  grid-template-areas: "n title estado" ". desc .";
  gap: 2px 12px;
  padding: 16px 4px;
  align-items: baseline;
}
.serie-row > a { transition: background 0.15s ease; }
.serie-row > a:hover { background: var(--bg-3); }
.serie-n {
  grid-area: n;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
}
.serie-title { grid-area: title; font-weight: 600; font-size: 0.98rem; }
.serie-row > div .serie-title { color: var(--ink-faint); }
.serie-desc {
  grid-area: desc;
  color: var(--ink-dim);
  font-size: 0.9rem;
  max-width: 60ch;
}
.serie-estado {
  grid-area: estado;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border: 1px solid var(--line-2);
  padding: 3px 7px;
  white-space: nowrap;
}
.serie-estado[data-estado="publicado"] { color: var(--accent-2); border-color: var(--accent-2); }
.serie-estado[data-estado="en-revision"] { color: var(--accent); border-color: var(--accent); }

.page-lede {
  color: var(--ink-dim);
  font-size: 1.05rem;
  max-width: 60ch;
  /* The body starts right after, so the lede needs its own bottom margin or the
     two run together as one block of text. */
  margin: 10px 0 26px;
}

@media (max-width: 560px) {
  /* The status chip drops under the title rather than squeezing it to a
     two-word column. */
  .serie-row > a,
  .serie-row > div {
    grid-template-columns: 30px 1fr;
    grid-template-areas: "n title" ". desc" ". estado";
    gap: 4px 10px;
  }
  .serie-estado { justify-self: start; margin-top: 4px; }
  .study-note { padding: 16px 16px 2px; }
}

/* ---------- wide elements break out of the measure ----------
   The article column is 660px because that is roughly 66 characters, which is
   where prose is comfortable to read. Tables, formulas and figures are not
   prose and 660px starves them — a six-column table wraps into unreadable
   stacks and a display equation gets a scrollbar it should not need.

   So the measure stays 660px for text and only these three break out of it,
   symmetrically. The bleed is derived from the sheet, not hardcoded: it is
   half the slack between the sheet's content width and the measure, floored at
   0 so it collapses on a phone and capped at 140px so a very wide monitor does
   not fling a table out to the sheet's edges.

   100vw can include the scrollbar in some browsers, which overestimates the
   slack by a few pixels. That is safe here: the overshoot is absorbed by the
   wrap's own padding long before it reaches the viewport edge. */
.post-body {
  --bleed: clamp(
    0px,
    calc((min(var(--sheet-w), 100vw) - 2 * var(--pad) - 660px) / 2),
    140px
  );
}
.post-body > .table-scroll,
.post-body > .katex-display,
.post-body > figure {
  width: calc(100% + 2 * var(--bleed));
  margin-left: calc(-1 * var(--bleed));
  margin-right: calc(-1 * var(--bleed));
}

/* ---------- figures ----------
   The generated SVGs sit on the plate with a hairline, like the sheet itself.
   The caption keeps the prose measure even when the figure is wider, because a
   caption is prose and inherits the same reason for the 660px limit. */
.post-body figure.fig { margin-block: 34px; }
.fig img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
}
.fig figcaption {
  margin: 12px auto 0;
  max-width: 62ch;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-faint);
}

/* A display formula is the one thing on the page that should never be cramped
   against the text above it. */
.post-body .katex-display { margin-block: 26px; }

@media (max-width: 720px) {
  .fig figcaption { font-size: 0.84rem; }
  .post-body figure.fig { margin-block: 26px; }
}

/* ---------- language chip in the archive ----------
   The archive lists articles in more than one language and each one exists in
   exactly one, so the language is a property of the row rather than something a
   switcher could change. The chip says which before the reader commits to a
   click.

   It shows on every row, not only on the odd one out: a marker that appears
   sometimes reads as "this one is special" rather than as "this is the
   language". */
.a-lang {
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border: 1px solid var(--line-2);
  padding: 2px 6px;
  line-height: 1.4;
}

@media (max-width: 640px) {
  /* The date column collapses on a phone, so the chip rides beside the date
     instead of under it. */
  .a-lang {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
  }
}

/* ---- Series navigation inside an article -------------------------------
   The crumb sits under the date; the nav closes the article. Both only render
   for articles whose slug appears in a series manifest, so a standalone piece
   is untouched. The nav keeps three grid columns even when a neighbour is
   missing, so "Siguiente" stays on the right in the last article of a series. */
.serie-crumb {
  margin: 6px 0 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-dim);
}
.serie-crumb a { color: var(--accent); }
.serie-crumb a:hover { color: var(--accent-hi); }
.serie-crumb-pos { color: var(--ink-faint); }
.serie-crumb-pos::before { content: "· "; }

.serie-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px 20px;
  align-items: start;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line-2);
}
.serie-nav > * { min-width: 0; }
.serie-nav-next { text-align: right; }
.serie-nav-up {
  align-self: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.serie-nav-up:hover { color: var(--ink); }
.serie-nav-prev,
.serie-nav-next { display: block; }
.serie-nav-dir {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-bottom: 4px;
}
.serie-nav-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.35;
}
a.serie-nav-prev:hover .serie-nav-title,
a.serie-nav-next:hover .serie-nav-title { color: var(--accent-hi); }

@media (max-width: 560px) {
  .serie-nav { grid-template-columns: 1fr; }
  .serie-nav-next { text-align: left; }
  .serie-nav-up { justify-self: start; }
  .serie-nav .is-empty { display: none; }
}

/* ---- Table of contents -------------------------------------------------
   Only rendered for articles with enough top-level sections to be worth
   jumping around in; the threshold is TOC_MIN_HEADINGS in scripts/build.mjs.
   Numbered because the reference articles get read in order the first time and
   by section afterwards, and a number is what someone quotes back. */
.post-toc {
  margin: 28px 0 8px;
  padding: 16px 20px 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.post-toc-title {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.post-toc ol {
  margin: 0;
  padding-left: 22px;
  columns: 2;
  column-gap: 28px;
}
.post-toc li {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--ink-dim);
  break-inside: avoid;
}
.post-toc a { color: var(--accent); }
.post-toc a:hover { border-bottom: 1px solid var(--accent); }

/* Room above a heading that was jumped to, so it does not land flush at the
   top edge of the viewport. */
.post-body h2[id] { scroll-margin-top: 24px; }

@media (max-width: 560px) {
  .post-toc ol { columns: 1; }
}


/* ============================================================
   HOME · EDITORIAL (body.home.ed)
   A technical-journal page: warm paper with a faint dot screen, a serif
   display face (Newsreader) over the Plex pair the rest of the site uses,
   navy as the one strong ground and a rust accent for kickers and marks.
   Every rule is scoped under .ed, so article pages are untouched.
   ============================================================ */
.ed {
  --ed-paper: #f4f1ea;
  --ed-paper-2: #ebe6da;     /* tinted panels on paper */
  --ed-rule: #c8c1b2;        /* hairlines on paper */
  --ed-ink: #1b1d22;
  --ed-ink-dim: #4a4d55;     /* 7.6:1 on paper */
  --ed-ink-faint: #6b665c;   /* 5.0:1 on paper */
  --ed-navy: #14284B;
  --ed-rust: #a4471f;        /* 5.3:1 on paper: text-safe */
  --ed-rust-soft: #e8b49c;   /* on navy only */
  --ed-on-navy: #f4f1ea;
  --ed-on-navy-dim: #c9cfdb;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  background-color: var(--ed-paper);
  background-image: radial-gradient(rgba(20, 40, 75, 0.05) 1px, transparent 1px);
  background-size: 4px 4px;
  color: var(--ed-ink);
}
.ed a { color: inherit; }
.ed :focus-visible { outline: 2px solid var(--ed-rust); outline-offset: 3px; }
.ed-wrap { max-width: 1240px; margin: 0 auto; padding: 0 40px; box-sizing: border-box; }

/* ---------- masthead ---------- */
.ed-head { border-bottom: 2px solid var(--ed-navy); }
.ed-head-inner {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px 24px; flex-wrap: wrap; padding-block: 14px;
}
.ed-brand { font-family: var(--serif); font-size: 1.6rem; color: var(--ed-navy); letter-spacing: -0.01em; }
.ed-nav { display: flex; flex-wrap: wrap; gap: 0 22px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; }
.ed-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ed-navy); }
.ed-nav a:hover { color: var(--ed-rust); }
.ed-nav .ed-nav-cv { color: var(--ed-rust); }

/* ---------- hero ---------- */
.ed-hero { padding-block: 60px 72px; }
.ed-hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: 64px; align-items: end;
}
.ed-kicker {
  margin: 0 0 22px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ed-rust);
}
.ed-title {
  margin: 0 0 26px; font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.6rem, 6vw, 4.8rem); line-height: 1.02; letter-spacing: -0.02em;
  color: var(--ed-navy); text-wrap: balance;
}
.ed-title em { font-style: italic; }
.ed-lede { margin: 0; font-size: 1.12rem; line-height: 1.7; color: var(--ed-ink-dim); max-width: 54ch; text-wrap: pretty; }
.ed-facts {
  margin: 30px 0 0; padding-top: 18px; border-top: 1px solid var(--ed-rule);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 20px;
}
.ed-facts dt { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ed-ink-faint); }
.ed-facts dd { margin: 6px 0 0; font-family: var(--serif); font-size: 1.22rem; line-height: 1.28; }

.ed-portrait { margin: 0; justify-self: end; width: 100%; max-width: 400px; }
.ed-portrait-frame { position: relative; display: block; }
.ed-portrait-frame::before {
  content: ""; position: absolute; inset: 18px -18px -18px 18px; background: var(--ed-navy);
}
.ed-portrait img {
  position: relative; display: block; width: 100%; height: auto; aspect-ratio: 4 / 5;
  object-fit: cover; filter: grayscale(1) contrast(1.08);
}
.ed-portrait figcaption { margin-top: 30px; font-family: var(--mono); font-size: 11px; color: var(--ed-ink-faint); }

/* ---------- section heads with the big outlined numeral ---------- */
.ed-sec-head { display: flex; align-items: flex-end; gap: 22px; margin-bottom: 34px; flex-wrap: wrap; }
.ed-sec-head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(2.2rem, 4vw, 3rem); color: var(--ed-navy); line-height: 1; }
.ed-sec-head p { margin: 8px 0 0; font-size: 0.95rem; color: var(--ed-ink-dim); }
.ed-num {
  font-family: var(--serif); font-size: clamp(5.5rem, 10vw, 9rem); line-height: 0.8;
  color: transparent; -webkit-text-stroke: 1px var(--ed-navy);
}
.ed-num--sm { font-size: 6.5rem; display: block; }
.ed-sec-head--light h2 { color: var(--ed-on-navy); }
.ed-sec-head--light p { color: var(--ed-on-navy-dim); }
.ed-sec-head--light .ed-num { -webkit-text-stroke-color: var(--ed-on-navy); }

/* ---------- 01 projects: navy section, animated figure + list ---------- */
.ed-projects { background: var(--ed-navy); color: var(--ed-on-navy); padding-block: 72px 80px; }
.pj { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 44px; align-items: start; }
.pj-fig { margin: 0; position: sticky; top: 24px; }
.pj-svg {
  display: block; width: 100%; height: auto; background: var(--ed-paper);
  box-shadow: 0 28px 50px -28px rgba(0, 0, 0, 0.7);
}
.pj-cap { margin-top: 12px; font-family: var(--mono); font-size: 11px; color: var(--ed-on-navy-dim); }

.pj-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(244, 241, 234, 0.3); }
.pj-item { border-bottom: 1px solid rgba(244, 241, 234, 0.3); transition: background 0.3s ease; }
.pj-item.is-on { background: rgba(244, 241, 234, 0.07); }
.pj-btn {
  position: relative; display: flex; flex-direction: column; gap: 7px; width: 100%;
  padding: 22px 20px 20px; background: none; border: 0; text-align: left;
  color: inherit; font: inherit; cursor: pointer;
}
.pj-meta { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ed-rust-soft); }
.pj-title { font-family: var(--serif); font-size: 1.65rem; line-height: 1.12; color: var(--ed-on-navy); }
.pj-text { font-size: 0.95rem; line-height: 1.6; color: var(--ed-on-navy-dim); }
.pj-keys { font-family: var(--mono); font-size: 11.5px; color: var(--ed-on-navy-dim); }
/* inactive items stay short: the description only opens on the active one */
.pj-item:not(.is-on) .pj-text, .pj-item:not(.is-on) .pj-keys { display: none; }
.pj-item:not(.is-on) .pj-title { color: var(--ed-on-navy-dim); }
.pj-btn:hover .pj-title { color: var(--ed-on-navy); }
/* the auto-advance timer, drawn as a rust rule across the top of the active item */
.pj-bar { position: absolute; left: 0; top: -1px; height: 2px; width: 100%; background: var(--ed-rust-soft); transform: scaleX(0); transform-origin: 0 50%; }
.pj-item.is-on .pj-bar { animation: pj-timer var(--pj-dur, 7s) linear forwards; }
.pj[data-paused] .pj-item.is-on .pj-bar { animation-play-state: paused; }
@keyframes pj-timer { to { transform: scaleX(1); } }
.pj-link { display: inline-block; margin: -6px 20px 18px; font-family: var(--mono); font-size: 12px; color: var(--ed-on-navy); }
.pj-item:not(.is-on) .pj-link { display: none; }

/* the figure: only the active scene shows; its animations restart on entry */
.pj-svg .scene { opacity: 0; transition: opacity 0.45s ease; }
.pj-fig[data-active="0"] .scene-0,
.pj-fig[data-active="1"] .scene-1,
.pj-fig[data-active="2"] .scene-2 { opacity: 1; }
.pj-svg path, .pj-svg ellipse { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pj-svg .st { stroke: #9aa1ac; stroke-width: 2; }
.pj-svg .faint { opacity: 0.5; }
.pj-svg .dashd { stroke-dasharray: 5 6; }
.pj-svg .lbl { fill: #6b665c; font: 12px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.08em; }
/* scene 0 */
.pj-svg .nodes circle { fill: var(--ed-paper); stroke: #9aa1ac; stroke-width: 2; }
.pj-svg .sensor { fill: var(--ed-paper); stroke: var(--ed-navy); stroke-width: 2; }
.pj-svg .msg { stroke: var(--ed-navy); stroke-width: 3; stroke-dasharray: 0.04 0.1; opacity: 0; }
.pj-svg .prob { fill: rgba(164, 71, 31, 0.12); stroke: var(--ed-rust); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
.pj-svg .ring { fill: none; stroke: var(--ed-rust); stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.pj-svg .hit { fill: var(--ed-rust); opacity: 0; }
/* scene 1: point-to-multipoint */
.pj-svg .cov { fill: none; stroke: var(--ed-rust); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
.pj-svg .lnk { stroke: var(--ed-navy); stroke-width: 1.4; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: .55; }
.pj-svg .pkt { stroke: var(--ed-rust); stroke-width: 3; stroke-dasharray: 0.05 0.95; stroke-dashoffset: 1; opacity: 0; }
.pj-svg .host { fill: var(--ed-paper); stroke: #9aa1ac; stroke-width: 2; }
.pj-svg .mast { stroke: var(--ed-navy); stroke-width: 2.2; }
.pj-svg .gw { fill: var(--ed-rust); stroke: none; }
/* scene 2 */
.pj-svg .climb { stroke: var(--ed-navy); stroke-width: 2.6; stroke-dasharray: 1; stroke-dashoffset: 1; }
.pj-svg .fall { stroke: var(--ed-navy); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; }
.pj-svg .burst, .pj-svg .burst-c { stroke: var(--ed-rust); stroke-width: 2.4; opacity: 0; }
.pj-svg .burst-c { fill: var(--ed-paper); }
.pj-svg .payload path, .pj-svg .payload-static path { stroke: var(--ed-navy); stroke-width: 1.8; }
.pj-svg .payload rect, .pj-svg .payload-static rect { fill: var(--ed-navy); }
.pj-svg .payload { opacity: 0; }
.pj-svg .payload-static { display: none; }

/* .run is added to a scene each time it becomes active (JS), restarting these */
.scene-0.run .msg { animation: pj-fade 0.3s ease forwards, pj-flow 1.1s linear infinite; }
.scene-0.run .msg-2 { animation-delay: 0.4s, 0.4s; }
.scene-0.run .p1 { animation: pj-grow 0.6s ease-out 1.6s forwards; }
.scene-0.run .p2 { animation: pj-grow 0.6s ease-out 2.2s forwards; }
.scene-0.run .ring { animation: pj-ring 1.8s ease-out 2.8s infinite; }
.scene-0.run .hit { animation: pj-fade 0.3s ease 2.6s forwards; }
.scene-1.run .cov { animation: pj-cov 2.7s ease-out infinite; }
.scene-1.run .c2 { animation-delay: 0.9s; }
.scene-1.run .c3 { animation-delay: 1.8s; }
.scene-1.run .lnk { animation: pj-draw 0.45s ease-out var(--d) forwards; }
.scene-1.run .host { animation: pj-host 0.3s ease var(--d) forwards; }
.scene-1.run .pkt { animation: pj-fade 0.2s ease var(--d) forwards, pj-uplink 1.3s linear var(--d) infinite; }
.scene-2.run .climb { animation: pj-draw 1.4s ease-in 0.2s forwards; }
.scene-2.run .burst-c, .scene-2.run .burst { animation: pj-fade 0.2s ease 1.6s forwards; }
.scene-2.run .fall { animation: pj-draw 2.4s ease-out 1.8s forwards; }
.scene-2.run .payload { animation: pj-fade 0.2s ease 1.8s forwards; }

@keyframes pj-fade { to { opacity: 1; } }
@keyframes pj-flow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -0.14; } }
@keyframes pj-grow { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: scale(1); } }
@keyframes pj-ring { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(2.4); } }
@keyframes pj-draw { to { stroke-dashoffset: 0; } }
@keyframes pj-emit { 0% { opacity: 0; } 20% { opacity: 1; } 70%, 100% { opacity: 0; } }
@keyframes pj-cov { 0% { opacity: .8; transform: scale(.3); } 100% { opacity: 0; transform: scale(5.2); } }
@keyframes pj-host { to { fill: var(--ed-navy); stroke: var(--ed-navy); } }
@keyframes pj-uplink { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* reduced motion: every scene shows its finished state, nothing moves */
@media (prefers-reduced-motion: reduce) {
  .pj-svg .msg, .pj-svg .hit, .pj-svg .burst, .pj-svg .burst-c, .pj-svg .prob { opacity: 1; }
  .pj-svg .lnk, .pj-svg .climb, .pj-svg .fall { stroke-dashoffset: 0; }
  .pj-svg .host { fill: var(--ed-navy); stroke: var(--ed-navy); }
  .pj-svg .payload { display: none; }
  .pj-svg .payload-static { display: inline; }
  .pj-item.is-on .pj-bar { display: none; }
}

.ed-learning { margin-top: 56px; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.ed-learning h3 { margin: 0; font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ed-rust-soft); padding-top: 4px; }
.ed-learning ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(244, 241, 234, 0.3); }
.ed-learning li {
  display: flex; justify-content: space-between; gap: 6px 20px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px solid rgba(244, 241, 234, 0.3);
}
.ed-learning li span:first-child { font-family: var(--serif); font-size: 1.15rem; }
.ed-learning li span:last-child { font-family: var(--mono); font-size: 11.5px; color: var(--ed-on-navy-dim); }

/* ---------- 02 experience + 03 research ---------- */
.ed-two {
  padding-block: 80px 88px;
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 64px; align-items: start;
}
.ed-jobs { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--ed-rule); }
.ed-jobs > li {
  display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 18px;
  padding: 18px 0; border-top: 1px solid var(--ed-rule);
}
.ed-year { font-family: var(--serif); font-size: 1.9rem; line-height: 1; color: var(--ed-navy); }
.ed-year--now { color: var(--ed-rust); }
.ed-jobs strong { display: block; font-weight: 600; font-size: 1.02rem; }
.ed-org { display: block; color: var(--ed-ink-dim); font-size: 0.95rem; margin-top: 2px; }
.ed details > summary {
  cursor: pointer; list-style: none; margin-top: 8px; display: inline-flex; align-items: center; gap: 8px;
  min-height: 32px; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; color: var(--ed-navy);
}
.ed details > summary::-webkit-details-marker { display: none; }
.ed details > summary::before { content: "+"; display: inline-block; width: 12px; color: var(--ed-rust); }
.ed details[open] > summary::before { content: "−"; }
.ed-jobs details ul { margin: 6px 0 4px; padding-left: 1.05rem; }
.ed-jobs details li { color: var(--ed-ink-dim); font-size: 0.93rem; line-height: 1.6; margin-bottom: 6px; }
.ed-jobs details li::marker { color: var(--ed-rust); }

.ed-more { margin-top: 18px; }
.ed-more > summary { font-size: 12px; }
.ed-more-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 28px; }
.ed-more h3 { margin: 18px 0 8px; font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ed-ink-faint); }
.ed-more h3:first-child { margin-top: 0; }
/* reuse the existing rows / skills / stack markup, re-inked for paper */
.ed .rows { border-top-color: var(--ed-rule); }
.ed .row { border-bottom-color: var(--ed-rule); }
.ed .rows-tight .row { grid-template-columns: 6rem minmax(0, 1fr); }
.ed .row-when { color: var(--ed-ink-faint); }
.ed .row-what { color: var(--ed-ink); }
.ed .row-where { color: var(--ed-ink-dim); }
.ed .row-what a.cred { color: var(--ed-navy); border-bottom: 1px solid var(--ed-rule); }
.ed .row-what a.cred:hover { color: var(--ed-rust); border-bottom-color: var(--ed-rust); }
.ed .skills { border-top-color: var(--ed-rule); }
.ed .skills > div { border-bottom-color: var(--ed-rule); }
.ed .skills dt { color: var(--ed-ink-faint); }
.ed .skills dd { color: var(--ed-ink-dim); }
.ed .stack li { background: rgba(255, 255, 255, 0.55); border-color: var(--ed-rule); color: var(--ed-ink-dim); }

.ed-research {
  background: var(--ed-paper-2); padding: 34px;
  box-shadow: 0 1px 0 #ffffff inset, 0 18px 30px -22px rgba(20, 40, 75, 0.45);
}
.ed-research h2 { margin: 10px 0 8px; font-family: var(--serif); font-weight: 400; font-size: 2.1rem; color: var(--ed-navy); }
.ed-research > p { margin: 0 0 16px; line-height: 1.6; color: var(--ed-ink-dim); }
.ed-research-links { display: flex; gap: 20px; flex-wrap: wrap; font-family: var(--mono); font-size: 12px; }
.ed-research-links a { color: var(--ed-navy); border-bottom: 1px solid var(--ed-rule); }
.ed-research-links a:hover { color: var(--ed-rust); border-bottom-color: var(--ed-rust); }
.ed-papers ol { list-style: none; margin: 10px 0 0; padding: 0; }
.ed-papers li { padding: 10px 0; border-top: 1px solid var(--ed-rule); display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 2px 10px; }
.ed-papers .pp-year { font-family: var(--mono); font-size: 11.5px; color: var(--ed-rust); grid-row: span 2; padding-top: 2px; }
.ed-papers a { font-family: var(--serif); font-size: 1.02rem; line-height: 1.3; color: var(--ed-ink); }
.ed-papers a:hover { color: var(--ed-navy); text-decoration: underline; text-underline-offset: 3px; }
.ed-papers .pp-venue { font-family: var(--mono); font-size: 11px; color: var(--ed-ink-faint); }
.ed-papers a.pp-cert { font-family: var(--mono); font-size: 11px; color: var(--ed-navy); border-bottom: 1px solid var(--ed-rule); }

/* ---------- 04 blog & news ---------- */
.ed-blog { background: var(--ed-paper-2); border-top: 1px solid var(--ed-rule); }
.ed-blog-inner { padding-block: 64px 70px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: end; }
.ed-blog .ed-sec-head { margin-bottom: 0; }
.ed-blog .articles-empty {
  margin: 0; padding: 26px 0; border-top: 1px solid var(--ed-rule); border-bottom: 1px solid var(--ed-rule);
  font-family: var(--serif); font-style: italic; font-size: 1.25rem; color: var(--ed-ink-faint);
}

/* ---------- footer ---------- */
.ed-foot { border-top: 2px solid var(--ed-navy); background: var(--ed-paper); }
.ed-foot-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding-block: 30px 22px; }
.ed-mail { font-family: var(--serif); font-size: clamp(1.4rem, 3vw, 2rem); color: var(--ed-navy); }
.ed-mail:hover { color: var(--ed-rust); }
.ed-social { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.ed-social a {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--ed-rule); color: var(--ed-navy); font-family: var(--mono); font-size: 12px;
  background: rgba(255, 255, 255, 0.4); transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.ed-social a:hover { background: var(--ed-navy); border-color: var(--ed-navy); color: var(--ed-on-navy); }
.ed-social svg { width: 17px; height: 17px; fill: currentColor; flex: 0 0 auto; }
.ed-foot-meta {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-block: 14px 22px; position: relative;
  font-family: var(--mono); font-size: 11.5px; color: var(--ed-ink-faint);
}

.ed-foot-meta::before { content: ""; position: absolute; top: 0; left: 40px; right: 40px; border-top: 1px solid var(--ed-rule); }
@media (max-width: 620px) { .ed-foot-meta::before { left: 20px; right: 20px; } }

/* ---------- intro ---------- */
#intro { display: none; }
.intro #intro {
  display: flex; position: fixed; inset: 0; z-index: 1000;
  align-items: center; justify-content: center; padding: 24px;
  background: #f4f1ea; transition: opacity 0.45s ease; cursor: pointer;
}
.intro body { overflow: hidden; }
.intro-out #intro { opacity: 0; }
.intro-inner { text-align: center; }
.intro-name {
  margin: 0; font-weight: 600; color: #14284B;
  font-size: clamp(1.8rem, 5.4vw, 3.6rem); letter-spacing: 0.03em; line-height: 1.15;
}
.intro-name span {
  display: inline-block; opacity: 0; transform: translateX(5px);
  animation: intro-letter 0.26s ease-in forwards;
  animation-delay: calc(500ms + var(--i) * 60ms);
}
.intro-name .sp { width: 0.32em; }
.intro-sub {
  margin: 14px 0 0; opacity: 0;
  font-family: var(--mono); font-size: clamp(11px, 1.4vw, 13px);
  letter-spacing: 0.2em; text-transform: uppercase; color: #4a4d55;
  animation: intro-fade 0.3s ease-in forwards;
}
@keyframes intro-letter { to { opacity: 1; transform: none; } }
@keyframes intro-fade { to { opacity: 1; } }

/* ---------- narrow screens ---------- */
@media (max-width: 960px) {
  .ed-hero-grid, .pj, .ed-two, .ed-blog-inner { grid-template-columns: 1fr; }
  .ed-portrait { justify-self: start; max-width: 300px; }
  .pj-fig { position: static; }
  .ed-learning { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 620px) {
  .ed-wrap { padding: 0 20px; }
  .ed-hero { padding-block: 36px 52px; }
  .ed-projects { padding-block: 52px 60px; }
  .ed-two { padding-block: 56px 60px; gap: 48px; }
  .ed-jobs > li { grid-template-columns: 1fr; gap: 6px; }
  .ed-research { padding: 24px; }
  .ed-social span { display: none; }
  .ed-social a { width: 44px; padding: 0; justify-content: center; }
}
