/*---------------------------------
  E-paper page: latest issue hero + archive grid of covers
-----------------------------------*/
.imv-epaper { padding-top: var(--space-2); padding-bottom: var(--space-5); }

/* ---- Cover (featured image, rendered PDF page 1, or styled fallback) ---- */
.imv-cover {
  position: relative;
  aspect-ratio: 1 / 1.414;   /* A-series newspaper page */
  container-type: inline-size;
  overflow: hidden;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 32, 28, .08), 0 8px 24px rgba(20, 32, 28, .12);
}
.imv-cover img,
.imv-cover canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.imv-cover canvas { opacity: 0; transition: opacity .4s ease; }
.imv-cover.is-drawn canvas { opacity: 1; }
.imv-cover.is-drawn .imv-cover-fallback { visibility: hidden; }

.imv-cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 10% 9%;
  background: linear-gradient(180deg, #fff 0%, #F4F7F5 100%);
}
.imv-cover-mast {
  padding-bottom: 6%;
  border-bottom: 3px solid var(--green-600);
  font-family: var(--secondaryFont);
  font-size: 12cqw;   /* scales with the cover, stays on one line */
  font-weight: 800;
  letter-spacing: -.02em;
  white-space: nowrap;
  color: var(--green-600);
}
.imv-cover-mast b { font-weight: 800; color: var(--ink); }
.imv-cover-no {
  margin-top: 7%;
  font-family: var(--secondaryFont);
  font-size: 7cqw;
  font-weight: 700;
  color: var(--ink);
}
.imv-cover-lines { display: grid; gap: 7px; margin-top: 8%; }
.imv-cover-lines i { display: block; height: 6px; border-radius: 3px; background: #DDE4E1; }
.imv-cover-lines i:nth-child(1) { height: 30cqw; background: #E6ECE9; }
.imv-cover-lines i:nth-child(3) { width: 85%; }
.imv-cover-lines i:nth-child(5) { width: 70%; }
.imv-cover-date { margin-top: auto; font-size: 5.5cqw; color: var(--muted); }
/* the archive card shows its date below the cover already */
.imv-ep-card .imv-cover-date { display: none; }

/* ---- Hero: latest issue ---- */
.imv-ep-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 340px) 1fr;
  gap: var(--space-8);
  align-items: center;
  margin-bottom: var(--space-6);
  padding: var(--space-6) var(--space-8);
  overflow: hidden;
  border-radius: 16px;
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, .12), transparent 45%),
    linear-gradient(135deg, var(--green-800) 0%, var(--green-600) 100%);
  color: #fff;
}
.imv-ep-hero:after {   /* soft dotted texture, top right */
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .16) 1.5px, transparent 2px) 0 0 / 18px 18px;
  pointer-events: none;
}
.imv-ep-hero-cover { position: relative; z-index: 1; width: 100%; }   /* auto margins in a grid would shrink it to 0 (the cover sizes from its width) */
.imv-ep-hero-cover .imv-cover {
  transform: rotate(-2deg);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .35), 0 6px 14px rgba(0, 0, 0, .2);
  transition: transform .35s ease;
}
.imv-ep-hero-cover:hover .imv-cover { transform: rotate(0) translateY(-4px); }
.imv-ep-hero-info { position: relative; z-index: 1; max-width: 520px; }
.imv-ep-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 var(--space-3);
  font-family: var(--secondaryFont);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .85);
}
.imv-ep-kicker:before { content: ""; width: 28px; height: 4px; border-radius: 2px; background: #fff; }
.imv-ep-title {
  margin: 0 0 var(--space-3);
  font-family: var(--secondaryFont);
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: #fff;
}
.imv-ep-date { margin: 0 0 var(--space-4); font-size: 15px; color: rgba(255, 255, 255, .85); }
.imv-ep-date i { position: relative; top: 2px; margin-right: 4px; }
.imv-ep-lead { margin: 0 0 var(--space-6); font-size: 17px; line-height: 1.6; color: rgba(255, 255, 255, .92); }
.imv-ep-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.imv-ep-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 26px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: var(--green-800);
  font-family: var(--secondaryFont);
  font-size: 15px;
  font-weight: 700;
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
}
.imv-ep-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(0, 0, 0, .24); color: var(--green-800); }
.imv-ep-btn-ghost {
  background: transparent;
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6);
}
.imv-ep-btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 0 0 0 2px #fff; }

