/* Aliuta
   A periodical of essays: a tiny name in a grainy opening, titles at poster scale,
   images that open to the page edges as you scroll, one reading column with notes in the margin. */

:root {
    --paper: #F9F9F7;
    --ink: #0F1012;
    --ink-2: #4F5258;
    --ink-3: #8A8D93;
    --rule: #E2E2DE;
    --plate: #E8E8E4;
    --accent: #3340C4;
    --on-image: #FFFFFF;
    --intro-bg: #0B0B0C;
    --display: var(--gh-font-heading, "Bodoni Moda", "Bodoni 72", Didot, "Iowan Old Style", Georgia, serif);
    --text: var(--gh-font-body, "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif);
    --ui: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --ease: cubic-bezier(.2, .75, .1, 1);
    --gutter: clamp(16px, 4vw, 56px);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #0C0D0E; --ink: #EDEDE9; --ink-2: #A2A5AA; --ink-3: #6C6F74;
        --rule: #232527; --plate: #18191B; --accent: #9AA4FF; color-scheme: dark;
    }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
    --paper: #0C0D0E; --ink: #EDEDE9; --ink-2: #A2A5AA; --ink-3: #6C6F74;
    --rule: #232527; --plate: #18191B; --accent: #9AA4FF; color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; background: var(--paper); }
body {
    margin: 0; background: var(--paper); color: var(--ink);
    font-family: var(--text); font-size: 18px; line-height: 1.55;
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    overflow-x: clip;
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.wrap { width: 100%; max-width: 1520px; margin-inline: auto; padding-inline: var(--gutter); }
.meta { font-family: var(--ui); font-size: 0.75rem; line-height: 1.45; color: var(--ink-3); letter-spacing: 0.02em; text-transform: lowercase; display: flex; flex-wrap: wrap; gap: 0 0.55em; margin: 0; }
.meta > span + span::before { content: "·"; margin-right: 0.55em; }
.meta > span:empty { display: none; }
.meta a { border-bottom: 1px solid transparent; transition: border-color .2s; }
.meta a:hover { border-color: currentColor; }
.display { font-family: var(--display); font-weight: 400; letter-spacing: -0.025em; line-height: 0.92; margin: 0; text-wrap: balance; font-optical-sizing: auto; }
.display em, [data-flourish] em { font-style: italic; letter-spacing: -0.03em; }

/* ---------- Corners: the only furniture ---------- */
.corner { position: fixed; z-index: 30; margin: 0; color: var(--ink); pointer-events: none; transition: color .35s, text-shadow .35s; }
body.img-top .c-tl, body.img-top .c-tr, body.img-bottom .c-bl, body.img-bottom .c-br { color: var(--on-image); text-shadow: 0 1px 14px rgba(0, 0, 0, .28); }
a.corner, .corner a, .corner button { pointer-events: auto; }
.c-tl { top: calc(env(safe-area-inset-top, 0px) + 22px); left: var(--gutter); }
.c-tl i { font-style: normal; display: inline-block; margin-right: 0.35em; transition: transform .4s var(--ease); }
.c-tl:hover i { transform: translateX(-4px); }
.c-tr { top: calc(env(safe-area-inset-top, 0px) + 20px); right: var(--gutter); display: flex; align-items: center; gap: 22px; }
.c-bl { bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); left: var(--gutter); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-br { bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); right: var(--gutter); font-variant-numeric: tabular-nums; }
.c-mark { font-family: var(--display); font-size: 1.05rem; letter-spacing: 0; line-height: 1; transition: opacity .5s, transform .7s var(--ease), color .35s; }
.home-template:not(.show-mark) .c-mark { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.c-nav a { font-family: var(--display); font-style: italic; font-size: 1.2rem; line-height: 1; text-transform: lowercase; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 5px; text-decoration-thickness: 1px; transition: text-decoration-color .25s; }
.c-nav a:hover, .c-nav a[aria-current="page"] { text-decoration-color: currentColor; }
/* Light or dark: a small half-filled disc that turns over */
.c-theme { display: grid; place-items: center; width: 1.25rem; height: 1.25rem; margin: 0; padding: 0; background: none; border: 0; color: inherit; cursor: pointer; }
.c-theme[hidden] { display: none; }
.c-theme::before { content: ""; width: 11px; height: 11px; border-radius: 50%; border: 1px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); transition: transform .6s var(--ease); }
.c-theme[aria-pressed="true"]::before { transform: rotate(180deg); }
.c-theme:hover::before { transform: rotate(90deg); }
.c-theme[aria-pressed="true"]:hover::before { transform: rotate(270deg); }
.c-small { font-family: var(--ui); font-size: 0.6875rem; letter-spacing: 0.04em; text-transform: lowercase; }
.progress-line { position: fixed; z-index: 31; top: 0; left: 0; right: 0; height: 2px; background: var(--ink); transform-origin: 0 50%; transform: scaleX(var(--read, 0)); opacity: var(--read-on, 0); transition: opacity .4s; pointer-events: none; }
body.img-top .progress-line { background: var(--on-image); }

/* ---------- Edge fades: once you scroll, the corners sit on a soft blurred band ---------- */
.edge { position: fixed; left: 0; right: 0; z-index: 25; pointer-events: none; opacity: 0; transition: opacity .6s var(--ease);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.edge-top { top: 0; height: calc(env(safe-area-inset-top, 0px) + 88px);
    -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent); mask-image: linear-gradient(to bottom, #000 50%, transparent); }
.edge-bottom { bottom: 0; height: calc(env(safe-area-inset-bottom, 0px) + 72px);
    -webkit-mask-image: linear-gradient(to top, #000 50%, transparent); mask-image: linear-gradient(to top, #000 50%, transparent); }
/* Two tones crossfade: pale under dark text, dark under white text. */
.edge::before, .edge::after { content: ""; position: absolute; inset: 0; transition: opacity .45s; }
.edge-top::before { background: linear-gradient(to bottom, color-mix(in srgb, var(--paper) 88%, transparent), transparent); }
.edge-top::after { background: linear-gradient(to bottom, rgba(0, 0, 0, .62), rgba(0, 0, 0, 0)); opacity: 0; }
.edge-bottom::before { background: linear-gradient(to top, color-mix(in srgb, var(--paper) 88%, transparent), transparent); }
.edge-bottom::after { background: linear-gradient(to top, rgba(0, 0, 0, .62), rgba(0, 0, 0, 0)); opacity: 0; }
body.img-top .edge-top::before, body.img-bottom .edge-bottom::before { opacity: 0; }
body.img-top .edge-top::after, body.img-bottom .edge-bottom::after { opacity: 1; }
body.scrolled .edge { opacity: 1; }

/* The strip behind a phone's status bar (the clock and battery). Safari 26 ignores theme-color and colours
   that strip from what sits at the very top edge of the page. In essays that was the transparent blur band,
   so Safari showed the text through it. On phones this solid 12px strip is the only thing touching the top
   edge (as the bleedblend library does it): page colour, or near-black when a picture is under the top
   corners, fading into the blur band, which starts just below it, as does the progress line. Older iPhones
   and Android read the theme-color tag, which aliuta.js keeps in step. */
.status-fill { --status: var(--paper); position: fixed; top: 0; left: 0; right: 0; height: 12px; z-index: 35; pointer-events: none; opacity: 0; background: var(--status); }
body.img-top .status-fill { --status: var(--intro-bg); }
/* The grain only plays over the home page's opening; elsewhere it is a full-screen layer doing nothing. */
body:not(.home-template) .projector { display: none; }
@media (max-width: 760px) {
    .status-fill { opacity: 1; }
    .status-fill::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 16px; pointer-events: none; background: linear-gradient(to bottom, var(--status), rgb(from var(--status) r g b / 0)); }
    .edge-top { top: 12px; height: calc(env(safe-area-inset-top, 0px) + 76px); }
    .progress-line { top: 12px; }
}

/* ---------- Film grain: only on the opening, fading as you scroll ---------- */
.projector { position: fixed; inset: 0; z-index: 50; pointer-events: none; overflow: hidden; opacity: var(--grain-o, 0); }
.projector .grain { position: absolute; inset: -64px; background-image: var(--grain, none); background-size: 180px; }
.projector .vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, .45) 100%); }
@media (prefers-reduced-motion: no-preference) {
    body.grain-live .projector .grain { animation: boil .48s steps(1) infinite; }
    @keyframes boil { 0% { transform: translate(0, 0); } 20% { transform: translate(-23px, 14px); } 40% { transform: translate(17px, -31px); } 60% { transform: translate(-9px, 27px); } 80% { transform: translate(29px, 8px); } }
}

/* ---------- Plates and bleeds ---------- */
.plate { position: relative; overflow: hidden; background: var(--plate); max-width: 100%; }
.plate img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.bleed {
    --p: 1; display: block; position: relative; width: 100%; overflow: hidden;
    clip-path: inset(0 calc((1 - var(--p)) * var(--gutter)) round calc((1 - var(--p)) * 6px));
}
.bleed .plate { position: absolute; inset: 0; }
.bleed .plate img { transform: scale(calc(1.14 - 0.14 * var(--p))); transition: transform .9s var(--ease); }
a:hover > .bleed .plate img { transform: scale(calc(1.17 - 0.14 * var(--p))); }

/* ---------- Opening ---------- */
.intro { position: relative; height: 235vh; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--intro-bg); display: grid; place-items: center; }
.stage-pic { position: absolute; inset: 0; display: block; }
.stage-pic .plate { position: absolute; inset: 0; background: var(--intro-bg); }
.stage-pic .plate img { transform: scale(var(--si, 1.1)); }
.stage-pic::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0) 58%); opacity: var(--o, 0); }
.veil { position: absolute; inset: 0; background: var(--intro-bg); opacity: var(--veil, .76); pointer-events: none; }
.tiny { position: relative; z-index: 2; margin: 0; font-family: var(--display); font-weight: 400; font-size: 1rem; line-height: 1; letter-spacing: 0.05em; color: var(--on-image);
    opacity: var(--t, 1); transform: translateY(calc(var(--lift, 0) * -1px)); filter: blur(calc(var(--blur, 0) * 1px)); pointer-events: none; }
