/* DWD media additions — portrait fit + launch gallery.
   Uses only existing design tokens (--paper, --ink, --line, --red). */

/* Author portrait: fills the existing square frame without changing its size,
   placement, background or inset border. */
.author-portrait {
  overflow: hidden;
}
.author-portrait .author-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

/* Minimal launch gallery strip */
.dwd-media {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 10vw 96px;
}
.dwd-media-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}
.dwd-media .section-tag {
  padding-top: 0;
}
.dwd-media-note {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}
.dwd-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(104px, 9vw, 118px);
  gap: 12px;
  list-style: none;
  margin: 22px 0 0;
  padding: 0 0 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.dwd-strip li {
  margin: 0;
}
.dwd-tile {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #ddd5ca;
  cursor: pointer;
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  color: #f4f1eb;
  font: inherit;
  text-align: left;
}
.dwd-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.dwd-tile:hover img,
.dwd-tile:focus-visible img {
  transform: scale(1.03);
}
.dwd-tile:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}
.dwd-tile-video::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(31, 32, 30, .18);
}
.dwd-play {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(244, 241, 235, .92);
  color: var(--dark);
  font-size: 11px;
  padding-left: 2px;
}
/* Lightbox */
.dwd-lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.dwd-lightbox::backdrop {
  background: rgba(23, 24, 22, .92);
}
.dwd-lightbox-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 100vh;
  padding: 56px 64px;
  margin: 0;
}
.dwd-lb-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: 76vh;
}
.dwd-lb-media img {
  max-width: min(1100px, 92vw);
  max-height: 76vh;
  width: auto;
  height: auto;
  object-fit: contain;
  touch-action: pan-y;
}
.dwd-lb-media video {
  max-width: min(960px, 92vw);
  max-height: 76vh;
  width: auto;
  height: auto;
  background: #000;
}
.dwd-lb-button {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(217, 213, 204, .4);
  border-radius: 50%;
  background: rgba(31, 32, 30, .7);
  color: #f4f1eb;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.dwd-lb-button:hover,
.dwd-lb-button:focus-visible {
  background: #f4f1eb;
  color: var(--dark);
  outline: none;
}
.dwd-lb-close {
  top: 18px;
  right: 18px;
  font-size: 22px;
}

@media (max-width: 760px) {
  .dwd-media {
    padding: 0 8vw 64px;
  }
  .dwd-media-head {
    padding-top: 22px;
  }
  .dwd-strip {
    grid-auto-columns: 96px;
    gap: 9px;
    margin-top: 16px;
  }
  .dwd-lightbox-inner {
    padding: 64px 12px 28px;
  }
  .dwd-lb-button {
    width: 36px;
    height: 36px;
  }
}

/* Supplied hero cover render: keep the existing cover box, dimensions,
   transform and shadow; fill it with the replacement artwork. */
.book-cover-replaced {
  padding: 0;
  background: #ffffff;
}
.book-cover-replaced img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
