/* ============================================================
   About & Writings pages
   Requires shared.css for tokens, header, footer, 3D book.
   ============================================================ */

body > .site-head { padding: 48px 48px 0; }
body > .footer { padding: 0 48px 64px; }
body > .subscribe { margin-left: 48px; margin-right: 48px; }

.page {
  --pad: 48px;
  position: relative;
  width: 100%;
  padding: 0 var(--pad);
  counter-reset: ref note;
}

/* the text column stays readable; sidenotes live in the space to its right */
.site-head,
.section,
.footer { max-width: 760px; }

/* ---------- sections ---------- */

.section {
  position: relative; /* sidenotes anchor to the section, not to the line */
  margin-top: 72px;
}

/* the first section sits flush under the header on every page */
.site-head + .section { margin-top: 0; }

.section p { text-wrap: pretty; }

.section p:not(.about-line) + p:not(.about-line),
.section p + .item-list,
.section p + .plain-list,
.section p + .toc-list,
.section .item-list + p,
.section p + .shelf-card { margin-top: 16px; }

.section .shelf-card + .item-list { margin: 24px 0; }

.section-head {
  font-size: inherit;
  font-weight: 400;
  font-style: italic;
  margin-bottom: 10px;
}

/* the opening statement, set large */
.about-lead {
  font-weight: 400; /* also used on headings, which would otherwise go bold */
  font-size: 28px;
  line-height: 1.4;
  margin-bottom: 20px;
  text-wrap: balance;
}

/* the quieter personal line beneath it */
.about-sub {
  margin-bottom: 20px;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.about-line { text-wrap: pretty; }
.about-line + .about-line { margin-top: 6px; }

/* ---------- lists ---------- */

.item-list {
  list-style-type: circle;
  padding-left: 1.3em;
}

.item-list li {
  padding: 3px 0;
  line-height: 1.5;
  text-wrap: pretty;
}

.item-list li::marker { color: var(--ink-faint); }

/* no bullets, one item per line */
.plain-list { list-style: none; }
.plain-list li { padding: 6px 0; text-wrap: pretty; }

/* a label on its own line above the link it introduces */
.line-label { display: block; color: var(--ink-soft); }

/* links inside the page carry the accent underline */
.page a { text-decoration-color: var(--link); }
.page a:hover { text-decoration-color: var(--link-hover); }

/* ---------- sidenotes ----------------------------------------
   Numbered margin notes on wide screens, hidden below that —
   an annotation layer, never the load-bearing text.
   -------------------------------------------------------------- */

.ref-mark {
  counter-increment: ref;
  display: none; /* a wide-screen feature */
}

.ref-mark::before {
  content: counter(ref);
  font-size: 12px;
  color: var(--ink-soft);
}

/* annotated phrases get a dotted amber rule so they read
   differently from plain links */
.noted,
.page a:has(+ .ref-mark) {
  text-decoration: underline dotted var(--note);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.page a:has(+ .ref-mark):hover { text-decoration-color: var(--note-hover); }

.sidenote {
  counter-increment: note;
  display: none; /* below the margin-note breakpoint */
  padding-left: 14px;
  border-left: 1px dotted color-mix(in srgb, var(--ink) 45%, transparent);
  font-size: 14px;
  line-height: 1.55;
  text-wrap: pretty;
}

.sidenote::before {
  content: "№ " counter(note) "\00a0\00a0";
  color: var(--ink-soft);
}

@media (min-width: 1160px) {
  .ref-mark { display: inline; }

  .sidenote {
    display: block;
    position: absolute;
    left: calc(100% + 48px);
    top: 0;
    /* as wide as the free space allows, capped for readability */
    width: min(420px, calc(100vw - 904px));
    /* hidden until you hover the phrase it belongs to */
    opacity: 0;
    visibility: hidden;
    transition: opacity 160ms ease, visibility 0s linear 400ms;
  }

  .sidenote.show,
  .sidenote:hover {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
  }
}

/* ---------- bookshelf teaser card ---------- */

.shelf-card {
  display: block;
  margin: 24px 0;
  color: inherit;
  text-decoration: none;
}

.shelf-label { display: block; margin-bottom: 28px; }

.shelf-strip {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.shelf-strip .book-scene { --bw: 138px; --bh: 207px; }

.shelf-view {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin-top: 28px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--ink) 25%, transparent);
  text-underline-offset: 4px;
  transition: text-decoration-color 120ms ease;
}

.shelf-card:hover .shelf-view { text-decoration-color: color-mix(in srgb, var(--ink) 85%, transparent); }
.shelf-view svg { display: block; }

/* ---------- table of contents: title · dotted leader · date ---------- */

.section-wide { max-width: none; }
.section-wide > p { max-width: 760px; } /* prose keeps its measure */

.toc-list { list-style: none; }

.toc-list li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
}

