/* The 1860 book (Whitman, as printed; sketched as sketches/2026-10-31-whitman/envs/1860-book): the window is the book, pressed rather
   than gilded. One face (Old Standard TT) and the
   book's own ornaments. JS sets on .stage: --H, --W, --ph (a page's height), --lx/--ly (the light, in stage px). */
@font-face { font-family: "WB"; src: url(/whitman/views/fonts/butterfly.woff2) format("woff2"); font-display: block; }   /* the views' one-glyph face of the butterfly, U+E912 */

:root {
  --ground: #110707;
  --cream: #f0e6d2;
  --cream-2: rgba(240, 230, 210, .64);
  --gold: #dcc184;
  --serif: "Old Standard TT", "Libre Caslon Text", Georgia, serif;
}
* { box-sizing: border-box; }
html { background: var(--ground); }
body { margin: 0; background: var(--ground); color: var(--cream); font-family: var(--serif); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.skip { position: absolute; left: -999px; top: 46px; z-index: 50; background: var(--cream); color: var(--ground); padding: 8px 12px; font-size: 14px; }
.skip:focus { left: 12px; }

.track { position: relative; }
.stage { position: sticky; top: 38px; height: var(--H, calc(100vh - 38px)); overflow: hidden; overflow: clip; }
.scene { position: absolute; inset: 0; will-change: transform; }
.scene.lifting { box-shadow: 0 22px 44px -10px rgba(0, 0, 0, .75); }
.scene.gone { visibility: hidden; }

/* ── 1 · The cover: the photographed cloth, relit by the light you carry ─────── */
.cover { background: #2a0b0b; overflow: hidden; }
.cloth {
  position: absolute; inset: 0;
  /* without WebGL: the photograph itself, placed where the camera looks, and a lamp over it */
  background: #2a0b0b url(img/cover.jpg) no-repeat;
  background-size: var(--bw, 100%) auto; background-position: var(--bx, 0) var(--by, 0);
}
.cloth canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cloth.gl { background: #2a0b0b; }
.cloth:not(.gl)::after {
  content: ""; position: absolute; inset: 0; mix-blend-mode: soft-light;
  background: radial-gradient(circle calc(var(--W, 1500px) * .5) at var(--lx, 60%) var(--ly, 35%), rgba(255, 236, 214, .5), rgba(255, 236, 214, 0) 60%, rgba(20, 0, 0, .5) 100%);
}
.cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(rgba(8, 1, 1, 0) 70%, rgba(8, 1, 1, .5) 88%, rgba(8, 1, 1, .7) 100%),
    radial-gradient(ellipse 85% 80% at 50% 50%, rgba(8, 1, 1, 0) 50%, rgba(8, 1, 1, .45) 100%);
}
.cover-foot { position: absolute; z-index: 2; left: 0; right: 0; bottom: 40px; text-align: center; padding: 0 60px; pointer-events: none; opacity: var(--foot, 1); }
.cover-foot a { pointer-events: auto; }
/* the footnote on "without Whitman's permission" (tools/footnotes.py): reached under the note, its card standing above the words */
.cover-foot .fn { pointer-events: auto; position: relative; white-space: nowrap; }   /* one line, so its card is placed on the screen (footnote.js measures one box) */
.cover-foot .fn-card { white-space: normal; text-shadow: none; }   /* the note's shadow stays on the cloth, not in the card */
.cover-foot .fn { --fn-chip: #e6dbc5; --fn-chip-ink: #2a0b0b; }   /* the chip in the note's cream, its number in the cloth's own dark (as The Book's cover sets its own) */
/* a soft dark band under the words, so they read wherever the light is; it shades the cloth, never lights it */
.cover-foot::before {
  content: ""; position: absolute; z-index: -1; left: 50%; bottom: -40px; width: min(1100px, 130%); height: 250px; transform: translateX(-50%);
  background: radial-gradient(ellipse 50% 50% at 50% 58%, rgba(10, 2, 2, .86) 0%, rgba(10, 2, 2, .8) 40%, rgba(10, 2, 2, .45) 72%, rgba(10, 2, 2, 0) 100%);
}
.note { max-width: 46em; margin: 0 auto 20px; font: italic 400 14px/1.55 var(--serif); color: #e6dbc5; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.cue-open {   /* "Scroll to open" (the comp's .open; renamed: footnote.js marks a pinned footnote .open) */
  display: inline-flex; flex-direction: column; align-items: center; gap: 12px; text-decoration: none;
  font: 400 11px/1 var(--serif); letter-spacing: .3em; text-transform: uppercase; color: #efe5d1; padding-left: .3em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .7);
}
.cue-open::after { content: ""; width: 1px; height: 36px; background: linear-gradient(rgba(240, 230, 210, .75), rgba(240, 230, 210, 0)); transform-origin: top; animation: fall 2.6s ease-in-out infinite; }
@keyframes fall { 0% { transform: scaleY(0); opacity: 0; } 30% { opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* ── 2–3 · The openings: the real pages, at one scale, on the dark cloth ─────── */
.opening, .rooms {
  background: #2a0b0b url(img/cloth-1860-worthington.webp) 0 0 / 420px 420px repeat;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
}
.opening::before, .rooms::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 62% 72% at 50% 50%, rgba(10, 3, 3, .66), rgba(10, 3, 3, .78) 55%, rgba(10, 3, 3, .92) 100%);
}
.rooms::before { background: rgba(10, 3, 3, .84); }
.spread {
  grid-column: 2; grid-row: 1; position: relative; z-index: 1; margin: 0; display: flex;
  box-shadow: 0 34px 70px -24px rgba(0, 0, 0, .85), 0 0 0 1px rgba(0, 0, 0, .35);
  transform: translateX(var(--pan, 0px));
}
.spread img { display: block; height: var(--ph, 660px); width: auto; }
.lamp {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light;
  background: radial-gradient(circle calc(var(--ph, 660px) * 1.05) at var(--sx, 30%) var(--sy, 20%),
    rgba(255, 246, 226, .5), rgba(255, 246, 226, 0) 46%, rgba(40, 22, 14, 0) 60%, rgba(40, 22, 14, .5) 100%);
}
.spread::after { content: ""; position: absolute; inset: 0; background: #070202; opacity: calc((1 - var(--u, 1)) * .45); pointer-events: none; }
.label {
  grid-column: 1; grid-row: 1; position: relative; z-index: 1; justify-self: end; align-self: end;
  width: min(250px, 100%); margin: 0 44px calc((var(--H, 767px) - var(--ph, 660px)) / 2 + 4px) 24px;
  font: italic 400 15px/1.55 var(--serif); color: var(--cream-2);
}
.label p { margin: 0; }
.kicker { margin: 0 0 10px !important; font: 400 11px/1.3 var(--serif) !important; font-style: normal !important; letter-spacing: .26em; text-transform: uppercase; color: var(--cream); opacity: .86; }

/* page iv: the light settles on the butterfly */
.spot { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: var(--spot, 0); }
.spot i { position: absolute; inset: -12%; display: block; mix-blend-mode: multiply; filter: blur(calc(var(--ph, 660px) * .05)); }
.spot i::before {
  /* the butterfly on page iv: x 1028–1488, y 2072–2772 of the page's 2306 × 3624, in the spread's box (the 12% margin added back) */
  content: ""; position: absolute; border-radius: 50%;
  left: calc(12% / 1.24 + 19.6% / 1.24); top: calc(12% / 1.24 + 53.5% / 1.24); width: calc(15.6% / 1.24); height: calc(26.5% / 1.24);
  box-shadow: 0 0 0 calc(var(--ph, 660px) * 1.4) rgba(30, 18, 14, .4);
}
.spot b { position: absolute; left: 19.6%; top: 53.5%; width: 15.6%; height: 26.5%; border-radius: 50%; mix-blend-mode: soft-light; background: radial-gradient(closest-side, rgba(255, 240, 210, .22), rgba(255, 240, 210, 0)); }

/* ── 4 · His rooms: a plate facing his contents ─────────────────────────────── */
.leaf {
  grid-column: 2; grid-row: 1; position: relative; z-index: 1;
  width: calc(var(--ph, 660px) * 1.25); height: var(--ph, 660px);
  display: grid; grid-template-columns: 1fr 1fr;
}
.plate { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 0 8% 0 0; text-decoration: none; color: inherit; min-height: 0; }
.plate .frame { width: 100%; height: 62%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.plate img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; box-shadow: 0 24px 50px -22px rgba(0, 0, 0, .9); transition: opacity .35s ease; }
.plate img.fading { opacity: 0; }
.plate-cap { margin-top: 22px; font: italic 400 19px/1.3 var(--serif); color: var(--cream); text-align: center; }
.plate-sub { margin-top: 6px; font: 400 11px/1.3 var(--serif); letter-spacing: .22em; text-transform: uppercase; color: var(--cream-2); }
.plate:hover .plate-cap, .plate:focus-visible .plate-cap { color: var(--gold); }

.contents { display: flex; flex-direction: column; align-items: stretch; padding: calc(var(--ph, 660px) * .035) 0 0 7%; min-height: 0; }
.headpiece {
  align-self: center; width: 44%; aspect-ratio: 384 / 108; background: var(--cream); opacity: .8;
  -webkit-mask: url(img/head-contents.webp) center / contain no-repeat; mask: url(img/head-contents.webp) center / contain no-repeat;
}
.name { align-self: center; margin: calc(var(--ph, 660px) * .03) 0 0; font: 400 calc(var(--ph, 660px) * .05)/1 var(--serif); letter-spacing: .03em; color: var(--cream); }
.name small { font-size: .76em; letter-spacing: .05em; }
.rule {
  align-self: center; width: 16%; aspect-ratio: 153 / 39; margin: calc(var(--ph, 660px) * .022) 0 calc(var(--ph, 660px) * .04); background: var(--cream); opacity: .7;
  -webkit-mask: url(img/rule-contents.webp) center / contain no-repeat; mask: url(img/rule-contents.webp) center / contain no-repeat;
}
.contents .kicker { margin: 0 0 -4px !important; }
.col { margin: 0; align-self: flex-end; font: 400 9px/1 var(--serif); letter-spacing: .2em; text-transform: uppercase; color: var(--cream-2); }
.toc { list-style: none; margin: 6px 0 0; padding: 0; }
.toc a {
  display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: rgba(240, 230, 210, .9);
  font: 400 calc(var(--ph, 660px) * .025)/1.8 var(--serif); transition: color .2s;
}
.toc .t { flex: none; }
.toc a::after { content: ""; order: 2; flex: 1; height: 4px; min-width: 20px; align-self: baseline; background: radial-gradient(circle, rgba(240, 230, 210, .42) .9px, rgba(240, 230, 210, 0) 1.3px) 0 0 / 7px 4px repeat-x; }
.toc .n { order: 3; flex: none; min-width: 1em; text-align: right; font-variant-numeric: tabular-nums; }
.toc a[aria-current="true"], .toc a:hover, .toc a:focus-visible { color: var(--gold); outline: none; }
.thumb { display: none; }
.butterfly {
  align-self: center; margin-top: auto; font: 400 calc(var(--ph, 660px) * .15)/1 "WB"; color: var(--cream);
  opacity: calc(var(--u, 1) * .92); transform: translateY(calc((1 - var(--u, 1)) * 18px));
}
.more { display: flex; justify-content: center; gap: 22px; margin: calc(var(--ph, 660px) * .025) 0 2px; }
.more a { font: 400 11px/1 var(--serif); letter-spacing: .24em; text-transform: uppercase; text-decoration: none; color: var(--cream-2); }
.more a:hover, .more a:focus-visible { color: var(--cream); }

.colophon { padding: 34px 24px 40px; text-align: center; font: italic 400 13px/1.5 var(--serif); color: rgba(240, 230, 210, .5); border-top: 1px solid rgba(240, 230, 210, .08); }
.colophon p { margin: 0 auto; max-width: 56em; }

/* ── Narrow screens ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .cover-foot { bottom: 28px; padding: 0 30px; }
  .note { font-size: 13px; margin-bottom: 16px; }
  .opening { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; align-items: stretch; }
  .spread { grid-column: 1; grid-row: 1; align-self: center; justify-self: start; margin-left: 20px; }
  .label { grid-column: 1; grid-row: 2; justify-self: stretch; width: auto; margin: 0 24px 30px; font-size: 14px; }
  .rooms { display: block; }
  .leaf { width: 100%; height: 100%; display: block; padding: 18px 24px 0; }
  .plate { display: none; }
  .contents { height: 100%; padding: 0; }
  .headpiece { width: 46%; }
  .name { font-size: 26px; margin-top: 14px; }
  .rule { margin: 10px 0 18px; }
  .col { display: none; }
  .toc a { font-size: 15.5px; line-height: 1.25; padding: 4px 0; gap: 12px; align-items: center; }
  .toc a::after { align-self: center; transform: translateY(4px); min-width: 10px; }
  .toc .t { flex: 0 1 auto; min-width: 0; }
  .thumb { display: block; flex: none; width: 38px; height: 38px; background: #222 center / cover no-repeat; }
  .butterfly { font-size: 70px; margin-top: 10px; }
  .more { margin: auto 0 0; padding: 12px 0 22px; flex-wrap: wrap; gap: 12px 20px; }
}

/* ── Reduced motion ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .track { height: auto !important; }
  .stage { position: relative; top: 0; height: auto; overflow: visible; }
  .scene { position: relative; height: var(--H, calc(100vh - 38px)); transform: none !important; visibility: visible !important; box-shadow: none !important; }
  .spread { transform: none; }
  .opening .spread { overflow-x: auto; max-width: calc(100vw - 40px); }   /* inside the screen on a phone, where it sits 20 px in (the comp ran 20 px past it) */
  .cue-open::after { animation: none; transform: none; opacity: .7; }
  .plate img { transition: none; }
}
