/* ==========================================================================
   Poetry · roguegoneawol
   One stylesheet for the shelf (home) and every collection page.
   Each collection has its own palette, set with a .t-<collection> class.
   ========================================================================== */

/* ---------- tokens ---------- */
@property --glow {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(31, 58, 43, 0.35);
}

:root {
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-poem: "EB Garamond", "Iowan Old Style", Garamond, Georgia, serif;
  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;

  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* default (home / paper) */
  --bg: #f4efe6;
  --bg2: #ebe4d6;
  --ink: #221d18;
  --muted: #6f665b;
  --line: rgba(34, 29, 24, 0.14);
  --accent: #2c5a3f;
  --accent-ink: #f4efe6;
  --surface: rgba(255, 255, 255, 0.5);
  --grain-opacity: 0.18;
}

/* ---------- collection palettes ---------- */
/* cover = book on the shelf, bg/bg2 = page background, the rest = page UI */
.t-roguegoneawol {
  --cover: linear-gradient(140deg, #2d5e43 0%, #173826 48%, #0b2015 100%);
  --cover-ink: #dcebd2;
  --swatch: #24513a;
  --glow-c: rgba(36, 81, 58, 0.42);
  --bg: #0c1c13;
  --bg2: #163223;
  --ink: #e3ead9;
  --muted: #93ab92;
  --line: rgba(227, 234, 217, 0.13);
  --accent: #a7d39b;
  --accent-ink: #0c1c13;
  --surface: rgba(255, 255, 255, 0.04);
  --hero:
    radial-gradient(120% 80% at 15% 0%, #2f6a49 0%, transparent 60%),
    radial-gradient(90% 70% at 100% 30%, #1b3f2b 0%, transparent 65%);
  --grain-opacity: 0.22;
}
.t-babymickflamingo {
  --cover: linear-gradient(150deg, #ffe3ea 0%, #f7b5c8 52%, #ec8eab 100%);
  --cover-ink: #5c1d37;
  --swatch: #f3a6bd;
  --glow-c: rgba(240, 150, 178, 0.5);
  --bg: #fdf1f4;
  --bg2: #f8dbe3;
  --ink: #3e1626;
  --muted: #9a5a72;
  --line: rgba(62, 22, 38, 0.13);
  --accent: #d24c7c;
  --accent-ink: #fff5f8;
  --surface: rgba(255, 255, 255, 0.55);
  --hero:
    radial-gradient(110% 80% at 10% 0%, #ffc4d4 0%, transparent 60%),
    radial-gradient(80% 70% at 100% 20%, #f7a3bd 0%, transparent 60%);
  --grain-opacity: 0.12;
}
.t-love {
  --cover: linear-gradient(145deg, #eeff9e 0%, #c4ef3c 50%, #94cf0f 100%);
  --cover-ink: #213006;
  --swatch: #b6e52b;
  --glow-c: rgba(170, 225, 30, 0.5);
  --bg: #f8fde8;
  --bg2: #e9f7b9;
  --ink: #1d2706;
  --muted: #5f7224;
  --line: rgba(29, 39, 6, 0.14);
  --accent: #5d8f00;
  --accent-ink: #f8fde8;
  --surface: rgba(255, 255, 255, 0.55);
  --hero:
    radial-gradient(110% 80% at 0% 0%, #dcff6a 0%, transparent 60%),
    radial-gradient(80% 70% at 100% 30%, #c2ee3a 0%, transparent 62%);
  --grain-opacity: 0.12;
}
.t-depths-of-maybe {
  --cover: linear-gradient(165deg, #2a4f98 0%, #12285e 45%, #050f27 100%);
  --cover-ink: #d3e2ff;
  --swatch: #163070;
  --glow-c: rgba(30, 62, 140, 0.45);
  --bg: #060f24;
  --bg2: #0f2350;
  --ink: #dde6f8;
  --muted: #8ea3cc;
  --line: rgba(221, 230, 248, 0.13);
  --accent: #9cbcff;
  --accent-ink: #060f24;
  --surface: rgba(255, 255, 255, 0.04);
  --hero:
    radial-gradient(120% 90% at 50% -20%, #24479a 0%, transparent 62%),
    radial-gradient(70% 60% at 0% 100%, #0b1d48 0%, transparent 70%);
  --grain-opacity: 0.22;
}
.t-2323 {
  --cover: linear-gradient(150deg, #45454b 0%, #222226 45%, #111113 100%);
  --cover-ink: #ececf0;
  --swatch: #2a2a2e;
  --glow-c: rgba(40, 40, 46, 0.4);
  --bg: #0f0f11;
  --bg2: #1d1d21;
  --ink: #e6e6ea;
  --muted: #9a9aa4;
  --line: rgba(230, 230, 234, 0.12);
  --accent: #d4d4dc;
  --accent-ink: #0f0f11;
  --surface: rgba(255, 255, 255, 0.035);
  --hero:
    radial-gradient(100% 80% at 80% 0%, #3a3a40 0%, transparent 60%),
    repeating-linear-gradient(
      115deg,
      rgba(255, 255, 255, 0.025) 0 2px,
      transparent 2px 9px
    );
  --grain-opacity: 0.25;
}
.t-ppd {
  --cover: linear-gradient(150deg, #2a2a2a 0%, #101010 55%, #000 100%);
  --cover-ink: #fff;
  --swatch: #0d0d0d;
  --glow-c: rgba(0, 0, 0, 0.3);
}

/* loading bar colors: grayish green on the home page, each collection's own colors on its page */
:root {
  --load-1: #c3cfc4;
  --load-2: #66806d;
  --load-ink: #fff;
}
.t-roguegoneawol {
  --load-1: #a7d39b;
  --load-2: #2d5e43;
}
.t-babymickflamingo {
  --load-1: #ffd0dd;
  --load-2: #d24c7c;
}
.t-love {
  --load-1: #eeff9e;
  --load-2: #94cf0f;
  --load-ink: #213006;
}
.t-depths-of-maybe {
  --load-1: #9cbcff;
  --load-2: #2a4f98;
}
.t-2323 {
  --load-1: #d4d4dc;
  --load-2: #45454b;
}

/* ---------- base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s;
}
.skip:focus {
  top: 16px;
}

.eyebrow {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ==========================================================================
   HOME · the shelf
   ========================================================================== */
.home {
  --glow: var(--glow-c, rgba(31, 58, 43, 0.35));
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  transition: --glow 0.8s var(--ease);
}
.home main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* paper: dotted grid + grain */
.paper {
  position: fixed;
  inset: 0 0 auto;
  /* tallest viewport, so it doesn't resize when the phone's address bar hides */
  height: 100vh;
  height: 100lvh;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(
    rgba(34, 29, 24, 0.16) 1px,
    transparent 1.2px
  );
  background-size: 28px 28px;
}
.paper::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--noise);
  background-size: 220px 220px;
  opacity: 0.22;
  mix-blend-mode: multiply;
}
.glow {
  position: fixed;
  left: 50%;
  top: 46vh;
  top: 46lvh;
  width: min(1100px, 140vw);
  aspect-ratio: 1.6;
  translate: -50% -50%;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(closest-side, var(--glow), transparent);
}

.title-overlay {
  position: fixed;
  inset: 0 0 auto;
  height: 100vh;
  height: 100lvh;
  z-index: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  overflow: hidden;
}
.title-overlay span {
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "opsz" 144;
  font-size: clamp(4.5rem, 17vw, 17rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-align: center;
  max-width: 96vw;
  overflow-wrap: anywhere;
  color: rgba(34, 29, 24, 0.055);
  transition:
    opacity 0.35s var(--ease),
    transform 0.6s var(--ease);
}
.title-overlay span.is-changing {
  opacity: 0;
  transform: translateY(12px);
}

.home-head,
.home main,
.home .site-foot {
  position: relative;
  z-index: 1;
}

.home-head {
  text-align: center;
  padding: clamp(2.2rem, 7vh, 4.5rem) 16px 0;
}
.home-head h1 {
  margin: 0.35rem 0 0.4rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-variation-settings: "opsz" 144;
  font-size: clamp(3rem, 9vw, 5.8rem);
  line-height: 1;
  letter-spacing: -0.03em;
}
.home-head .lede {
  margin: 0;
  font-family: var(--font-poem);
  font-size: clamp(1.02rem, 2.4vw, 1.2rem);
  color: var(--muted);
}

/* ---- the books ---- */
.shelf-wrap {
  --gap: clamp(8px, 2.2vw, 30px);
  --bw: clamp(40px, calc((100vw - 32px - 5 * var(--gap)) / 6), 148px);
  --bh: calc(var(--bw) * 1.42);
  position: relative;
  width: 100%;
  max-width: 1100px;
  padding: clamp(2rem, 7vh, 4.5rem) 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.books {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-end;
  gap: var(--gap);
  position: relative;
  z-index: 2;
}

.book {
  position: relative;
  width: var(--bw);
  height: var(--bh);
  animation: book-in 0.9s var(--ease) both;
  animation-delay: calc(0.15s + var(--i) * 0.09s);
}
@keyframes book-in {
  from {
    opacity: 0;
    transform: translateY(40px) rotate(-2deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.book-cover {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-decoration: none;
  color: var(--cover-ink);
  -webkit-tap-highlight-color: transparent;
  container-type: inline-size;
  transition: transform 0.6s var(--ease);
}
.book-cover:focus-visible {
  outline-offset: 6px;
}

/* back cover + pages peek out on the right when the cover "opens" */
.book-pages {
  position: absolute;
  inset: 2% 1% 2% 4%;
  border-radius: 0 6px 6px 0;
  background: #1b1714;
}
.book-pages span {
  position: absolute;
  top: 2.5%;
  bottom: 2.5%;
  right: 2px;
  width: 94%;
  border-radius: 0 5px 5px 0;
  background: linear-gradient(90deg, #f5efe3, #fffdf8);
  border: 1px solid rgba(0, 0, 0, 0.12);
  transition: transform 0.6s var(--ease);
}

.book-front {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 13cqw 10cqw 11cqw 16cqw;
  border-radius: 2px 6px 6px 2px;
  background: var(--noise), var(--cover);
  background-size:
    160px 160px,
    cover;
  background-blend-mode: soft-light, normal;
  box-shadow:
    inset 4px 0 6px -3px rgba(255, 255, 255, 0.25),
    rgba(0, 0, 0, 0.16) 8px 4px 16px,
    rgba(0, 0, 0, 0.1) 18px 0 28px;
  transform-origin: left center;
  overflow: hidden;
  transition:
    transform 0.7s var(--ease),
    box-shadow 0.7s var(--ease);
}
/* spine crease */
.book-front::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 7cqw;
  width: 9cqw;
  border-left: 1px solid rgba(0, 0, 0, 0.12);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0)
  );
  transition: transform 0.7s var(--ease);
}
.book-light {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.45) 100%
  );
  mix-blend-mode: overlay;
  opacity: 0.18;
  transition: opacity 0.7s var(--ease);
  pointer-events: none;
}

.cover-title {
  position: relative;
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 72;
  font-size: min(22cqw, calc(132cqw / var(--len, 8)));
  line-height: 1.02;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.cover-years {
  position: relative;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: max(5px, 7.4cqw);
  letter-spacing: 0.12em;
  opacity: 0.78;
  text-align: right;
}

.book-shadow {
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 80%;
  height: 4px;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.28) 0%,
    transparent 70%
  );
  z-index: -1;
  transition:
    width 0.6s var(--ease),
    opacity 0.6s var(--ease);
}

/* active book: lift, open the cover a little, show the pages */
.book.is-active .book-cover {
  transform: translateY(calc(var(--bw) * -0.08));
}
.book.is-active .book-front {
  transform: translateX(calc(var(--bw) * -0.06)) scaleX(0.95);
  box-shadow:
    inset 4px 0 6px -3px rgba(255, 255, 255, 0.25),
    rgba(0, 0, 0, 0.32) 16px 6px 20px,
    rgba(0, 0, 0, 0.14) 28px 0 34px;
}
.book.is-active .book-front::before {
  transform: translateX(2cqw);
}
.book.is-active .book-light {
  opacity: 0.32;
}
.book.is-active .book-pages span:nth-child(1) {
  transform: translateX(2px);
}
.book.is-active .book-pages span:nth-child(3) {
  transform: translateX(-2px);
}
.book.is-active .book-shadow {
  width: 105%;
  opacity: 0.85;
}
.book.is-soon .book-front {
  filter: saturate(0.85);
}

.shelf {
  position: relative;
  z-index: 3;
  width: min(
    100%,
    calc(6 * var(--bw) + 5 * var(--gap) + 2 * clamp(12px, 4vw, 60px))
  );
  height: clamp(9px, 1.4vw, 15px);
  margin-top: -1px;
  border-radius: 2px;
  background: linear-gradient(180deg, #e9e1d2 0%, #d6ccb9 100%);
  box-shadow:
    0 -1px 1px rgba(255, 255, 255, 0.5),
    0 2px 3px rgba(0, 0, 0, 0.12),
    0 8px 14px rgba(0, 0, 0, 0.08),
    0 26px 40px rgba(0, 0, 0, 0.12),
    0 50px 70px rgba(0, 0, 0, 0.08);
  animation: fade-in 1s var(--ease) both;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* ---- info under the shelf ---- */
.info {
  width: 100%;
  max-width: 640px;
  padding: clamp(2.2rem, 6vh, 3.6rem) 16px 3rem;
  text-align: center;
  animation: fade-in 1s 0.5s var(--ease) both;
}
.info .line {
  display: block;
  overflow: hidden;
}
.info .line > span {
  display: inline-block;
}
.info-inner.is-in .line > span {
  animation: line-up 0.7s var(--ease) both;
}
.info-inner.is-in .info-title .line > span {
  animation-delay: 0.06s;
}
.info-inner.is-in .info-years .line > span {
  animation-delay: 0.12s;
}
.info-inner.is-in .read-btn {
  animation: fade-in 0.6s 0.2s var(--ease) both;
}
@keyframes line-up {
  from {
    transform: translateY(105%);
    opacity: 0;
  }
}
.info-num {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.info-title {
  margin: 0.5rem 0 0.4rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-variation-settings: "opsz" 144;
  font-size: clamp(2.1rem, 6.5vw, 3.4rem);
  line-height: normal;
  letter-spacing: -0.025em;
}
.info-years {
  margin: 0;
  font-family: var(--font-poem);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--muted);
}

.read-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.6rem;
  padding: 0.85rem 1.4rem 0.85rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--btn-ink, #f4efe6);
  background: var(--noise), var(--btn-bg, #2c5a3f);
  background-size:
    160px 160px,
    cover;
  background-blend-mode: soft-light, normal;
  box-shadow:
    0 10px 24px -10px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition:
    transform 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}
.read-btn svg {
  width: 1.2em;
  height: 1.2em;
  transition: transform 0.3s var(--ease);
}
.read-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 30px -12px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.read-btn:hover svg {
  transform: translateX(3px);
}
.read-btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.7;
  box-shadow: none;
}
.read-btn[aria-disabled="true"] svg {
  display: none;
}

.noscript-list ul {
  list-style: none;
  padding: 0;
  text-align: center;
  font-family: var(--font-poem);
  font-size: 1.2rem;
  line-height: 2;
}

/* ==========================================================================
   COLLECTION PAGES
   ========================================================================== */
.bookpage {
  background: var(--bg);
}
/* the top-of-screen tint, on its own fixed layer (a "fixed" page background repaints on every scroll) */
.bookpage::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 100vh;
  height: 100lvh;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, var(--bg2) 0%, var(--bg) 46rem);
}
.grain {
  position: fixed;
  inset: 0 0 auto;
  height: 100vh;
  height: 100lvh;
  z-index: 0;
  pointer-events: none;
  background-image: var(--noise);
  background-size: 220px 220px;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
}

.hero {
  position: relative;
  z-index: 1;
  padding: clamp(1.4rem, 4vw, 2.2rem) 16px clamp(3rem, 9vw, 6rem);
  text-align: center;
  background: var(--hero);
  overflow: hidden;
}
.crumbs {
  text-align: left;
  max-width: 1180px;
  margin: 0 auto clamp(3rem, 10vw, 6.5rem);
}
.crumbs a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--surface);
  backdrop-filter: blur(6px);
  transition:
    background 0.25s,
    border-color 0.25s;
}
.crumbs a:hover {
  border-color: var(--accent);
}
.crumbs svg {
  width: 1.1em;
  height: 1.1em;
}
.hero-title {
  margin: 0.7rem auto 1.5rem;
  max-width: 14ch;
  font-family: var(--font-display);
  font-weight: 400;
  font-variation-settings: "opsz" 144;
  font-size: clamp(3rem, 12vw, 8.5rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
  animation: hero-in 1.1s var(--ease) both;
}
.hero .eyebrow,
.hero-meta {
  animation: fade-in 1s 0.25s var(--ease) both;
}
@keyframes hero-in {
  from {
    opacity: 0;
    transform: translateY(24px);
    letter-spacing: 0;
  }
}
.hero-meta {
  margin: 0;
  font-family: var(--font-poem);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--muted);
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 18.5rem minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 6rem);
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px) 4rem;
}

/* ---- poems ---- */
.poems {
  min-width: 0;
}
.poem {
  max-width: 40rem;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5rem) 0 clamp(2.5rem, 6vw, 3.5rem);
  border-top: 1px solid var(--line);
  scroll-margin-top: 1.5rem;
}
.poem:first-child {
  border-top: 0;
  padding-top: 1rem;
}
.poem-title {
  margin: 0 0 1.8rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-variation-settings: "opsz" 96;
  font-size: clamp(1.75rem, 4.5vw, 2.45rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.poem-title a {
  text-decoration: none;
}
.poem-title a:hover {
  color: var(--accent);
}
.poem-body {
  font-family: var(--font-poem);
  font-size: clamp(1.12rem, 2.6vw, 1.3rem);
  line-height: 1.6;
}
.stanza {
  margin: 0 0 1.35em;
}
/* hanging indent: when a long line wraps on a small screen, the overflow is indented */
.ln {
  display: block;
  padding-left: 1.4em;
  text-indent: -1.4em;
}
.ln em {
  font-style: italic;
}
.part {
  margin: 2rem 0 1rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.poem-body > .part:first-child {
  margin-top: 0;
}

.poem-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.2rem;
}
.poem-end {
  color: var(--accent);
  font-size: 0.9rem;
  opacity: 0.7;
}

/* ---- like button (rolling counter) ---- */
.like {
  --h: 44px;
  position: relative;
  display: inline-flex;
  align-items: stretch;
  height: var(--h);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 6px 16px -10px rgba(0, 0, 0, 0.4);
  transition:
    border-color 0.25s,
    background 0.25s,
    opacity 0.25s;
}
.like:hover {
  border-color: var(--accent);
}
.like:disabled {
  cursor: default;
  opacity: 0.55;
}
.like-main {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.95rem 0 0.8rem;
}
.like-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  color: var(--muted);
  transition:
    fill 0.2s,
    color 0.2s;
}
.like-text {
  font-size: 0.88rem;
  font-weight: 600;
}
.like-count {
  position: relative;
  display: grid;
  min-width: 3rem;
  padding: 0 0.8rem;
  place-items: center;
  border-left: 1px solid var(--line);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  overflow: hidden;
}
.like-count .num {
  grid-area: 1 / 1;
  transition:
    transform 0.5s var(--ease),
    opacity 0.5s var(--ease);
}
.like[aria-pressed="true"] .like-icon {
  fill: #fc4e6e;
  color: #fc4e6e;
}
.like[aria-pressed="true"] .like-count {
  color: var(--ink);
}
.like.pop .like-icon {
  animation: heart-pop 0.45s var(--ease);
}
@keyframes heart-pop {
  0% {
    transform: scale(0.55);
  }
  60% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}

/* ---- pager ---- */
.book-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 40rem;
  margin: 2rem auto 0;
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
}
.pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
  transition:
    transform 0.3s var(--ease),
    border-color 0.3s;
}
.pager-link.next {
  text-align: right;
}
.pager-link:hover {
  transform: translateY(-2px);
  border-color: var(--swatch);
}
.pager-k {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.pager-t {
  font-family: var(--font-display);
  font-size: 1.35rem;
}

/* ---- side navigation (scrollspy) ---- */
.sidenav {
  position: relative;
  order: -1;
}
.sidenav-inner {
  position: sticky;
  top: 1.5rem;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 3rem);
  max-height: calc(100dvh - 3rem);
  padding: 1.25rem 0.5rem 1.25rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}
/* first item in the nav: back to the shelf (home) */
.sidenav-home {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0.75rem 1.1rem 0;
  padding: 0.55rem 0.95rem 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    border-color 0.25s,
    background 0.25s;
}
.sidenav-home:hover {
  border-color: var(--accent);
  background: var(--surface);
}
.sidenav-home svg {
  width: 1.1em;
  height: 1.1em;
  transition: transform 0.3s var(--ease);
}
.sidenav-home:hover svg {
  transform: translateX(-3px);
}
.sidenav-label {
  margin: 0 0 0.6rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidenav-head {
  padding-right: 0.75rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.sidenav-current {
  margin: 0 0 0.8rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.15;
}
.progress {
  height: 3px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.progress span,
.nowbar-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
}

.toc-wrap {
  flex: 1 1 auto;
  min-height: 8rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  mask-image: linear-gradient(
    180deg,
    transparent 0,
    #000 1.6rem,
    #000 calc(100% - 1.6rem),
    transparent 100%
  );
  padding-block: 0.4rem;
}
.toc {
  list-style: none;
  margin: 0;
  padding: 0 0 0.6rem;
  border-left: 1px solid var(--line);
}
.toc a {
  position: relative;
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.3rem 0.4rem 0.3rem 0.85rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  line-height: 1.3;
  text-decoration: none;
  color: var(--muted);
  transition:
    color 0.2s,
    background 0.2s;
}
.toc a::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 0.35s var(--ease);
}
.toc a:hover {
  color: var(--ink);
}
.toc-n {
  flex: none;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
}
.toc a.is-active {
  color: var(--ink);
  font-weight: 600;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 16%, transparent),
    transparent
  );
}
.toc a.is-active::before {
  transform: scaleY(1);
}

.shelf-nav {
  flex: none;
  padding: 1rem 0.75rem 0 0;
  margin-top: 0.4rem;
}
.shelf-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
/* each collection link fills with its own colors on hover */
.sl-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  isolation: isolate;
  overflow: hidden;
  transition: color 0.35s var(--ease);
}
.sl-link::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--noise), var(--cover);
  background-size:
    160px 160px,
    cover;
  background-blend-mode: soft-light, normal;
  clip-path: inset(0 100% 0 0 round 10px);
  transition: clip-path 0.45s var(--ease);
}
a.sl-link:hover,
a.sl-link:focus-visible {
  color: var(--cover-ink);
}
a.sl-link:hover::before,
a.sl-link:focus-visible::before {
  clip-path: inset(0 0 0 0 round 10px);
}
.sl-t {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
}
.sl-y {
  flex: none;
  white-space: nowrap;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.65;
}
.sl-link[aria-current="page"] {
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}
.sl-link.is-soon {
  opacity: 0.5;
  cursor: default;
}

/* mobile "now reading" bar (hidden on desktop) */
.nowbar,
.scrim {
  display: none;
}

/* ---------- footer ---------- */
.site-foot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1.4rem;
  padding: 2rem 16px 2.4rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}
.site-foot p {
  margin: 0;
}
.visits {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.visits[hidden] {
  display: none;
}
.visits strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- most liked poems ---------- */
.top-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 0.25s,
    transform 0.25s var(--ease);
}
.top-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.top-btn svg {
  width: 1rem;
  height: 1rem;
  color: var(--accent);
}
/* colored like the cover of the most liked collection (class t-<collection> is added by script.js) */
.top-btn.is-themed {
  border-color: transparent;
  color: var(--cover-ink);
  background: var(--noise), var(--cover);
  background-size:
    160px 160px,
    cover;
  background-blend-mode: soft-light, normal;
  box-shadow:
    0 8px 18px -10px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.top-btn.is-themed svg {
  color: currentColor;
}

.top-dialog {
  width: min(30rem, calc(100vw - 32px));
  max-height: min(36rem, calc(100dvh - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  background: var(--bg);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
  font-family: var(--font-ui);
}
.top-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}
.top-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: top-in 0.4s var(--ease) both;
}
@keyframes top-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}
.top-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.2rem 0.9rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.top-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.45rem;
}
.top-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: inherit;
  background: none;
  cursor: pointer;
}
.top-close svg {
  width: 1.1rem;
  height: 1.1rem;
}
.top-body {
  overflow-y: auto;
  padding: 0.6rem 0.7rem 0.9rem;
}
.top-msg {
  margin: 1.2rem 0.8rem;
  color: var(--muted);
}
.top-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.top-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.2s;
}
.top-link:hover,
.top-link:focus-visible {
  background: var(--surface);
}
.top-rank {
  flex: none;
  width: 1.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.top-text {
  flex: 1;
  min-width: 0;
  display: grid;
}
.top-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.2;
}
.top-book {
  font-size: 0.75rem;
  color: var(--muted);
}
.top-count {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.top-count svg {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--accent);
}

