/* ============================================================
   Habin Paik — personal site
   Editorial flow. Black band only on Home. KO+EN serif (Noto Serif KR),
   metadata in sans (Pretendard). One body-text rule, one text width.

   How the site behaves (keep to this when adding anything):
   - A CV, not a portal. Pages are read straight down; the reader never has to press
     arrows or open tabs to follow the story. Side-scrolling rails are only for extra
     material at the end of a section.
   - The text leads. Articles are mentioned along the way of the narrative, not listed
     as a feed. Photos stay within the text column and short on desktop.
   - One headline style: Noto Serif KR SemiBold (600) at the headline size, nothing heavier.
     Dates and labels small, in sans, grey. Descriptions under a block, not inside photos.
   - Photos greyscale, hairlines #DFDFDF, square corners. Hover: text links fill with crimson
     and turn white; text on photos goes light crimson. One brand colour, Korea University crimson (PANTONE 202C):
     hovers, the current-page bar and the dial's city hands -- nothing else. At rest, links are
     the colour of their text, marked only by a hairline underline.
   - New pieces reuse these tokens and components rather than bringing in a look of their own.
   ============================================================ */

/* Newsreader, served from fonts/ (SIL Open Font License, fonts/OFL.txt).
   size-adjust: its lowercase is small (x-height 0.426 of the size, Lora 0.50), so the glyphs are
   drawn 8% larger, a little under the size the site had with Lora; Korean text is untouched */
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 400; font-display: swap; size-adjust: 108%;
  src: url(fonts/newsreader-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 400; font-display: swap; size-adjust: 108%;
  src: url(fonts/newsreader-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 500; font-display: swap; size-adjust: 108%;
  src: url(fonts/newsreader-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 500; font-display: swap; size-adjust: 108%;
  src: url(fonts/newsreader-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 600; font-display: swap; size-adjust: 108%;
  src: url(fonts/newsreader-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 600; font-display: swap; size-adjust: 108%;
  src: url(fonts/newsreader-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 700; font-display: swap; size-adjust: 108%;
  src: url(fonts/newsreader-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 700; font-display: swap; size-adjust: 108%;
  src: url(fonts/newsreader-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 400; font-display: swap; size-adjust: 108%;
  src: url(fonts/newsreader-latin-400-italic.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 400; font-display: swap; size-adjust: 108%;
  src: url(fonts/newsreader-latin-ext-400-italic.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  --paper: #FAF9F6;   /* a white with a little warmth: easier on the eye than pure white */
  --ink:   #1A1A1A;
  --stone: color-mix(in srgb, var(--ink) var(--stone-mix), var(--paper));   /* grey = a fixed share of the words' colour over the paper, so in the day/night change it moves with the words */
  --stone-mix: 63%;
  --line:  #E0DDD7;   /* NYT 광고 띠 경계선 */
  --brand:      #F3F1EC;   /* NYT 광고 띠 배경: 배너·표지책장 배경 */
  --brand-deep: #424245;   /* 같은 계열의 진한 회색: 본문 링크 */
  /* two shades only, each laid just under a top edge:
     strong -- the top edge of each page only (under the menu, or where the page meets the photo
     above it); light -- everything else: section lines and the openers' lines, the footer's top
     line, the mail box, story boxes, portfolio cards, shelves */
  --sh-strong: rgba(0,0,0,.14); --sh-light: rgba(0,0,0,.07);   /* the two shades' colours (day: dark; night: light) */
  --shade-strong: linear-gradient(to bottom, var(--sh-strong), transparent 12px);
  --shade-light:  linear-gradient(to bottom, var(--sh-light), transparent var(--s2));   /* a short fade, 8px */
  --dial-rim: #E0DDD7; --dial-home: #E0DDD7; --dial-city: #862633; --dial-pin: #1A1A1A; --dial-lab: var(--stone);   /* the dial's colours, by day */
  --sec-gap: calc(1.5625rem - 0.5em);   /* above a section line: last baseline -> line = 25px (0.5em of the line sits under the baseline) */
  --inset: var(--s4);   /* box inset, edge -> letters on every side: the paragraph gap; a step less on phones */
  --crimson: #862633;   /* 고려대 교색 Crimson, PANTONE 202C */
  --on-fill: var(--paper);   /* words on a crimson (or coloured) fill: the page's own ground, day and night */
  --crimson-light: color-mix(in srgb, var(--crimson) 35%, #fff);   /* the same crimson lightened: hover on dark photos, hover bars */
  /* everything else is one of these two, so the page keeps a short palette; tooltips are crimson */
  --on-dark: #fff;   /* words on photos and dark grounds: plain white, all of them (no second, see-through white) */
  --veil:    rgba(0,0,0,.55);         /* darkening behind words on photos; halos */
  --link:  inherit;   /* text links take the colour of the words around them, with a hairline underline; crimson only on hover */
  --hero-bg: var(--brand-deep);   /* Home 상단 이름 영역 + 그때의 메뉴 배경 */

  --serif: "Newsreader", "Noto Serif KR", Georgia, "Times New Roman", serif;
  --serif-ko: "Noto Serif KR", Georgia, serif;
  --sans:  "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.875rem; --s4: 1.25rem;
  --s5: 1.75rem; --s6: 2.5rem; --s7: 3.5rem; --s8: 5rem;

  --t-small: clamp(0.875rem, 0.76rem + 0.19vw, 0.92rem);
  --t-body:  clamp(1.0625rem, 0.875rem + 0.3vw, 1.125rem);   /* 15 -> 18px (was 16 -> 19.2) */
  --t-title: clamp(1.18rem, 1.06rem + 0.62vw, 1.58rem);
  /* subject colours (Research bookshelf): filter buttons, cover tags and spines all use these */
  /* picked to stay far apart (CIEDE2000), all >= 4.8:1 with white; maths a mid green, the same weight as the others */
  --c-meche: #a76118; --c-phys: #1d689c; --c-math: #00804c;
  --c-gensci: #004c3e; --c-classics: #637b0e; --c-journalism: var(--crimson);
  --t-display: clamp(1.3rem, 2.6vw, 1.75rem);   /* identity line */
  --t-name: clamp(1.75rem, 0.75rem + 4.6vw, 3.5rem);   /* big name = clocks: 56px on desktop, ~29–31px on phones */

  --page-max: 62rem;      /* full content width (grids, tables, wide photos) */
  --measure:  34rem;      /* the single text measure — ALL body copy uses this */
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: break-word;
  font-feature-settings: "onum" 1, "kern" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:lang(ko), .ko { font-family: var(--sans); font-feature-settings: normal; }

/* Secondary metadata (dates, authors, years) in sans. Captions stay serif. */
.date, .years, .fact .sep, .book .a,
.work .desc, .table .cell .desc, .entry .date, .table .cell .date {
  font-family: var(--sans);
  font-feature-settings: normal;
}

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

/* One content column width everywhere: header, main, footer, home blocks.
   Wide/full photos and grids break out of this on their own. */
main.wrap, .site-head .wrap, .site-foot .wrap { max-width: 46rem; }
.lead, .bio { max-width: 46rem; margin-inline: auto; }

/* ============================================================
   ONE body-text rule. Every paragraph of running copy is just <p>.
   No .intro / .bio / .affil variants — they were all this.
   ============================================================ */
p { margin: 0 0 var(--s4); }   /* paragraph -> paragraph = section title -> its first paragraph */
p:last-child { margin-bottom: 0; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }

.home .lead, body:not(.home) > main.wrap { position: relative; }   /* holds the outline rail */



/* ---------- Header (sticky; state changes on scroll) ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid transparent;   /* at the very top of a page: no line under the bar */
  transition: background .25s ease, border-color .25s ease;
}
.site-head.scrolled { border-bottom-color: var(--line); }   /* the page has moved: the line shows */
/* scrolled or not, the bar is the page's own solid ground (no see-through blur); the line under it stays */
.site-head.scrolled { background: var(--paper); }
.site-head .bar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s4); padding-top: var(--s2); padding-bottom: var(--s1);   /* a slim bar: about the same small gap above the letters and below them */
}
/* the name is the Home button: grey, a thin grey bar on hover, dark + bar when you're on Home -- like the menu */
.brand { display: flex; align-items: baseline; gap: var(--s2); }
.wordmark {
  position: relative;
  font-family: var(--serif); font-size: var(--t-body); font-weight: 400; letter-spacing: -0.01em;
  color: var(--stone); text-decoration: none;
  transition: opacity .25s ease, visibility .25s, color .15s ease;
}
.wordmark[aria-current="page"] { color: var(--ink); }
/* back arrow on Research / Journalism / Portfolio: part of the same name link */
.wordmark .back-ico {
  display: inline-block; width: 0.8em; height: 0.8em; margin-right: 0.3em; vertical-align: -0.04em;
  fill: none; stroke: currentColor; stroke-width: 2px; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round;   /* every icon line 2px on screen */
}
.nav { --nav-gap: var(--s4); display: flex; gap: var(--nav-gap); font-size: var(--t-body); }
.nav a { position: relative; color: var(--stone); text-decoration: none; font-weight: 400; font-size: var(--t-body); transition: color .15s ease; }
.nav a[aria-current="page"] { color: var(--ink); }
/* the current page and the hovered item: no bar under the word -- a shade inside the top of the menu
   bar, over the word's width, from the bar's top edge down (--up: word top to that edge, set by site.js).
   Current page (was the dark bar) -> the strong shade; hover (was the grey bar) -> the light shade */
.nav a[aria-current="page"]::after,
.wordmark[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(-1 * var(--up, var(--s2)));
  height: 12px; background: var(--shade-strong); pointer-events: none;
}
@media (hover: hover) {
  .nav a:not([aria-current="page"]):hover::after,
  .wordmark:not([aria-current="page"]):hover::after {
    content: ""; position: absolute; left: 0; right: 0; top: calc(-1 * var(--up, var(--s2)));
    height: var(--s2); background: var(--shade-light); pointer-events: none;
  }
  .hero-on .nav a:not([aria-current="page"]):hover::after,
  .hero-on .wordmark:not([aria-current="page"]):hover::after,
  .j-page.cover-on .nav a:not([aria-current="page"]):hover::after,
  .j-page.cover-on .wordmark:not([aria-current="page"]):hover::after { background: linear-gradient(to bottom, rgba(255,255,255,.10), transparent var(--s2)); }
}

/* ---------- Hero (HOME ONLY) ----------
   Photo area = top 40% of the screen, menu bar included (the bar floats over it).
   The hero stays put; the page (.sheet) slides up over it. */
.hero {
  margin-top: 0;   /* override the generic section spacing */
  position: sticky; top: 0; z-index: 0;
  height: 40vh; height: 40svh;
  display: flex; align-items: center;
  overflow: hidden;
  background: var(--hero-bg); color: #fff;
  --hero-dim: .32;   /* darkening over the photos so white text stays legible */
}
.hero-photo {
  position: absolute; left: 0; right: 0; top: 0; height: 100%;
  container-type: size;   /* lets the photo read this layer's width/height (cqw/cqh) */
  transition: opacity .3s ease;
}
/* Photo: fills the layer, never squashed.
   Layer taller than the photo's ratio -> centred, as before.
   Layer wider -> the photo is cropped top/bottom; the focus point (--fy, share of photo height)
   is pulled toward the middle of the layer as far as the photo's edges allow, so the wider the
   layer, the closer the view gets to the focus point. --ratio = photo width / height. */
.hero-photo::before {
  content: ""; position: absolute; inset: 0;
  background-repeat: no-repeat; background-size: cover;
  background-position: 50% min(0px, max(
    calc(50cqh - var(--fy) * 100cqw / var(--ratio)),
    calc(100cqh - 100cqw / var(--ratio))
  ));
}
.hero-photo::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,var(--hero-dim)); }
.hero-photo.portrait { --ratio: 1.5; --fy: .40; }        /* 2400x1600, focus: throat */
.hero-photo.portrait::before { background-image: url("images/hero-portrait.jpg"); }
/* sized to the visible photo area at the moment it appears (set by script) */
.hero-photo.campus { --ratio: 1.3333; --fy: .65; height: var(--campus-h, 100%); opacity: 0; }   /* 2400x1800, focus: below centre */
.hero-photo.campus::before { background-image: url("images/hero-campus.jpg"); }
.hero.campus .hero-photo.campus { opacity: 1; }

.hero .wrap { position: relative; z-index: 1; width: 100%; max-width: 46rem; text-align: right; }
.hero-name {
  margin: 0;
  font-family: var(--serif); font-weight: 400;   /* regular, as the menu and the copyright */
  font-size: var(--t-name);
  line-height: 1.15; letter-spacing: -0.02em;
  margin-top: -0.04em;   /* evens the gaps above the letters and below them */
}
.hero-name .alt { display: block; font-family: var(--serif), "Noto Serif Devanagari", "Noto Naskh Arabic", serif; }   /* serif in every script */
.hero-name .ko { display: block; }

/* ---------- Journalism: cover (JOURNALISM ONLY) ----------
   The first screen, under the menu bar, on the page's own ground: a ring of the 12 photos turns and
   stops with one pair in front; the pair folds into one zigzag board (an agamograph) that turns with
   the pointer. Moved frame by frame by jcover.js. */
.j-cover {
  position: relative; overflow: hidden; outline: none;
  height: calc(100vh - var(--head-h, 3rem)); height: calc(100svh - var(--head-h, 3rem));
  perspective: 1700px; touch-action: pan-y;   /* sideways drags turn the board; vertical ones scroll */
}
.jc-ring, .jc-board { position: absolute; left: 50%; top: calc(50% - 14px); width: 0; height: 0; transform-style: preserve-3d; }
.jc-card { position: absolute; width: var(--cw); height: calc(var(--cw) * .75); left: calc(var(--cw) / -2); top: calc(var(--cw) * -.375); }
.jc-card img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.jc-ring { transition: opacity .6s ease; }
.j-cover.folded .jc-ring { opacity: 0; pointer-events: none; }
.jc-board { opacity: 0; transition: opacity .3s ease; cursor: pointer; }
.j-cover.folded .jc-board { opacity: 1; }
.jc-face { position: absolute; left: 0; top: calc(var(--bh) / -2); transform-origin: 0 50%; background-repeat: no-repeat; backface-visibility: hidden; }
.jc-face::after { content: ""; position: absolute; inset: 0; background: #000; opacity: var(--da, 0); pointer-events: none; }   /* turned away: darker */
.jc-face.b::after { opacity: var(--db, 0); }
/* the two names under the board: the one you are seeing more of in ink */
.jc-labels {
  position: absolute; left: 50%; top: calc(50% - 14px + var(--bh) / 2 + 2rem); width: var(--bw); transform: translateX(-50%);
  display: flex; justify-content: space-between; font-size: var(--t-small); line-height: 1; color: var(--stone);
  opacity: 0; transition: opacity .6s ease; pointer-events: none;
}
.jc-labels span { transition: color .3s ease; }
.jc-labels span.on { color: var(--ink); }
.j-cover.folded .jc-labels { opacity: 1; }
.jc-dek { position: relative; z-index: 2; pointer-events: none; }   /* held over the stage by jcover.js; its room is kept by .jc-dekslot */
.jc-dekslot + p { margin-top: 0; }
.jc-ring, .jc-board { top: calc(var(--res, 0px) + (100% - var(--res, 0px)) / 2 - 14px); }   /* centred in the room under the opener */
.jc-labels { top: calc(var(--res, 0px) + (100% - var(--res, 0px)) / 2 - 14px + var(--bh) / 2 + 2rem); }
/* off the cover, the bar is the solid ground as on every page */
.j-page .site-head,
.j-page .site-head.scrolled {
  background: var(--paper);

}
/* while the cover is in view: no bar at all, white text straight on the picture.
   Once the page has filled the screen, the bar turns into the usual blurred one. */
.j-page .site-head { transition: background .15s ease, border-color .15s ease; }
.j-page.cover-on .site-head,
.j-page.cover-on .site-head.scrolled {
  background: transparent; border-bottom-color: transparent;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.j-page.cover-on .wordmark,
.j-page.cover-on .nav a { color: var(--on-dark); }
.j-page.cover-on .nav a[aria-current="page"] { color: #fff; }
.j-page.cover-on .nav a[aria-current="page"]::after { background: linear-gradient(to bottom, rgba(255,255,255,.17), transparent 12px); }   /* on the photo: the same shades, light (as at night) */

/* the page: its first --head-h is see-through (the menu bar sits there over the photo) */
.sheet {
  position: relative; z-index: 1;
  margin-top: calc(-1 * var(--head-h, 3rem));
  background: linear-gradient(to bottom, transparent var(--head-h, 3rem), var(--paper) var(--head-h, 3rem));
}

/* once the bar reaches the top and turns blurred, the see-through band behind it
   gets a gradient -- clear at the top, page colour at the bottom -- fading in at the
   same speed as the menu text turns dark (.15s), so the photo melts into the page */
.home .sheet::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: var(--head-h, 3rem);
  background: linear-gradient(to bottom, transparent, var(--paper));
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease;
}
.home:not(.hero-on) .sheet::before { opacity: 1; }

/* menu bar on Home: the line shows the moment the bar leaves the photo (no fade) */
.home .site-head { transition: background .15s ease; }
.hero-on .site-head,
.hero-on .site-head.scrolled {
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
/* hidden (space kept, so the menu doesn't shift) until the page has covered the big name */
.hero-on:not(.named) .wordmark { opacity: 0; visibility: hidden; }
.hero-on .wordmark { color: var(--on-dark); }
.hero-on .wordmark[aria-current="page"] { color: #fff; }
.hero-on .wordmark[aria-current="page"]::after { background: linear-gradient(to bottom, rgba(255,255,255,.17), transparent 12px); }   /* on the photo: the shade, light (as at night) */
.hero-on .nav a { color: var(--on-dark); }
.hero-on .nav a[aria-current="page"] { color: #fff; }
.hero-on .nav a[aria-current="page"]::after { background: linear-gradient(to bottom, rgba(255,255,255,.17), transparent 12px); }

/* the leading top block (home) shares the plain <p> rule */
.lead { padding-top: calc(var(--s6) + 1px); padding-bottom: var(--s7); }   /* the same top gap as the other pages' main column (+1px: the bar stops 1px into the page) */
.bio { margin-bottom: var(--s7); }

/* Home: the opener, then "Engineer, Physician, Journalist." and the rest, all one run of text --
   no line between the top block and the paragraphs that follow */
.lead { padding-bottom: 0; }
.lead + main { padding-top: var(--s4); }   /* the last line above runs on into the paragraphs below at the paragraph gap */
/* a page's one-sentence opener (.dek), at the band's size in the body face -- one sentence only,
   standing as a section of its own (after the NYT's article deks) */
p.dek {
  font-size: var(--t-display); font-weight: 400; line-height: 1.5; letter-spacing: -0.01em;
  /* every opener closes like a section: 25px under its last line (--sec-gap) a hairline with the light
     shade, then 50px from the shade's end to the next line's capitals, as under a section title
     (0.3em of a body line sits above its capitals) */
  position: relative;
  padding-bottom: var(--sec-gap); border-bottom: 1px solid var(--line);
}
p.dek, main > p.dek:first-child { margin: 0 0 calc(var(--s2) + 3.125rem - 0.265 * var(--t-body)); }
p.dek::after { content: ""; position: absolute; left: 0; right: 0; top: calc(100% + 1px);   /* under the line, not over it */ height: var(--s2); background: var(--shade-light); pointer-events: none; }


main { padding-block: var(--s6); }

h2.section-title {
  font-family: var(--sans);
  font-size: var(--t-body);
  font-weight: 600;
  margin: 0 0 var(--s4);   /* the same gap as between paragraphs */
  /* every section opens with a hairline across the text column, with a short shade under it.
     Text above -> line = 25px (--sec-gap); from the shade's end (--s2) down to the title's capitals is
     twice that, 50px; 0.37em is the space above the capitals in the title's line */
  padding-top: calc(var(--s2) + 3.125rem - 0.37em);
  border-top: 1px solid var(--line);
  background: var(--shade-light) no-repeat;
}
section { margin-top: var(--sec-gap); }
main > p:has(+ section) { margin-bottom: 0; }   /* a paragraph right before a section: the 25px is the section's alone */
h2.section-title + * { margin-top: 0 !important; }   /* whatever follows a title starts the same gap below it */
/* a lead paragraph before the first section (research/journalism/portfolio) */
main > p:first-child { margin-bottom: var(--sec-gap); }

/* ---------- Home: bio beside ID photo ---------- */
.bio-row { display: block; margin-bottom: var(--sec-gap); }
.bio::after { content: ""; display: block; clear: both; }
/* the photo floats at the right of the paragraphs, so the text runs beside it and then on under it;
   its top on the first line's capitals */
.bio .id-photo { float: right; margin: 0.17em 0 var(--s3) var(--s5); }
.bio-row .bio { margin-bottom: 0; max-width: none; }
.id-photo { width: 150px; }
.id-photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; filter: grayscale(1); background: var(--line); display: block; }
.home-top { display: block; }
@media (max-width: 34rem) {
  .bio .id-photo { float: none; margin: 0 0 var(--s4); width: 140px; }
}

/* facts */
.fact { line-height: 1.6; margin: 0 0 var(--s2); font-family: var(--sans); }   /* a list, not prose: in the sans */
.fact:last-child { margin-bottom: 0; }
.fact .primary { font-weight: 600; }
.fact .sep { color: var(--stone); }
.fact .years { color: var(--stone); font-size: var(--t-small); }
.fact .nowrap { white-space: nowrap; }   /* a Korean name and its years stay together on one line */
.contact-note a { white-space: nowrap; }
.linklist { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--s2) var(--s4); flex-wrap: wrap; }
.linklist a { font-family: var(--sans); font-size: var(--t-small); }

/* ---------- Featured entries ---------- */
.entry { margin-bottom: var(--s6); }
.entry:last-child { margin-bottom: 0; }
.entry .head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.entry h3 { font-family: var(--serif-ko); font-size: var(--t-title); font-weight: 400; line-height: 1.3; margin: 0; letter-spacing: -0.02em; word-break: keep-all; }
.entry h3 a { color: var(--ink); text-decoration: none; }
.entry h3 a:hover { color: var(--on-fill); }
.shelf-note { margin: var(--s5) 0 0; font-family: var(--sans); font-size: var(--t-small); line-height: 1.6; color: var(--stone); }   /* a credit line: small and grey */
.shelf-note a { color: inherit; }
.entry .date { color: var(--stone); font-size: var(--t-small); white-space: nowrap; }
.entry .desc { margin: var(--s2) 0 0; }
/* opt-in divider: centered in the EXISTING gap, adds no extra height.
   Entries above have --s6 bottom margin; the rule sits in that gap. */
/* opt-in divider centred in the existing --s6 gap with no net extra height:
   pull up half the gap, then push the next entry down half the gap. */
hr.rule { border: 0; border-top: 1px solid var(--line); height: 0; margin: calc(var(--s6) / -2) 0 calc(var(--s6) / 2); }

/* centred closing line (portfolio) */
main > p.epigraph:first-child { margin-bottom: var(--s3); }
main > p.dek:first-child + section { margin-top: 0; }   /* the opener is larger: its own measure sets the 25px */   /* the opener is a section of its own: the same gap below it as between sections */   /* the Korean of the opener, right under it at body size */
.epigraph {
  text-align: left; max-width: none;
  margin: 0 0 var(--s3); color: var(--ink);
  line-height: 1.6;
}
.epigraph .ko { color: var(--stone); font-size: 0.95em; }
/* date — description separator */
.entry .desc .date + .dash { color: var(--stone); }
.dash { color: var(--stone); }

/* ---------- Key reporting TABLE: 3 cols, equal cells ---------- */
/* Gap-based grid so every cell (and its image) is identical width. */
.table {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s5) var(--s4);
}
.table .cell { position: relative; }
/* vertical divider centred in the column gap; not after the last col in a row */
.table .cell::after {
  content: ""; position: absolute; top: 0; bottom: 0;
  right: calc(var(--s4) / -2); width: 1px; background: var(--line);
}
.table .cell:nth-child(3n)::after { display: none; }  /* no line on the right edge */
.table .cell img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; filter: grayscale(1); background: var(--line); display: block; margin-bottom: var(--s2); }
.table .cell .th { }
.table .cell .th a { font-family: var(--serif-ko); color: var(--ink); text-decoration: none; font-weight: 400; font-size: var(--t-body); line-height: 1.6; letter-spacing: -0.02em; }
.table .cell .th a:hover { color: var(--on-fill); }
.table .cell .desc { color: var(--stone); font-size: var(--t-small); margin: var(--s2) 0 0; line-height: 1.6; max-width: none; }
.table .cell .date { color: var(--stone); font-size: var(--t-small); }
@media (max-width: 52rem) {
  .table { grid-template-columns: repeat(2, 1fr); }
  .table .cell:nth-child(3n)::after { display: block; }
  .table .cell:nth-child(2n)::after { display: none; }
}
@media (max-width: 30rem) {
  .table { grid-template-columns: 1fr; gap: var(--s4); }
  .table .cell::after { display: none; }
  /* compact horizontal layout: small thumbnail left, text right */
  .table .cell { display: grid; grid-template-columns: 5.5rem 1fr; gap: var(--s3); align-items: start; }
  .table .cell img { aspect-ratio: 1 / 1; margin-bottom: 0; grid-row: 1 / span 2; }
  .table .cell .th { grid-column: 2; }
  .table .cell .desc { grid-column: 2; }
}

/* ---------- Spine shelf: books stood on end, browse by swiping ----------
   Full-bleed tinted panel. Each book is a vertical spine with a rotated
   title, aligned to a common baseline (a shelf). Height/thickness vary by
   category: classic = short & thick, science = tall & thin, humanities = mid. */
.spine-panel {
  width: calc(100vw - var(--sbw, 0px)); margin-left: calc(50% - (100vw - var(--sbw, 0px)) / 2); transform: none;
  padding-top: 4px; padding-bottom: 0;   /* the tags sit close over the shelf */   /* 트랙 위 여유 4px과 합쳐 박스 위→첫 책 20px */   /* 트랙 위 여유 4px과 합쳐 박스 위→첫 책 8px 유지 */
}
.spine-wrap { max-width: 46rem; margin-inline: auto; padding-inline: var(--gutter); position: relative; }
.spine-shelf {
  --pile-max: 260px;   /* 더미 최대 높이: 넘치면 오른쪽 새 더미로 */
  --floor: 8px;        /* 바닥 막대 두께 */
  overflow-x: auto; padding-top: 0; padding-bottom: var(--floor);
  position: relative; z-index: 1;
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.spine-shelf::-webkit-scrollbar { display: none; }
.spine-track {
  display: flex; align-items: flex-end; gap: 10px;
  width: max-content; position: relative;
  padding: 4px 8px 0 0;   /* 위 4px: 경계 여유, 오른쪽 8px: 마지막 더미 호버 때 안 잘리게 */
}
.spine-board {
  position: absolute; bottom: 0; z-index: 0;
  left: calc(var(--gutter) - 20px); right: calc(var(--gutter) - 20px);
  /* the floor, as the site draws any top edge: a hairline and the light shade under it, on the page */
  height: 8px; border-radius: 0;
  background: var(--shade-light);
  border-top: 1px solid var(--line);
}
/* 더미: 아래부터 위로 쌓임 */
.pile { display: flex; flex-direction: column-reverse; align-items: center; flex: 0 0 auto; padding-inline: 8px; }   /* centred, so every book bears the ones above it; 8px room for the jitter */
.pile > .spine:last-child, .pile > .pair:last-child { margin-top: 0; }
/* two books side by side in one layer of a pile */
.pair { display: flex; gap: 6px; position: relative; margin-top: -1px; }
.pair > .spine { margin-top: 0; }   /* 맨 위 책은 올리지 않음 → 위쪽 경계에 안 잘림 */
/* 눕힌 책: 옆면(책등)이 보이는 띠. 채움 없이 테두리와 글자만 */
.spine {
  --cat: var(--stone); --rot: 0deg;
  display: flex; align-items: center; box-sizing: border-box;
  position: relative; z-index: 1;
  background: var(--paper);           /* every spine the page's own colour ... */
  border: 1px solid var(--cat);       /* ... the subject only in its outline */
  border-radius: 0;
  margin-top: -1px;               /* 위아래 책 테두리가 한 줄로 겹침 (두 겹으로 두꺼워지지 않게) */
  padding: 0 6px;   /* letters 6px from the side lines, as in the book tip */
  transition: transform .15s ease;
}
.spine:hover { transform: translateX(6px); z-index: 2; }   /* 살짝 빼내는 느낌 */
.spine .t {
  font-family: var(--sans); font-size: var(--t-small); font-weight: 400;
  line-height: 1; letter-spacing: -0.01em; color: var(--cat);   /* the title in its subject colour */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;   /* 길면 … */
}
/* 분류별 지정 두께(띠 높이)·길이·테두리색 — 기존 책등 규칙 그대로 */
.spine { width: max-content; max-width: 225px; }   /* as long as its title, up to the longest book */
.spine.humanities { --cat: var(--c-classics); height: 44px; }  /* Classics */
.spine.journalism { --cat: var(--c-journalism); height: 34px; }  /* Journalism */
.spine.science    { --cat: var(--c-gensci); height: 22px; }  /* General Sci */
@media (max-width: 40rem) {
  .spine-shelf { --pile-max: 220px; }
  .spine { max-width: 192px; }
  .spine.humanities { height: 40px; }
  .spine.journalism { height: 32px; }
  .spine.science    { height: 22px; }
}
/* left/right scroll arrows — bottom-right, translucent */
/* left/right: two square buttons under the shelf, as the "more" button under the covers */
.spine-nav { display: flex; justify-content: center; gap: var(--s2); margin-top: var(--s4); }
.spine-nav button, .rail-btn {
  display: flex; align-items: center; justify-content: center;
  padding: var(--s2) var(--s4); border: 1px solid var(--line); border-radius: 0;
  color: var(--ink); cursor: pointer; line-height: 1;
  background: linear-gradient(var(--crimson), var(--crimson)) no-repeat 0 100% / 100% 0;
  transition: background-size .45s cubic-bezier(.45, 0, .25, 1), color .45s ease, border-color .45s ease;
}
.spine-nav button:hover, .rail-btn:hover { background-size: 100% 100%; color: var(--on-fill); border-color: var(--crimson); }
.spine-nav button, .rail-btn { font-size: var(--t-small); }
.spine-nav svg, .rail-btn svg { display: block; width: 1.75rem; height: 1.23em; padding-block: calc((1.23em - 0.75rem) / 2); box-sizing: border-box;   /* as tall as the "more" button's line */ fill: none; stroke: currentColor; stroke-width: 0.125em; vector-effect: non-scaling-stroke; stroke-linecap: butt; stroke-linejoin: miter; }   /* a long thin arrow, a 1px line */
.spine-nav button:disabled { color: var(--line); cursor: default; background-size: 100% 0; border-color: var(--line); }

/* hover tooltip near cursor */
.spine-tip {
  position: fixed; z-index: 100; pointer-events: none;
  max-width: 16rem; padding: var(--s2) var(--s3);
  background: var(--crimson); color: var(--on-fill); border-radius: 0;
  font-family: var(--sans); font-size: var(--t-small); line-height: 1.4;
  opacity: 0; transition: opacity .12s ease;
}
.spine-tip.show { opacity: 1; }
.spine-tip i { font-style: italic; }   /* one line of reference, one colour and weight; only a Latin-script title in italics */

/* ---------- Cover shelf: books at their natural proportions on a shelf ----------
   Covers keep their own aspect ratio (only height is normalised), standing
   side by side on a long shelf board. Scrolls horizontally. */
.cover-shelf-wrap { max-width: 46rem; margin-inline: auto; padding-inline: var(--gutter); position: relative; margin-top: var(--s5); }
.cover-shelf {
  display: flex; align-items: flex-end; gap: 8px;
  overflow-x: auto; scroll-behavior: smooth;
  padding: 0 2px 10px;
  position: relative;
}
.cover-shelf::-webkit-scrollbar { height: 6px; }
.cover-shelf::-webkit-scrollbar-thumb { background: var(--line); border-radius: 0; }
.cover-shelf .bk { flex: 0 0 auto; text-decoration: none; display: block; transition: transform .15s ease; }
.cover-shelf .bk img {
  height: 130px; width: auto; display: block;
}
.cover-shelf .bk:hover { transform: translateY(-5px); }
@media (max-width: 40rem) { .cover-shelf .bk img { height: 105px; } }

/* ---------- Research bookshelf (legacy cover grid) ---------- */
.shelf-panel {
  padding-top: 4px;                      /* its own section now: the tags sit over the covers as over the desk */
  padding-bottom: 40px;                  /* 버튼 ↔ 박스 아래 (바로 아래가 푸터라 넉넉히) */
  margin-top: 0;
  position: relative;
}
/* the panel is full-bleed but the shelf grid is capped to the text column */
.shelf-panel {
  width: calc(100vw - var(--sbw, 0px)); margin-left: calc(50% - (100vw - var(--sbw, 0px)) / 2); transform: none;
}
.shelf-wrap { max-width: 46rem; margin-inline: auto; padding-inline: var(--gutter); }

.shelf {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px var(--s4);   /* 줄 사이 간격 32px */
  position: relative;
}
/* 독서대: 줄마다 뒤에 깔리는 가로로 긴 직사각형 (JS가 행 위치를 재서 그림) */
.shelf-boards { position: absolute; inset: 0; pointer-events: none; }   /* no stacking of its own: the ledge's lip can rise above the covers */
.shelf-boards .board { z-index: 0; }
/* the ledge's front lip, at the covers' feet: the light shade falls from there, drawn over the covers'
   bottom edges (so where the two edges meet, the shade wins); the titles sit above it */
.shelf-boards .board::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: var(--s2); border-top: 1px solid var(--line); background: var(--shade-light) no-repeat; background-origin: padding-box; z-index: 2; }
.shelf-boards .board {
  position: absolute; left: -20px; right: -20px;
  /* no band of its own: just the floor at the covers' feet (::after), as under the desk */
  background: none; border-top: 0;
}
.shelf .book { position: relative; }   /* no stacking of its own: cover (1), lip shade (2), title (3) */
.book { text-decoration: none; color: inherit; position: relative; }
.book .cover { position: relative; }
.book .cover img { position: relative; z-index: 1; }
.book .cover { position: relative; }
/* 틀은 2:3로 고정, 표지는 원본 비율 그대로 틀 바닥에 세움 */
.book .cover { display: flex; flex-direction: column; justify-content: flex-end; aspect-ratio: 2 / 3; width: 100%; min-height: 0; overflow: visible; }
.book .face { flex: 0 0 auto; align-self: flex-start; }   /* 표지 왼쪽 정렬 */
.book[data-subject="MechE"]       { --cat: var(--c-meche); }
.book[data-subject="Phys"]        { --cat: var(--c-phys); }
.book[data-subject="Math"]        { --cat: var(--c-math); }
.book[data-subject="General Sci"] { --cat: var(--c-gensci); }
.book .face { position: relative; display: block; }
.book img { width: 100%; height: auto; display: block; }
.book img { outline: 1px solid var(--cat, var(--line)); outline-offset: -1px; }   /* the subject in a hairline round the cover, as on the spines */
.book .t { position: relative; z-index: 3; display: block; margin-top: var(--s2); color: var(--stone); font-size: var(--t-small); line-height: 1.6; font-family: var(--sans); }

/* books past the first row start hidden; revealed downward by 더보기 */
.book.is-hidden { display: none; }

.shelf-more { text-align: center; margin-top: var(--s4); }   /* the paragraph gap, as the spine buttons under their shelf */
.shelf-more button {
  font-family: var(--sans); font-size: var(--t-small); font-weight: 600;
  color: var(--ink); background: transparent;
  border: 1px solid var(--line); border-radius: 0;
  padding: var(--s2) var(--s4); cursor: pointer; transition: background .15s ease;
}
/* hover: crimson rises from the bottom and fills the button, the words turning white -- as on links */
.shelf-more button {
  background-image: linear-gradient(var(--crimson), var(--crimson)); background-repeat: no-repeat;
  background-position: 0 100%; background-size: 100% 0;
  transition: background-size .45s cubic-bezier(.45, 0, .25, 1), color .45s ease, border-color .45s ease;
}
.shelf-more button:hover, .shelf-panel .shelf-more button:hover { background-size: 100% 100%; color: var(--on-fill); border-color: var(--crimson); }
.shelf-more button[hidden] { display: none; }


@media (max-width: 34rem) { .shelf { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Portfolio grid ---------- */
.works {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--s6) var(--s5);
}
.work .th { display: flex; align-items: baseline; gap: var(--s2); justify-content: space-between; }
.work .th a { color: var(--ink); text-decoration: none; font-weight: 400; font-size: var(--t-title); line-height: 1.6; }
.work .th a:hover { color: var(--on-fill); }
.work .date { color: var(--stone); font-size: var(--t-small); white-space: nowrap; }
.work .desc { color: var(--stone); font-size: var(--t-small); margin: var(--s2) 0 0; max-width: none; }

/* ---------- Free photo utilities (Journalism etc.) ---------- */
figure.ph { margin: var(--s6) 0; }
figure.ph img { width: 100%; display: block; filter: grayscale(1); background: var(--line); }
figure.ph figcaption { font-size: var(--t-small); color: var(--stone); margin-top: var(--s2); }
figure.ph.wide  { width: min(84rem, 96vw); margin-left: 50%; transform: translateX(-50%); }
figure.ph.full  { width: calc(100vw - var(--sbw, 0px)); margin-left: calc(50% - (100vw - var(--sbw, 0px)) / 2); transform: none; }
figure.ph.wide img, figure.ph.full img { max-height: 78vh; object-fit: cover; }
/* phones: a wide photo runs edge to edge; its caption stays on the text column */
@media (max-width: 34rem) {
  figure.ph.wide { width: calc(100vw - var(--sbw, 0px)); margin-left: calc(50% - (100vw - var(--sbw, 0px)) / 2); transform: none; }
  figure.ph.wide figcaption, figure.ph.full figcaption { padding-inline: var(--gutter); }
}
figure.ph.left  { float: left;  width: 46%; margin: var(--s1) var(--s5) var(--s4) 0; }
figure.ph.right { float: right; width: 46%; margin: var(--s1) 0 var(--s4) var(--s5); }
figure.ph.small.left, figure.ph.small.right { width: 32%; }
.clear { clear: both; }
figure.ph.tall:not(.wide):not(.full) img { aspect-ratio: 2 / 3; object-fit: cover; }
figure.ph.land:not(.wide):not(.full) img { aspect-ratio: 3 / 2; object-fit: cover; }
figure.ph.pano img { aspect-ratio: 16 / 6; object-fit: cover; }

/* two or three photos splitting the width, flush together */
figure.ph.duo, figure.ph.trio { display: grid; gap: var(--s2); }
figure.ph.duo  { grid-template-columns: 1fr 1fr; }
figure.ph.trio { grid-template-columns: 1fr 1fr 1fr; }
figure.ph.duo img, figure.ph.trio img { aspect-ratio: 3 / 4; object-fit: cover; margin: 0; }
figure.ph.duo figcaption, figure.ph.trio figcaption { grid-column: 1 / -1; }
@media (max-width: 34rem) { figure.ph.trio { grid-template-columns: 1fr 1fr; } }

/* text laid over the image (bottom-left), for a dramatic titled photo */
figure.ph.overlay { position: relative; margin-inline: calc(-1 * var(--s4)); }   /* wider by the caption's inset, so the caption lines up with the text column */
figure.ph.overlay img { aspect-ratio: 16 / 9; object-fit: cover; }
figure.ph.overlay figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0;
  color: #fff; padding: var(--s5) var(--s4) var(--s3);
  font-size: var(--t-body); line-height: 1.5;   /* the Portfolio card-title size */
  background: linear-gradient(to top, rgba(0,0,0,.82), rgba(0,0,0,0));
}

/* two clickable overlay cards side by side: image + title on it, links out */
.overlay-duo { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin: var(--s6) 0; }
.overlay-card { position: relative; display: block; text-decoration: none; overflow: hidden; }
.overlay-card img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover; filter: grayscale(1);
  background: var(--line); display: block;
  transition: transform .4s ease;
}
.overlay-card:hover img { transform: scale(1.05); }
.overlay-card .cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  color: #fff; padding: var(--s7) var(--inset) var(--inset);
  background: linear-gradient(to top, rgba(0,0,0,.82), rgba(0,0,0,0));
}
.overlay-card .cap .title {
  display: block;
  font-family: var(--serif-ko); font-size: var(--t-body); font-weight: 400;   /* the Portfolio card-title size */
  line-height: 1.3; letter-spacing: -0.02em; word-break: keep-all;
  transition: color .15s ease;
}
.overlay-card .cap .meta {
  display: block; margin-top: var(--s2); text-box-trim: trim-end; text-box-edge: cap alphabetic;
  font-family: var(--sans); font-size: var(--t-small); color: var(--on-dark);
  word-break: keep-all;
}
@media (max-width: 34rem) { .overlay-duo { grid-template-columns: 1fr; } }
/* tall pair: two half-width portrait photos, headline at the side-story size; stays two-up on phones */
.overlay-duo.tall .overlay-card img { aspect-ratio: 2 / 3; }
.overlay-duo.tall .cap .title { font-size: var(--t-title); font-weight: 600; line-height: 1.3; letter-spacing: -0.0125em; }
.overlay-duo.tall .cap .meta .date, .overlay-duo.tall .cap .meta .dash { font-size: inherit; color: inherit; }
.overlay-duo.tall .cap .meta { font-family: var(--sans); }
@media (max-width: 34rem) {
  .overlay-duo.tall { grid-template-columns: 1fr 1fr; gap: var(--s3); }
  .overlay-duo.tall .cap { padding-top: var(--s6); }
  .overlay-duo.tall .cap .title { font-size: var(--t-body); }
}

/* ---- Side photos: mounted in the empty space beside the text column ----
   The entry is the positioning context; the photo is absolutely placed just
   outside the column into the left/right gutter. On narrow screens where the
   gutter is too small, it falls back to a normal inline photo below the text. */
.entry { position: relative; }
figure.ph.side-left, figure.ph.side-right {
  position: absolute; top: 0; width: 12rem; margin: 0;
}
figure.ph.side-left  { right: calc(100% + var(--s5)); }  /* just left of the column */
figure.ph.side-right { left:  calc(100% + var(--s5)); }  /* just right of the column */
figure.ph.side-left img, figure.ph.side-right img { aspect-ratio: 3 / 4; object-fit: cover; }

/* When the viewport can't fit a side photo (narrow), show it inline instead. */
@media (max-width: 72rem) {
  figure.ph.side-left, figure.ph.side-right {
    position: static; width: 14rem; margin: var(--s4) 0;
  }
}

/* legacy margin-left/right kept as simple inline blocks (no negative margins) */
figure.ph.margin-left, figure.ph.margin-right { width: 12rem; margin: var(--s4) 0; }

/* ---------- Story pair: two articles mentioned inside the narrative ----------
   Articles always come in twos, and they sit inside running text — so they read top to bottom,
   with nothing to click through. Both are the width of the text column, never wider.
     1. .feat — photo with the headline centred along its bottom edge (white on a dark fade).
     2. .side — headline in a white box that overlaps the photo on its right.
   Headline = Noto Serif KR SemiBold at the headline size, with an optional small English
   title (.en) under it. Date and description go below the block as an ordinary .desc,
   never inside the photo or the box. Break a long headline by hand at its comma (<br>).
   Desktop photos are kept short (2:1, 16:9) so the reader isn't scrolling past pictures;
   phones use 3:2 and put the box under the photo, lifted onto its bottom edge.
   Markup:
     <div class="feat">
       <a class="feat-photo" href="…"><img src="…" alt="">
         <span class="feat-head">헤드<span class="en">English headline</span></span></a>
       <p class="desc"><span class="date">Sep 2025</span> <span class="dash">—</span> …</p>
     </div>
     <div class="side">
       <div class="side-row">
         <a class="side-head" href="…">헤드,<br> 이어지는 헤드<span class="en">English headline</span></a>
         <a class="side-photo" href="…" tabindex="-1" aria-hidden="true"><img src="…" alt=""></a>
       </div>
       <p class="desc">…</p>
     </div> */
.feat, .side { margin: var(--s6) 0; }   /* a story sits in the essay with the same gap above and below */
.feat .date, .side .date { color: var(--stone); font-size: var(--t-small); white-space: nowrap; }
.feat .date + .dash, .side .date + .dash { color: var(--stone); }

.feat-head, .side-head {
  font-family: var(--serif-ko); font-size: var(--t-title); font-weight: 600; line-height: 1.3;
  letter-spacing: -0.0125em; word-break: keep-all; transition: color .15s ease;
}
.feat-head .en, .side-head .en {   /* small English title under the Korean one, in the sans */
  display: block; margin-top: var(--s2);
  font-family: var(--sans); font-size: var(--t-small); font-weight: 400; line-height: 1.5; letter-spacing: 0;
}

/* 1. photo, headline on it */
.feat-photo { position: relative; display: block; overflow: hidden; background: var(--line); }
.feat-photo img { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; filter: grayscale(1); }
.feat-photo::after {   /* the frosted band of the card news, under the headline: blur + a little dark, fading out upward */
  content: ""; position: absolute; inset: 45% 0 0; pointer-events: none;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(to top, var(--veil), rgba(0,0,0,.14));
  -webkit-mask-image: linear-gradient(to top, #000 55%, transparent);
          mask-image: linear-gradient(to top, #000 55%, transparent);
}
.feat-head {
  position: absolute; z-index: 1; left: 50%; bottom: var(--s4); transform: translateX(-50%);   /* a photo story keeps more room under its headline than a box */
  width: min(36rem, 86%); text-align: center; color: #fff; text-wrap: balance;
}
.feat-head .en { color: var(--on-dark); }
.feat-head { z-index: 2; }

/* Boxes tucked behind the story above them, centred and each narrower than the one above, as if
   pages of the paper lay underneath: a companion story (Special Report), then the print edition.
   Each one's top edge hides behind the one above, so the light shade starts just below that edge.
   Crimson fill on hover like the other boxes. */
.feat { position: relative; z-index: 0; }
.feat-photo { z-index: 3; }
.tuck-story, .print-tab {
  position: relative; display: block; box-sizing: border-box; margin: calc(-1 * var(--s2)) auto 0;
  border: 1px solid var(--line); background-color: var(--paper);
  background-image: var(--shade-light) !important;
  background-repeat: no-repeat; background-position: 0 calc(var(--s2) - 1px);
  background-origin: padding-box;
  text-decoration: none; text-align: center;
  transition: background-size .45s cubic-bezier(.45, 0, .25, 1), border-color .45s ease;
}
.tuck-story { z-index: 2; width: 75%; padding: calc(var(--s2) + var(--inset) + 0.15 * var(--t-body)) var(--inset) var(--inset); text-box-trim: trim-both; text-box-edge: cap alphabetic; }   /* --s2 of it hides behind the photo */
.print-tab {
  z-index: 1; width: 75%; padding: calc(var(--s2) + var(--inset)) var(--inset) var(--inset); text-box-trim: trim-both; text-box-edge: cap alphabetic;
  font-family: var(--sans); font-size: var(--t-small); color: var(--stone); transition-property: background-size, border-color, color;
}
.tuck-story + .print-tab { width: 45%; }   /* under the companion story: narrower again */
.tuck-head {
  display: block; font-family: var(--serif-ko); font-size: var(--t-body); font-weight: 600; line-height: 1.3;
  letter-spacing: -0.0125em; word-break: keep-all; text-wrap: balance; color: var(--ink); transition: color .45s ease;
}
.tuck-story .en {
  display: block; margin-top: var(--s2); font-family: var(--sans); font-size: var(--t-small); line-height: 1.5;
  color: var(--stone); transition: color .45s ease;
}
@media (max-width: 34rem) { .tuck-story { width: 85%; } .tuck-story + .print-tab { width: 60%; } }

/* 2. headline box overlapping the photo */
.side-row { display: grid; grid-template-columns: 6fr 1fr 5fr; align-items: center; }
.side-head {
  grid-column: 1 / 3; grid-row: 1; position: relative; z-index: 1;
  /* the box inset (see "Box insets" below): 14px from the edge to the letters on every side */
  padding: calc(var(--inset) + 0.13em) var(--inset) var(--inset); text-box-trim: trim-both; text-box-edge: cap alphabetic; background: var(--paper);   /* +0.13em: Hangul stands above the capitals */ border: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
}
.side-head .en { color: var(--stone); }
.side-head.sm { font-size: var(--t-body); }   /* a smaller side story: the box headlines' size */
.en .date, .en .dash, .feat .en .date + .dash { font-size: inherit; color: inherit; }   /* date leads the English head */
.side-head {
  background-image: var(--shade-light); background-repeat: no-repeat; background-origin: padding-box;
}
.side-head .en { transition: color .45s ease; }
.side-photo { grid-column: 2 / 4; grid-row: 1; display: block; overflow: hidden; background: var(--line); border: 1px solid var(--line); }   /* same hairline as the box: a pale photo or chart still has an edge */
.side-photo img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; filter: grayscale(1); }

@media (max-width: 34rem) {
  .feat-photo img, .side-photo img { aspect-ratio: 3 / 2; }
  .feat-head { width: 90%; bottom: var(--s3); }
  .side-row { grid-template-columns: 1fr; }
  .side-photo { grid-column: 1; grid-row: 1; }
  .side-head { grid-column: 1; grid-row: 2; margin: calc(-1 * var(--s6)) var(--s4) 0; }
}

/* ---------- Links ----------
   Text links: a hairline underline at rest. On hover a crimson box fills the word from the bottom
   up -- the underline growing into it -- inside a box just a little wider than the letters, while
   the letters turn white. (Menu, wordmark, image cards and the footer's buttons are excluded.)
   Links with no underline at rest (headlines, the footer address) fill the same way. */
:root { --link-hover: var(--on-fill); }
a:where(:not(.nav a, .wordmark, .bk, .book, .overlay-card, .feat-photo, .side-head, .side-photo, .blur-card, .card, .print-tab, .tuck-story)) {
  text-decoration: none;
  /* the box reaches a hair past the letters on every side -- above the capitals, below the
     descenders -- so the fill rises from under the whole word to over it; the text doesn't move */
  padding: 0.1em 0.12em 0.08em; margin: 0 -0.12em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;   /* a link over two lines gets a box on each */
  background-image: linear-gradient(var(--crimson), var(--crimson)), linear-gradient(var(--crimson), var(--crimson));   /* the fill, and a crimson hairline underline */
  background-repeat: no-repeat;
  background-position: 0 100%, 0.12em calc(100% - 0.08em);   /* the underline stays where it was */
  background-size: 100% 0, calc(100% - 0.24em) 1px;
  transition: background-size .45s cubic-bezier(.45, 0, .25, 1), color .45s ease;   /* rises from the underline, unhurried */
}
a:where(:not(.nav a, .wordmark, .bk, .book, .overlay-card, .feat-photo, .side-head, .side-photo, .blur-card, .card, .print-tab, .tuck-story)):hover {
  color: var(--link-hover);
  background-size: 100% 100%, calc(100% - 0.24em) 1px;
}
.entry h3 a, .table .cell .th a, .work .th a, .foot-contact a { background-size: 100% 0, 0 1px; }
.entry h3 a:hover, .table .cell .th a:hover, .work .th a:hover, .foot-contact a:hover { background-size: 100% 100%, 0 1px; }

/* address that follows the pointer over a link (site.js) */
.link-tip {
  position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none;
  font-family: var(--sans); font-size: var(--t-small); line-height: 1.4;   /* the book tip's size and box, exactly */
  color: var(--on-fill); background: var(--crimson);
  padding: 6px; border-radius: 0; text-box-trim: trim-both; text-box-edge: cap alphabetic;
  white-space: nowrap; max-width: 60vw; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity .12s ease;
}
.link-tip.on { opacity: 1; }

/* ---------- Footer ----------
   A full dark block that ends the page at full strength:
   mail button, clocks (Seoul / LA / New York), then the address with the copyright at its right. */
.site-foot {
  margin-top: 0;
  background: var(--paper); color: var(--stone);   /* no ground of its own: set apart by the line and shade alone; every word grey */
  border-top: 1px solid var(--line);             /* a line to set it apart from the page above */
  background-image: var(--shade-light); background-repeat: no-repeat;   /* and the light shade just under it, as every other edge below a page's top */
}
/* Footer spacing uses exactly two sizes, measured on what you see (letters and the pill's edge):
   --fg (40px) for every small gap -- top, mail -> clocks, address -> copyright, bottom --
   and the body's section gap for clocks -> address. The em offsets below remove each
   font's built-in space above/below its letters so the visible gaps come out equal. */
.site-foot { --fg: var(--s6); }
.site-foot .wrap { padding-block: var(--s5) calc(var(--s5) - 0.5em); }   /* tight above the time and under the copyright: 28px */
/* clocks (with the mail), then the address with the copyright on its right */
.foot-main { display: grid; grid-template-columns: auto 1fr; column-gap: var(--s6); row-gap: 0; }
.foot-side { display: contents; }
.foot-side > .clocks { grid-column: 1 / -1; grid-row: 1; }
.foot-side > .foot-contact { grid-column: 1; grid-row: 2;
  margin-top: var(--s4); }   /* the mail's line -> address: the paragraph gap, two paragraphs of text */
.foot-copy { grid-column: 2; grid-row: 2; justify-self: end; align-self: end; white-space: nowrap; }   /* level with the last address line */


/* one dial for all five cities: the minutes are the same everywhere, so one minute hand and an hour
   hand per city. Every line in it -- rim, hour marks, hands -- is the same 1px hairline. The rim,
   the marks, the minute hand and Seoul's hour hand share the rim's pale grey; the other cities'
   hour hands are dark. Each hour hand is named just outside the dial where it points; hands
   pointing the same way share one label. Size and place are worked out by site.js: as large as
   fits beside the time and mail, down to the address or the copyright below it. */
.clocks { position: relative; }
.aclock { position: absolute; left: 0; top: 0; width: 88px; height: 88px; }
@media (max-width: 40rem) { .clocks .aclock .lab { font-size: 0.75rem; } }   /* phones: names a size down, to leave the dial room */
.aclock svg { display: block; position: relative; width: 100%; height: 100%; overflow: visible; }
/* hover: the face fills with crimson in step with the seconds (drawn by site.js); it fades in and out */
.aclock-fill { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity .3s ease; }
.aclock.live .aclock-fill { opacity: 1; }
.aclock .face, .aclock .tick, .aclock .pin { transition: stroke .3s ease, fill .3s ease; }
.aclock .hand { transition: stroke .12s ease; }   /* quick, so each hand lights as the crimson reaches it */
/* while the face is part pale, part crimson, the hands go dark so they read on both */
@media (hover: hover) {   /* not on touch screens, where a tap would leave the hands dark */
  .aclock:hover .hand.city { stroke: var(--ink); }
  /* the Seoul hour and minute hands never change: always pale grey (below) */
}
.aclock .face { fill: none; }
.aclock .face, .aclock line { stroke-width: 1; vector-effect: non-scaling-stroke; }   /* 1px at any size */
.aclock .face, .aclock .tick { stroke: var(--dial-rim); }
.aclock .hand.min, .aclock .hand.home { stroke: var(--dial-home) !important; transition: none; }   /* fixed pale grey, hover or not */
.aclock .hand { stroke-linecap: round; }
.aclock .hand.city { stroke: var(--dial-city); }
.aclock .pin { fill: var(--dial-pin); }
.aclock .lab {
  position: absolute; white-space: nowrap; pointer-events: none;
  font-family: var(--sans); font-feature-settings: normal; font-size: var(--t-small); line-height: 1.2; color: var(--dial-lab);   /* the same size as "in Seoul" and "Always open" */
}

/* address: plain body text, no hierarchy -- only the colour is dimmer */
.foot-contact { font-style: normal; font-size: var(--t-body); line-height: 1.5; color: var(--stone); }   /* same grey as the city names */
.foot-contact > * { display: block; }

/* clocks, two lines:
   1) Seoul -- the time large (twice the body, regular weight), then the weekday
      (Thursday) small, then "in Seoul" small and grey
   2) New York, California, London, Beijing -- the city small and grey, the time at body size */
.clocks { margin-top: -0.24em; }   /* the space above the figures in Newsreader: the top gap then reads as --fg */
/* the clock reads as a paragraph of text: "22:12 Saturday in Seoul," / "Always open" / the mail,
   all at the body size and grey, the mail a link like any other */
.clocks p { margin: 0; font-size: var(--t-body); line-height: 1.5; color: var(--stone); }
.clocks time {
  font-family: var(--serif); color: var(--stone); letter-spacing: -0.01em;   /* the body's own tracking; grey, as all the footer's words */
  font-feature-settings: "lnum" 1, "pnum" 1, "kern" 1;               /* natural-width lining figures */
}
.foot-copy { margin: 0; font-family: var(--serif); font-weight: 400; font-size: var(--t-body); color: var(--stone); }   /* same grey as the city names */
.foot-copy .ko { font-weight: 600; }

@media (max-width: 40rem) {
  .foot-main { grid-template-columns: 1fr; }
  .foot-copy { grid-column: 1; grid-row: 4; justify-self: start; margin-top: 0; line-height: 1.5; }   /* phones: straight on from the address, as one paragraph */
  .site-foot .wrap { padding-bottom: calc(var(--s5) - 0.51em); }
}
@media (prefers-reduced-motion: reduce) { a { animation: none !important; } }

@media (max-width: 40rem) {
  figure.ph.left, figure.ph.right,
  figure.ph.small.left, figure.ph.small.right { float: none; width: 100%; margin: var(--s5) 0; }
}
/* the menu bar stays one row at every width. When the name and the menu don't fit side by side, the
   name goes small and only Habin Paik shows, while the menu keeps its own
   letters (site.js decides, by measuring: .name-stack); only if even that doesn't fit does the bar go to
   two rows (.two-row) */
.site-head .brand, .site-head .nav { flex-shrink: 0; } .wordmark, .nav a { white-space: nowrap; }   /* never squeezed into extra lines: it fits, or the next step is taken */
.site-head.name-stack .bar { column-gap: var(--s2); }   /* the least room between name and menu; space-between gives the rest */
.site-head.name-stack .nav { --nav-gap: 10px; }
.site-head.name-stack .wordmark { font-size: var(--t-small); }   /* still the serif, smaller */
/* ...and shows only Habin Paik */
.site-head.name-stack .wordmark .ko { display: none; }
.site-head.two-row .bar { flex-direction: column; gap: var(--s1); align-items: flex-start; padding-top: calc(var(--s2) - 0.8px); }   /* two rows: the space between them already holds the name's room below and the menu's room above, so no gap -- above, between and below then read the same */
.site-head.two-row .bar .nav { align-self: center; }   /* the menu row is centred */
.site-head.two-row .bar .brand { align-self: center; }  /* so is the name row: "Habin Paik 백하빈" itself is centred, */
.site-head.two-row .wordmark .back-ico {                 /* and the back arrow hangs to its left */
  position: absolute; right: 100%; top: 50%; margin-right: 0.3em; transform: translateY(-50%);
}
.site-head.two-row .wordmark[aria-current="page"]::after { display: none; }   /* the name on its own row: no current-page shade */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
a:focus-visible { outline: 2px solid var(--crimson); outline-offset: 3px; }

/* 디자인 색 배경의 표지 책장 위 요소 */
.shelf-panel .book .t { color: var(--cat, var(--ink)); }   /* the title in its subject colour */
.shelf-panel .shelf-more button { color: var(--ink); border-color: var(--line); background-color: transparent; }

/* 책은 링크가 아니므로 일반 커서 */
.spine, .book { cursor: default; }

/* ---------- 책장 박스: 분류 버튼 줄 + 가로책장 + 표지책장을 하나의 회색 박스로 ---------- */
.shelf-box {
  width: calc(100vw - var(--sbw, 0px)); margin-left: calc(50% - (100vw - var(--sbw, 0px)) / 2);
  background: none;   /* no grey box: the shelves sit straight on the page */
  margin-top: var(--s3);
}
/* Research: the bookshelf box runs straight into the dark footer -- no white strip between */
main.shelf-end { padding-bottom: 0; }
.shelf-box [hidden] { display: none !important; }
.shelf-box:has(.spine-panel) { padding-bottom: calc(1.5625rem - var(--sec-gap)); }   /* the desk closes like text: arrow buttons -> section line 25px */
.shelf-box.no-covers .spine-panel { padding-bottom: 20px; }
.shelf-box.no-spines .shelf-panel { padding-top: 20px; }   /* 가로책장이 숨으면 박스 위→표지 첫 줄도 20px */   /* 표지책장이 숨으면 바닥 막대 아래 여백 8px */
.shelf-filter { margin-top: var(--s3); }   /* 각주 아래, 회색 박스 밖 */
.filter-wrap { display: flex; flex-wrap: wrap; gap: 6px; }

.filter-btn {
  font-family: var(--sans); font-size: var(--t-small); line-height: 1.6;
  padding: 2px 12px; border-radius: 0; cursor: pointer;
  background: var(--paper); color: var(--cat, var(--stone));
  border: 1px solid color-mix(in srgb, var(--cat, var(--stone)) 45%, transparent);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
/* (tags: hovering deepens the shade inside the top, the border stays as it is -- see the end) */
.filter-btn[aria-pressed="true"] { background: var(--cat, var(--ink)); color: var(--on-fill); border-color: var(--cat, var(--ink)); }
.book.is-filtered { display: none; }

/* 두꺼운 고전·인문 책은 두께 그대로 제목 두 줄까지 */
.spine.humanities .t {
  white-space: normal; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ---------- Portfolio: card rail at the end of each section ----------
   After NAVER's news cards: photo on top (3:2), a light grey panel below with the date (small),
   the title, and tag chips pinned to the bottom; cards in one row that runs off the right edge
   of the screen and scrolls sideways; under it a hairline with a dark thumb showing where you are,
   and prev / next arrows on the right. */
.card-rail {
  margin-top: var(--s4);   /* the paragraph gap */
  /* from the text column's left edge to the right edge of the screen */
  margin-right: calc((100% - (100vw - var(--sbw, 0px))) / 2);
}
.rail-track {
  display: flex; gap: var(--s4);
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; -ms-overflow-style: none;
  padding-right: var(--gutter);
  overscroll-behavior-x: contain;
}
.rail-track::-webkit-scrollbar { display: none; }
.card {
  flex: 0 0 clamp(15rem, 70vw, 18rem);
  display: flex; flex-direction: column;
  scroll-snap-align: start;
  color: var(--ink); text-decoration: none;
  background: var(--paper); border: 1px solid var(--line);   /* a box as the others: hairline, the page inside */
}
.card-img { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--line); }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.card:hover .card-img img { transform: scale(1.04); }
.card-txt { flex: 1; display: flex; flex-direction: column; padding: calc(var(--inset) + 1px) var(--inset) var(--inset); min-height: 11rem; background: var(--shade-light) no-repeat; }   /* 3.99px: the space above the title's capitals */   /* light shade under the photo's edge */
.card-date { font-family: var(--sans); font-size: var(--t-small); line-height: 1.5; color: var(--stone);   /* dates are grey, as everywhere */ }
.card-title {
  margin-top: 0; text-box-trim: trim-start; text-box-edge: cap alphabetic;
  font-family: var(--serif); font-size: var(--t-body); line-height: 1.5; letter-spacing: -0.01em;
  word-break: keep-all;
}
.card-foot { margin-top: auto; padding-top: var(--s4); display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s2); }   /* the date, at the foot */
.card-date { white-space: nowrap; text-box-trim: trim-end; text-box-edge: cap alphabetic; }   /* baseline -> card edge = the inset, as the other sides */
.rail-foot { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s4); padding-right: var(--gutter); }
.rail-bar { position: relative; flex: 1; height: 12px; background: var(--shade-light) no-repeat; }   /* the track: the light shade (no line) */
.rail-thumb { position: absolute; left: 0; top: 0; height: 12px; width: 20%; background: var(--shade-strong); }   /* where you are: the strong shade */


/* Portfolio: the cards no longer scroll sideways -- they fill the text column in rows and the
   page simply carries on down (Journalism's blur-card rails keep scrolling) */
.card-rail:not(.blur-rail) { margin-right: 0; }
.card-rail:not(.blur-rail) .rail-track {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  overflow: visible; scroll-snap-type: none; padding-right: 0;
}
.card-rail:not(.blur-rail) .card { flex: none; }
.card-rail:not(.blur-rail) .rail-foot { display: none; }
@media (max-width: 40rem) {   /* phones: two cards a row */
  .card-rail:not(.blur-rail) .rail-track { grid-template-columns: 1fr 1fr; gap: var(--s3); }
  .card-txt { min-height: 9rem; }
}

/* ---------- Journalism: headlines in Noto Serif KR SemiBold, as JoongAng's opinion headlines
   (their "400" is in fact the SemiBold file), tracking -0.4px at 32px = -0.0125em ---------- */
.j-page .entry h3,
.j-page .table .cell .th a,
.j-page .overlay-card .cap .title { font-weight: 600; letter-spacing: -0.0125em; }

/* small label above a headline (e.g. "세종시장 후보 인터뷰") */
.entry .kicker { margin: 0 0 var(--s1); font-family: var(--sans); font-size: var(--t-small); color: var(--stone); }
.entry .desc a { color: inherit; }
.entry .desc a:hover { color: var(--on-fill); }   /* the crimson fill turns these white too */

/* ---------- Journalism: blur cards, in a sideways-scrolling rail (same rail as Portfolio) ----------
   Same family as the overlay cards above (grey photo, title on the picture, square corners);
   the caption sits on a frosted band: the photo blurs under the text and clears toward the top. */
.blur-rail { margin-top: var(--s6); }
.blur-card {
  position: relative; display: block; overflow: hidden; text-decoration: none;
  flex: 0 0 clamp(15rem, 70vw, 18rem); scroll-snap-align: start;
  aspect-ratio: 4 / 5; background: var(--brand-deep);
}
/* phones: two card-news cards side by side in view (half the text column each) */
@media (max-width: 40rem) {
  .blur-rail .rail-track { gap: var(--s3); }   /* the same gap as the portfolio cards */
  .blur-card { flex-basis: calc((100vw - var(--sbw, 0px) - 2 * var(--gutter) - var(--s3)) / 2); }
  .blur-card { aspect-ratio: 3 / 5; }   /* taller, so the date, headline and description still fit at half width */
}
.blur-card img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease;   /* card news keep the paper's own colour photos */
}
.blur-card:hover img { transform: scale(1.05); }
.blur-card .cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  display: block; padding: var(--s7) var(--inset) var(--inset); color: #fff;
}
.blur-card .cap::before {   /* the frosted band: blur + a little dark, fading out upward */
  content: ""; position: absolute; inset: 0; z-index: -1;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(to top, var(--veil), rgba(0,0,0,.14));
  -webkit-mask-image: linear-gradient(to top, #000 55%, transparent);
          mask-image: linear-gradient(to top, #000 55%, transparent);
}
.blur-card .cap .meta { display: block; font-family: var(--sans); font-size: var(--t-small); color: var(--on-dark); }
.blur-card .cap .title {   /* body size, in the serif (myeongjo) at the headline weight */
  display: block;
  font-family: var(--serif-ko); font-size: var(--t-body); font-weight: 600; line-height: 1.3;
  letter-spacing: -0.0125em; word-break: keep-all; transition: color .15s ease;
}
/* the English headline under the Korean one: room for up to three lines */
.blur-card .cap .en {
  display: block; margin-top: var(--s2); text-box-trim: trim-end; text-box-edge: cap alphabetic;
  font-family: var(--sans); font-size: var(--t-small); line-height: 1.5; color: var(--on-dark);
}
.blur-card .cap .en .date, .blur-card .cap .en .dash { color: var(--on-dark); }   /* date leads the English line */

/* Local election desking: the three headlines in boxes stacked down the left, each overlapping the
   one above a little and stepping right; the one description flows to their right and on below.
   A race's pledge analysis sits inside its box. Headlines at the card-news headline size. Boxes as
   the story box: hairline, light shade, crimson fill on hover (both links turn white). */
.election::after { content: ""; display: block; clear: both; }
.estack { float: left; width: 46%; margin: 0 var(--s5) var(--s3) 0; }
.ebox {
  position: relative; width: calc(100% - 2 * var(--inset)); padding: calc(var(--inset) + 0.1 * var(--t-small)) var(--inset) calc(var(--inset) + 0.1 * var(--t-body)); text-box-trim: trim-both; text-box-edge: cap alphabetic;   /* first line the race (small sans), last the headline -- to the foot of its Hangul, which sits a little under the baseline */
  border: 1px solid var(--line); background-color: var(--paper);
  background-image: var(--shade-light); background-repeat: no-repeat; background-origin: padding-box;
  /* an empty box of the same size just behind, a few pixels down and to the right -- a small stack */
  box-shadow: 5px 5px 0 -1px var(--paper), 5px 5px 0 0 var(--line);
}
.ebox + .ebox { margin-top: calc(-1 * var(--s2)); }   /* overlaps the box above -- by 8px, so the "Pledge analysis" line above stays clear */
.ebox:nth-child(2) { margin-left: var(--s4); z-index: 1; }
.ebox:nth-child(3) { margin-left: calc(2 * var(--s4)); z-index: 2; }
.ebox .ekick { display: block; margin-bottom: var(--s1); font-family: var(--sans); font-size: var(--t-small); color: var(--crimson); transition: color .45s ease; }   /* which race, small, above the headline */
.ebox h3 { margin: 0; font-family: var(--serif-ko); font-size: var(--t-body); font-weight: 600; line-height: 1.3; letter-spacing: -0.0125em; word-break: keep-all; }
.ebox h3 a { color: var(--ink); transition: color .45s ease; }
.ebox .go { display: inline-block; margin-top: var(--s1); font-family: var(--sans); font-size: var(--t-small); color: var(--stone); transition: color .45s ease; }
.ebox h3 a, .ebox .go { background-image: none !important; padding: 0; margin-inline: 0; }   /* the box does the hover */
/* A box with a pledge analysis is split by a hairline: the top (race + headline) opens the interview,
   the strip below opens the analysis */
.ebox.split { padding: 0; }
.eup { position: relative; display: block; padding: calc(var(--inset) + 0.1 * var(--t-small)) var(--inset) calc(var(--inset) + 0.1 * var(--t-body)); text-box-trim: trim-both; text-box-edge: cap alphabetic; }
.ebox.split .go { display: block; margin: 0; border-top: 1px solid var(--line); padding: var(--inset); text-box-trim: trim-both; text-box-edge: cap alphabetic; }
.election > p { margin: 0; }
.election > p + p { margin-top: var(--s4); }   /* paragraph gap, as elsewhere */   /* the essay runs beside the boxes, as text beside a figure in a book */
.election .date { color: var(--stone); font-size: var(--t-small); white-space: nowrap; }
.election .dash { color: var(--stone); }
@media (max-width: 34rem) {
  .estack { float: none; width: 100%; margin: 0 0 var(--s4); }
  .ebox { width: calc(85% - 2 * var(--inset)); }
}

/* Desking: two headline boxes side by side, the second set a little lower and pulled a little to the
   left so the two overlap at a corner -- the election boxes' look: date and headline only */
.epair { display: flex; align-items: flex-start; margin: var(--s6) 0; }
.epair .ebox { flex: 1 1 0; width: auto; padding-top: calc(var(--inset) + 0.15 * var(--t-body)); padding-bottom: var(--inset); }
.epair.big .ebox { padding-top: calc(var(--inset) + 0.15 * var(--t-title)); }   /* first line the headline, last the English head */

.epair .ebox + .ebox { margin: var(--s5) 0 0 calc(-1 * var(--s4)); z-index: 1; }
.epair.big .ebox h3 { font-size: var(--t-title); }   /* at the side-story headline size */
.ebox .en { display: block; margin-top: var(--s2); font-family: var(--sans); font-size: var(--t-small); line-height: 1.5; color: var(--stone); transition: color .45s ease; }   /* English title, as under the side headlines */
@media (max-width: 34rem) {   /* still side by side on phones, with tighter padding and overlap */
  .epair .ebox + .ebox { margin: var(--s4) 0 0 calc(-1 * var(--s3)); }
}
.nw { white-space: nowrap; }   /* keep a pair joined by a middle dot on one line */

/* Box insets: every story box and card keeps its letters --inset from its edges (--s4, 20px; on
   phones --s3, 14px), on all four
   sides, measured to what you see -- the top of the first line's letters; the baseline of the last
   (the foot of its Hangul, if Korean). text-box trims each box's first line to its capitals and its
   last to the baseline, so the padding is the visible gap at any size; boxes that end in Korean add
   the Hangul's foot. Photo stories keep more room (--s4). */
@media (max-width: 34rem) { :root { --inset: var(--s3); } }

/* Hover, for every story box, photo story and card: the box or photo stays as it is; only the
   Korean headline (or a box's one label) gets the text links' crimson -- it rises from the bottom
   behind the letters, a hair wider than them, one box per line, and the letters turn white */
.kh {
  padding: 0 0.12em; margin: 0 -0.12em;   /* a hair past the letters at the sides */
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  /* the fill is a band 1.22em tall from the bottom of each line's box -- never the full font box, which
     in the Korean serif runs taller than the line and so reached up over the line above */
  background: linear-gradient(to top, var(--crimson) 1.22em, transparent 1.22em) no-repeat 0 100% / 100% 0;
  transition: background-size .45s cubic-bezier(.45, 0, .25, 1), color .45s ease;
}
/* every story box and photo story already answers a hover -- its shade deepens or its photo enlarges --
   so the headline itself stays as it is: no crimson fill there (it is kept for plain text links) */
/* a whole box is the link, not just its words */
.ebox:not(.split) h3 a::after, .eup h3 a::after { content: ""; position: absolute; inset: 0; }

/* Research buttons: the light shade just inside the top edge, as if set into the page */
.filter-btn, .spine-nav button, .rail-btn { position: relative; }
.filter-btn::after, .spine-nav button::after, .rail-btn::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: var(--s2);
  background: var(--shade-light); pointer-events: none;
}

/* Messy Desk: no line or shade where it closes */
section:has(.spine-panel) + section > h2.section-title { background: none; border-top-color: transparent; }   /* line and shade both gone; the spacing stays */
section:has(> .card-rail.blur-rail:last-child) + section > h2.section-title { background: none; border-top-color: transparent; }   /* after a card rail, its scroll bar already closes the section: no second bar */

/* "A prime more": the print-edition box -- hairline, light shade inside its top, the box inset on every
   side of the words (trimmed to capitals and baseline), small grey sans; on hover only the words fill */
.shelf-panel .shelf-more button, .shelf-more button {
  font-family: var(--sans); font-size: var(--t-small); font-weight: 400; color: var(--stone);
  padding: var(--inset); text-box-trim: trim-both; text-box-edge: cap alphabetic; line-height: 1.5;
  border: 1px solid var(--line); background: var(--paper) var(--shade-light) no-repeat;
  background-image: var(--shade-light); background-size: auto; background-origin: padding-box;
}
.shelf-panel .shelf-more button:hover, .shelf-more button:hover { color: var(--stone); border-color: var(--line); background-size: auto; }

/* Research buttons, one height: every button's words trimmed to capitals and baseline, with --s3 above
   and below them (the arrows drawn as tall as the capitals) -- tags, arrows and "more" all alike */
.filter-btn, .spine-nav button, .shelf-panel .shelf-more button, .shelf-more button, .rail-btn {
  padding-block: var(--s2); line-height: 1.5; text-box-trim: trim-both; text-box-edge: cap alphabetic;
}
.spine-nav svg, .rail-btn svg { height: 1cap; padding-block: 0.14px; box-sizing: content-box; }   /* +0.28px: the font's trimmed capitals run a hair taller than 1cap */

/* In-page buttons (they act here, they don't lead to another page): the desk's arrows and "A prime more".
   No crimson: pressing one only deepens the shade inside its top (to the strong one), which then fades back. */
.spine-nav button, .shelf-more button { position: relative; }
.spine-nav button, .spine-nav button:hover, .rail-btn, .rail-btn:hover { background-size: 100% 0; color: var(--stone); border-color: var(--line); }   /* arrows grey */
.shelf-panel .shelf-more button:hover, .shelf-more button:hover { background-size: auto; color: var(--stone); border-color: var(--line); }
.shelf-more button:hover .kh { background-size: 100% 0; color: inherit; }
.spine-nav button:disabled, .spine-nav button:disabled:hover, .rail-btn:disabled, .rail-btn:disabled:hover { color: var(--line); }
.spine-nav button::before, .shelf-more button::before, .rail-btn::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px; background: var(--shade-strong);
  opacity: 0; pointer-events: none; transition: opacity .45s ease;
}
.spine-nav button:active::before, .shelf-more button:active::before, .rail-btn:active::before { opacity: 1; transition-duration: .06s; }

/* "Pledge analysis" strips: the light shade under their top line, as every top edge */
.ebox.split .go { position: relative; }
.ebox.split .go::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: var(--s2); background: var(--shade-light); pointer-events: none; }

/* Magnet (front page): between the photo and the page there is no resting place -- the browser's own
   scroll snapping carries it to the photo or to the page (menu bar at the top), with the scroll's own
   momentum, so it never waits and then glides. The page itself is taller than the screen, so inside it
   scrolling stays free. The photo is sticky, so a 1px marker at the very top stands in for it. */
/* no css scroll snap: under a pinch zoom (Android Chrome, Samsung Internet) mandatory snapping threw the
   page back up to the menu bar; the magnet script in index.html does this work and stands aside while zoomed */
.snap-top { position: absolute; top: 0; left: 0; width: 1px; height: 1px; scroll-snap-align: start; pointer-events: none; }
.snap-top ~ .sheet { scroll-snap-align: start; scroll-snap-stop: always; scroll-margin-top: -1px; }   /* a fling up from the page stops here, not past it into the photo */   /* 1px past: the bar surely stuck */

/* arrows and "A prime more": hovering deepens the shade inside the top (pointer screens only);
   a press turns the words/arrow black for a moment, then they ease back to grey */
@media (hover: hover) {
  .spine-nav button:not(:disabled):hover::before, .shelf-more button:hover::before, .rail-btn:not(:disabled):hover::before { opacity: 1; }
}
.spine-nav button, .shelf-more button, .rail-btn { transition: color .45s ease; }
.spine-nav button:not(:disabled):active, .shelf-panel .shelf-more button:active, .shelf-more button:active, .rail-btn:not(:disabled):active { color: var(--ink); transition-duration: .06s; }

/* "A prime more" pressed: it swells downward into a crimson block with a big "+n" (white), the shelf
   opens beneath the covers carrying it down, the new books fade in; then it settles back */
.shelf-more button .big { display: none; }
.shelf-more button { white-space: nowrap; box-sizing: border-box; }
.shelf-more button { transition: color .45s ease, height .38s cubic-bezier(.3,0,.2,1), background-color .25s ease, border-color .25s ease; overflow: hidden; vertical-align: top; }
.shelf-panel .shelf-more button.burst, .shelf-more button.burst { background: var(--crimson); border-color: var(--crimson); color: var(--on-fill); }
.shelf-more button.burst::before { opacity: 0 !important; }
.shelf-more button.burst .kh { display: none; }
.shelf-more button.burst .big {
  display: block; font-family: var(--sans); font-weight: 600; font-size: var(--t-display); line-height: 1;   /* the identity-line size (28px at most), was the big name */
  color: var(--on-fill); text-box-trim: trim-both; text-box-edge: cap alphabetic; padding-block: var(--s3);
}
.shelf.opening { transition: height .75s cubic-bezier(.3,0,.2,1); }
.shelf .book { transition: opacity .6s ease .1s; }
.shelf .book.arriving { opacity: 0; transition: none; }

/* Journalism: hovering a story (its photo, its head, or its box) slowly enlarges its photo, as the Portfolio cards */
.feat-photo img, .side-photo img { transition: transform .5s ease; }
.feat-photo:hover img, .side-photo:hover img, .feat-photo.zoom img, .side-photo.zoom img { transform: scale(1.04); }

/* Messy Desk: the desk runs on past the text column into the empty margins on either side (the piles
   in the column stay exactly where they were: the shelf only widens outward, padded by the same
   amount), and there, outside the column, it blurs progressively away -- a cue that more lies that
   way. The blur lives only in the margins; nothing in the column is touched. */
.spine-wrap { --ext: max(var(--gutter), min((100vw - var(--sbw, 0px) - 46rem) / 2 + var(--gutter), var(--gutter) + 5rem)); }   /* at most 5rem past the column */
.spine-shelf { margin-inline: calc(var(--gutter) - var(--ext)); padding-inline: calc(var(--ext) - var(--gutter)); }
.desk-edge { position: absolute; top: 0; bottom: 8px; width: calc(var(--ext) - var(--gutter) + var(--gutter)); z-index: 2; pointer-events: none; opacity: 0; transition: opacity .35s ease; }
.desk-edge.on { opacity: 1; }
.desk-edge.r { left: calc(100% - var(--gutter)); }
.desk-edge.l { right: calc(100% - var(--gutter)); transform: scaleX(-1); }
.desk-edge span { position: absolute; inset: 0; }
.desk-edge span:nth-child(1) { backdrop-filter: blur(0.6px); -webkit-backdrop-filter: blur(0.6px); -webkit-mask-image: linear-gradient(to right, transparent, #000 25%); mask-image: linear-gradient(to right, transparent, #000 25%); }
.desk-edge span:nth-child(2) { backdrop-filter: blur(1.4px); -webkit-backdrop-filter: blur(1.4px); -webkit-mask-image: linear-gradient(to right, transparent 15%, #000 50%); mask-image: linear-gradient(to right, transparent 15%, #000 50%); }
.desk-edge span:nth-child(3) { backdrop-filter: blur(2.6px); -webkit-backdrop-filter: blur(2.6px); -webkit-mask-image: linear-gradient(to right, transparent 40%, #000 80%); mask-image: linear-gradient(to right, transparent 40%, #000 80%); }
.desk-edge::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to right, transparent 75%, color-mix(in srgb, var(--paper) 70%, transparent)); }   /* a light fade only at the far edge */

/* Bookshelf: the next books, a blurred glimpse in the background where "A prime more" and the note sit
   -- a cue that more lies below. Behind everything, no effect on layout; fades out downward. */
.shelf-wrap { position: relative; }
.shelf-peek {
  position: absolute; z-index: 0; pointer-events: none; overflow: hidden;
  filter: blur(6px); opacity: 0; transition: opacity .6s ease;
  -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent);
}
.shelf-peek.in { opacity: .5; }
.shelf-peek img { position: absolute; display: block; height: auto; }
.shelf-peek .pline { position: absolute; left: 0; right: 0; height: var(--s2); border-top: 1px solid var(--line); background: var(--shade-light) no-repeat; }
.shelf-wrap { isolation: isolate; }
.shelf-wrap > .shelf { z-index: 1; }   /* the real shelf, its ledges included, above the glimpse */
.shelf-more, .shelf-note { position: relative; z-index: 1; }

/* box-like controls and tags in semibold: subject tags, "A prime more", the print-edition box, the pledge-analysis strips */
.filter-btn, .shelf-panel .shelf-more button, .shelf-more button, .print-tab, .ebox .go { font-weight: 600; }
.spine-wrap .spine-board { left: calc(2 * var(--gutter) - var(--ext)); right: calc(2 * var(--gutter) - var(--ext)); }   /* the floor runs on under the desk into the margins, as far as it shows */

/* Messy Desk minimap (as an editor's overview): at the right end of the tag row, the whole desk in
   miniature -- each pile a small grey block, standing on a hairline -- with a frame for the part in
   view. Click or drag on it to move the desk. Hidden where the tags leave no room. */
.shelf-filter { position: relative; }
.desk-map { position: absolute; right: 0; bottom: 0; width: 7.5rem; height: 1.6rem; cursor: pointer; touch-action: none; }
.desk-map .floor { position: absolute; left: 0; right: 0; bottom: 0; border-top: 1px solid var(--line); }
.desk-map .mp { position: absolute; bottom: 1px; background: var(--line); }
.desk-map .view { position: absolute; top: 0; bottom: 0; border: 1px solid var(--stone); transition: border-color .2s ease; }
.desk-map:hover .view { border-color: var(--ink); }
.desk-map[hidden] { display: none; }
/* arrows: the stem weight of Pretendard SemiBold at the button size (0.125em -- 1.8px on desktop), square ends and sharp corners, as the letters */

/* Messy Desk edges, done plainly: the desk (and its floor) fades in from the blank page and out into it
   across the margins beyond the column -- no blur, no cut. On phones, where there is no margin, over
   the last 1.5rem. */
.desk-edge { display: none !important; }
.spine-wrap { --fade: max(1.5rem, var(--ext) - var(--gutter)); }
.spine-shelf, .spine-wrap .spine-board {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent);
          mask-image: linear-gradient(to right, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent);
}
@media (max-width: 40rem) { .desk-map { display: none !important; } }   /* phones: the tag row has no room for the minimap */

/* subject tags: hovering only deepens the shade inside the top (to the strong one); the border never changes */
.filter-btn::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px; background: var(--shade-strong); opacity: 0; pointer-events: none; transition: opacity .45s ease; }
@media (hover: hover) { .filter-btn:hover::before { opacity: 1; } }

/* arrows pressed: like the other buttons when on -- a dark ground and a white arrow for a moment, then back */
.spine-nav button { transition: color .45s ease, background-color .45s ease, border-color .45s ease; }
.spine-nav button:not(:disabled):active, .rail-btn:not(:disabled):active { background-color: var(--ink); border-color: var(--ink); color: var(--on-fill); transition-duration: .06s; }
.spine-nav button:not(:disabled):active::before, .rail-btn:not(:disabled):active::before { opacity: 0; }

/* Research: an outline of the page's sections in the left sketch area -- small grey sans on a 1px rail;
   the section being read in ink, marked by a 5px crimson bar that slides along the rail. Fixed under the
   menu bar, it fades in at the first section and out at the footer. Wide screens only. */
.outline-rail { position: absolute; bottom: 0; width: max-content; max-width: 12rem; z-index: 1; pointer-events: none; }   /* as wide as its longest item: its right edge on the same line as the time box's below (--s6 off the column) */
.outline { position: sticky; width: max-content; max-width: 12rem; font-family: var(--sans); font-size: var(--t-small); line-height: 1.4; pointer-events: auto; }
.outline ol { list-style: none; margin: 0; padding: 0; position: relative; border-left: 1px solid var(--line); }
.outline li + li { margin-top: var(--s2); }
.outline a { display: block; padding: 2px 0 2px var(--s3); color: var(--stone); text-decoration: none; background: none; transition: color .3s ease; }
.outline a:hover, .outline a.cur { color: var(--ink); }
.outline .bar { position: absolute; left: -3px; width: 5px; background: var(--crimson); transition: top .35s cubic-bezier(.3,0,.2,1), height .35s cubic-bezier(.3,0,.2,1); }
@media (max-width: 68.75rem) { .outline-rail { display: none; } }
h2.section-title { scroll-margin-top: calc(var(--head-h, 4rem) + var(--s5)); }

/* Night at the end: scroll to the very bottom of a page and the cream gives way to a soft warm black
   (not pure black), the words to a soft off-white; subject colours and crimson lift so they still read.
   Scroll back up and it returns. The change eases over .7s. */
html.night {
  --paper: #1C1B19; --ink: #E6E3DD; --stone: #A9A59D;   /* the night grey, exactly (the day's is mixed from ink and paper) */ --line: #3A3834; --brand: #252421; --brand-deep: #C9C6BF;
  --crimson: #C25466;
  --c-meche: #D08B4A; --c-phys: #6FA6D0; --c-math: #4DB585; --c-gensci: #4FA893; --c-classics: #A3B84E;
  --sh-strong: rgba(255,255,255,.17); --sh-light: rgba(255,255,255,.10);   /* at night the shades are light: a glow under each edge, strong enough to read on the dark */
  --dial-rim: #A9A59D; --dial-home: #A9A59D; --dial-city: #E3808F; --dial-pin: #A9A59D; --dial-lab: #A9A59D;   /* the dial at night: one grey (the words' grey) and pink */
  color-scheme: dark;
}
html.night, html.night body { background-color: var(--paper); color: var(--ink); }
/* day <-> night: the page cross-fades as one picture (site.js starts a view transition) */


/* wide screens (the sketch areas are roomy): the time, "Always open" and the mail leave the footer and
   stay in the left sketch area, at its foot, lined up with the outline above; the footer keeps one
   paragraph -- the copyright, then the address -- with the dial beside it */
@media (min-width: 80rem) {
  .site-foot .clock-main { display: none; }
  .foot-copy { grid-column: 1; grid-row: 2; justify-self: start; align-self: start; line-height: 1.5; }
  .foot-side > .foot-contact { grid-row: 3; margin-top: 0; }
  .clocks { margin-top: 0; }
}

/* the dial, at night (where it mostly turns now): rim and marks a step lighter than the night's lines,
   Seoul's hands a quiet grey that still shows, the city hands the lifted crimson, the pin off-white */
/* at night the dial keeps to grey and pink: one grey for the rim, marks, Seoul's hands, the pin and
   the names; pink for the cities' hands and the sweep, under which the hands turn dark */
html.night .aclock .face, html.night .aclock line, .site-foot .aclock .face, .site-foot .aclock line { stroke-width: 1.5; }   /* a hair heavier at night, so the dial holds on the dark */
/* at night the sweep's light leading edge fades into the dark ground, not toward white (which read as cream) */
html.night { --crimson-light: color-mix(in srgb, var(--crimson) 45%, var(--paper));
  --dial-fill: #D9707F; --dial-edge: color-mix(in srgb, #D9707F 35%, var(--paper)); --dial-on: var(--paper); }

/* from the bar over Explore More down, the page is night all the time; only what lies above it turns.
   The night colours are set again on these two, and every colour made from them is worked out again
   here (a custom property is resolved where it is declared, so :root's would stay day's) */
.pre-foot, .site-foot {
  --paper: #1C1B19; --ink: #E6E3DD; --line: #3A3834; --brand: #252421; --brand-deep: #C9C6BF;
  --crimson: #C25466; --c-journalism: var(--crimson);
  --sh-strong: rgba(255,255,255,.17); --sh-light: rgba(255,255,255,.10);
  --stone: #A9A59D;
  --shade-strong: linear-gradient(to bottom, var(--sh-strong), transparent 12px);
  --shade-light:  linear-gradient(to bottom, var(--sh-light), transparent var(--s2));
  --on-fill: var(--paper); --link-hover: var(--on-fill);
  --crimson-light: color-mix(in srgb, var(--crimson) 45%, var(--paper));
  --dial-rim: #A9A59D; --dial-home: #A9A59D; --dial-city: #E3808F; --dial-pin: #A9A59D; --dial-lab: #A9A59D;
  --dial-fill: #D9707F; --dial-edge: color-mix(in srgb, #D9707F 35%, var(--paper)); --dial-on: var(--paper);
  color-scheme: dark; background-color: var(--paper); color: var(--ink);
}   /* the sweep a clear pink at night, its edge fading into the dark; hands under it go dark */

/* the buffer before the footer, "Explore More": the four pages in a 2 x 2 grid, each name at its
   cell's top-left. Each cell carries the light shade on its left side only; the page you are on, and
   a hovered cell, the strong shade there. The page you
   are on in ink, the others grey; no crimson fill. */
.pre-foot { padding-bottom: 0; border-top: 0; background: none; background-color: var(--paper); }   /* the page runs straight into Explore More: no line, no shade, day or night */
.pre-foot .wrap { max-width: 46rem; }
.pre-foot h2.section-title { margin-top: -1px; }   /* Explore More opens like any section: its title's line and the light shade under it */
body:has(main > section:last-of-type > .card-rail.blur-rail:last-child) .pre-foot h2.section-title { border-top-color: transparent; background: none; }   /* after a card-news rail its scroll bar already divides */
.pre-foot ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; }   /* 2 x 2 */
.pre-foot li { position: relative; min-width: 0; }
/* no lines between the columns: the shades mark them */
.pre-foot a {
  position: relative; display: block; overflow: hidden;
  height: 100%; padding: var(--s4) var(--s3) var(--s5) var(--s4); text-decoration: none; color: var(--stone);
  background: none; margin: 0;   /* not a text link: no crimson line, no reach past the column */
}
.pre-foot li::before {   /* the light shade along the left side of each cell only */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--s2); background: linear-gradient(to right, var(--sh-light), transparent); pointer-events: none; z-index: 1;
}
.pre-foot li:has(a[aria-current="page"])::before { width: 12px; background: linear-gradient(to right, var(--sh-strong), transparent); }   /* the page you are on: the strong shade, as well as its words */
.pre-foot a::after {   /* hover: the strong shade along the cell's top */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 12px; background: linear-gradient(to right, var(--sh-strong), transparent);
  opacity: 0; transition: opacity .45s ease; pointer-events: none;   /* hover: the strong shade on the left side */
}
@media (hover: hover) { .pre-foot a:hover::after { opacity: 1; } }
.pre-foot a[aria-current="page"] { color: var(--ink); }
.pre-foot .pf-name { display: block; font-family: var(--serif); font-size: var(--t-display); line-height: 1.2; text-box-trim: trim-both; text-box-edge: cap alphabetic; overflow-wrap: anywhere; }

/* the end of a page's text -> the Explore More line: the same 25px as before every section line
   (the main's own bottom padding and the last block's margin give way to it) */
main { padding-bottom: 0; }
main > section:last-of-type, main > section:last-of-type > :last-child { margin-bottom: 0; }
.shelf-panel { padding-bottom: 0; }   /* the note is the bookshelf's last line of text */
/* a page that ends on a box (a rail of cards, its arrow buttons) keeps the box's edge 25px off the line, as the desk's arrows */
/* a section that ends on boxes (a rail of cards, the election boxes) keeps the boxes' edge 25px off the next line */
main > section:has(> .card-rail:last-child), main > section:has(> .election:last-child) { padding-bottom: calc(1.5625rem - var(--sec-gap)); }
/* a section that ends on a photo: its caption's last line 25px off the next line, as text */
main > section > figure:last-child { margin-bottom: 0; }
main > section > figure:last-child figcaption { padding-bottom: calc((var(--t-body) - var(--t-small)) / 2); }
.shelf-note { padding-bottom: calc((var(--t-body) - var(--t-small)) / 2); }   /* small type sits higher in its line: make up the difference to the 25px */
.pre-foot { margin-top: var(--sec-gap); }
section > .fact:last-child { padding-bottom: 0.068em; }   /* the sans list sits a hair higher in its line than the serif: level the 25px with every other section */

/* the footer's line (right under Explore More's last row) -> the footer's first letters: the same as a
   section line -> its title's capitals (the light shade, then 50px) */
/* the footer's line is a section line: in the text column only, Portfolio's baseline 25px above it */
.site-foot { border-top: 0; background-image: none; }
.pre-foot { padding-bottom: 0; }
.site-foot .wrap { padding-top: 0; }   /* the footer's line meets the bottom of the Explore More grid: the cross's upright stands on it */
.foot-main { border-top: 0; background: none;   /* no line under Explore More's last row */   /* no shade under Explore More's last row */ padding-top: calc(var(--s2) + 3.125rem); }
@media (min-width: 80rem) { .foot-main { padding-top: calc(var(--s2) + 3.125rem - 0.28em); } }

/* wide screens: the rail the time and mail ride in the right sketch area (laid by site.js) */
.time-rail { position: absolute; top: 0; z-index: 40; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; padding-right: var(--s5); box-sizing: border-box; pointer-events: none; }
.time-rail[hidden] { display: none; }
.time-rail .clock-main { position: sticky; bottom: calc(50vh - var(--tb-h, 0px) / 2);   /* the screen's vertical middle */ pointer-events: auto; width: max-content;
  margin: 0; font-family: var(--serif); font-size: var(--t-body); line-height: 1.5; color: var(--stone);
  padding: var(--s3); border: 1px solid var(--line); background: var(--paper);
  text-box-trim: trim-both; text-box-edge: cap alphabetic; }

/* the time box is one button for the mail: the light shade inside its top; hovering deepens it; a press
   fills the box crimson (words white) and opens the mail */
.time-rail .clock-main { cursor: pointer; background: var(--paper) var(--shade-light) no-repeat; background-image: var(--shade-light);
  transition: background-color .45s ease, color .45s ease, border-color .45s ease; }
.time-rail .clock-main::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px; background: var(--shade-strong);
  opacity: 0; pointer-events: none; transition: opacity .45s ease; }
@media (hover: hover) { .time-rail .clock-main:hover::before { opacity: 1; } }
.time-rail .clock-main:active { background-color: var(--crimson); border-color: var(--crimson); color: var(--on-fill); transition-duration: .06s; }
.time-rail .clock-main:active::before { opacity: 0; }
.time-rail .clock-main:active .foot-mail { color: var(--on-fill) !important; text-decoration-color: var(--on-fill) !important; background: none !important; }
.time-rail .clock-main .foot-mail:hover { background: none; color: inherit; }   /* the box is the button: no separate hover on the address */
.time-rail .clock-main .foot-mail { transition: color .45s ease, text-decoration-color .45s ease; }
.time-rail .clock-main:active .foot-mail { transition-duration: .06s; }   /* turns white with the rest of the box, not after it */
/* in the box the address is just words: no underline, no link of its own -- the box is the button */
.time-rail .clock-main .foot-mail { text-decoration: none !important; pointer-events: none; color: inherit !important; background: none !important; }
.time-rail .clock-main { color: var(--ink); }   /* the box's words in the body's colour */

/* day <-> night: the page changes at once under a veil of the old ground that fades out (site.js) */
.night-veil { position: absolute; top: 0; left: 0; right: 0; z-index: 9999; pointer-events: none; opacity: 1; transition: opacity .3s ease; }
.night-veil.go { opacity: 0; }
html.night-switch body, html.night-switch body *, html.night-switch body *::before, html.night-switch body *::after { transition: none !important; }
html.night-switch .night-veil { transition: opacity .3s ease !important; }
/* the book tip, tight: 6px from its edge to the letters on every side (trimmed to capitals and baseline) */
.spine-tip { padding: 6px; text-box-trim: trim-both; text-box-edge: cap alphabetic; }

/* at every width the copyright opens the footer's last paragraph, above "Mechanical Engineering &
   Physics": one paragraph -- copyright, then the address -- a paragraph gap under the mail */
.foot-main .foot-copy { grid-column: 1; grid-row: 2; justify-self: start; align-self: start; line-height: 1.5; margin-top: var(--s4); }
.foot-side > .foot-contact { grid-column: 1; grid-row: 3; margin-top: 0; }
@media (min-width: 80rem) { .foot-main .foot-copy { margin-top: 0; } }   /* wide: the mail has gone to the corner; the paragraph is the footer's first */

/* Journalism and Portfolio: every box with a shade inside its top deepens it (light -> strong) on hover,
   as the time box and the research buttons do; the tucked boxes' shade starts where the box above ends */
.tuck-story::before, .print-tab::before, .side-head::before, .ebox::before, .ebox.split .go::before, .card-txt::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px; background: var(--shade-strong);
  opacity: 0; pointer-events: none; transition: opacity .45s ease;
}
.tuck-story::before, .print-tab::before { top: calc(var(--s2) - 1px); }
.card-txt { position: relative; }
@media (hover: hover) {
  .tuck-story:hover::before, .print-tab:hover::before, .side-head:hover::before,
  .ebox:not(.split):hover::before, .ebox.split:has(h3 a:hover)::before, .ebox.split .go:hover::before,
  .card:hover .card-txt::before,
  .tuck-story.deep::before, .print-tab.deep::before, .side-head.deep::before { opacity: 1; }   /* .deep: a photo of the same story is hovered (site.js) */
}