.cue { position: absolute; z-index: 2; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; display: grid; justify-items: center; gap: 10px; font-family: var(--ui); font-size: 0.6875rem; text-transform: lowercase; letter-spacing: 0.04em; color: rgba(255, 255, 255, .45); opacity: var(--m, 1); pointer-events: none; }
.cue i { width: 1px; height: 36px; background: currentColor; transform-origin: top; animation: cue 2.4s var(--ease) infinite; }
@keyframes cue { 0% { transform: scaleY(0); } 45% { transform: scaleY(1); transform-origin: top; } 55% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }
.lead-over { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 0 var(--gutter) clamp(28px, 5vw, 64px); color: var(--on-image);
    display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px clamp(16px, 3vw, 48px); align-items: end;
    opacity: var(--o, 0); transform: translateY(calc((1 - var(--o, 0)) * 28px)); pointer-events: var(--o-pe, none); }
.lead-over .meta { grid-column: 1 / -1; color: rgba(255, 255, 255, .8); }
.lead-title { grid-column: 1 / span 9; font-size: clamp(3.2rem, 8.6vw, 10.5rem); color: var(--on-image); transition: opacity .3s; }
.lead-over:hover .lead-title { opacity: .8; }
.lead-side { grid-column: 10 / span 3; padding-bottom: 0.6vw; }
.lead-side .dek { color: rgba(255, 255, 255, .86); }
.dek { font-size: clamp(1.15rem, 0.95rem + 0.6vw, 1.5rem); line-height: 1.38; color: var(--ink-2); margin: 0; text-wrap: pretty; max-width: 34ch; }