/* ---------- loading screen (progress bar) ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 0 32px;
  background: var(--bg);
  transition:
    opacity 0.5s var(--ease),
    visibility 0s 0.5s;
  /* safety net: never stays up, even if the script fails */
  animation: loader-gone 0.4s 8s forwards;
}
@keyframes loader-gone {
  to {
    opacity: 0;
    visibility: hidden;
  }
}
.is-loaded .loader {
  opacity: 0;
  visibility: hidden;
}
.loader-track {
  width: min(400px, 100%);
  height: 30px;
  border-radius: 20px;
  background: var(--line);
}
.loader-bar {
  display: grid;
  place-items: center;
  width: 0;
  min-width: 3.2rem;
  height: 100%;
  border-radius: 20px;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 0.8rem;
  font-weight: bolder;
  font-variant-numeric: tabular-nums;
  color: var(--load-ink);
  background: linear-gradient(to left, var(--load-2), var(--load-1));
  box-shadow: 0 3px 60px -6px var(--load-2);
  transition: width 0.3s ease;
}
/* jump straight to a linked poem while loading (a smooth scroll would aim at where it was before the fonts arrived) */
html.is-loading {
  scroll-behavior: auto;
}
/* hold the page's own entrance animations until the loader is gone */
.is-loading body *:not(.loader, .loader *) {
  animation-play-state: paused !important;
}
.site-foot a {
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 960px) {
  .layout {
    z-index: auto;
    grid-template-columns: minmax(0, 1fr);
  }
  .hero {
    padding-top: 5.5rem;
  }
  .poem {
    scroll-margin-top: 5.5rem;
  }

  /* side nav becomes a bottom sheet */
  .sidenav {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 40;
    padding: max(10px, env(safe-area-inset-top)) 10px 0;
    transform: translateY(-105%);
    visibility: hidden;
    transition:
      transform 0.5s var(--ease),
      visibility 0s 0.5s;
  }
  .sidenav.is-open {
    transform: none;
    visibility: visible;
    transition:
      transform 0.5s var(--ease),
      visibility 0s;
  }
  .sidenav-inner {
    position: relative;
    top: 0;
    max-height: min(78vh, 40rem);
    max-height: min(78dvh, 40rem);
    background: var(--bg);
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.5);
    /* short phones: the whole sheet scrolls, so the collections never spill out of it */
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .toc-wrap {
    flex: none;
    min-height: 0;
    overflow: visible;
    mask-image: none;
  }

  .nowbar {
    position: fixed;
    left: 12px;
    right: 12px;
    top: max(12px, env(safe-area-inset-top));
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    overflow: hidden;
    text-align: left;
    transition:
      transform 0.4s var(--ease),
      opacity 0.4s;
  }
  .nowbar.is-hidden {
    transform: translateY(-140%);
    opacity: 0;
  }
  .nowbar-k {
    flex: none;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .nowbar-t {
    flex: 1;
    min-width: 0;
    font-family: var(--font-display);
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nowbar svg {
    flex: none;
    width: 1.2rem;
    height: 1.2rem;
  }
  .nowbar-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
  }

  .scrim:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.35);
    animation: fade-in 0.3s both;
  }
}

