/* -----------------------------------------------------------------------
   Tokens — plain, editorial, close to Substack's default reading theme
----------------------------------------------------------------------- */
:root {
  --paper: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #444444;
  --muted: #6b6b6b;
  --rule: #e8e8e8;
  --accent: #1a1a1a;   /* Substack's default theme is monochrome + one accent */
  --link: #3b82c4;

  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --wrap: 1000px;
  --wrap-narrow: 640px;
}

* { box-sizing: border-box; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: var(--wrap-narrow); margin: 0 auto; padding: 0 24px; }

/* -----------------------------------------------------------------------
   Avatars
----------------------------------------------------------------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #efefef;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.avatar--brand { width: 28px; height: 28px; background: var(--ink); color: #fff; font-size: 11px; }

/* -----------------------------------------------------------------------
   Top nav
----------------------------------------------------------------------- */
.topnav {
  border-bottom: 1px solid var(--rule);
  padding: 14px 0;
}

.topnav__inner {
  display: flex;
  align-items: center;
  gap: 32px;
}

.topnav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}

.topnav__links {
  display: flex;
  gap: 22px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}
.topnav__links a:hover { color: var(--ink); }

.topnav__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.link-muted { color: var(--ink-soft); font-weight: 500; }
.link-muted:hover { color: var(--ink); }

.btn {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
}
.btn:hover { background: #333; }
.btn--pill { border-radius: 100px; }
.btn--lg { padding: 12px 26px; font-size: 15px; }

/* -----------------------------------------------------------------------
   Hero
----------------------------------------------------------------------- */
.hero { padding: 56px 24px 40px; text-align: center; }

.hero__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 40px;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

.hero__sub {
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0 auto 24px;
  max-width: 46ch;
}

.subscribe-form {
  display: flex;
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
}
.subscribe-form input {
  flex: 1;
  padding: 11px 14px;
  border-radius: 4px;
  border: 1px solid #d6d6d6;
  font-size: 15px;
  font-family: var(--font-sans);
}
.subscribe-form input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }

.hero__proof { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

/* -----------------------------------------------------------------------
   Shared post meta row (avatar · name · date · likes · comments)
----------------------------------------------------------------------- */
.post-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}
.post-meta__name { font-weight: 500; color: var(--ink-soft); }
.post-meta__dot { color: #cfcfcf; }
.post-meta__spacer { flex: 1; }
.post-meta__icon { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.post-meta__icon--lg { font-size: 15px; color: var(--ink-soft); }

/* -----------------------------------------------------------------------
   Feature post
----------------------------------------------------------------------- */
.feature { display: block; padding: 8px 0 36px; border-bottom: 1px solid var(--rule); margin-bottom: 32px; }

.feature__thumb {
  width: 100%;
  aspect-ratio: 2 / 1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.feature__thumb span { font-size: 52px; opacity: 0.55; }

.feature__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.25;
  margin: 0 0 8px;
}

.feature__sub {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0;
}

/* -----------------------------------------------------------------------
   Feed list
----------------------------------------------------------------------- */
.feed { padding-bottom: 80px; }

.feed__heading {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 4px;
}

.feed__list { display: flex; flex-direction: column; }

.post-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
  padding: 26px 0;
  border-bottom: 1px solid var(--rule);
}
/* The reward button wraps onto its own line, spanning the full card width. */
.post-row .reward-btn { flex-basis: 100%; }

.post-row__text { flex: 1; min-width: 0; }

.post-row__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.3;
  margin: 0 0 6px;
}
.post-row:hover .post-row__title { text-decoration: underline; }

.post-row__sub {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-row__thumb {
  width: 116px;
  height: 116px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.post-row__thumb span { font-size: 30px; opacity: 0.5; }

/* -----------------------------------------------------------------------
   Single post
----------------------------------------------------------------------- */
.post { padding: 48px 24px 40px; }

.post__section-tag {
  font-size: 13px;
  font-weight: 600;
  color: var(--link);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 14px;
}

.post__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 34px;
  line-height: 1.2;
  margin: 0 0 14px;
}

.post__subtitle {
  font-family: var(--font-serif);
  font-size: 19px;
  color: var(--ink-soft);
  margin: 0 0 22px;
}

.byline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 8px;
}
.byline .avatar { width: 34px; height: 34px; font-size: 13px; }
.byline__text { display: flex; flex-direction: column; line-height: 1.3; }
.byline__name { font-size: 14px; font-weight: 600; }
.byline__date { font-size: 13px; color: var(--muted); }

.post__body { font-family: var(--font-serif); font-size: 19px; color: var(--ink); margin-top: 28px; }
.post__body p { margin: 0 0 22px; }
.post__body h2 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 24px;
  margin: 38px 0 16px;
}

.post__actions {
  display: flex;
  gap: 24px;
  padding: 20px 0;
  margin-top: 12px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.post__nav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 36px;
}
.post__nav-link { max-width: 46%; }
.post__nav-link--next { text-align: right; margin-left: auto; }
.post__nav-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.post__nav-title { display: block; font-family: var(--font-serif); font-weight: 600; font-size: 15px; }
.post__nav-link:hover .post__nav-title { text-decoration: underline; }

