/* ───────────────────────────────────────────────
   Black on white. One literary typeface: EB Garamond (self-hosted).
   ─────────────────────────────────────────────── */

@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/EBGaramond.woff") format("woff");
  font-weight: 400 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/EBGaramond-Italic.woff") format("woff");
  font-weight: 400 800; font-style: italic; font-display: swap;
}

:root {
  --ink: #000;
  --paper: #fff;
  --hair: #e6e6e6;            /* hairlines only — never text */
  --serif: "EB Garamond", Garamond, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 640px;
  --wide: 880px;
  --gutter: 40px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.6;
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
a { color: var(--ink); }
img, video, iframe { display: block; max-width: 100%; }
::selection { background: #000; color: #fff; }

/* ── Masthead: name left, sections right ── */
.masthead {
  display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 36px var(--gutter);
}
.name { font-weight: 700; font-size: 24px; letter-spacing: .005em; text-decoration: none; }
.sections { display: flex; flex-wrap: wrap; gap: 6px 28px; font-size: 19px; }
.sections a { text-decoration: none; padding-bottom: 2px; border-bottom: 1px solid transparent; }
.sections a:hover, .sections a[aria-current] { border-bottom-color: var(--ink); }

/* ── Column ── */
.main { max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 0 auto; padding: 72px var(--gutter) 160px; }

/* Date · author · read time — top-right corner of every post */
.meta {
  margin: 0 0 10px;
  display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0 10px;
  font-size: 16px; font-style: italic;
}
.meta > * + *::before { content: "·"; margin-right: 10px; font-style: normal; }

.post-title { font-weight: 700; font-size: 52px; line-height: 1.06; letter-spacing: -.012em; margin: 0 0 18px; }
.post-title a { text-decoration: none; }
.post-subtitle { margin: -6px 0 28px; font-size: 24px; font-style: italic; line-height: 1.4; }

/* Home: older posts after the newest one */
.post-list { margin-top: 96px; }
.post + .post-list { padding-top: 64px; border-top: 1px solid var(--hair); }
.entry + .entry { margin-top: 64px; }
.entry-title { font-weight: 700; font-size: 36px; line-height: 1.1; letter-spacing: -.008em; margin: 0 0 10px; }
.entry-title a { text-decoration: none; }
.entry-excerpt { margin: 0; }
.more { display: inline-block; margin-top: 10px; font-style: italic; text-underline-offset: 4px; }

/* ── Front page ── */
.lead { padding-bottom: 56px; border-bottom: 1px solid var(--hair); }
.lead-tag { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.lead-label { font-style: italic; font-size: 16px; }
.lead-excerpt { margin: 0; }

.tag {
  display: inline-block; flex: none;
  min-width: 92px; padding: 3px 8px 2px;
  background: var(--ink); color: var(--paper);
  font-size: 12px; font-weight: 500; line-height: 1.3; letter-spacing: .12em; text-transform: uppercase; text-align: center;
}

.shelf { display: flex; flex-direction: column; margin-top: 72px; }
.shelf-title { font-weight: 700; font-size: 30px; line-height: 1.1; margin: 0 0 14px; }
.headlines { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.headlines li { border-bottom: 1px solid var(--hair); }
.headline {
  display: flex; align-items: center; gap: 16px; width: 100%;
  padding: 15px 0; margin: 0; border: 0; background: none;
  font: inherit; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer;
}
.h-title { flex: 1; min-width: 0; font-weight: 600; font-size: 21px; line-height: 1.3; text-wrap: balance; }
.headline:hover .h-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.headline:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.h-meta { flex: none; font-size: 15px; font-style: italic; white-space: nowrap; font-variant-numeric: tabular-nums; }
.h-out { font-weight: 400; }
.h-thumb { flex: none; width: 44px; height: 44px; object-fit: cover; }
.open-more { align-self: flex-end; margin-top: 14px; font-style: italic; font-size: 18px; text-underline-offset: 4px; }
.open-more::after { content: " \2192"; font-style: normal; }

/* ── Prose ── */
.prose > * + * { margin-top: 1.05em; }
.prose p { margin: 0; }
.prose h2 { font-weight: 700; font-size: 30px; line-height: 1.2; margin: 1.8em 0 .1em; }
.prose h3 { font-weight: 500; font-style: italic; font-size: 25px; margin: 1.6em 0 .1em; }
.prose a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose blockquote { margin: 1.6em 0; padding-left: 24px; border-left: 2px solid var(--ink); font-style: italic; }
.prose blockquote p + p { margin-top: .6em; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li + li { margin-top: .3em; }
.prose hr { border: 0; text-align: center; margin: 2.4em 0; }
.prose hr::before { content: "* * *"; letter-spacing: .5em; }
.prose code { font-family: var(--mono); font-size: .76em; background: #f5f5f5; padding: .12em .35em; }
.prose pre { background: #f5f5f5; padding: 18px 20px; overflow-x: auto; font-size: 15px; line-height: 1.55; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose table { width: 100%; border-collapse: collapse; font-size: .9em; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--hair); }
.pull { font-size: 34px; line-height: 1.25; font-style: italic; text-align: center; margin: 1.4em 0 !important; }

/* ── Media (shown as-is: no filters, no tints) ── */
figure { margin: 2.2em 0; }
figure img, figure video { width: 100%; height: auto; }
figure img[data-zoom] { cursor: zoom-in; }
figcaption { margin-top: 10px; font-size: 16px; font-style: italic; text-align: center; line-height: 1.45; }

.wide, .full { position: relative; left: 50%; transform: translateX(-50%); }
.wide { width: min(var(--wide), 100vw - 2 * var(--gutter)); }
.full { width: 100vw; }
.full figcaption { padding: 0 var(--gutter); }

.gallery-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 6px; }
.gallery-grid img { aspect-ratio: 1; object-fit: cover; }

/* Video card: thumbnail or silent loop + play button, links out */
.video-thumb { position: relative; display: block; aspect-ratio: 16 / 9; max-width: 100%; overflow: hidden; background: #000; }
.video-thumb img, .video-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.video-thumb:hover img, .video-thumb:hover video { transform: scale(1.025); }
.play {
  position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px 0 0 -34px;
  display: grid; place-items: center; border-radius: 50%;
  background: #fff; color: #000; box-shadow: 0 0 0 1px rgba(0,0,0,.08);
  transition: transform .2s ease;
}
.play svg { width: 28px; height: 28px; margin-left: 3px; }
.video-thumb:hover .play { transform: scale(1.08); }
.video-thumb:focus-visible { outline: 2px solid #000; outline-offset: 3px; }
.duration { position: absolute; right: 10px; bottom: 10px; background: #000; color: #fff; font-size: 14px; line-height: 1; padding: 5px 7px; font-variant-numeric: tabular-nums; }
.video-card figcaption { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.watch { font-style: italic; text-underline-offset: 3px; }
.watch::after { content: " \2197"; font-style: normal; }
.tile .video-thumb { margin-bottom: 12px; }
.tile-title { text-decoration: none; }
.tile-date a { text-underline-offset: 3px; }

.post-nav { display: flex; justify-content: space-between; gap: 24px; margin-top: 80px; padding-top: 28px; border-top: 1px solid var(--hair); }
.post-nav a { text-decoration: none; max-width: 48%; font-weight: 700; font-size: 21px; line-height: 1.25; }
.post-nav small { display: block; font-weight: 400; font-style: italic; font-size: 15px; }
.post-nav .next { text-align: right; margin-left: auto; }

/* ── Section pages ── */
.section-head { margin-bottom: 64px; }
.section-title { font-weight: 700; font-size: 52px; line-height: 1.05; margin: 0 0 8px; }
.section-intro { margin: 0; font-style: italic; }
.empty { font-style: italic; }
.tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 40px 24px; }
.tile { text-decoration: none; display: flex; flex-direction: column; }
.tile > img { aspect-ratio: 4 / 3; object-fit: cover; margin-bottom: 12px; }
.tile-title { font-weight: 700; font-size: 22px; line-height: 1.2; }
.tile-date { font-size: 15px; font-style: italic; }

/* ── Social icons: fixed lower-left ── */
.social { display: flex; justify-content: center; gap: 26px; align-items: center; padding: 0 0 56px; }
@media (min-width: 1100px) { .social { position: fixed; left: var(--gutter); bottom: 32px; padding: 0; } }
.social a { display: block; line-height: 0; }
.icon { width: 20px; height: 20px; }
.social a:hover { opacity: .55; }

/* ── Images page: every photo, grouped by month ── */
.month { font-weight: 500; font-style: italic; font-size: 22px; margin: 56px 0 14px; }
.section-head + .month { margin-top: 0; }
.photo-wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-wall img { width: 100%; aspect-ratio: 1; object-fit: cover; cursor: zoom-in; transition: opacity .2s ease; }
.photo-wall img:hover { opacity: .85; }
img[data-zoom]:focus-visible { outline: 2px solid #000; outline-offset: 2px; }

/* ── Photo viewer ── */
html.viewer-open { overflow: hidden; }
.viewer {
  position: fixed; inset: 0; z-index: 100;
  display: grid; grid-template-columns: 88px minmax(0, 1fr) 88px; align-items: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) env(safe-area-inset-right, 0px) max(24px, env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px);
  background: #fff;
}
.viewer[hidden] { display: none; }
.v-prev { grid-column: 1; } .v-next { grid-column: 3; }
.v-stage { grid-column: 2; grid-row: 1; margin: 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.v-img {
  display: block; width: auto; height: auto;
  max-width: min(900px, 100%); max-height: min(72vh, 100vh - 220px); max-height: min(72dvh, 100dvh - 220px);
  object-fit: contain;
}
.v-cap { text-align: center; display: flex; flex-direction: column; gap: 2px; max-width: 640px; }
.v-title { font-weight: 700; font-size: 20px; line-height: 1.3; }
.v-sub { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 10px; font-size: 15px; font-style: italic; }
.v-sub > :not([hidden]) ~ :not([hidden])::before { content: "·"; display: inline-block; margin-right: 10px; font-style: normal; text-decoration: none; }
.v-post { text-underline-offset: 3px; }
.v-count { font-style: normal; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.viewer button {
  appearance: none; background: none; border: 0; padding: 0; margin: 0; color: #000; cursor: pointer;
  width: 56px; height: 56px; display: grid; place-items: center; justify-self: center; border-radius: 50%;
}
.viewer button svg { width: 30px; height: 30px; }
.viewer button:hover { background: #f2f2f2; }
.viewer button:focus-visible { outline: 2px solid #000; outline-offset: 2px; }
.viewer button[hidden] { display: none; }
.v-close { position: absolute; top: max(16px, env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); }
.v-close svg { width: 26px; height: 26px; }

/* ── Small screens ── */
@media (max-width: 760px) {
  :root { --gutter: 20px; }
  body { font-size: 19px; }
  .masthead { padding: 24px var(--gutter); flex-direction: column; gap: 10px; }
  .sections { gap: 4px 18px; font-size: 17px; }
  .main { padding-top: 40px; padding-bottom: 40px; }
  .post-title, .section-title { font-size: 38px; }
  .entry-title { font-size: 30px; }
  .post-subtitle { font-size: 21px; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .tile-grid { grid-template-columns: 1fr; }
  .headline { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "tag meta thumb" "title title thumb"; gap: 6px 12px; align-items: center; }
  .headline .tag { grid-area: tag; }
  .headline .h-meta { grid-area: meta; }
  .headline .h-title { grid-area: title; font-size: 19px; }
  .headline .h-thumb { grid-area: thumb; width: 56px; height: 56px; }
  .shelf { margin-top: 56px; }
  .photo-wall { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .viewer { grid-template-columns: minmax(0, 1fr); padding-bottom: max(88px, env(safe-area-inset-bottom, 0px)); }
  .v-img { max-height: calc(100vh - 260px); max-height: calc(100dvh - 260px); }
  .v-prev, .v-next { position: absolute; bottom: max(20px, env(safe-area-inset-bottom, 0px)); }
  .v-prev { left: 24px; }
  .v-next { right: 24px; }
  .v-stage { grid-column: 1; padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .video-thumb img, .video-thumb video, .play { transition: none; }
}
