/* Newsletter issue pages (noticeboard/newsletters/). Desktop shows the
   issue's PDF in an embedded viewer (like the constitution page); phones and
   tablets, where embedded PDFs work poorly, get the issue as HTML. Builds on
   staff-update.css (the body keeps .page-staff-update) and its theme-aware
   --update-* tokens. */

.page-newsletter {
  --nl-green: #2f9a55;
  --nl-green-wash: #e6f1e1;
  --nl-festive: #c62828;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .page-newsletter {
    --nl-green: #7fd39a;
    --nl-green-wash: #23382b;
    --nl-festive: #ff8a80;
  }
}

:root[data-theme="dark"] .page-newsletter {
  --nl-green: #7fd39a;
  --nl-green-wash: #23382b;
  --nl-festive: #ff8a80;
}

/* Desktop (matches the noticeboard's two-column breakpoint): PDF viewer.
   Below it: the HTML version. */
.nl-desktop-only {
  display: none;
}

@media (min-width: 1101px) {
  .nl-desktop-only {
    display: block;
  }

  .nl-mobile-only {
    display: none;
  }
}

.nl-hero-issue {
  margin: 10px 0 0;
  color: #fff;
  font-size: clamp(15px, 0.4vw + 13px, 19px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Desktop: PDF viewer ---------- */

.nl-viewer-shell {
  width: min(1000px, 100%);
  margin: 0 auto;
}

.nl-intro {
  max-width: 820px;
  margin: 0 auto 28px;
  color: var(--update-copy);
  font-size: clamp(16px, 0.3vw + 14px, 19px);
  line-height: 1.7;
  text-align: center;
}

.nl-viewer-frame {
  overflow: hidden;
  border-radius: 20px;
  background: var(--update-card);
  box-shadow: 0 24px 48px var(--update-shadow-strong);
}

/* The issue is A4 portrait: tall enough to read a page at a time. */
.nl-viewer {
  display: block;
  width: 100%;
  height: min(130vw, 1100px);
  min-height: 560px;
  border: 0;
  background: var(--update-card);
}

.nl-download-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  padding-top: 22px;
}

.nl-file-link,
.nl-back-link {
  color: var(--update-heading);
  font-size: clamp(15px, 0.3vw + 13px, 18px);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nl-back-link {
  margin-left: auto;
  color: var(--update-accent);
}

.nl-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 22px;
  border-radius: 13px;
  background: #ff5a3c;
  color: #fff;
  font-size: clamp(16px, 0.3vw + 14px, 19px);
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(97, 47, 25, 0.22);
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.nl-download-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ---------- Phones and tablets: HTML issue ---------- */

.nl-card img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* "Download PDF version": the first thing on the HTML issue */
.nl-pdf-cta {
  position: relative;
  overflow: hidden;
  margin: 0 0 26px;
  padding: 26px 24px 24px;
  border-radius: 20px;
  background: linear-gradient(135deg, #3b1d6e 0%, #6b3fa0 60%, #8a5cc4 100%);
  color: #fff;
  text-align: center;
  box-shadow: 0 18px 36px rgba(59, 29, 110, 0.35);
}

/* Soft gold glow in the corner, echoing the noticeboard covers */
.nl-pdf-cta::before {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: #ffd166;
  content: "";
  opacity: 0.22;
}

.nl-pdf-cta-kicker {
  position: relative;
  margin: 0 0 4px;
  color: #ffd166;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nl-pdf-cta-title {
  position: relative;
  margin: 0 0 18px;
  color: #fff;
  font-size: clamp(20px, 2vw + 14px, 26px);
  font-weight: 800;
  line-height: 1.25;
}

.nl-pdf-cta-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(100%, 360px);
  min-height: 56px;
  padding: 14px 22px;
  overflow: hidden;
  border-radius: 16px;
  background: #ff5a3c;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 0 0 0 rgba(255, 90, 60, 0.55);
  animation: nl-cta-pulse 2.4s ease-out infinite;
  transition: transform 160ms ease;
}

/* Light sweeping across the button */
.nl-pdf-cta-btn::after {
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  content: "";
  transform: skewX(-18deg);
  animation: nl-cta-shine 3.2s ease-in-out infinite;
}

.nl-pdf-cta-btn:active {
  transform: scale(0.97);
}

.nl-pdf-cta-btn:focus-visible {
  outline: 3px solid #ffd166;
  outline-offset: 3px;
}

.nl-pdf-cta-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7 10l5 5 5-5M5 20h14'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7 10l5 5 5-5M5 20h14'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: nl-cta-bob 1.6s ease-in-out infinite;
}

.nl-pdf-cta-size {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 12px;
  font-weight: 700;
}

@keyframes nl-cta-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 90, 60, 0.55);
  }

  70% {
    box-shadow: 0 0 0 16px rgba(255, 90, 60, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 90, 60, 0);
  }
}

@keyframes nl-cta-shine {
  0%,
  55% {
    left: -60%;
  }

  100% {
    left: 130%;
  }
}

@keyframes nl-cta-bob {
  0%,
  100% {
    transform: translateY(-2px);
  }

  50% {
    transform: translateY(3px);
  }
}

/* In this issue */
.nl-contents {
  margin: 0 0 26px;
}

.nl-contents h2 {
  margin: 0 0 10px;
  color: var(--update-meta);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nl-contents ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nl-contents a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--update-accent-wash);
  color: var(--update-accent);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.nl-contents a:hover,
