/*
Theme Name: Captured by Nguyen
Theme URI: https://www.capturedbynguyen.com/
Author: Peter Nguyen
Description: Dark-first personal blog theme for a site that writes in two registers — a technical log and a personal essay. Photographic banner, an archive ledger, and a deliberately different layout for each thread. Built for capturedbynguyen.com; not for distribution.
Version: 2.0.0
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cbn
Tags: blog, two-column, custom-menu, featured-images, threaded-comments, dark-mode
*/

/* =========================================================================
 * Typefaces — self-hosted, see assets/fonts/LICENSE.txt
 *
 * Be Vietnam Pro was drawn for Vietnamese. Roughly a fifth of the posts here are
 * written in Vietnamese, with stacked diacritics that most display faces render
 * as collisions, so this is a content decision before it is an aesthetic one.
 * Newsreader carries the display voice. Self-hosted, because the site makes no
 * third-party requests and a font CDN is a tracker with a stylesheet.
 * ====================================================================== */

@font-face {
	font-family: 'Be Vietnam Pro';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url(assets/fonts/bevietnampro-400-vietnamese.woff2) format('woff2');
	unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
	font-family: 'Be Vietnam Pro';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url(assets/fonts/bevietnampro-400-latin-ext.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: 'Be Vietnam Pro';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url(assets/fonts/bevietnampro-400-latin.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: 'Be Vietnam Pro';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url(assets/fonts/bevietnampro-600-vietnamese.woff2) format('woff2');
	unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
	font-family: 'Be Vietnam Pro';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url(assets/fonts/bevietnampro-600-latin-ext.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: 'Be Vietnam Pro';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url(assets/fonts/bevietnampro-600-latin.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;
	src: url(assets/fonts/newsreader-400-vietnamese.woff2) format('woff2');
	unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
	font-family: 'Newsreader';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url(assets/fonts/newsreader-400-latin-ext.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: 400;
	font-display: swap;
	src: url(assets/fonts/newsreader-400-latin.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;
	src: url(assets/fonts/newsreader-600-vietnamese.woff2) format('woff2');
	unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
	font-family: 'Newsreader';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url(assets/fonts/newsreader-600-latin-ext.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;
	src: url(assets/fonts/newsreader-600-latin.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;
}

/* =========================================================================
 * Tokens
 *
 * Dark is the default and the designed state; light is the alternate. The ground
 * is a desaturated ink-teal rather than pure black — the banner is a photograph,
 * and #000 behind a photograph reads as a broken image, not as a night.
 *
 * Two accents, one per thread, and they carry meaning: cool for the machines,
 * warm for the people. Any element with data-thread re-points --accent for its
 * whole subtree, so nothing is styled twice.
 * ====================================================================== */

:root,
:root[data-mode="dark"] {
	--bg:        #0b1114;
	--bg-soft:   #101a1e;
	--bg-sunken: #17242a;
	--fg:        #e9efec;
	--fg-muted:  #86999f;
	--rule:      #1f2f36;

	--tech:      #93c3d9;   /* enamelware blue */
	--pers:      #ee7a55;   /* lacquer */
	--accent:    var(--tech);
	--on-accent: #080f12;

	--scrim:     8, 14, 17;

	--display: Newsreader, "Iowan Old Style", Georgia, serif;
	--sans:    "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--mono:    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

	--wrap: 1180px;
	--gap: 2rem;
	--radius: 4px;
	--header-h: 72px;
	--shadow: 0 2px 4px rgb(0 0 0 / 30%), 0 16px 40px rgb(0 0 0 / 30%);
}

:root[data-mode="light"] {
	--bg:        #f7f5f0;   /* warm paper, not white — the accents need warmth under them */
	--bg-soft:   #ffffff;
	--bg-sunken: #ece7dd;
	--fg:        #16211f;
	--fg-muted:  #5d6b6e;
	--rule:      #ded7ca;

	--tech:      #1c6b88;
	--pers:      #bc4a24;
	--on-accent: #ffffff;

	--scrim:     16, 22, 24;
	--shadow: 0 1px 2px rgb(22 33 31 / 6%), 0 12px 32px rgb(22 33 31 / 8%);
}

[data-thread="technical"] { --accent: var(--tech); }
[data-thread="personal"]  { --accent: var(--pers); }

/* =========================================================================
 * Base
 * ====================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/* Everything on this site is sized in rem, so the whole type scale — body,
   headings, the mono labels, and the rem-based spacing that keeps them in
   proportion — moves from this one number. 112.5% puts the base at 18px. */
html {
	font-size: 112.5%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--header-h) + 1.5rem);
}
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font: 400 1.0625rem/1.72 var(--sans);
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
	font-family: var(--display);
	font-weight: 400;
	line-height: 1.14;
	letter-spacing: -.015em;
	margin: 0 0 .5em;
}
p { margin: 0 0 1.25em; }

a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

img, svg, video, iframe { max-width: 100%; height: auto; display: block; }
figure { margin: 0; }
code, pre, kbd { font-family: var(--mono); font-size: .9em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px;
	clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--accent); color: var(--on-accent); padding: .75rem 1.25rem; }
.skip-link:focus { left: 0; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 1.5rem; }

/* The eyebrow: mono, letterspaced, tiny. Used for every label on the page, so it
   is the one voice that says "this is metadata, not prose". */
.eyebrow {
	font-family: var(--mono);
	font-size: .74rem;
	font-weight: 500;
	letter-spacing: .18em;
	text-transform: uppercase;
	color: var(--fg-muted);
}

/* =========================================================================
 * Header
 * ====================================================================== */

.site-header {
	position: sticky; top: 0; z-index: 50;
	background: color-mix(in srgb, var(--bg) 90%, transparent);
	backdrop-filter: saturate(160%) blur(14px);
	border-bottom: 1px solid var(--rule);
	transition: background .25s ease, border-color .25s ease;
}

/* Over the banner the header is glass on a photograph, so it drops its own
   surface entirely until the page scrolls (see .scrolled, set in cbn.js). */
.has-banner .site-header {
	position: fixed; left: 0; right: 0;
	background: transparent; backdrop-filter: none; border-bottom-color: transparent;
	color: #f4f7f5;
}
.has-banner .site-header.scrolled {
	background: color-mix(in srgb, var(--bg) 92%, transparent);
	backdrop-filter: saturate(160%) blur(14px);
	border-bottom-color: var(--rule);
	color: var(--fg);
}

.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: var(--header-h); }

.brand { margin-right: auto; min-width: 0; display: flex; align-items: baseline; gap: .7rem; }
.brand-name {
	font-family: var(--display); font-size: 1.3rem; font-weight: 600;
	letter-spacing: -.02em; text-decoration: none; white-space: nowrap;
}
.brand-tagline {
	margin: 0; font-family: var(--mono); font-size: .68rem; letter-spacing: .1em;
	text-transform: uppercase; color: var(--fg-muted);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.has-banner .site-header:not(.scrolled) .brand-tagline { color: rgb(255 255 255 / 62%); }
.custom-logo { max-height: 40px; width: auto; }

.nav-list { display: flex; gap: 1.6rem; list-style: none; margin: 0; padding: 0; }
.nav-list a {
	display: block; padding: .3rem 0;
	font-size: .88rem; font-weight: 500; letter-spacing: .04em;
	text-decoration: none; color: inherit;
	border-bottom: 1px solid transparent;
}
.nav-list a:hover, .nav-list .current-menu-item > a { border-bottom-color: var(--accent); color: var(--accent); }
.nav-list a[data-thread="technical"]:hover { color: var(--tech); border-bottom-color: var(--tech); }
.nav-list a[data-thread="personal"]:hover  { color: var(--pers); border-bottom-color: var(--pers); }
.nav-list .sub-menu { display: none; }

.header-actions { display: flex; gap: .25rem; }

.icon-btn {
	display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
	background: none; border: 0; border-radius: var(--radius); color: inherit; cursor: pointer;
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.nav-toggle { display: none; }
[data-mode="dark"] .icon-sun, [data-mode="light"] .icon-moon { display: none; }

.header-search { border-top: 1px solid var(--rule); padding: 1rem 0; background: var(--bg-soft); }
.has-banner .header-search { background: var(--bg); }

.search-form { display: flex; gap: .5rem; }
.search-form input[type="search"] {
	flex: 1; min-width: 0; padding: .7rem .9rem;
	border: 1px solid var(--rule); border-radius: var(--radius);
	background: var(--bg); color: inherit; font: inherit; font-size: .95rem;
}
.search-form button, .btn, .comments input[type="submit"] {
	padding: .7rem 1.3rem; border: 0; border-radius: var(--radius);
	background: var(--accent); color: var(--on-accent);
	font: inherit; font-size: .85rem; font-weight: 600; letter-spacing: .03em; cursor: pointer;
}
.search-form button:hover, .btn:hover { filter: brightness(1.1); }

/* =========================================================================
 * Banner
 *
 * A photograph, a hard scrim, and one sentence that says what the site is. The
 * headline is the thesis of the whole page: two subjects, one comma.
 * ====================================================================== */

.banner {
	position: relative;
	min-height: min(76vh, 660px);
	display: grid; align-items: end;
	padding-top: var(--header-h);
	isolation: isolate;
	background: var(--bg-sunken);
	overflow: hidden;
}

.banner-media { position: absolute; inset: 0; z-index: -2; background: #060b0d; }
/* The photograph is knocked back at the source rather than relying on the scrim
   alone. The banner image is owner-chosen and can be anything — the first one
   here is a bright blue sky — and white display type has to stay legible on all
   of them, not just the dark ones. */
.banner-media img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.48) saturate(.78); }

/* Two scrims: a vertical one so the text sits on ink, and a flat one so the photo
   never fights the type at the top either. Tuned dark — the banner is the only
   place white text sits on an arbitrary photograph. */
.banner-photo::after {
	content: ""; position: absolute; inset: 0; z-index: -1;
	background:
		linear-gradient(to top, rgb(var(--scrim) / 94%) 4%, rgb(var(--scrim) / 74%) 34%, rgb(var(--scrim) / 46%) 70%, rgb(var(--scrim) / 52%) 100%);
}

.banner-inner { max-width: var(--wrap); margin-inline: auto; padding: 0 1.5rem 5rem; width: 100%; color: #f2f6f4; }

.banner-eyebrow { color: rgb(255 255 255 / 72%); margin-bottom: 1.5rem; display: block; }

.banner-title {
	font-size: clamp(2.6rem, 1.4rem + 4.6vw, 5.4rem);
	line-height: 1.02;
	letter-spacing: -.03em;
	max-width: 16ch;
	margin: 0 0 1.5rem;
	text-wrap: balance;
}
/* The comma is the hinge of the sentence and of the site: one mark, two subjects.
   It is the only coloured thing in the banner — a second accent here turned the
   full stop into what looked like a rendering fault. */
.banner-title .hinge { color: var(--pers); }

.banner-lede {
	max-width: 54ch; font-size: clamp(1rem, .95rem + .3vw, 1.15rem);
	color: rgb(255 255 255 / 86%); margin-bottom: 2rem;
}

.banner-threads { display: flex; flex-wrap: wrap; gap: .75rem; }
.thread-chip {
	display: inline-flex; align-items: baseline; gap: .6rem;
	padding: .6rem 1.1rem;
	border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent);
	border-radius: 100px;
	background: color-mix(in srgb, var(--accent) 18%, rgb(var(--scrim) / 62%));
	backdrop-filter: blur(3px);
	color: #fff; text-decoration: none;
	font-size: .88rem; font-weight: 500;
	transition: background .18s ease, border-color .18s ease;
}
.thread-chip:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.thread-chip .n { font-family: var(--mono); font-size: .74rem; opacity: .75; }

/* No photograph: the two threads become the atmosphere instead. A cool field on
   the left, a warm one on the right, both far below the type. Used when no header
   image is set and no photo in the library is large enough — which is better than
   stretching a 300px thumbnail, and better than borrowing stock photography this
   site did not shoot. */
.banner-plain {
	background:
		radial-gradient(120% 90% at 12% 92%, color-mix(in srgb, var(--tech) 20%, transparent) 0%, transparent 62%),
		radial-gradient(120% 90% at 88% 8%, color-mix(in srgb, var(--pers) 17%, transparent) 0%, transparent 60%),
		var(--bg);
	border-bottom: 1px solid var(--rule);
}
/* A hairline grid, barely there — the only nod to the terminal in the whole
   design, and it keeps a large flat field from reading as an unloaded image. */
.banner-plain::after {
	content: ""; position: absolute; inset: 0; z-index: -1;
	background-image:
		linear-gradient(to right, color-mix(in srgb, var(--fg) 5%, transparent) 1px, transparent 1px),
		linear-gradient(to bottom, color-mix(in srgb, var(--fg) 5%, transparent) 1px, transparent 1px);
	background-size: 72px 72px;
	mask-image: radial-gradient(80% 70% at 30% 60%, #000 0%, transparent 78%);
}
.banner-plain .banner-inner { color: var(--fg); }
.banner-plain .banner-eyebrow { color: var(--fg-muted); }
.banner-plain .banner-lede { color: var(--fg-muted); }
.banner-plain .thread-chip { color: var(--fg); background: color-mix(in srgb, var(--accent) 10%, transparent); backdrop-filter: none; }
.banner-plain .thread-chip:hover { color: var(--on-accent); }
.banner-plain .banner-scroll { color: var(--fg-muted); }

.banner-scroll {
	position: absolute; left: 50%; bottom: 1.5rem; translate: -50% 0; z-index: 1;
	color: rgb(255 255 255 / 45%);
}
.banner-scroll svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* =========================================================================
 * Ledger — the signature
 *
 * One column per year, one segment per post, coloured by thread. It is the
 * archive's real shape: a thin warm scatter from 2012, a long silence, then a
 * dense cool block in 2026. Nothing here is decorative — every segment is a post
 * and links to it.
 * ====================================================================== */

.ledger { padding: 4.5rem 0 3.5rem; border-bottom: 1px solid var(--rule); }
.ledger-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 2.5rem; }
.ledger-note { max-width: 46ch; color: var(--fg-muted); font-size: .92rem; margin: .5rem 0 0; }
.ledger-legend { display: flex; gap: 1.25rem; }
.ledger-legend span { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); }
.ledger-legend i { width: 10px; height: 10px; border-radius: 2px; background: var(--accent); }

.ledger-chart {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, 1fr);
	align-items: end;
	gap: 6px;
	height: 170px;
	padding-bottom: .5rem;
	border-bottom: 1px solid var(--rule);
}

/* One bar per year, height normalised against the busiest year via --h. Fixed
   chart height, so daily publishing changes the proportions inside the chart and
   never the size of the chart itself. */
.ledger-year {
	display: flex; flex-direction: column-reverse; gap: 2px;
	height: var(--h); min-height: 4px;
	border-radius: 2px; overflow: hidden;
	text-decoration: none;
	transition: opacity .15s ease, transform .15s ease;
}
.ledger-year:hover, .ledger-year:focus-visible { transform: scaleY(1.03); transform-origin: bottom; }
.ledger-chart:hover .ledger-year:not(:hover) { opacity: .55; }

.ledger-seg { display: block; background: var(--accent); min-height: 3px; }

/* A year with nothing in it keeps its column against the baseline rule, which
   reads as zero. Collapsing those would hide the quiet years entirely. */
.ledger-year-empty { height: 2px; background: var(--rule); border-radius: 1px; }

.ledger-axis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; margin-top: .6rem; }
.ledger-axis span { font-family: var(--mono); font-size: .64rem; color: var(--fg-muted); text-align: center; }
/* 15 year labels will not fit on a phone; show every third and keep the bars. */
.ledger-axis span.minor { visibility: visible; }

/* =========================================================================
 * Section headings — the rule-and-label device, used for both threads
 * ====================================================================== */

.thread-section { padding: 5rem 0; }
.thread-section + .thread-section { border-top: 1px solid var(--rule); }

.section-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 1.5rem; margin-bottom: 3rem; }
.section-title { font-size: clamp(2rem, 1.5rem + 2vw, 3.2rem); margin: .4rem 0 .5rem; color: var(--accent); }
.section-sub { color: var(--fg-muted); max-width: 48ch; margin: 0; font-size: 1rem; }
.section-more {
	font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
	color: var(--accent); text-decoration: none; white-space: nowrap; padding-bottom: .4rem;
	border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.section-more:hover { border-bottom-color: var(--accent); }

/* =========================================================================
 * Technical — the log
 *
 * No thumbnails. These are 31 diagnostic posts whose images are stock server
 * photography; a card grid would spend the page's whole budget on pictures that
 * say nothing. A dense dated list is what a changelog looks like, and it lets you
 * scan four times as many titles.
 * ====================================================================== */

.log { border-top: 1px solid var(--rule); }

.log-row {
	display: grid;
	grid-template-columns: 6.5rem 88px minmax(0, 1fr) 4.5rem;
	align-items: center; gap: 1.25rem;
	padding: .8rem 0;
	border-bottom: 1px solid var(--rule);
	text-decoration: none;
	transition: background .15s ease, padding .15s ease;
}
.log-row:hover, .log-row:focus-visible {
	background: color-mix(in srgb, var(--accent) 7%, transparent);
	padding-inline: 1rem;
	color: inherit;
}
.log-date { font-family: var(--mono); font-size: .78rem; color: var(--fg-muted); letter-spacing: .04em; }

/* Fixed box whether or not a post has an image, so the dates and titles stay in
   line all the way down. An empty one reads as a quiet gap, not a broken row. */
.log-thumb {
	display: block; width: 88px; aspect-ratio: 3 / 2;
	border-radius: 3px; overflow: hidden;
	background: var(--bg-sunken);
}
.log-thumb img { width: 100%; height: 100%; object-fit: cover; transition: scale .3s ease; }
.log-row:hover .log-thumb img { scale: 1.06; }

.log-title { font-family: var(--display); font-size: 1.22rem; line-height: 1.28; margin: 0; font-weight: 400; }
.log-row:hover .log-title { color: var(--accent); }
.log-time { font-family: var(--mono); font-size: .76rem; color: var(--fg-muted); text-align: right; }

/* =========================================================================
 * Personal — the gallery
 *
 * The opposite treatment, for the opposite content: 8 essays with real
 * photographs in them — a street sign in Little Saigon, a school gate in Hanoi.
 * Those earn the space a stock server rack does not.
 * ====================================================================== */

.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 3rem 2.5rem; }

