/* ─────────────────────────────────────────────────────────────
   writings-read.css · reading the essays (2026-10-04). Logic: js/writings-read.js.
   Typography and company for the reader; no words added to the essays.
   Loaded by writings.html after its own <style>.
   ───────────────────────────────────────────────────────────── */

/* A touch more size and air in the column on wide screens. */
@media (min-width: 1100px) {
  html.rd .essay .body { font-size: 1.13rem; line-height: 1.72; }
}

/* ── Beats: one short line, set as a line ── */
html.rd .essay .body p.rd-beat {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: clamp(1.55rem, 2.6vw, 2.15rem); line-height: 1.18; letter-spacing: -0.012em;
  color: var(--ink);
  margin: 2.1rem 0 2.1rem;
  max-width: 24ch;
  text-wrap: balance;
}
html.rd .essay .body p.rd-beat em { font-style: normal; color: var(--red); font-weight: 400; }
html.rd .essay .body p.rd-verse { max-width: none; line-height: 1.28; }
/* two beats in a row sit closer, like a pair of lines */
html.rd .essay .body p.rd-beat + p.rd-beat { margin-top: -0.9rem; }

/* ── Ink: paragraphs come up as they reach you ── */
html.rd .essay .body > .rd-ink { opacity: .16; transform: translateY(10px); transition: opacity 1s var(--ease-out, ease), transform 1s var(--ease-out, ease); }
html.rd .essay .body > .rd-ink.rd-in { opacity: 1; transform: none; }

/* ── The big number each essay opens over ── */
html.rd .essay-head { position: relative; isolation: isolate; }
html.rd .essay-head[data-n]::before {
  content: attr(data-n);
  position: absolute; z-index: -1; pointer-events: none;
  top: -0.42em; right: -0.04em;
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: clamp(7rem, 22vw, 11rem); line-height: 1; letter-spacing: -0.04em;
  color: transparent; -webkit-text-stroke: 1px var(--red);
  opacity: .32;
}
@media (min-width: 1180px) {
  html.rd .essay-head[data-n]::before {
    right: auto; left: auto; top: -0.12em;
    right: calc(100% + 1.4rem);
    font-size: clamp(10rem, 15vw, 15rem); opacity: .5;
  }
}
html.rd .essay { padding-top: clamp(4rem, 12vh, 8rem); }

/* ── Next: a door to the next essay ── */
html.rd .essay .footer-note.rd-foot { display: grid; grid-template-columns: 1fr; gap: 1.6rem; border-top: 0; padding-top: 0; }
html.rd .essay .footer-note a.rd-next {
  display: grid; gap: .45rem; border: 0; border-top: 1px solid var(--ink);
  padding: 1.4rem 0 .4rem; color: var(--ink); text-decoration: none;
}
html.rd .rd-next-k { font-family: var(--mono); font-size: var(--mono-b); letter-spacing: var(--mono-b-track); text-transform: uppercase; color: var(--red); }
html.rd .rd-next-t {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: clamp(1.8rem, 3.6vw, 2.8rem); line-height: 1.05; letter-spacing: -0.015em;
  transition: translate .35s var(--ease), color .25s var(--ease);
}
html.rd .rd-next-t::after { content: "\00a0↓"; color: var(--red); font-style: normal; }
html.rd .rd-next-d { font-family: var(--serif); font-style: italic; font-size: 1.05rem; line-height: 1.45; color: var(--ink-2); max-width: 46ch; }
html.rd .essay .footer-note a.rd-next:hover .rd-next-t,
html.rd .essay .footer-note a.rd-next:focus-visible .rd-next-t { color: var(--red); translate: .4rem 0; }
html.rd .essay .footer-note.rd-foot > span { order: 2; }

/* ── Read: the red eye of the mark on what you have finished ── */
html.rd .index-row .num { position: relative; }
html.rd .index-row.rd-done .num { color: var(--red); }
html.rd .index-row.rd-done .num::after,
html.rd .rd-rail li.rd-done .rd-n::after {
  content: ""; display: inline-block; vertical-align: middle;
  width: 1.5em; height: .95em; margin-left: .45em;
  background: var(--red);
  -webkit-mask: url(../images/mark/eye.svg) center / contain no-repeat;
          mask: url(../images/mark/eye.svg) center / contain no-repeat;
}

