/* Book chapter pages (/book/chapter-N/). Written for the monograph theme:
   flat surfaces, thin rules, no radius, no shadow, no motion. */

.chapter-kicker {
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: var(--space-l) 0 0;
}
.chapter-kicker + h1 { margin-top: 0.35rem; }

.chapter-sample p:first-child::first-letter {
  font-family: var(--font-heading);
  float: left;
  font-size: 3.4em;
  line-height: 0.85;
  padding: 0.08em 0.12em 0 0;
  font-weight: 600;
}
.chapter-sample__end {
  margin-top: var(--space-l) !important;
  padding-top: var(--space-s);
  border-top: 1px solid var(--border);
  font-style: italic;
  color: var(--text-muted);
}
.chapter-sample__end a { color: var(--text); }

.further { max-width: var(--measure); }
.further__intro { color: var(--text-muted); font-size: 0.98rem; margin: 0 0 var(--space-m); }

.sources { list-style: none; padding: 0; margin: 0; counter-reset: source; }
.source {
  --thumb: 7.75rem;
  counter-increment: source;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--thumb);
  gap: 0.75rem 1.25rem;
  align-items: start;
  border-top: 1px solid var(--border);
  padding: var(--space-m) 0 var(--space-m) 2.25rem;
}
.source::before {
  content: counter(source);
  position: absolute;
  left: 0;
  top: calc(var(--space-m) + 0.1rem);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--primary);
  font-weight: 600;
}
.source p { margin: 0; }
.source__meta {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.source__title { font-family: var(--font-heading); font-size: 1.15rem; line-height: 1.35; margin-top: 0.2rem !important; }
.source__title a { color: var(--text); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.source__title a:hover { color: var(--primary-dark); }
.source__creator { color: var(--text-muted); font-size: 0.95rem; }
.source__anchor {
  margin-top: 0.6rem !important;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--text-muted);
  border-left: 2px solid var(--primary);
  padding-left: 0.75rem;
}
.source__anchor span {
  font-style: normal;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
}

/* Media column: every image is self-hosted WebP with width/height set, so nothing shifts as it loads */
.source__media { display: block; position: relative; background: var(--muted); border: 1px solid var(--border); overflow: hidden; }
.source__media img { display: block; width: 100%; height: auto; }
.source__image--book { border-color: transparent; background: none; }
.source__image--book img { border: 1px solid var(--border); }
.source__tile {
  aspect-ratio: 4 / 5;
  display: flex;
  align-items: flex-end;
  padding: 0.6rem;
  text-decoration: none;
  background:
    repeating-linear-gradient(0deg, transparent 0 1.35rem, var(--border) 1.35rem calc(1.35rem + 1px)),
    var(--surface);
}
.source__tile span { font-family: var(--font-heading); font-style: italic; font-size: 0.85rem; color: var(--text-muted); overflow-wrap: anywhere; line-height: 1.2; background: var(--surface); }

/* Videos: a full-width still under the text */
.source--wide { grid-template-columns: minmax(0, 1fr); }

/* Click-to-load embeds */
.embed__play {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}
.embed__play img { transition: none; }
.embed__tile { display: flex; aspect-ratio: 4 / 5; align-items: center; justify-content: center; padding: 0.75rem; text-align: center; font-family: var(--font-heading); font-size: 0.9rem; }
.embed__badge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.4rem 0.55rem 0.45rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
  color: #fff;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
}
.embed__badge::before { content: "\25B6\FE0E"; margin-right: 0.45em; color: var(--accent); }
.embed__badge--post::before { content: "\2197\FE0E"; }
.source--wide .embed__badge { font-size: 0.82rem; padding: 2.5rem 0.9rem 0.7rem; }
.embed__play:hover .embed__badge, .embed__play:focus-visible .embed__badge { background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.1)); }
.embed__play:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Playing: the item goes single column and the player takes the full width */
.source.is-playing { grid-template-columns: minmax(0, 1fr); }
.embed.is-loaded { background: transparent; border-color: transparent; }
.embed.is-loading { background: var(--muted); }
.embed.is-loading::before {
  content: "Loading\2026";
  position: absolute;
  top: var(--space-s);
  left: var(--space-m);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.embed iframe { display: block; width: 100%; border: 0; }
.embed--youtube.is-loaded, .embed--vimeo.is-loaded { aspect-ratio: 16 / 9; }
.embed--youtube iframe, .embed--vimeo iframe { height: 100%; }
.embed--instagram.is-loaded { max-width: 400px; }
.embed--instagram iframe { height: 760px; }
.embed--linkedin.is-loaded { max-width: 504px; }
.embed--linkedin iframe { height: 640px; }

@media (max-width: 480px) {
  .source { --thumb: 6rem; padding-left: 1.75rem; gap: 0.6rem 0.9rem; }
  .source__title { font-size: 1.05rem; }
  .embed__badge { font-size: 0.6rem; letter-spacing: 0.03em; padding: 1.1rem 0.4rem 0.35rem; }
  .embed--instagram iframe { height: 680px; }
}

/* Pager and contents */
.chapter-pager {
  display: flex;
  justify-content: space-between;
  gap: var(--space-m);
  max-width: var(--measure);
  margin: var(--space-xl) 0 0;
  padding-top: var(--space-m);
  border-top: 2px solid var(--text);
}
.chapter-pager a { text-decoration: none; color: var(--text); font-family: var(--font-heading); font-size: 1.1rem; }
.chapter-pager a span { display: block; font-family: var(--font-body); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.chapter-pager__next { text-align: right; margin-left: auto; }
.chapter-contents { max-width: var(--measure); margin-top: var(--space-l); }
.chapter-contents h2 { margin-top: var(--space-l); }
.chapter-contents h3 { font-size: 1rem; margin: var(--space-m) 0 0.3rem; }
.chapter-contents ol { list-style: none; padding: 0; margin: 0; }
.chapter-contents li a { display: flex; gap: 0.75rem; padding: 0.3rem 0; text-decoration: none; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.chapter-contents li a span { min-width: 1.5rem; color: var(--primary); font-family: var(--font-heading); }
.chapter-contents li a:hover { color: var(--text); }
.chapter-contents li[aria-current="page"] a { color: var(--text); font-weight: 600; }

@media (max-width: 480px) {
  .source { padding-left: 1.75rem; }
  .embed--instagram iframe { height: 680px; }
}
