/* Newsletter archive (/newsletter) + single issue (/newsletter/{slug}) */

.text-accent { color: var(--color-primary); }

/* ============================================================
   Archive grid
   ============================================================ */
.newsletter-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1rem 5rem;
}

/* Header — matches /leaderboard (.lb-title / .lb-subtitle) */
.newsletter-header {
  margin-bottom: 24px;
}

.newsletter-title {
  margin: 0 0 0.75rem;
  font-size: 2rem;
  font-weight: 700;
  font-style: italic;
  line-height: 1.3;
  color: var(--color-text-primary);
}

.newsletter-subtitle {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
}

/* Native subscribe form — posts to /api/newsletter/subscribe (beehiiv API) */
.newsletter-subscribe {
  margin: 0 0 2.5rem;
  max-width: 520px;
}

.nl-subscribe-form {
  display: flex;
  align-items: stretch;   /* button stretches to the input's height */
  gap: 8px;
  margin: 0;
}

/* Pico.css styles bare input/button elements; reset with !important like the
   nav search input does (base.css) so our theme wins. */
.nl-subscribe-input {
  flex: 1 1 auto;
  width: auto !important;
  height: 44px;
  margin: 0 !important;
  padding: 0 14px 0 42px !important;   /* left room for the mail icon */
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  /* No background shading; mail icon as an SVG background. */
  background-color: transparent !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m3 7 9 6 9-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: 14px center !important;
  border-radius: 8px !important;
  color: var(--color-text-primary) !important;
  font-size: 0.95rem;
  line-height: 44px !important;
  box-shadow: none !important;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease;
}

.nl-subscribe-input::placeholder { color: var(--color-text-primary); opacity: 1; }

/* No blue focus highlight — keep the box neutral on focus. */
.nl-subscribe-input:focus {
  border-color: rgba(255, 255, 255, 0.08) !important;
  background-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

/* White-outline button (matches the leaderboard hero CTA).
   Centers text the same way the input does — line-height == height — since
   line-height:1 + flex renders high with this font. */
/* Styled like the /about "Get in touch" button (.cta-btn.cta-btn-secondary),
   but keeping the current 0.08 outline color and auto-matching the input height. */
.nl-subscribe-btn {
  flex: 0 0 auto;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  width: auto !important;
  /* No fixed height — stretches to the input's height via the form's align-items. */
  margin: 0 !important;
  padding: 0 2rem !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;   /* keep current outline color */
  border-radius: 8px !important;   /* match the email input's corners */
  background: rgba(255, 255, 255, 0.02) !important;   /* match the grid card shading */
  color: var(--color-text-primary) !important;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1 !important;
  text-decoration: none;
  box-shadow: none !important;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: all 0.3s ease;
}

/* Flex-centered already; small nudge down so it reads dead-center with this font. */
.nl-subscribe-label {
  position: relative;
  top: 2px;
}

.nl-subscribe-btn:hover {
  background: rgba(255, 255, 255, 0.035) !important;   /* match the card hover shading */
  transform: translateY(-2px);
}

.nl-subscribe-btn:disabled { opacity: 0.6; cursor: default; }

.nl-subscribe-msg {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  min-height: 1.1em;
}

.nl-subscribe-msg.is-success { color: #3ddc84; }
.nl-subscribe-msg.is-error { color: #ff6b6b; }

@media (max-width: 480px) {
  .nl-subscribe-form { flex-direction: column; }
  .nl-subscribe-btn { width: 100%; }
}

.newsletter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.newsletter-card {
  display: flex;
  flex-direction: column;
  /* Match /leaderboard panel shading */
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.newsletter-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
}

.newsletter-card-thumb {
  aspect-ratio: 16 / 9;
  background: var(--color-bg-base-mid);
  overflow: hidden;
}

.newsletter-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.newsletter-card-thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-bg-base-mid), var(--color-bg-base-darker));
  color: var(--color-text-muted);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: var(--font-size-sm);
}

.newsletter-card-body {
  padding: 0.9rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.newsletter-card-date {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-semibold);
}

.newsletter-card-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin: 0;
  line-height: 1.3;
}

.newsletter-card-excerpt {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.newsletter-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: 4rem 1rem;
  font-size: var(--font-size-md);
}

/* ============================================================
   Single issue
   ============================================================ */
.newsletter-issue {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem 5rem;
}

.newsletter-back {
  display: inline-block;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--font-size-base);
  margin-bottom: 1.5rem;
  transition: color 0.15s ease;
}

.newsletter-back:hover { color: var(--color-primary); }

.newsletter-issue-header { margin-bottom: 1.5rem; }

.newsletter-issue-date {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 0.6rem;
}

.newsletter-issue-title {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-extrabold);
  line-height: 1.1;
  color: var(--color-text-primary);
  margin: 0 0 0.75rem;
}

.newsletter-issue-subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  margin: 0;
}

.newsletter-issue-hero {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 1.75rem 0;
}

.newsletter-issue-hero img {
  width: 100%;
  display: block;
}

/* beehiiv post body — normalize into our typography */
.newsletter-article {
  color: var(--color-text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
}

.newsletter-article h1,
.newsletter-article h2,
.newsletter-article h3,
.newsletter-article h4 {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-bold);
  line-height: 1.25;
  margin: 2rem 0 0.75rem;
}

/* Subordinate to the page title; beehiiv often uses h1 for section heads. */
.newsletter-article h1 { font-size: 1.5rem; }
.newsletter-article h2 { font-size: 1.3rem; }
.newsletter-article h3 { font-size: 1.15rem; }
.newsletter-article h4 { font-size: 1.05rem; }

.newsletter-article p { margin: 0 0 1.15rem; }

/* beehiiv highlight — theme it (browser default is bright yellow). */
.newsletter-article mark {
  background: rgba(0, 168, 255, 0.18);
  color: inherit;
  padding: 0 3px;
  border-radius: 3px;
}

.newsletter-article a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.newsletter-article img,
.newsletter-article video,
.newsletter-article iframe {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1.25rem 0;
}

.newsletter-article ul,
.newsletter-article ol { margin: 0 0 1.15rem 1.25rem; }

.newsletter-article li { margin-bottom: 0.4rem; }

.newsletter-article blockquote {
  border-left: 3px solid var(--color-primary);
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.1rem;
  color: var(--color-text-primary);
  font-style: italic;
}

.newsletter-article hr {
  border: none;
  border-top: 1px solid var(--color-border-secondary);
  margin: 2rem 0;
}

/* Rebuilt beehiiv link-preview card (.generic-embed--root -> nl-link-card) */
.newsletter-article .nl-link-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 1.5rem 0;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none !important;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.newsletter-article .nl-link-card:hover {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.12);
}

.nl-link-card-text {
  flex: 1 1 auto;
  min-width: 0;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
}

.nl-link-card-title {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-bold);
  font-size: 1rem;
  line-height: 1.3;
}

.nl-link-card-desc {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nl-link-card-source {
  color: var(--color-text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--font-weight-semibold);
  margin-top: 2px;
}

.nl-link-card-thumb {
  flex: 0 0 150px;
  align-self: stretch;
}

.newsletter-article .nl-link-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
  border-radius: 0;
}

@media (max-width: 560px) {
  .newsletter-article .nl-link-card { flex-direction: column-reverse; }
  .nl-link-card-thumb { flex-basis: 180px; width: 100%; }
}

.newsletter-issue-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border-secondary);
}

@media (max-width: 860px) {
  .newsletter-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .newsletter-issue-title { font-size: var(--font-size-2xl); }
  .newsletter-grid { grid-template-columns: 1fr; }
}
