/* The shelf has one shared center line: masthead, cover, title, and edition.
   These rules leave the open-issue reader's viewport and controls untouched. */
.immersive .newsstand-dialog:not(.is-reading) {
  --shelf-edge: max(12px, env(safe-area-inset-left), env(safe-area-inset-right));
  width: min(500px, calc(100vw - var(--shelf-edge) - var(--shelf-edge)));
  max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
  scrollbar-gutter: stable both-edges;
}
.immersive .newsstand-dialog:not(.is-reading):has(.issue-card:nth-child(2)) {
  width: min(760px, calc(100vw - var(--shelf-edge) - var(--shelf-edge)));
}
.immersive .newsstand-dialog:not(.is-reading) .newsstand-shell {
  min-width: 0;
  padding: 12px clamp(12px, 3vw, 24px) 20px;
}
.immersive .newsstand-dialog:not(.is-reading) .newsstand-top {
  position: sticky;
  z-index: 2;
  top: 0;
  display: block;
  padding: 8px 40px 17px;
  border: 0;
  background-color: var(--paper-light);
  background-image: var(--comic-ink-rule);
  background-position: center bottom;
  background-size: 100% 4px;
  background-repeat: no-repeat;
  text-align: center;
}
.immersive .newsstand-dialog:not(.is-reading) .newsstand-top > div {
  min-width: 0;
  width: 100%;
}
.immersive .newsstand-dialog:not(.is-reading) .newsstand-top .eyebrow {
  margin: 0 0 7px;
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 1.5px;
}
.immersive .newsstand-dialog:not(.is-reading) .newsstand-top h2 {
  max-width: 22ch;
  margin: 0 auto;
  font-size: clamp(21px, 3vw, 28px);
  line-height: 1.15;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.immersive .newsstand-dialog:not(.is-reading) .newsstand-top .close-button {
  position: absolute;
  top: 1px;
  right: 0;
  width: 40px;
  height: 40px;
  min-height: 40px;
  margin: 0;
}
.immersive .newsstand-dialog:not(.is-reading) #chapter-shelf { min-width: 0; }
.immersive .newsstand-dialog:not(.is-reading) .shelf-status {
  max-width: 38ch;
  margin: 0 auto;
  text-align: center;
}
.immersive .newsstand-dialog:not(.is-reading) .shelf-status:not(:empty) { padding: 18px 0 0; }
.immersive .newsstand-dialog:not(.is-reading) .issue-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  justify-items: center;
  align-items: start;
  gap: 24px;
}
.immersive .newsstand-dialog:not(.is-reading) .issue-grid:not(:empty) { padding-top: 18px; }
.immersive .newsstand-dialog:not(.is-reading) .issue-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 310px;
  min-width: 0;
  margin: 0;
  padding: 13px 13px 16px;
  border: 5px solid transparent;
  border-image: var(--comic-paper-border) 12 / 5px / 0 stretch;
  border-radius: 0;
  background: var(--paper-light);
  background-clip: padding-box;
  box-shadow: none;
  filter: none;
  text-align: center;
  cursor: pointer;
  scroll-margin-top: 140px;
}
.immersive .newsstand-dialog:not(.is-reading) .issue-card::before { content: none; }
.immersive .newsstand-dialog:not(.is-reading) .issue-card img {
  display: block;
  width: auto;
  height: clamp(160px, 44dvh, 350px);
  max-width: 100%;
  max-height: none;
  margin: 0 auto 2px;
  object-fit: contain;
  object-position: center;
}
.immersive .newsstand-dialog:not(.is-reading) .issue-card strong {
  display: block;
  width: 100%;
  max-width: 25ch;
  margin: 0;
  font: 600 clamp(17px, 2vw, 20px) / 1.25 var(--comic-lettering);
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.immersive .newsstand-dialog:not(.is-reading) .issue-card span {
  display: block;
  width: 100%;
  margin: 0;
  color: var(--comic-secondary-ink);
  font: 12px / 1.4 var(--comic-lettering);
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.immersive .newsstand-dialog:not(.is-reading) .issue-card:hover:not(:disabled) {
  background-color: var(--paper);
  filter: none;
}
.immersive .newsstand-dialog:not(.is-reading) .issue-card:active:not(:disabled) {
  filter: none;
}
.immersive .newsstand-dialog:not(.is-reading) .issue-card:focus-visible {
  outline: 2px dashed var(--ink);
  outline-offset: 3px;
}

@media (max-width: 360px) {
  .immersive .newsstand-dialog:not(.is-reading) .newsstand-shell { padding: 8px 8px 14px; }
  .immersive .newsstand-dialog:not(.is-reading) .newsstand-top { padding-right: 36px; padding-left: 36px; }
  .immersive .newsstand-dialog:not(.is-reading) .issue-card { padding: 10px 10px 13px; gap: 8px; }
}

@media (forced-colors: active) {
  .immersive .newsstand-dialog:not(.is-reading) .newsstand-top { background-color: Canvas; }
  .immersive .newsstand-dialog:not(.is-reading) .issue-card {
    border-image: none;
    border-color: ButtonText;
    background: Canvas;
    color: ButtonText;
    filter: none;
  }
  .immersive .newsstand-dialog:not(.is-reading) .issue-card span { color: CanvasText; }
  .immersive .newsstand-dialog:not(.is-reading) .issue-card:hover:not(:disabled) { background: Canvas; filter: none; }
  .immersive .newsstand-dialog:not(.is-reading) .issue-card:focus-visible { outline-color: Highlight; }
}
