/* =========================================================================
   book.css — the reading and listening section at /book/
   Loaded after site.css. Same palette, but this is a reading environment:
   long measures, serif, generous leading, no motion.
   ========================================================================= */

.readhead { padding: 8.5rem 0 var(--step); }
.readhead .h1 { font-size: clamp(2rem, 5vw, 3.4rem); }

.readwrap {
  display: grid; gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
@media (min-width: 62em) {
  .readwrap { grid-template-columns: 15rem minmax(0, 1fr); }
}

/* ------------------------------------------------------------- contents -- */
.contents {
  font-family: var(--sans); font-size: .8125rem;
  border-top: 1px solid var(--hair-soft); padding-top: 1.25rem;
}
@media (min-width: 62em) {
  .contents { position: sticky; top: 5rem; max-height: calc(100vh - 7rem); overflow: auto; }
}
.contents h2 {
  font-size: .6875rem; font-weight: 700; letter-spacing: .19em;
  text-transform: uppercase; color: var(--on-dark-3); margin-bottom: 1rem;
}
.contents ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.contents a {
  display: block; padding: .38rem .5rem; margin-left: -.5rem;
  border-radius: 5px; text-decoration: none; color: var(--on-dark-2); line-height: 1.35;
}
.contents a:hover { background: rgba(255, 255, 255, .06); color: var(--on-dark); }
.contents .part-label {
  font-family: var(--mono); font-size: .625rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--on-dark-3);
  margin: 1.35rem 0 .35rem; padding-left: 0;
}
.contents li.is-current > a { color: var(--on-dark); background: rgba(255, 255, 255, .07); }

/* -------------------------------------------------------------- reading -- */
.reading { max-width: 40rem; }

.part-open {
  margin: var(--step) 0 2.5rem; padding-top: 2rem;
  border-top: 1px solid var(--hair);
}
.part-open .kicker {
  font-family: var(--mono); font-size: .6875rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--on-dark-3); margin: 0 0 .7rem;
}
.part-open h2 { font-family: var(--sans); font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  font-weight: 800; letter-spacing: -.028em; }