.toc-list .leader {
  flex: 1;
  min-width: 32px;
  border-bottom: 1px dotted color-mix(in srgb, var(--ink) 40%, transparent);
  transform: translateY(-4px);
}

.toc-list .date { color: var(--ink-soft); white-space: nowrap; }

/* ---------- music: an optional player slot per section ----------
   Paste a Spotify or Bandcamp embed inside .music-embed; while it
   holds nothing but a comment it takes no space. */

.music-embed { margin: 20px 0 8px; }
.music-embed:empty { display: none; }
.music-embed iframe { display: block; width: 100%; border: 0; border-radius: 12px; }
.music-embed + .toc-list { margin-top: 16px; }
.toc-list cite { font-style: italic; }

/* album artwork: square sleeves; on hover the record slides out */

.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 20px 24px;   /* the wider column gap is room for the record to peek into */
  margin-top: 24px;
}

.art {
  position: relative;
  display: block;
  aspect-ratio: 1;
  text-decoration: none;
  color: var(--ink);
}

/* the record, tucked behind the sleeve */
.art::before {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background:
    radial-gradient(circle, #e9e4d8 0 9%, #111 9.5% 11%, transparent 11.5%),
    repeating-radial-gradient(circle, #151515 0 1.5px, #222 1.5px 3px);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.25);
  transition: transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* clear vinyl: add .art--clear to any .art. Translucent disc with faint
   grooves, a darker rim so it reads on white, a sheen, and a paper label */
.art--clear::before {
  background:
    radial-gradient(circle, #f4f1ea 0 9%, rgb(0 0 0 / 0.22) 9.5% 10.1%, transparent 10.5%),
    conic-gradient(from 20deg, rgb(255 255 255 / 0.7), transparent 10%, transparent 38%,
                   rgb(255 255 255 / 0.55) 50%, transparent 62%, transparent 88%, rgb(255 255 255 / 0.7)),
    repeating-radial-gradient(circle, rgb(110 135 145 / 0.12) 0 1px, transparent 1px 3px),
    radial-gradient(circle, rgb(205 222 228 / 0.30) 0 66%, rgb(140 165 175 / 0.45) 70.5%, transparent 71%);
  box-shadow: inset 0 0 0 1px rgb(110 135 145 / 0.35), 0 1px 4px rgb(0 0 0 / 0.10);
  -webkit-backdrop-filter: blur(1.5px);
          backdrop-filter: blur(1.5px);
}

.art-sleeve {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 3px;
  background: #f1efea;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 6px 16px -6px rgb(0 0 0 / 0.25);
  transition: transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.art-sleeve img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* no artwork yet: the title, set small in the corner */
.art-placeholder {
  display: flex;
  align-items: flex-end;
  padding: 10px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-soft);
  border: 1px dashed color-mix(in srgb, var(--ink) 18%, transparent);
  box-shadow: none;
}

.art:hover, .art:focus-visible { z-index: 1; }
.art:hover::before, .art:focus-visible::before { transform: translateX(20%) rotate(30deg); }
.art:hover .art-sleeve, .art:focus-visible .art-sleeve { transform: translateX(-4%) rotate(-1.5deg); }
.art:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; border-radius: 3px; }

@media (max-width: 600px) {
  .art-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 16px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .art::before, .art-sleeve { transition: none; }
}

/* a single call to action: an outlined button that fills on hover */
.cta-row { margin-top: 28px; }
.page a.cta {
  display: inline-block;
  padding: 9px 22px;
  border: 1px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}
.page a.cta:hover { background: var(--ink); color: var(--paper); }

/* questions and answers */
.faq { max-width: 760px; }
.faq dt { margin-top: 22px; }
.faq dt:first-child { margin-top: 0; }
.faq dd { margin: 2px 0 0; color: var(--ink-soft); text-wrap: pretty; }
.faq dd .item-list { margin-top: 4px; color: var(--ink); }

/* records on the About page: a sleeve with its title and artist beneath */
.record { margin: 0; }
.record figcaption { margin-top: 10px; font-size: 14px; line-height: 1.4; }
.record cite { display: block; font-style: italic; }
.record .soft { display: block; }

.records + .shelf-view { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.records + .shelf-view:hover { text-decoration-color: color-mix(in srgb, var(--ink) 85%, transparent); }
.section-wide .records-page { max-width: 1100px; }

/* an aside set like a pulled quote */
.quote {
  margin: 16px 0;
  padding-left: 16px;
  border-left: 1px dotted color-mix(in srgb, var(--ink) 45%, transparent);
  font-style: italic;
  color: var(--ink-soft);
}

/* ---------- press: clippings open in draggable windows ---------- */

/* a subgroup label, quieter than the section head */
.press-group {
  font-size: inherit;
  font-weight: 400;
  color: var(--ink-soft);
  margin: 24px 0 6px;
}

.section-head + .press-group { margin-top: 0; }

/* the trigger reads exactly like any other link on the page */
.press-open {
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  text-decoration: underline dotted var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color 120ms ease;
}

.press-open:hover { text-decoration-color: var(--link-hover); }
.press-open:focus,
.press-window:focus { outline: none; }

/* A floating card: striped offset shadow (::before) behind a solid
   face (::after), content above both. Overflow stays visible so the
   stripe shows. Draggable, and several can be open at once. */
.press-window {
  --stripe-offset: 6px;
  position: fixed;
  width: min(600px, 92vw);
  padding: 24px;
  border: none;
  background: transparent;
  color: var(--ink);
  overflow: visible;
  isolation: isolate;
  cursor: default;
}

.press-window.is-dragging { cursor: grabbing; user-select: none; }
.press-window.is-dragging * { cursor: grabbing !important; }

.press-window::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: var(--stripe-offset);
  left: var(--stripe-offset);
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(-45deg, var(--ink) 0 1.5px, transparent 1.5px 4px);
  pointer-events: none;
}

.press-window::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: #fff;
  border: 1px solid var(--ink);
  pointer-events: none;
}

.press-window > * { position: relative; z-index: 2; }

.press-window img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(62vh, 600px);
  margin: 0 auto;
  border: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
}

.press-window figcaption { margin-top: 14px; line-height: 1.5; }
.press-caption { display: block; text-wrap: pretty; }
.press-meta { display: block; margin-top: 2px; font-size: 15px; }

.press-source {
  display: inline-block;
  margin-top: 10px;
  text-decoration-color: var(--link);
}

.press-source:hover { text-decoration-color: var(--link-hover); }

/* square corner close */
.press-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  appearance: none;
  background: #fff;
  border: 1px solid var(--ink);
  color: var(--ink);
  cursor: pointer;
}