/* ---- Archive grid ---- */
.imv-ep-archive .imv-header-nav { margin-bottom: var(--space-4); }
/* issue count next to the section title */
.imv-ep-archive .imv-count {
  display: inline-grid; place-items: center; min-width: 26px; height: 22px; margin-left: 8px; padding: 0 8px;
  border-radius: 999px; background: var(--green-600); color: #fff; font-size: 12px; vertical-align: 2px;
}
.imv-ep-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-5) var(--space-4);
}
.imv-epaper article.imv-ep-card { margin: 0; min-width: 0; }
.imv-ep-card-open {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.imv-ep-card .imv-cover { border-radius: 6px; box-shadow: 0 1px 2px rgba(20, 32, 28, .08), 0 6px 16px rgba(20, 32, 28, .10); }
.imv-ep-card-open .imv-cover { transition: transform .25s ease, box-shadow .25s ease; }
.imv-ep-card-open:hover .imv-cover,
.imv-ep-card-open:focus-visible .imv-cover {
  transform: translateY(-5px);
  box-shadow: 0 2px 4px rgba(20, 32, 28, .08), 0 16px 32px rgba(20, 32, 28, .2);
}
/* dark veil + "Soma" on hover */
.imv-ep-card-open:after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(8, 36, 27, 0) 45%, rgba(8, 36, 27, .65) 100%);
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
.imv-ep-card-open:hover:after,
.imv-ep-card-open:focus-visible:after { opacity: 1; transform: translateY(-5px); }
.imv-ep-card-hover {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #fff;
  color: var(--green-800);
  font-family: var(--secondaryFont);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity .2s ease, transform .25s ease;
  pointer-events: none;
}
.imv-ep-card-open:hover .imv-ep-card-hover,
.imv-ep-card-open:focus-visible .imv-ep-card-hover { opacity: 1; transform: translate(-50%, -5px); }
.imv-ep-card-open:disabled { cursor: default; opacity: .6; }
.imv-ep-card-title {
  margin: var(--space-3) 0 0;
  font-family: var(--secondaryFont);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}
.imv-ep-card-date { margin: 2px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.imv-ep-empty { color: var(--muted); }

.imv-ep-pages { margin-top: var(--space-6); }
.imv-ep-pages ul.page-numbers { display: flex; justify-content: center; gap: 6px; padding: 0; margin: 0; list-style: none; }
.imv-ep-pages ul.page-numbers li { margin: 0; }
.imv-ep-pages .page-numbers a,
.imv-ep-pages .page-numbers span { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }

/* ---- Flipbook reader: the page stays visible behind it, blurred ---- */
.flipbook-overlay {
  background: rgba(10, 14, 12, .55) !important;
  -webkit-backdrop-filter: blur(14px) saturate(120%);
          backdrop-filter: blur(14px) saturate(120%);
}
.flipbook-main-wrapper { background: transparent !important; }

/* ---- Responsive ---- */
@media (max-width: 1199px) {
  .imv-ep-grid { grid-template-columns: repeat(4, 1fr); }
  .imv-ep-hero { gap: var(--space-6); padding: var(--space-6); }
}
@media (max-width: 991px) {
  .imv-ep-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767px) {
  .imv-ep-hero { grid-template-columns: 1fr; text-align: center; padding: var(--space-6) var(--space-5); }
  .imv-ep-hero-cover { max-width: 240px; margin: 0 auto; }
  .imv-ep-kicker { justify-content: center; }
  .imv-ep-actions { justify-content: center; }
  .imv-ep-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-5) var(--space-4); }
}

/* ---- Dark mode ---- */
.theme-dark .imv-ep-card-title { color: #fff; }
.theme-dark .imv-cover-fallback { background: #1E2926; }
.theme-dark .imv-cover-mast b, .theme-dark .imv-cover-no { color: #fff; }

/* the footer sits closer to the archive on this page */
body:has(.imv-epaper) .imv-footer { margin-top: var(--space-5); }