/* ...and on the same hover, the headline of that story is underlined (a hairline, as text links are);
   its colours stay as they are -- at once, no fade */
.kh, .en, .meta, .ekick, .card-foot { transition: none; }
.kh { text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 1px; text-underline-offset: 0.25em; text-decoration-skip-ink: none; }   /* a quarter of the letter size below: clear of the headline */
@media (hover: hover) {
  :is(.side-head, .tuck-story, .print-tab, .ebox:not(.split), .ebox.split .go, .card, .feat-photo, .blur-card, .overlay-card):hover .kh,
  .ebox.split .eup:has(h3 a:hover) .kh,
  :is(.side-head, .tuck-story, .print-tab).deep .kh,
  .feat-photo.zoom .kh { text-decoration-color: var(--stone); }   /* the grey */
  :is(.feat-photo, .blur-card, .overlay-card):is(:hover, .zoom) .kh.kh.kh { text-decoration-color: #A9A59D; }   /* on a photo: the dark-ground grey (.kh thrice: outranks the list above, whose :is() counts as its weightiest member) */
}

/* the English line of every story is grey: on paper the day grey (already), on a photo the grey of
   white words on a dark ground */
.feat-head .en, .blur-card .cap .en, .blur-card .cap .en :is(.date, .dash),
.overlay-card .cap .meta, .overlay-card .cap .meta :is(.date, .dash) { color: #A9A59D; }

/* every headline laid on a photo sits on the same frosted band as the card news: the photo blurred
   and a little darkened under the words, fading out upward (no plain black gradient any more) */
figure.ph.overlay figcaption, .overlay-card .cap { background: none; z-index: 1; }
figure.ph.overlay figcaption::before, .overlay-card .cap::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(to top, var(--veil), rgba(0,0,0,.14));
  -webkit-mask-image: linear-gradient(to top, #000 55%, transparent);
          mask-image: linear-gradient(to top, #000 55%, transparent);
}

/* a side story is one thing -- its headline box and its photo together: hover anywhere on the pair
   and both answer at once (the photo enlarges, the box's shade deepens, the headline is underlined) */
.side-row:hover .side-photo img { transform: scale(1.04); }
.side-row:hover .side-head::before { opacity: 1; }
.side-row:hover .side-head .kh { text-decoration-color: var(--stone); }

/* Explore More: the page you are on is the one pink cell -- the night crimson, plain; its name in
   the dark ground's colour (words on a fill), the strong shade along its top as on any chosen cell */
.pre-foot li:has(a[aria-current="page"]) { background: var(--crimson); }   /* the crimson of its mode -- here, on the night ground, the night one (as a link's hover fill) */
.pre-foot li:has(a[aria-current="page"])::before { background: linear-gradient(to right, rgba(0,0,0,.14), transparent); }
.pre-foot a[aria-current="page"] { color: #1C1B19; }

/* a small, light upright between the menu's words, in the middle of the gap */
.nav a + a::before {
  content: ""; position: absolute; left: calc(var(--nav-gap) / -2); top: 50%; width: 1px; height: 0.7em;
  transform: translate(-50%, -62%); background: var(--line); pointer-events: none;   /* centred on the capitals, not on the line box */
}

/* card-news rails: the same arrow buttons as the Research desk's; phones swipe instead */
.rail-btn { display: none; margin: 0; }
@media (hover: hover) and (pointer: fine) { .rail-btn { display: flex; } }
.rail-btn:disabled { cursor: default; }

/* the three stacked boxes of a featured story (photo, companion story, print PDF): a little tighter
   than the site's box inset -- 16px from edge to letters (12px on phones) instead of 20 (14) */
.feat { --inset: 16px; }
@media (max-width: 34rem) { .feat { --inset: 12px; } }
.feat .feat-head { bottom: var(--inset); }   /* the photo's headline as close to its foot as the boxes below keep their letters */
/* a touch tighter still, and the boxes under the photo two thirds, then one third, of its width */
.feat { --inset: 14px; }
@media (max-width: 34rem) { .feat { --inset: 10px; } }
.feat .tuck-story, .feat .print-tab { width: calc(100% * 2 / 3); }
.feat .tuck-story + .print-tab { width: calc(100% / 3); }
/* Journalism: every story box and button keeps the featured story's tighter inset -- 14px from edge
   to letters (10px on phones) instead of the site's 20 (14) */
.j-page { --inset: 14px; }
@media (max-width: 34rem) { .j-page { --inset: 10px; } }

/* Explore More: the tighter inset as on Journalism -- 14px from each cell's edge to its name (10 on phones) */
.pre-foot { --inset: 14px; }
@media (max-width: 34rem) { .pre-foot { --inset: 10px; } }
.pre-foot a { padding: var(--inset); }