.essay { display: flex; flex-direction: column; }
.essay-media {
	display: block; aspect-ratio: 4 / 3; overflow: hidden;
	background: var(--bg-sunken); border-radius: var(--radius); margin-bottom: 1.25rem;
}
.essay-media img { width: 100%; height: 100%; object-fit: cover; transition: scale .5s cubic-bezier(.2,.6,.2,1); }
.essay:hover .essay-media img { scale: 1.03; }
.essay-date { display: block; margin-bottom: .6rem; }
.essay-title { font-size: 1.6rem; line-height: 1.18; margin: 0 0 .6rem; }
.essay-title a { text-decoration: none; }
.essay-excerpt { color: var(--fg-muted); font-size: 1rem; margin: 0; }

/* First essay runs the full width with the image beside the text — the newest
   piece gets the room, and it breaks the grid's rhythm on purpose. */
.gallery .essay-lead { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 2.5rem; align-items: center; }
.gallery .essay-lead .essay-media { aspect-ratio: 3 / 2; margin: 0; }
.gallery .essay-lead .essay-title { font-size: clamp(1.8rem, 1.4rem + 1.4vw, 2.6rem); }
.gallery .essay-lead .essay-excerpt { font-size: 1.05rem; }

/* =========================================================================
 * Cards — used by archives, search, related. Quieter than the homepage.
 * ====================================================================== */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.card-grid-3 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.card { display: flex; flex-direction: column; }