.piece { margin: 0 0 4.5rem; scroll-margin-top: 5rem; }
.piece > h3 {
  font-family: var(--sans); font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  font-weight: 800; letter-spacing: -.024em; line-height: 1.14;
}
.piece .sub {
  font-family: var(--sans); font-size: .875rem; color: var(--on-dark-3);
  margin: .6rem 0 1.75rem; font-style: normal;
}
.piece .body > p { color: #ddd8d2; }
.piece .body > p:first-of-type::first-letter { /* nothing fancy, just breathing room */ }

.piece blockquote {
  margin: 2rem 0; padding-left: 1.25rem;
  border-left: 2px solid var(--hair);
  color: var(--on-dark-2); font-style: italic;
}

.fade-out {
  position: relative;
  max-height: none;
}

.gate {
  margin-top: 1.75rem; padding: 1.25rem 1.4rem;
  border: 1px solid var(--hair-soft); border-radius: 10px;
  background: rgba(255, 255, 255, .028);
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  font-family: var(--sans); font-size: .875rem; color: var(--on-dark-2);
}
.gate p { margin: 0; flex: 1 1 15rem; }
.gate .rule { display: block; height: 2px; width: 2rem; background: var(--spectrum);
  border-radius: 2px; margin-bottom: .7rem; }

.dedication {
  font-size: clamp(1.1rem, 2.4vw, 1.35rem); line-height: 1.7;
  color: var(--on-dark-2); font-style: italic;
}

/* ------------------------------------------------------------- audiobook -- */
.player {
  border: 1px solid var(--hair-soft); border-radius: 14px;
  background: linear-gradient(180deg, var(--ground-2), var(--ground));
  padding: clamp(1.25rem, 3vw, 1.9rem);
  scroll-margin-top: 5rem;
}
.player__top { display: flex; align-items: center; gap: 1rem; }

.player__play {
  flex: 0 0 auto; width: 3.4rem; height: 3.4rem; border-radius: 50%;
  border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--spectrum); background-size: 240% 100%; background-position: 20% 0;
  transition: background-position .3s ease, transform .16s ease;
}
.player__play:hover { background-position: 70% 0; }
.player__play:active { transform: scale(.96); }
.player__play svg { width: 1.1rem; height: 1.1rem; fill: #0d0c0b; }
.player__play .ic-pause { display: none; }
.player[data-playing="1"] .player__play .ic-play { display: none; }
.player[data-playing="1"] .player__play .ic-pause { display: block; }

.player__now { min-width: 0; flex: 1 1 auto; }
.player__now .label {
  font-family: var(--sans); font-size: .625rem; font-weight: 700;
  letter-spacing: .19em; text-transform: uppercase; color: var(--on-dark-3);
  margin: 0 0 .3rem;
}
.player__now .title {
  font-family: var(--sans); font-size: 1rem; font-weight: 650; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.player__side { display: flex; align-items: center; gap: .35rem; flex: 0 0 auto; }
.iconbtn {
  border: 1px solid var(--hair); background: rgba(255, 255, 255, .03);
  color: var(--on-dark-2); border-radius: 8px; cursor: pointer;
  font-family: var(--mono); font-size: .75rem; padding: .45rem .6rem;
  min-width: 2.2rem; display: grid; place-items: center;
  transition: border-color .16s ease, color .16s ease;
}
.iconbtn:hover { border-color: rgba(255, 255, 255, .3); color: var(--on-dark); }
.iconbtn svg { width: .85rem; height: .85rem; fill: currentColor; display: block; }
.iconbtn[aria-pressed="true"] { border-color: var(--azure); color: var(--azure); }

.player__bar { display: flex; align-items: center; gap: .75rem; margin-top: 1.15rem; }
.player__bar time {
  font-family: var(--mono); font-size: .6875rem; color: var(--on-dark-3);
  font-variant-numeric: tabular-nums; flex: 0 0 auto;
}
.seek { flex: 1 1 auto; -webkit-appearance: none; appearance: none;
  height: 1.15rem; background: transparent; cursor: pointer; }
.seek::-webkit-slider-runnable-track {
  height: 3px; border-radius: 3px;
  background: linear-gradient(to right, var(--azure) var(--pct, 0%), rgba(255,255,255,.14) var(--pct, 0%));
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: .8rem; height: .8rem; border-radius: 50%;
  background: var(--on-dark); margin-top: -.25rem; border: 0;
}
.seek::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(255,255,255,.14); }
.seek::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--azure); }
.seek::-moz-range-thumb { width: .8rem; height: .8rem; border: 0; border-radius: 50%; background: var(--on-dark); }

.tracks {
  list-style: none; margin: 1.5rem 0 0; padding: 1.25rem 0 0;
  border-top: 1px solid var(--hair-soft);
  display: none; max-height: 20rem; overflow: auto;
}
.player[data-list="1"] .tracks { display: block; }
.tracks li { margin: 0; }
.tracks button {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  display: flex; gap: .8rem; align-items: baseline;
  padding: .5rem .6rem; border-radius: 6px;
  font-family: var(--sans); font-size: .875rem; color: var(--on-dark-2);
}
.tracks button:hover { background: rgba(255, 255, 255, .06); color: var(--on-dark); }
.tracks li[aria-current="true"] button { color: var(--on-dark); background: rgba(255,255,255,.07); }
.tracks .n { font-family: var(--mono); font-size: .6875rem; color: var(--on-dark-3); flex: 0 0 1.6rem; }

.player__note {
  font-family: var(--sans); font-size: .8125rem; color: var(--on-dark-3);
  margin: 1.25rem 0 0;
}
.player__error {
  display: none; margin-top: 1rem; padding: .8rem 1rem; border-radius: 8px;
  border: 1px solid rgba(232, 57, 122, .35); background: rgba(232, 57, 122, .08);
  font-family: var(--sans); font-size: .8125rem; color: #f7bfd2;
}
.player.has-error .player__error { display: block; }

@media (max-width: 34em) {
  .player__top { flex-wrap: wrap; }
  .player__side { width: 100%; justify-content: flex-start; }
}