/* ---------- Quote: an epigraph, quieter than the essays it introduces ---------- */
.quote { padding-block: clamp(96px, 12vw, 180px) 0; display: grid; gap: 18px; justify-items: center; text-align: center; }
.big-quote { margin: 0; font-family: var(--display); font-style: italic; font-weight: 400; font-size: clamp(1.5rem, 1rem + 1.6vw, 2.6rem); line-height: 1.2; letter-spacing: -0.015em; max-width: 30ch; text-wrap: balance; color: var(--ink-2); }
.big-quote::before { content: "\201C"; } .big-quote::after { content: "\201D"; }
.quote-src { margin: 0; font-family: var(--ui); font-size: 0.75rem; text-transform: lowercase; letter-spacing: 0.02em; color: var(--ink-3); }

/* ---------- Shelves: each kind of writing gets a section head you can't miss ---------- */
.shelf { padding-top: clamp(96px, 11vw, 180px); }
.index { padding-bottom: clamp(96px, 12vw, 180px); }
.index--paged, main > .index:first-child { padding-top: clamp(120px, 14vw, 200px); }
.intro--empty { height: 170vh; }
.intro + .index { padding-top: clamp(112px, 14vw, 220px); }
.intro--empty + .index, .intro--empty + .quote { padding-top: clamp(96px, 12vw, 160px); }
.shelf-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title count" "note count"; align-items: end; gap: 12px 24px; padding-bottom: clamp(18px, 2vw, 28px); border-bottom: 1px solid var(--ink); }
.shelf-title { grid-area: title; font-style: italic; font-size: clamp(3rem, 7.4vw, 8.5rem); line-height: 0.86; letter-spacing: -0.035em; }
.shelf-note { grid-area: note; margin: 0; font-style: italic; color: var(--ink-2); font-size: clamp(1rem, 0.9rem + 0.3vw, 1.2rem); line-height: 1.4; }
.shelf-count { grid-area: count; justify-self: end; padding-bottom: 0.2em; }
.shelf-count a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 4px; border: 0; }
.shelf-count a:hover { text-decoration-color: var(--ink); }
.shelf-head--small { grid-template-areas: "count"; grid-template-columns: 1fr; }
/* A title and count with no note under it: one row, so the count lines up with the title's baseline. */
.shelf-head--bare { grid-template-areas: "title count"; }
.shelf-head--small .shelf-count { justify-self: start; }
.archive-head + .shelf { padding-top: 0; }