.press-close:focus { outline: none; }

.press-x {
  position: relative;
  display: block;
  width: 12px;
  height: 12px;
  pointer-events: none;
}

.press-x::before,
.press-x::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  margin-top: -0.5px;
  background: currentColor;
}

.press-x::before { transform: rotate(45deg); }
.press-x::after { transform: rotate(-45deg); }

/* ---------- narrow screens ---------- */

@media (max-width: 860px) {
  /* the window becomes a centred sheet: 12px gutters, content
     scrolls inside, one window at a time (enforced in JS) */
  .press-window {
    left: 12px !important;
    right: 12px !important;
    top: 50% !important;
    bottom: auto !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    /* hug short content; only tall content fills the viewport */
    max-height: calc(100dvh - 24px) !important;
    transform: translateY(-50%) !important;
    display: flex;
    flex-direction: column;
    padding: 16px;
  }

  /* the one scroll surface inside the sheet */
  .press-window figure {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* !important beats the pixel size the JS sets for desktop */
  .press-window img {
    width: 100% !important;
    height: auto !important;
    max-height: none;
  }

  .press-window figcaption { padding-right: 24px; }
  .press-close { width: 36px; height: 36px; }
}

/* keep the page from scrolling behind the sheet */
body.window-open { overflow: hidden; }

@media (max-width: 720px) {
  .shelf-strip .book-scene { --bw: 96px; --bh: 144px; }
}

@media (max-width: 700px) {
  /* title on its own line, date beneath it */
  .toc-list li { display: block; padding: 8px 0; }
  .toc-list .leader { display: none; }
  .toc-list .date { display: block; margin-top: 2px; }
}

@media (max-width: 600px) {
  body > .site-head { padding: 44px 20px 0; }
  body > .footer { padding: 0 20px 48px; }
  body > .subscribe { margin-left: 20px; margin-right: 20px; }
  .page { --pad: 20px; }
  .section { margin-top: 36px; }
  .about-lead { font-size: 22px; }

  .shelf-label { margin-bottom: 16px; }
  .shelf-view { margin-top: 16px; }
  .shelf-strip { gap: 12px; }

  /* three covers share the row and grow to fill it, ratio locked */
  .shelf-strip .book-scene:nth-child(n + 4) { display: none; }
  .shelf-strip .book-scene {
    --bw: calc((100% - 24px) / 3);
    --bh: auto;
    width: var(--bw);
    height: auto;
    aspect-ratio: 2 / 3;
  }
}