.card-media { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--bg-sunken); border-radius: var(--radius); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: scale .4s ease; }
.card:hover .card-media img { scale: 1.04; }
.card-body { padding: 1rem 0 0; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 1.24rem; margin: .5rem 0 .5rem; line-height: 1.24; }
.card-title a { text-decoration: none; }
.card-excerpt { color: var(--fg-muted); font-size: .96rem; margin-bottom: 1rem; }
.card .post-meta { margin-top: auto; }

.card-compact { flex-direction: row; align-items: flex-start; gap: .85rem; padding-bottom: .9rem; border-bottom: 1px solid var(--rule); }
.card-compact:last-child { border-bottom: 0; padding-bottom: 0; }
.card-compact .card-media { flex: 0 0 68px; aspect-ratio: 1; }
.card-compact .card-body { padding: 0; }
.card-compact .card-title { font-size: .96rem; margin: 0 0 .25rem; line-height: 1.32; }
.card-rail { display: grid; gap: .9rem; }

.thread-badge {
	display: inline-block;
	font-family: var(--mono); font-size: .68rem; font-weight: 500;
	letter-spacing: .16em; text-transform: uppercase;
	color: var(--accent); text-decoration: none;
}
.thread-badge::before { content: "— "; opacity: .5; }
.thread-badge:hover { color: var(--accent); text-decoration: underline; }