/* ---------- Essay list ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.item a {
    display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto; align-items: baseline; gap: clamp(12px, 2vw, 32px);
    padding-block: clamp(22px, 2.4vw, 38px); border-bottom: 1px solid var(--rule); transition: opacity .4s var(--ease);
}
.item-no { font-family: var(--ui); font-size: 0.8125rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.item-body { display: grid; gap: clamp(8px, 0.9vw, 14px); min-width: 0; }
.item-title { font-family: var(--display); font-size: clamp(1.9rem, 3.9vw, 4.6rem); line-height: 0.98; letter-spacing: -0.03em; display: block; text-wrap: balance; transition: transform .6s var(--ease); }
.item-dek { color: var(--ink-2); font-size: clamp(1rem, 0.92rem + 0.25vw, 1.15rem); line-height: 1.45; max-width: 52ch; text-wrap: pretty;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; transition: transform .6s var(--ease); }
.item-dek:empty { display: none; }
.item-meta { font-family: var(--ui); font-size: 0.8125rem; color: var(--ink-3); text-align: right; white-space: nowrap; text-transform: lowercase; }
.item .plate { display: none; }
.item:target .item-title { animation: arrive 1.6s var(--ease) both; }
@keyframes arrive { from { opacity: .25; } }
.empty { padding-block: 32px; font-style: italic; color: var(--ink-2); }
@media (hover: hover) and (pointer: fine) {
    .list.hovering .item a { opacity: 0.2; }
    .list.hovering .item a.active { opacity: 1; }
    .item a.active .item-title, .item a.active .item-dek { transform: translateX(0.25em); }
}
.pager { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 28px; }

/* Floating preview that follows the pointer over the list */
.float { position: fixed; left: 0; top: 0; z-index: 20; width: clamp(220px, 21vw, 340px); aspect-ratio: 4 / 5; pointer-events: none; opacity: 0; transition: opacity .35s; will-change: transform; }
.float.on { opacity: 1; }
.float-inner { position: absolute; inset: 0; overflow: hidden; border-radius: 3px; transform: scale(.82); transition: transform .6s var(--ease); background: var(--plate); }
.float.on .float-inner { transform: scale(1); }
.float-img { position: absolute; inset: 0; opacity: 0; transition: opacity .35s; }
.float-img.on { opacity: 1; }
.float-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (hover: none), (pointer: coarse), (max-width: 760px) { .float { display: none; } }

