/* Archive-specific styles. The shared stylesheet remains unchanged. */
.archive-bar .filters { flex-wrap: wrap; justify-content: flex-end; }
.archive-bar .filter { min-height: 44px; }
.archive-message { color: var(--muted); padding: 14px 0; line-height: 1.5; }
.issue-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  text-decoration: underline; text-decoration-color: transparent;
  text-underline-offset: 4px; overflow-wrap: anywhere;
}
.issue-link:hover, .issue-link:focus-visible { color: var(--green); text-decoration-color: currentColor; }
.issue-link::after { content: "↗"; font-size: 15px; color: var(--green-soft); flex: none; }
.issue .issue-title { min-width: 0; }
html.reader-open, html.reader-open body { overflow: hidden; }

.magazine-reader {
  width: min(1040px, calc(100vw - 32px));
  height: min(88dvh, 820px);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid #214635;
  border-radius: 20px;
  color: #f3eddf;
  background: transparent;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  overflow: hidden;
  font-family: "IM Fell English", Georgia, serif;
}
.magazine-reader::backdrop { background: rgba(0, 0, 0, .62); }
.magazine-reader[open] { display: grid; place-items: center; }
/* Hidden reader elements must stay hidden even when styled as flex or grid. */
.magazine-reader [hidden] { display: none !important; }

.reader-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: linear-gradient(180deg, #0f2a20 0%, #0b2018 100%);
}
.reader-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #0e2a1f;
  border-bottom: 1px solid #ffffff1f;
}
.reader-heading {
  min-width: 0;
  flex: 1 1 auto;
}
.reader-heading h2 {
  margin: 0;
  font-size: 21px;
  font-weight: normal;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.reader-heading p {
  margin: 3px 0 0;
  color: #d5d7ca;
  font-size: 12px;
}
.reader-control,
.reader-arrow,
.reader-tile {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.reader-control,
.reader-arrow {
  background: transparent;
  border: 1px solid #ffffff38;
  border-radius: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 4px 10px;
}
.reader-control:hover,
.reader-control:focus-visible,
.reader-arrow:hover,
.reader-arrow:focus-visible {
  background: #ffffff12;
}
.reader-control:disabled,
.reader-arrow:disabled {
  opacity: .38;
  cursor: default;
}
.reader-close {
  font: 29px/1 system-ui, sans-serif;
  border-color: transparent;
  flex: none;
}
.reader-back {
  flex: none;
}
.reader-body {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
}
.reader-view {
  height: 100%;
  min-height: 0;
}
.reader-grid-view {
  overflow: auto;
  padding: 14px;
}
.reader-helper {
  margin: 0 0 10px;
  color: #d5d7ca;
  font-size: 14px;
}
.reader-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.reader-tile {
  appearance: none;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: inherit;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
.reader-tile:focus-visible {
  outline: 2px solid #f3eddf;
  outline-offset: 2px;
}
.reader-tile-image-wrap {
  display: block;
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f3eddf12;
}
.reader-tile-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #ece6d6;
}
.reader-tile-number {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 28px;
  min-height: 28px;
  padding: 4px 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, .72);
  color: #fdfaf1;
  font-size: 13px;
  line-height: 1;
}
.reader-tile-missing .reader-tile-image-wrap::after {
  content: "Missing";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(41, 42, 36, .76);
  color: #fff;
  font-size: 13px;
}
.reader-page-view {
  overflow: hidden;
}
.reader-stage-wrap {
  height: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
}
.reader-arrow {
  font: 36px/1 system-ui, sans-serif;
  padding: 0;
}
.reader-stage {
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border-radius: 16px;
  background: rgba(0, 0, 0, .12);
}
.reader-current-page {
  --zoom: 1;
  --fit-width: 820px;
  width: calc(var(--fit-width) * var(--zoom));
  max-width: none;
  margin: 0 auto;
  background: #faf7ee;
  color: #292a24;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
}
.reader-current-page img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1.414;
  object-fit: contain;
}
.reader-current-page img.loaded { aspect-ratio: auto; }
.reader-current-page img[hidden],
.reader-current-page .reader-error[hidden] {
  display: none;
}
.reader-error {
  min-height: 220px;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 20px;
  overflow-wrap: anywhere;
}
.reader-error p { margin: 6px 0; }
.reader-toolbar {
  flex: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #0e2a1f;
  border-top: 1px solid #ffffff1f;
}
.reader-page-nav,
.reader-jump,
.reader-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.reader-page-status {
  min-width: 92px;
  text-align: center;
}
.reader-jump input {
  width: 62px;
  min-height: 44px;
  border: 1px solid #ffffff38;
  border-radius: 8px;
  background: #152c22;
  color: #f3eddf;
  font: inherit;
  font-size: 16px;
  text-align: center;
}
.reader-zoom #reader-fit { min-width: 66px; }

@media (max-width: 760px) {
  .archive-bar .filters { justify-content: flex-start; gap: 6px; }
  .archive-bar .filter { padding: 7px 9px; }
  .magazine-reader {
    width: min(100vw - 18px, 720px);
    height: min(92dvh, 860px);
    border-radius: 18px;
  }
  .reader-header {
    padding: 10px 12px;
    gap: 8px;
  }
  .reader-heading h2 { font-size: 18px; }
  .reader-stage-wrap {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }
  .reader-arrow {
    display: none;
  }
  .reader-grid-view {
    padding: 10px;
  }
  .reader-grid {
    gap: 6px;
  }
  .reader-toolbar {
    gap: 8px 12px;
    padding: 8px 10px 10px;
  }
  .reader-page-nav,
  .reader-jump,
  .reader-zoom {
    gap: 6px;
  }
  .reader-jump input { width: 54px; }
}

@media (max-width: 520px) {
  .magazine-reader {
    width: calc(100vw - 12px);
    height: calc(100dvh - 12px);
    border-radius: 14px;
  }
  .reader-header {
    padding: 8px 10px;
  }
  .reader-heading h2 { font-size: 17px; }
  .reader-heading p { font-size: 11px; }
  .reader-control,
  .reader-arrow {
    min-width: 42px;
    min-height: 42px;
  }
  .reader-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .reader-stage {
    padding: 4px;
  }
  .reader-toolbar {
    align-items: stretch;
  }
  .reader-page-nav,
  .reader-jump,
  .reader-zoom {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* Annual archive: one clickable row per year. */
.annual-collection { grid-template-columns: minmax(0, 1fr); gap: 0; }
.annual-collection .issue-link { display: flex; justify-content: space-between; width: 100%; color: var(--green); }