/* =========================================================================
 * Post meta
 * ====================================================================== */

.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .85rem; font-family: var(--mono); font-size: .76rem; letter-spacing: .03em; color: var(--fg-muted); }
.post-meta a { text-decoration: none; }
.meta-author { display: inline-flex; align-items: center; gap: .45rem; }
.meta-author a { display: inline-flex; align-items: center; gap: .45rem; color: inherit; }
.meta-author img { width: 22px; height: 22px; border-radius: 50%; }
.meta-item + .meta-item::before, .meta-author + .meta-item::before { content: "/"; margin-right: .85rem; opacity: .45; }

/* =========================================================================
 * Single post
 *
 * Split hero: text left, photograph right, vertically centred. Then a narrower
 * centred reading column, with images allowed to break out wider than the text.
 * Follows the reference theme's layout 2, which the owner picked.
 * ====================================================================== */

.single-hero {
	display: grid;
	grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
	gap: 3rem;
	align-items: center;
	padding: 4rem 1.5rem 4.5rem;
}
/* No featured image: the head drops onto the same centred axis as the reading
   column below it. Left-aligning it at the wrap edge while the body sat centred
   is exactly the mismatch that made the old layout look broken. */
.single-hero-solo { grid-template-columns: minmax(0, 1fr); padding-bottom: 1rem; }
/* width:100% first — auto margins on a grid item make it shrink-to-fit, so
   max-width alone left the box as wide as its longest line and centred that. */