/* ---------- Snippets: short pieces, shown by their opening lines ---------- */
.shelf--snippets { padding-bottom: clamp(96px, 12vw, 180px); }
.snips { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); gap: 0 clamp(24px, 3vw, 48px); }
.snip a { display: grid; grid-template-rows: auto auto 1fr auto; gap: 14px; height: 100%; padding-block: clamp(24px, 2.4vw, 36px) clamp(28px, 3vw, 44px); border-bottom: 1px solid var(--rule); }
.snip-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(1.6rem, 1.1rem + 1.1vw, 2.3rem); line-height: 1.02; letter-spacing: -0.02em; text-wrap: balance; transition: opacity .25s; }
.snip-text { margin: 0; color: var(--ink-2); font-size: 1.0625rem; line-height: 1.55; text-wrap: pretty;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden; }
.snip-more { justify-self: start; font: 400 0.75rem/1 var(--ui); text-transform: lowercase; letter-spacing: 0.02em; text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 5px; transition: text-decoration-color .2s; }
.snip a:hover .snip-title { opacity: .7; }
.snip a:hover .snip-more { text-decoration-color: var(--ink); }
.snip:target .snip-title { animation: arrive 1.6s var(--ease) both; }
.shelf--page { padding-bottom: clamp(96px, 12vw, 180px); }

/* ---------- Subscribe: one sentence ---------- */
.join { padding-block: clamp(96px, 13vw, 200px); border-top: 1px solid var(--ink); display: grid; gap: 28px; }
.join-line { font-size: clamp(2rem, 4.4vw, 4.8rem); line-height: 1.06; max-width: 15ch; }
.join-line input { font: inherit; font-style: italic; letter-spacing: -0.03em; width: 6.6em; max-width: 100%; background: transparent; color: var(--ink); border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; outline: 0; padding: 0; }
.join-line input::placeholder { color: var(--ink-3); }
.join-line input:focus-visible { border-bottom-color: var(--accent); }
.join-line button { font: inherit; font-style: italic; letter-spacing: -0.03em; background: none; border: 0; padding: 0; color: var(--ink-3); cursor: pointer; transition: color .25s; }
.join-line button:hover { color: var(--ink); }
.join-line.loading button { opacity: .4; }
.join-msg.m-ok, .join-msg.m-err { display: none; }
.join:has(.join-line.success) .m-default, .join:has(.join-line.error) .m-default { display: none; }
.join:has(.join-line.success) .m-ok, .join:has(.join-line.error) .m-err { display: flex; }

/* ---------- Essay ---------- */
.essay-head { padding-block: clamp(96px, 10vw, 150px) clamp(36px, 5vw, 72px); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px) clamp(16px, 3vw, 48px); align-items: end; }
.essay-head .meta { grid-column: 1 / -1; }
.essay-title { grid-column: 1 / -1; font-size: clamp(3.4rem, 9vw, 11rem); max-width: 12ch; }
.essay-head .dek { grid-column: 1 / span 6; }
.essay--snippet .essay-title { font-size: clamp(2.6rem, 5.6vw, 6.2rem); max-width: 16ch; }
.byline { grid-column: 10 / span 3; margin: 0; font-family: var(--ui); font-size: 0.75rem; text-transform: lowercase; letter-spacing: 0.02em; color: var(--ink-2); display: grid; gap: 2px; justify-self: end; text-align: right; }
.byline b { font-weight: 500; color: var(--ink); }
.essay-figure, .page-figure { margin: 0; }
.essay .bleed { aspect-ratio: 16 / 9; max-height: 90vh; }
.caption { font-family: var(--ui); font-size: 0.6875rem; text-transform: lowercase; letter-spacing: 0.03em; color: var(--ink-3); margin: 12px auto 0; }
.caption a { text-decoration: underline; text-underline-offset: 3px; }