.nl-contents a:focus-visible {
  background: var(--update-inset-hover);
}

.nl-card [id] {
  scroll-margin-top: 24px;
}

.page-newsletter .staff-update-highlight {
  border-left-color: var(--nl-green);
}

.nl-lead-title {
  margin: 0 0 14px;
  font-size: clamp(30px, 1.6vw + 22px, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.page-newsletter .staff-update-highlight p {
  margin: 0 0 14px;
  line-height: 1.7;
}

.page-newsletter .staff-update-highlight p:last-child {
  margin-bottom: 0;
}

/* Text beside a picture */
.nl-split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-top: 30px;
}

.nl-split > div > h2:first-child {
  margin-top: 0;
}

.nl-split-wide {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}

.nl-figure {
  margin: 0;
}

.nl-figure img,
.nl-photo-row img,
.nl-photo-stack img {
  width: 100%;
  border-radius: 14px;
  box-shadow: 0 12px 24px var(--update-shadow);
  object-fit: cover;
}

.nl-figure figcaption {
  margin-top: 10px;
  color: var(--update-meta);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.nl-guide {
  margin: 8px 0 26px;
}

.nl-photo-row {
  display: grid;
  gap: 14px;
  margin: 22px 0 8px;
}

.nl-photo-row-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nl-photo-row-3 {
  grid-template-columns: 1fr 2fr 1fr;
}

.nl-photo-row img {
  height: 240px;
}

.nl-photo-stack {
  display: grid;
  gap: 14px;
}

.nl-photo-stack img {
  max-height: 300px;
}

/* Christmas opening / Can you help? */
.nl-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 30px 0 8px;
}

.nl-tile {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border-radius: 16px;
  background: var(--nl-green-wash);
}

.nl-tile h2 {
  margin-top: 0;
}

.nl-tile p {
  position: relative;
}

.nl-tile-festive {
  padding-right: 150px;
}

.nl-tile-art {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 124px;
  border-radius: 12px;
}

.page-newsletter .nl-greeting {
  color: var(--nl-festive);
  font-weight: 700;
}

/* Did you know? */
.nl-facts {
  overflow: hidden;
  border-radius: 16px;
  background: var(--nl-green-wash);
  text-align: center;
}

.nl-facts img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.nl-facts h3 {
  margin: 16px 0 4px;
  color: var(--nl-festive);
  font-size: 20px;
  font-weight: 800;
}

.nl-facts dl {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 8px 16px 20px;
}

.nl-facts dt {
  color: var(--update-heading);
  font-size: clamp(26px, 1vw + 20px, 32px);
  font-weight: 800;
  line-height: 1.1;
}

.nl-facts dd {
  margin: 2px 0 0;
  color: var(--update-copy);
  font-size: 15px;
}

/* Party packs. Out-specifies staff-update.css's generic article list. */
.page-newsletter .staff-update-body ul.nl-packs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 8px 0 14px;
  padding: 0;
  list-style: none;
}

.page-newsletter .staff-update-body .nl-packs li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px;
  border-radius: 16px;
  background: var(--nl-green-wash);
  text-align: center;
}

.nl-packs img {
  width: 100%;
  height: 150px;
  margin-bottom: 8px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
}

.nl-pack-price {
  color: var(--nl-festive);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.nl-pack-name {
  color: var(--update-copy);
  font-size: 15px;
  font-weight: 700;
}

/* Christmas appeal */
.nl-appeal {
  margin: 34px 0 8px;
  padding: 0 0 26px;
  overflow: hidden;
  border-radius: 16px;
  background: var(--update-inset);
}

.nl-appeal-garland {
  width: 100%;
  height: 64px;
  object-fit: cover;
}

.nl-appeal > h2,
.nl-appeal > p,
.nl-appeal-donate {
  padding: 0 26px;
}

.page-newsletter .nl-appeal > h2 {
  color: var(--nl-festive);
  text-align: center;
}

.nl-appeal-donate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
}

.nl-qr {
  margin: 0;
  padding: 12px;
  border: 6px solid #e02020;
  border-radius: 12px;
  background: #fff;
  text-align: center;
}

.nl-qr img {
  width: 140px;
  image-rendering: pixelated;
}

.nl-qr figcaption {
  margin-top: 6px;
  color: #1d1d1d;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 860px) {
  .nl-split,
  .nl-split-wide,
  .nl-tiles,
  .nl-appeal-donate {
    grid-template-columns: 1fr;
  }

  .nl-photo-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-newsletter .staff-update-body ul.nl-packs {
    grid-template-columns: 1fr;
  }

  .nl-photo-row-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nl-photo-row-3 img:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .nl-qr {
    justify-self: center;
  }
}

@media (max-width: 520px) {
  .nl-tile-festive {
    padding-right: 24px;
  }

  .nl-tile-art {
    position: static;
    margin-top: 12px;
  }

  .nl-photo-row img {
    height: 180px;
  }

  .nl-appeal > h2,
  .nl-appeal > p,
  .nl-appeal-donate {
    padding: 0 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nl-download-btn,
  .nl-pdf-cta-btn {
    transition: none;
  }

  .nl-pdf-cta-btn,
  .nl-pdf-cta-btn::after,
  .nl-pdf-cta-icon {
    animation: none;
  }

  .nl-pdf-cta-btn::after {
    display: none;
  }

  .nl-download-btn:hover {
    transform: none;
  }
}