.single-hero-solo .single-hero-text { width: 100%; max-width: 720px; margin-inline: auto; }

.single-title { font-size: clamp(1.9rem, 1.3rem + 2.2vw, 3rem); margin: .75rem 0 1.5rem; text-wrap: balance; }

.single-hero-media { margin: 0; }
.single-hero-media img {
	width: 100%; aspect-ratio: 3 / 2; object-fit: cover;
	border-radius: 8px;
}
.single-hero-media figcaption {
	font-size: .82rem; color: var(--fg-muted); margin-top: .75rem;
}

/* Top-aligned, not centred: at the larger type size the meta line wraps to two
   rows on some posts, and a centred avatar then floats against the middle of the
   block instead of sitting with the name it belongs to. */
.single-byline { display: flex; align-items: flex-start; gap: .9rem; }
.byline-avatar { flex-shrink: 0; line-height: 0; }
.byline-avatar img { width: 44px; height: 44px; border-radius: 50%; }
.byline-name {
	font-family: var(--display); font-size: 1.05rem; font-weight: 600;
	text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 1px;
}
.byline-meta {
	display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem;
	font-family: var(--mono); font-size: .76rem; color: var(--fg-muted); margin-top: .35rem;
}
.byline-meta a { text-decoration: none; }
.byline-meta .sep { opacity: .45; }