/* The reading column. Ghost cards sit in it; wide and full cards break out. */
.prose {
    display: grid;
    grid-template-columns: [full-start] minmax(var(--gutter), 1fr) [main-start] minmax(0, 35em) [main-end] 3.5rem [note-start] minmax(0, 15rem) [note-end] minmax(var(--gutter), 1fr) [full-end];
    font-size: clamp(1.125rem, 0.95rem + 0.45vw, 1.3125rem); line-height: 1.68;
    padding-block: clamp(56px, 8vw, 112px) 0;
    font-feature-settings: "onum" 1;
    hanging-punctuation: first;
}
.prose > * { grid-column: main; min-width: 0; }
.prose p { margin: 0 0 1.25em; text-wrap: pretty; }
.prose a { text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: text-decoration-color .2s; }
.prose a:hover { text-decoration-color: var(--ink); }
.essay:not(.essay--snippet) .prose > p:first-of-type { font-size: 1.16em; line-height: 1.55; }
.essay:not(.essay--snippet) .prose > p:first-of-type::first-letter { font-family: var(--display); float: left; font-size: 4.7em; line-height: 0.78; padding: 0.06em 0.09em 0 0; font-weight: 400; }
.prose h2, .prose h3, .prose h4 { font-family: var(--display); font-weight: 400; letter-spacing: -0.02em; line-height: 1.04; margin: 1.5em 0 0.55em; text-wrap: balance; }
.prose h2 { font-size: clamp(1.9rem, 1.4vw + 1.3rem, 2.8rem); }
.prose h3 { font-size: clamp(1.45rem, 0.8vw + 1.1rem, 1.9rem); }
.prose h4 { font-size: 1.2em; font-style: italic; }
.prose ul, .prose ol { margin: 0 0 1.25em; padding-left: 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose blockquote { grid-column: main-start / note-end; margin: 1.2em 0 1.4em; padding: 0; border: 0; font-family: var(--display); font-style: italic; font-size: clamp(2rem, 2.6vw + 1rem, 3.6rem); line-height: 1.04; letter-spacing: -0.025em; text-wrap: balance; max-width: 18ch; }
.prose blockquote p { margin: 0 0 0.4em; }
.prose blockquote.kg-blockquote-alt { font-size: clamp(1.4rem, 1vw + 1rem, 1.9rem); line-height: 1.3; max-width: 28ch; padding-left: 1em; border-left: 1px solid var(--ink); grid-column: main; }
.prose hr { border: 0; height: auto; margin: 1.1em 0 1.3em; text-align: center; }
.prose hr::after { content: "\2042"; color: var(--ink-3); font-family: var(--display); font-size: 1.4em; }
.prose code { font-family: var(--ui); font-size: 0.82em; background: var(--plate); padding: 0.1em 0.35em; border-radius: 3px; }
.prose pre { font-family: var(--ui); font-size: 0.8rem; line-height: 1.6; background: var(--plate); padding: 1.2em 1.4em; border-radius: 3px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose figure { margin: 1.6em 0 2em; }
.prose figcaption { font-family: var(--ui); font-size: 0.6875rem; text-transform: lowercase; letter-spacing: 0.03em; color: var(--ink-3); margin-top: 12px; text-align: left; }
.prose .kg-image-card img, .prose .kg-gallery-image img { display: block; width: 100%; height: auto; border-radius: 3px; }
.prose .kg-width-wide { grid-column: main-start / note-end; }
.prose .kg-width-full { grid-column: full-start / full-end; }
.prose .kg-width-full img { border-radius: 0; }
.prose .kg-width-full figcaption { padding-inline: var(--gutter); }
.prose .kg-embed-card, .prose .kg-video-card, .prose .kg-bookmark-card { margin: 1.6em 0 2em; }

/* Margin notes, made from Markdown footnotes by aliuta.js */
.with-note { grid-column: main-start / note-end; display: grid; grid-template-columns: subgrid; }
.with-note > :not(.note) { grid-column: main; }
.note { grid-column: note; font-family: var(--text); font-style: italic; font-size: 0.78em; line-height: 1.5; color: var(--ink-2); padding-top: 0.35em; font-feature-settings: normal; }
.note p { margin: 0; }
.note b, sup.ref { font-family: var(--ui); font-style: normal; font-weight: 500; color: var(--accent); }
sup.ref { font-size: 0.6em; margin-left: 1px; line-height: 0; }
.note b { margin-right: 6px; }
.prose .footnotes { font-size: 0.85em; color: var(--ink-2); border-top: 1px solid var(--rule); padding-top: 1em; }
.prose .footnotes-sep { display: none; }

.essay-end { grid-column: main-start / note-end; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 32px; align-items: center; border-top: 1px solid var(--ink); padding-top: 24px; margin-top: 2.2em; }
.essay-end p { margin: 0; color: var(--ink-2); line-height: 1.5; font-style: italic; font-size: 0.9em; }
.essay-end b { color: var(--ink); font-weight: 400; font-style: normal; }
.essay-end .actions { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.text-btn { font: 400 0.75rem/1 var(--ui); text-transform: lowercase; letter-spacing: 0.02em; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 5px; transition: text-decoration-color .2s; }
.text-btn:hover { text-decoration-color: var(--ink); }
.prose .text-btn { text-decoration-thickness: auto; }
.replies { grid-column: main-start / note-end; margin-top: 2.4em; }
.replies-gate { margin: 0; font-style: italic; color: var(--ink-2); font-size: 0.9em; }
.replies-gate a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 4px; }
.replies-gate a:hover { text-decoration-color: var(--ink); }

/* With no next piece below (the oldest essay, or a snippet with none older), leave room before the footer rule. */
main > .essay:last-child { padding-bottom: clamp(96px, 12vw, 180px); }
.next { padding-block: clamp(96px, 12vw, 180px) 0; }
.next .bleed { aspect-ratio: 21 / 9; min-height: 340px; }
.next .bleed::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0) 62%); }
.next-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: clamp(20px, 4vw, 56px) calc(var(--gutter) + clamp(4px, 2vw, 32px)); color: var(--on-image); display: grid; gap: 14px; }
.next-text .meta { color: rgba(255, 255, 255, .78); }
.next-title { font-size: clamp(2.8rem, 7.4vw, 9rem); max-width: 14ch; color: var(--on-image); }
.next-plain { padding-bottom: clamp(48px, 6vw, 96px); }
.next-plain a { display: grid; gap: 16px; border-top: 1px solid var(--ink); padding-top: 24px; }
.next-plain .meta { color: var(--ink-3); }
.next-plain .next-title { color: var(--ink); font-size: clamp(2.4rem, 5vw, 5.6rem); transition: opacity .25s; }
.next-plain a:hover .next-title { opacity: .7; }