/* ── The rail (wide screens): beside the column ── */
.rd-rail, .rd-bar { display: none; }
@media (min-width: 1180px) {
  html.rd .rd-rail {
    display: block; position: fixed; z-index: 50;
    left: var(--edge, 2rem); top: 50%; transform: translate(-12px, -50%);
    width: calc((100vw - 660px) / 2 - var(--edge, 2rem) - 2.5rem); max-width: 300px;
    opacity: 0; pointer-events: none;
    transition: opacity .45s var(--ease, ease), transform .45s var(--ease, ease);
  }
  html.rd.rd-reading .rd-rail { opacity: 1; pointer-events: auto; transform: translate(0, -50%); }
  .rd-rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
  .rd-rail a {
    display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: .7rem;
    padding: .28rem 0; color: var(--muted); text-decoration: none;
    font-family: var(--mono); font-size: var(--mono-b); letter-spacing: var(--mono-b-track); text-transform: uppercase;
  }
  .rd-rail .rd-tick { display: block; width: 18px; height: 1px; background: var(--rule); position: relative; overflow: hidden; transition: width .35s var(--ease); }
  .rd-rail .rd-tick i { position: absolute; inset: 0; background: var(--red); transform-origin: left; transform: scaleX(0); }
  .rd-rail .rd-t {
    font-family: var(--display); font-style: italic; text-transform: none; letter-spacing: 0;
    font-size: .98rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    opacity: 0; transition: opacity .25s var(--ease);
  }
  .rd-rail li.rd-cur a { color: var(--ink); }
  .rd-rail li.rd-cur .rd-tick { width: 44px; height: 2px; }
  .rd-rail li.rd-cur .rd-t { opacity: 1; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
  .rd-rail:hover .rd-t { opacity: .55; }
  .rd-rail:hover li.rd-cur .rd-t, .rd-rail a:hover .rd-t, .rd-rail a:focus-visible .rd-t { opacity: 1; }
  .rd-rail a:hover, .rd-rail a:focus-visible { color: var(--ink); outline: none; }
  .rd-rail a:hover .rd-tick { width: 30px; }
  .rd-rail li.rd-done .rd-n { color: var(--red); }
  .rd-rail li.rd-done .rd-tick i { transform: scaleX(1) !important; }
  .rd-rail .rd-left {
    display: block; margin-top: 1.1rem; padding-left: calc(44px + .7rem);
    font-family: var(--mono); font-size: var(--mono-c, 10px); letter-spacing: var(--mono-c-track, .14em); text-transform: uppercase; color: var(--red);
    min-height: 1em;
  }
  /* the page-wide line steps back while the rail is up */
  html.rd.rd-reading .progress { opacity: 0; }
}

/* ── The strip (phones and narrow screens): one line at the top ── */
@media (max-width: 1179px) {
  html.rd .rd-bar {
    display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: .7rem;
    position: fixed; z-index: 60; top: 0; left: 0; right: 0;
    padding: .62rem var(--edge, 1rem) .58rem;
    padding-top: calc(.62rem + env(safe-area-inset-top, 0px));
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--rule-soft);
    color: var(--ink); text-decoration: none;
    transform: translateY(-110%); transition: transform .35s var(--ease, ease);
  }
  html.rd.rd-reading .rd-bar { transform: none; }
  html.rd.rd-reading .progress { opacity: 0; }
  .rd-bar-n { font-family: var(--mono); font-size: var(--mono-b); letter-spacing: var(--mono-b-track); text-transform: uppercase; color: var(--red); }
  .rd-bar-t { font-family: var(--display); font-style: italic; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .rd-bar-m { font-family: var(--mono); font-size: var(--mono-c, 10px); letter-spacing: var(--mono-c-track, .14em); text-transform: uppercase; color: var(--muted); white-space: nowrap; }
  .rd-bar-fill { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--red); transform-origin: left; transform: scaleX(0); }
}

/* ── More writings, in book form: the text books on a shelf ── */
.rd-books { max-width: 1200px; margin: 0 auto; padding: clamp(2.2rem, 6vh, 3.6rem) var(--edge) clamp(1.6rem, 4vh, 2.6rem); border-top: 1px solid var(--rule); }
.rd-books-head { display: flex; justify-content: space-between; align-items: end; gap: 1.4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.rd-books-head h2 { font-family: var(--display); font-style: italic; font-weight: 400; font-size: clamp(1.9rem, 4.2vw, 3.2rem); line-height: 1; letter-spacing: -0.015em; color: var(--ink); max-width: 18ch; }
.rd-books-head h2 em { font-style: normal; color: var(--red); }
.rd-books-head a { font-family: var(--serif); font-style: italic; font-size: .95rem; color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--rule-soft); }
.rd-books-head a:hover { color: var(--red); border-color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  html.rd .essay .body > .rd-ink { opacity: 1; transform: none; }
}
@media print {
  .rd-rail, .rd-bar { display: none !important; }
  html.rd .essay .body > .rd-ink { opacity: 1 !important; transform: none !important; }
}