.breadcrumbs, .rank-math-breadcrumb { font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 1rem; }
.breadcrumbs a, .rank-math-breadcrumb a { text-decoration: none; }
.breadcrumbs span[aria-hidden], .rank-math-breadcrumb .separator { margin: 0 .5rem; opacity: .5; }

/* The reading column. Centred and narrow — the measure is the column itself, so
   nothing inside needs its own max-width. */
.single-body { max-width: 720px; margin-inline: auto; padding-bottom: 4rem; }

.entry-content { font-size: 1.09rem; }
.entry-content h2 { font-size: 1.75rem; margin-top: 2.4em; }
.entry-content h3 { font-size: 1.3rem; margin-top: 2em; }

/* Images break out wider than the text, centred, the way the reference does it.
   Clamped to the viewport so it can never cause a horizontal scrollbar. */
.entry-content figure,
.entry-content .separator,
.entry-content > img,
.entry-content > p > img {
	--breakout: min(118%, 100vw - 3rem);
	width: var(--breakout);
	max-width: var(--breakout);
	margin-inline: calc((100% - var(--breakout)) / 2);
}
.entry-content img { border-radius: 6px; margin-block: 2.25rem; width: 100%; height: auto; }
.entry-content figure { margin-block: 2.25rem; }
.entry-content figure img { margin-block: 0; }
.entry-content figcaption {
	font-size: .85rem; color: var(--fg-muted); margin-top: .75rem; line-height: 1.55;
}
.entry-content blockquote {
	margin: 2rem 0; padding: .25rem 0 .25rem 1.5rem;
	border-left: 2px solid var(--accent);
	font-family: var(--display); font-size: 1.2em; color: var(--fg-muted);
}
.entry-content pre { background: var(--bg-soft); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.15rem; overflow-x: auto; line-height: 1.55; max-width: 100%; }
.entry-content :not(pre) > code { background: var(--bg-sunken); border-radius: 3px; padding: .12em .4em; }
.entry-content table { width: 100%; border-collapse: collapse; margin: 2rem 0; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { border: 1px solid var(--rule); padding: .6rem .85rem; text-align: left; }
.entry-content th { background: var(--bg-soft); font-weight: 600; }
.entry-content ul, .entry-content ol { padding-left: 1.4rem; margin: 0 0 1.25em; }
.entry-content li { margin-bottom: .4em; }
.entry-content hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 2.5rem 0; }
.share-label { font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--fg-muted); margin-right: .35rem; }
.share-link {
	padding: .35rem .8rem; border: 1px solid var(--rule); border-radius: 100px;
	background: none; color: var(--fg-muted); font: inherit; font-size: .78rem; text-decoration: none; cursor: pointer;
}
.share-link:hover { border-color: var(--accent); color: var(--accent); }

.tags { display: flex; flex-wrap: wrap; gap: .5rem; margin: 2.5rem 0; }
.tags a { font-family: var(--mono); font-size: .72rem; padding: .28rem .65rem; border-radius: 3px; background: var(--bg-sunken); color: var(--fg-muted); text-decoration: none; }
.tags a:hover { background: var(--accent); color: var(--on-accent); }

.author-box { display: flex; gap: 1.25rem; align-items: flex-start; padding: 1.75rem 0; margin: 3rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.author-box img { border-radius: 50%; flex-shrink: 0; }
.author-name { font-size: 1.2rem; margin-bottom: .3rem; }
.author-bio { color: var(--fg-muted); font-size: .94rem; margin-bottom: .5rem; }
.author-link { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); text-decoration: none; }

.prev-next { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin: 3rem 0; }
.pn { padding: 1.25rem 0; border-top: 1px solid var(--rule); text-decoration: none; }
.pn:hover { border-top-color: var(--accent); }
.pn-next { text-align: right; }
.pn-label { display: block; font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: .5rem; }
.pn-title { font-family: var(--display); font-size: 1.1rem; line-height: 1.3; }