/* ---------- Pages and archives ---------- */
.page-head, .archive-head { padding-block: clamp(120px, 12vw, 180px) clamp(40px, 6vw, 88px); display: grid; gap: 28px; }
.page-title, .archive-title { font-size: clamp(3rem, 7.2vw, 9rem); max-width: 14ch; }
.page-bleed { aspect-ratio: 21 / 9; min-height: 300px; }
.page-prose { padding-bottom: clamp(80px, 10vw, 150px); }
.error-head { min-height: 70vh; align-content: center; }
.text-link { border-bottom: 1px solid var(--rule); transition: border-color .2s; }
.text-link:hover { border-color: var(--ink); }

/* ---------- Footer: a colophon, then the name again like a back cover ---------- */
/* The bottom padding keeps the blurred edge band and the corners clear of the name. */
.foot { border-top: 1px solid var(--rule); padding-top: clamp(48px, 6vw, 80px); padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 108px); overflow: hidden; }
.foot-in { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px clamp(16px, 3vw, 48px); }
.colophon { grid-column: 1 / span 5; display: grid; gap: 12px; align-content: start; }
.colophon p:not(.meta) { margin: 0; font-style: italic; color: var(--ink-2); font-size: 1rem; line-height: 1.55; max-width: 44ch; }
.foot-links { grid-column: 9 / span 4; justify-self: end; display: flex; flex-wrap: wrap; gap: 8px 22px; align-content: start; font-family: var(--ui); font-size: 0.75rem; text-transform: lowercase; letter-spacing: 0.02em; }
.foot-links a { color: var(--ink-2); transition: color .2s; }
.foot-links a:hover { color: var(--ink); }
.foot-copy { color: var(--ink-3); }
.foot-word { grid-column: 1 / -1; margin: clamp(40px, 8vw, 120px) 0 0; font-family: var(--display); font-style: italic; font-weight: 400; line-height: 0.78; letter-spacing: -0.04em; white-space: nowrap; font-size: 22vw; padding-bottom: 0.04em; }
.foot-word span { display: inline-block; }

/* ---------- Share sheet: the story card beside its buttons; stacked on phones ---------- */
html:has(.share[open]) { overflow: hidden; }
.share { width: min(760px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: clamp(20px, 3vw, 36px);
    border: 0; border-radius: 2px; background: var(--paper); color: var(--ink);
    grid-template-columns: auto minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); align-items: end; }