/* -----------------------------------------------------------------------
   Subscribe CTA band + footer
----------------------------------------------------------------------- */
.cta-band { border-top: 1px solid var(--rule); padding: 56px 0; }
.cta-band__inner { text-align: center; }
.cta-band__inner h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  margin: 0 0 20px;
}

.site-footer { padding: 32px 0 64px; }
.site-footer__inner { font-size: 13px; color: var(--muted); text-align: center; }
.site-footer__inner p { margin: 0 0 10px; }
.site-footer__copy a { color: var(--muted); text-decoration: underline; }

/* -----------------------------------------------------------------------
   404
----------------------------------------------------------------------- */
.not-found { padding: 100px 24px; text-align: center; }

/* -----------------------------------------------------------------------
   Responsive
----------------------------------------------------------------------- */
@media (max-width: 640px) {
  .topnav__links { display: none; }
  .hero__title { font-size: 30px; }
  .post__title { font-size: 27px; }
  .post-row__thumb { width: 84px; height: 84px; }
  .post__nav { flex-direction: column; }
  .post__nav-link, .post__nav-link--next { max-width: 100%; text-align: left; margin-left: 0; }
}

/* -----------------------------------------------------------------------
   Ad slots
----------------------------------------------------------------------- */
.ad-slot {
  /* Collapsed by default — no empty placeholder box. Revealed only once a
     non-empty creative renders (JS adds .ad-filled in slotRenderEnded). */
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #fafafa;
  border: 1px dashed #d0d0d0;
  border-radius: 6px;
  margin: 20px 0;
  color: #9a9a9a;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.ad-slot.ad-filled { display: flex; }
/* Never let an injected ad iframe exceed the column width and cause h-scroll. */
.ad-slot > div,
.ad-slot iframe {
  max-width: 100%;
}
.ad-slot__tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ad-slot__meta { font-size: 11px; }

/* -----------------------------------------------------------------------
   Premium-content button — full-width CTA at the bottom of each article
   card. Opening the article shows a rewarded ad to unlock the content.
----------------------------------------------------------------------- */
.reward-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 18px;
  padding: 11px 18px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}
.feature:hover .reward-btn,
.post-row:hover .reward-btn {
  background: #333;
}
.reward-ic {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

/* -----------------------------------------------------------------------
   Related articles
----------------------------------------------------------------------- */
.related { padding: 12px 24px 8px; }

.related__heading {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 18px;
}

.related__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.related__thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.related__thumb span { font-size: 24px; opacity: 0.5; }

.related__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 15.5px;
  line-height: 1.3;
  margin: 0 0 6px;
}
.related__card:hover .related__title { text-decoration: underline; }

.related__meta { font-size: 12.5px; color: var(--muted); margin: 0; }

/* -----------------------------------------------------------------------
   Comments
----------------------------------------------------------------------- */
.comments { padding: 12px 24px 72px; }

.comments__heading {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 20px;
  margin: 0 0 20px;
}

.comment-form {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 32px;
}
.comment-form .avatar { width: 30px; height: 30px; font-size: 11px; margin-top: 4px; }
.comment-form textarea {
  flex: 1;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #d6d6d6;
  font-family: var(--font-sans);
  font-size: 14.5px;
  resize: vertical;
}
.comment-form .btn { align-self: flex-end; }

.comment-list { display: flex; flex-direction: column; gap: 22px; }

.comment { display: flex; gap: 12px; }
.comment .avatar { width: 30px; height: 30px; font-size: 11px; margin-top: 2px; }
.comment__body { flex: 1; }

.comment__meta { display: flex; align-items: center; gap: 7px; font-size: 13px; margin-bottom: 4px; }
.comment__name { font-weight: 600; }
.comment__date { color: var(--muted); }

.comment__text { font-size: 14.5px; color: var(--ink-soft); margin: 0 0 6px; }

.comment__reply {
  background: none;
  border: none;
  padding: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-sans);
}
.comment__reply:hover { color: var(--ink); }

/* -----------------------------------------------------------------------
   Responsive additions
----------------------------------------------------------------------- */
@media (max-width: 640px) {
  .related__grid { grid-template-columns: 1fr; }
}

/* -----------------------------------------------------------------------
   Logo image (config-driven)
----------------------------------------------------------------------- */
.topnav__logo { width: 28px; height: 28px; border-radius: 6px; display: block; }

/* -----------------------------------------------------------------------
   Cover images (wired-in webp; gradient remains as load fallback)
----------------------------------------------------------------------- */
.feature__thumb, .post-row__thumb, .related__thumb, .post__cover { overflow: hidden; position: relative; }
.feature__thumb img,
.post-row__thumb img,
.related__thumb img,
.post__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.post__cover {
  width: 100%;
  aspect-ratio: 2 / 1;
  border-radius: 6px;
  margin: 24px 0 8px;
}