.related { margin: 0 auto 5rem; }
.section-heading { font-family: var(--mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 1.75rem; font-weight: 500; }

/* Pages reuse the reading column, so a page's title and body share one axis. */
.single-page .single-hero { padding-bottom: 1rem; }
.single-hero-media.wrap { max-width: 720px; margin-inline: auto; margin-bottom: 2.5rem; }
.layout-narrow { grid-template-columns: minmax(0, 1fr); max-width: 720px; margin-inline: auto; }

/* =========================================================================
 * Archive header
 * ====================================================================== */

.archive-head { padding: 5rem 0 3rem; margin-bottom: 3.5rem; border-bottom: 1px solid var(--rule); }
.archive-title { font-size: clamp(2.4rem, 1.8rem + 2.6vw, 4rem); margin: .5rem 0 .75rem; color: var(--accent); }
.archive-blurb { color: var(--fg-muted); font-size: 1.05rem; max-width: 52ch; margin-bottom: 1rem; }
.archive-count { margin: 0; }
.empty { color: var(--fg-muted); }
.error-404 .banner-threads { margin: 2rem 0 3rem; }
.error-404 .thread-chip { color: var(--fg); }

/* =========================================================================
 * Sidebar
 * ====================================================================== */

.sidebar { display: grid; gap: 2.5rem; }
.widget-sticky { position: sticky; top: calc(var(--header-h) + 2rem); }
.widget { border-top: 1px solid var(--rule); padding-top: 1.15rem; }
.widget-title { font-family: var(--mono); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 1.1rem; font-weight: 500; }
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: .4rem 0; }
.widget a { text-decoration: none; font-size: .97rem; }
.widget-threads a { display: flex; justify-content: space-between; align-items: baseline; color: var(--accent); }
.widget-threads .count { font-family: var(--mono); font-size: .72rem; color: var(--fg-muted); }

/* =========================================================================
 * Forms — contact page
 * ====================================================================== */

.contact-form { margin: 2.5rem 0; display: grid; gap: 1.25rem; max-width: 640px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin: 0; }
.field { margin: 0; }
.field label { display: block; font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: .45rem; }
.field input, .field textarea {
	width: 100%; padding: .75rem .9rem;
	border: 1px solid var(--rule); border-radius: var(--radius);
	background: var(--bg-soft); color: inherit; font: inherit; font-size: .96rem;
}
.field textarea { resize: vertical; min-height: 160px; }
.field input:focus-visible, .field textarea:focus-visible { border-color: var(--accent); }
.field-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.field-note { font-size: .82rem; color: var(--fg-muted); max-width: 42ch; }

.form-notice {
	padding: .9rem 1.1rem; border-radius: var(--radius); margin: 2rem 0 0;
	border-left: 3px solid var(--accent); background: var(--bg-soft); font-size: .95rem;
}
/* The accents already mean thread, not status, so success and failure are told
   apart by their own colours rather than by borrowing one of them. */
.form-notice-ok  { border-left-color: #4fa87a; }
.form-notice-bad { border-left-color: #d1584f; }

/* =========================================================================
 * Comments
 * ====================================================================== */

.comments { margin-top: 4rem; padding-top: 3rem; border-top: 1px solid var(--rule); }
.comment-list, .comment-list .children { list-style: none; margin: 0; padding: 0; }
.comment-list .children { margin-left: 1.5rem; padding-left: 1.25rem; border-left: 1px solid var(--rule); }
.comment-body { padding: 1.35rem 0; border-bottom: 1px solid var(--rule); }
.comment-author { display: flex; align-items: center; gap: .65rem; font-weight: 600; font-size: .95rem; }
.comment-author img { border-radius: 50%; }
.comment-author .says { display: none; }
.comment-metadata { font-family: var(--mono); font-size: .7rem; color: var(--fg-muted); margin: .35rem 0 .8rem; }
.comment-metadata a { text-decoration: none; }
.reply a, .comment-reply-link { font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); text-decoration: none; }
.comments-closed { color: var(--fg-muted); font-size: .9rem; }

.comment-form { display: grid; gap: .9rem; margin-top: 1.75rem; }
.comment-form label { display: block; font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: .35rem; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
	width: 100%; padding: .75rem .9rem; border: 1px solid var(--rule); border-radius: var(--radius);
	background: var(--bg-soft); color: inherit; font: inherit; font-size: .95rem;
}
.comment-form textarea { min-height: 150px; resize: vertical; }
.comment-form .form-submit { margin: 0; }
.comment-notes, .comment-form-cookies-consent label { font-family: inherit; text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--fg-muted); }

/* =========================================================================
 * Pagination
 * ====================================================================== */

.pagination { margin-top: 4rem; }
.nav-links { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.page-numbers {
	display: grid; place-items: center; min-width: 38px; height: 38px; padding: 0 .75rem;
	border: 1px solid var(--rule); border-radius: var(--radius);
	font-family: var(--mono); font-size: .8rem; text-decoration: none;
}
.page-numbers:hover { border-color: var(--accent); color: var(--accent); }
.page-numbers.current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.page-numbers.dots { border-color: transparent; }

/* =========================================================================
 * Footer
 * ====================================================================== */

.site-footer { border-top: 1px solid var(--rule); padding: 4rem 0 2rem; margin-top: 5rem; background: var(--bg-soft); }
.footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 2.5rem; margin-bottom: 3rem; }
.site-footer .widget { border-top: 0; padding-top: 0; }
.site-footer .widget-title { font-family: var(--display); font-size: 1.15rem; letter-spacing: -.01em; text-transform: none; color: var(--fg); margin-bottom: .75rem; font-weight: 600; }
.site-footer .widget-title a { text-decoration: none; }
.site-footer .widget p { color: var(--fg-muted); font-size: .92rem; }
.footer-links li { padding: .28rem 0; }
.footer-links a { font-size: .9rem; color: var(--fg-muted); }
.footer-links a:hover { color: var(--accent); }