@media (max-width: 560px) {
  .title-overlay {
    display: none;
  }
  .home-head {
    padding-top: 2rem;
  }
  .info {
    padding-top: 2rem;
  }
  .read-btn {
    width: 100%;
    justify-content: center;
  }
  .poem-foot {
    margin-top: 1.6rem;
  }
  .book-pager {
    grid-template-columns: 1fr;
  }
  .pager-link.next {
    text-align: left;
  }
  .like {
    --h: 42px;
  }
}

/* phones: two shelves, three books on each */
@media (max-width: 560px) {
  .shelf-wrap {
    --bw: clamp(64px, calc((100vw - 32px - 2 * var(--gap)) / 3), 120px);
    --overhang: clamp(12px, 4vw, 24px);
  }
  .books {
    flex-wrap: wrap;
    width: calc(3 * var(--bw) + 2 * var(--gap));
    row-gap: calc(clamp(9px, 1.4vw, 15px) + 2.2rem);
  }
  /* top shelf, sitting under the first row */
  .books::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: calc(var(--bh) - 1px);
    left: calc(-1 * var(--overhang));
    right: calc(-1 * var(--overhang));
    height: clamp(9px, 1.4vw, 15px);
    border-radius: 2px;
    background: linear-gradient(180deg, #e9e1d2 0%, #d6ccb9 100%);
    box-shadow:
      0 -1px 1px rgba(255, 255, 255, 0.5),
      0 2px 3px rgba(0, 0, 0, 0.12),
      0 8px 14px rgba(0, 0, 0, 0.08);
    animation: fade-in 1s var(--ease) both;
  }
  .shelf {
    width: calc(3 * var(--bw) + 2 * var(--gap) + 2 * var(--overhang));
  }
}

@media (hover: hover) {
  .book:not(.is-active) .book-cover:hover {
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .grain,
  .sidenav,
  .nowbar,
  .like,
  .site-foot,
  .book-pager,
  .crumbs {
    display: none !important;
  }
  .bookpage {
    background: #fff;
    color: #000;
  }
  .layout {
    display: block;
  }
  .poem {
    break-inside: avoid;
  }
}