.share[open] { display: grid; }
.share::backdrop { background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
/* The designs sit side by side in a strip that snaps one card at a time: swipe on phones, arrows on desktop. */
.share-stage { display: grid; gap: 12px; justify-items: center; }
.share-cards { height: min(64vh, 600px); aspect-ratio: 9 / 16; display: flex; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scrollbar-width: none; background: var(--intro-bg); }
.share-cards::-webkit-scrollbar { display: none; }
.share-cards:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.share-card { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; display: block; scroll-snap-align: center; scroll-snap-stop: always; }
.share-wait { flex: 0 0 100%; justify-content: center; align-self: center; color: rgba(255, 255, 255, .55); }
.share-pick { align-items: center; justify-content: center; gap: 0 14px; color: var(--ink-2); }
.share-pick .text-btn { font-size: 0.95rem; text-decoration: none; padding: 6px 8px; }
#share-name { min-width: 16ch; text-align: center; }
.share-h { font-style: italic; font-size: clamp(2.4rem, 5vw, 3.6rem); margin-bottom: 14px; }
.share-note { margin: 0 0 22px; color: var(--ink-2); font-style: italic; font-size: 1rem; line-height: 1.45; max-width: 34ch; }
.share .actions { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.share-status { min-height: 1.45em; margin-top: 16px; }
.text-btn:disabled { opacity: .4; cursor: default; }
@media (max-width: 760px) {
    .share { grid-template-columns: 1fr; justify-items: center; align-items: start; }
    .share-cards { height: min(50dvh, 500px); }
    .share-side { justify-self: stretch; }
}

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; z-index: 40;
    font: 400 0.75rem/1.4 var(--ui); text-transform: lowercase; letter-spacing: 0.02em; background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 2px;
    max-width: calc(100% - 32px); text-align: center; transition: opacity .3s, transform .45s var(--ease); }
.toast.off { opacity: 0; transform: translateY(8px); pointer-events: none; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
    .first .tiny { animation: dawn 2.6s cubic-bezier(.3, .6, .2, 1) both; animation-delay: .25s; }
    @keyframes dawn { from { opacity: 0; letter-spacing: 0.32em; filter: blur(3px); } }
    .first .rise { animation: rise 1.1s var(--ease) both; animation-delay: calc(var(--d, 0) * 1ms); }
    @keyframes rise { from { opacity: 0; transform: translateY(22px); } }

    /* Page to page: the shared image glides; everything else crossfades. */
    @view-transition { navigation: auto; }
    ::view-transition-old(root) { animation: vt-out .24s ease both; }
    ::view-transition-new(root) { animation: vt-in .6s var(--ease) both; }
    ::view-transition-group(*) { animation-duration: .8s; animation-timing-function: cubic-bezier(.22, .8, .1, 1); }
    ::view-transition-old(*), ::view-transition-new(*) { height: 100%; width: 100%; object-fit: cover; }
    @keyframes vt-out { to { opacity: 0; } }
    @keyframes vt-in { from { opacity: 0; transform: translateY(16px); } }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 1100px) {
    .prose { grid-template-columns: [full-start] minmax(var(--gutter), 1fr) [main-start note-start] minmax(0, 35em) [main-end note-end] minmax(var(--gutter), 1fr) [full-end]; }
    .note { padding: 0 0 0 1.1em; margin: -0.6em 0 1.4em; border-left: 1px solid var(--rule); }
}
@media (max-width: 860px) {
    .lead-title, .lead-side { grid-column: 1 / -1; }
    .essay-head .dek, .byline { grid-column: 1 / -1; }
    .byline { justify-self: start; text-align: left; }
    .colophon, .foot-links { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 760px) {
    .c-bl { display: none; }
    .essay .bleed { aspect-ratio: 4 / 5; }
    .next .bleed { aspect-ratio: 4 / 5; }
    .page-bleed { aspect-ratio: 4 / 3; }
    .item a { grid-template-columns: minmax(0, 1fr) 76px; grid-template-areas: "body thumb" "meta thumb"; align-items: start; gap: 10px 16px; }
    .item-no { display: none; }
    .item-body { grid-area: body; }
    .shelf-head { grid-template-areas: "title" "note" "count"; grid-template-columns: 1fr; }
    .shelf-head--bare { grid-template-areas: "title" "count"; }
    .shelf-count { justify-self: start; }
    .item-meta { grid-area: meta; text-align: left; }
    .item .plate { display: block; grid-area: thumb; aspect-ratio: 4 / 5; border-radius: 2px; }
    .essay-end { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    /* Room for the back link beside the menu on narrow phones. */
    .c-tr { gap: 16px; }
    .c-back-all { display: none; }
}