.footer-bottom { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; padding-top: 1.75rem; border-top: 1px solid var(--rule); font-family: var(--mono); font-size: .76rem; color: var(--fg-muted); }
.copyright { margin: 0; }
.footer-nav { display: flex; gap: 1.25rem; list-style: none; margin: 0; padding: 0; }
.footer-nav a { text-decoration: none; }

.to-top {
	position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 40;
	display: grid; place-items: center; width: 42px; height: 42px;
	border: 1px solid var(--rule); border-radius: 50%;
	background: var(--bg-soft); color: var(--fg); cursor: pointer; box-shadow: var(--shadow);
}
.to-top[hidden] { display: none; }   /* our display:grid outranks the UA [hidden] rule */
.to-top:hover { color: var(--accent); border-color: var(--accent); }
.to-top svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* =========================================================================
 * Responsive
 * ====================================================================== */

@media (max-width: 1000px) {
	.layout { grid-template-columns: minmax(0, 1fr); gap: 3rem; }
	.widget-sticky { position: static; }
	.sidebar { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
	.gallery .essay-lead { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
}

@media (max-width: 760px) {
	:root { --gap: 1.5rem; }
	body { font-size: 1rem; }

	.nav-toggle { display: grid; }
	.brand-tagline { display: none; }

	/* Anchored to the header's own box, so a wrapped brand cannot push the panel
	   under the content it is supposed to sit below. */
	.primary-nav {
		position: absolute; top: 100%; left: 0; right: 0;
		background: var(--bg); border-bottom: 1px solid var(--rule);
		padding: 1rem 1.5rem; box-shadow: var(--shadow); display: none;
		color: var(--fg);
	}
	.nav-open .primary-nav { display: block; }
	.nav-list { flex-direction: column; gap: 0; }
	.nav-list li + li { border-top: 1px solid var(--rule); }
	.nav-list a { padding: .9rem 0; font-size: 1rem; }

	/* Stack the hero. Image first: on a phone the photograph is the thing that
	   tells you what the post is before the title has room to. */
	.single-hero {
		grid-template-columns: minmax(0, 1fr);
		gap: 1.5rem; padding: 1.5rem 1.5rem 2.5rem;
	}
	.single-hero-media { order: -1; }
	.single-hero-media img { aspect-ratio: 16 / 10; border-radius: 6px; }
	.single-byline { gap: .75rem; }

	/* No breakout at this width — there is nothing to break out of. */
	.entry-content figure,
	.entry-content .separator,
	.entry-content > img,
	.entry-content > p > img { --breakout: 100%; }

	.banner { min-height: 620px; }
	.banner-inner { padding-bottom: 3.5rem; }
	.banner-title { max-width: none; }

	/* min-height, never height: the 2026 column is taller than any fixed value
	   and a fixed one made the bars overflow across the year labels. Shorter
	   ticks keep the whole chart in proportion on a phone instead. */
	.ledger-chart { height: 120px; gap: 4px; }
	/* 15 year labels will not fit; thin them rather than shrinking them to mush. */
	.ledger-axis span.minor { visibility: hidden; }
	.ledger-head { display: block; }
	.ledger-legend { margin-top: 1.25rem; }

	.thread-section { padding: 3.5rem 0; }
	.section-head { grid-template-columns: minmax(0, 1fr); }

	/* Thumbnail down the left, title over the date and reading time. A four-column
	   row does not survive this width, but the image is worth keeping. */
	.log-row {
		grid-template-columns: 64px minmax(0, 1fr) auto;
		align-items: start; gap: .3rem .9rem; padding: .9rem 0;
	}
	.log-thumb { grid-row: 1 / 3; grid-column: 1; width: 64px; }
	.log-title { grid-row: 1; grid-column: 2 / -1; font-size: 1.05rem; }
	.log-date { grid-row: 2; grid-column: 2; font-size: .7rem; }
	.log-time { grid-row: 2; grid-column: 3; }
	.log-row:hover { padding-inline: 0; }

	.gallery { grid-template-columns: 1fr; gap: 2.5rem; }
	.single-head { padding-top: 2.5rem; }
	.author-box { flex-direction: column; }
	.pn-next { text-align: left; }
	.footer-bottom { justify-content: flex-start; }
}

@media print {
	.site-header, .site-footer, .sidebar, .share, .to-top, .prev-next, .related, .comments, .banner, .ledger { display: none; }
	.layout { grid-template-columns: 1fr; }
	body { font-size: 11pt; background: #fff; color: #000; }
}
