/* Nightjar blog: article list, articles, call-to-action and sign-up.
   Loads after styles.css and reuses its colours (--ink, --paper, --gold …). */

@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-opsz.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-opsz-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

.blog-page {
  --read: min(720px, 100%);
  --body-text: #c3c5ce;
}

/* ── List pages ─────────────────────────────────────────── */

.blog-main,
.article-main {
  width: var(--page);
  margin: 0 auto;
}

.blog-hero {
  padding: clamp(72px, 10vw, 130px) 0 clamp(44px, 6vw, 70px);
  border-bottom: 1px solid var(--line);
}

.blog-hero h1 {
  max-width: 900px;
  margin-bottom: 26px;
  font-size: clamp(3rem, 6.4vw, 6rem);
  line-height: 0.95;
}

.blog-eyebrow,
.crumbs {
  margin: 0 0 22px;
  color: var(--subdued);
  font-size: 0.74rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.blog-eyebrow a,
.crumbs a {
  color: var(--gold);
  text-decoration: none;
}

.blog-eyebrow a:hover,
.crumbs a:hover {
  color: var(--gold-bright);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.blog-intro {
  max-width: 640px;
  margin: 0;
  color: #a8a9b3;
  font-size: clamp(1.02rem, 1.5vw, 1.2rem);
  line-height: 1.7;
}

.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.topic-list a {
  padding: 8px 15px;
  color: var(--paper-soft);
  border: 1px solid var(--line-cool);
  border-radius: 999px;
  font-size: 0.8rem;
  text-decoration: none;
  transition: border-color 180ms ease, color 180ms ease;
}

.topic-list a:hover {
  color: var(--gold);
  border-color: var(--line);
}

.blog-empty {
  padding: 80px 0;
  color: var(--subdued);
  font-family: var(--serif);
  font-size: 1.3rem;
  font-style: italic;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(34px, 4vw, 56px) clamp(24px, 3vw, 40px);
  padding: clamp(48px, 6vw, 80px) 0;
}

.post-card__link {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.post-card__media {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line-cool);
  border-radius: 14px;
  background: var(--ink-raised);
}

.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms cubic-bezier(.2, .7, .2, 1), opacity 300ms ease;
  opacity: 0.88;
}

.post-card__link:hover .post-card__media img {
  transform: scale(1.03);
  opacity: 1;
}

.post-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--gold);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.post-card__meta span + span::before {
  margin-right: 14px;
  color: var(--subdued);
  content: "·";
}

.post-card__meta .badge + span::before {
  content: none;
}

.badge {
  padding: 3px 8px;
  color: var(--ink);
  background: var(--gold);
  border-radius: 4px;
  letter-spacing: 0.08em;
}

.post-card__title {
  margin: 0;
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2vw, 1.62rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
  transition: color 180ms ease;
}

.post-card__link:hover .post-card__title {
  color: var(--gold-bright);
}

.post-card__dek {
  color: #9fa1ab;
  font-size: 0.95rem;
  line-height: 1.6;
}

.post-card__date {
  color: #6f717c;
  font-size: 0.8rem;
}

.post-card--featured {
  grid-column: 1 / -1;
}

.post-card--featured .post-card__link {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(28px, 5vw, 70px);
}

.post-card--featured .post-card__title {
  font-size: clamp(2rem, 3.6vw, 3.1rem);
  line-height: 1.05;
}

.post-card--featured .post-card__dek {
  font-size: 1.05rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 0 0 60px;
  color: var(--subdued);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pagination a {
  color: var(--gold);
  text-decoration: none;
}

.blog-signup {
  padding: clamp(60px, 8vw, 100px) 0;
  border-top: 1px solid var(--line-cool);
}

/* ── Article ────────────────────────────────────────────── */

.preview-banner {
  margin: 24px 0 0;
  padding: 12px 18px;
  color: var(--ink);
  background: var(--gold);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.article-hero {
  max-width: 900px;
  padding: clamp(64px, 9vw, 120px) 0 clamp(36px, 5vw, 56px);
}

.article-hero h1 {
  margin-bottom: 26px;
  font-size: clamp(2.6rem, 5.6vw, 4.9rem);
  line-height: 1;
}

.article-dek {
  max-width: 720px;
  margin-bottom: 30px;
  color: #a8a9b3;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.9vw, 1.42rem);
  font-style: italic;
  line-height: 1.5;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  color: var(--subdued);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.article-meta > * + *::before {
  margin-right: 18px;
  color: #5c5e68;
  content: "·";
}

.article-cover {
  margin: 0 0 clamp(48px, 6vw, 80px);
  overflow: hidden;
  aspect-ratio: 16 / 8;
  border: 1px solid var(--line-cool);
  border-radius: 18px;
  background: var(--ink-raised);
}

.article-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--read));
  justify-content: center;
  padding-bottom: clamp(70px, 9vw, 120px);
}

.article-layout.has-toc {
  grid-template-columns: minmax(170px, 240px) minmax(0, var(--read));
  justify-content: space-between;
  gap: clamp(40px, 6vw, 90px);
}

.article-toc {
  align-self: start;
  position: sticky;
  top: 40px;
  font-size: 0.86rem;
}

.article-toc p {
  margin: 0 0 16px;
  color: var(--gold);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.article-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line-cool);
}

.article-toc li {
  margin: 0;
}

.article-toc a {
  display: block;
  padding: 7px 0 7px 16px;
  margin-left: -1px;
  color: #8e909b;
  border-left: 1px solid transparent;
  line-height: 1.4;
  text-decoration: none;
  transition: color 180ms ease, border-color 180ms ease;
}

.article-toc a:hover,
.article-toc a.is-active {
  color: var(--paper);
  border-color: var(--gold);
}

/* Body copy */

.article-body {
  color: var(--body-text);
  font-size: 1.1rem;
  line-height: 1.78;
}

.article-body > :first-child {
  margin-top: 0;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body dl {
  margin: 0 0 1.35em;
}

.article-body h2 {
  margin: 2.2em 0 0.65em;
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  line-height: 1.12;
  scroll-margin-top: 30px;
}

.article-body h3 {
  margin: 1.8em 0 0.55em;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  scroll-margin-top: 30px;
}

.article-body h4 {
  margin: 1.6em 0 0.5em;
  color: var(--paper-soft);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.article-body a {
  color: var(--gold);
  text-decoration-color: rgba(221, 195, 156, 0.45);
}

.article-body a:hover {
  color: var(--gold-bright);
  text-decoration-color: currentColor;
}

.article-body strong {
  color: var(--paper);
  font-weight: 600;
}

.article-body ul,
.article-body ol {
  padding-left: 1.3em;
}

.article-body li {
  margin-bottom: 0.55em;
  padding-left: 0.3em;
}

.article-body li::marker {
  color: var(--gold);
}

.article-body blockquote,
.article-body .pull-quote {
  margin: 2em 0;
  padding: 0 0 0 26px;
  color: var(--paper);
  border-left: 2px solid var(--gold);
  font-family: var(--serif);
  font-size: 1.32rem;
  font-style: italic;
  line-height: 1.5;
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

.article-body hr {
  width: 46px;
  margin: 3em 0;
  border: 0;
  border-top: 1px solid var(--gold);
}

.article-body code {
  padding: 0.12em 0.4em;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  font-size: 0.88em;
}

.article-body pre {
  overflow-x: auto;
  padding: 18px 20px;
  background: var(--ink-raised);
  border: 1px solid var(--line-cool);
  border-radius: 10px;
}

.article-body pre code {
  padding: 0;
  background: none;
}

.article-body img {
  height: auto;
  margin: 2em auto;
  border-radius: 14px;
}

.article-body figure {
  margin: 2.2em 0;
}

.article-body figure img {
  margin: 0 auto;
}

.article-body figcaption {
  margin-top: 12px;
  color: var(--subdued);
  font-size: 0.85rem;
  text-align: center;
}

.article-body .table-wrap {
  overflow-x: auto;
  margin: 2em 0;
  border: 1px solid var(--line-cool);
  border-radius: 12px;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.article-body th,
.article-body td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-cool);
  text-align: left;
  vertical-align: top;
}

.article-body th {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-body tr:last-child td {
  border-bottom: 0;
}

.article-body details {
  margin: 0 0 12px;
  border-bottom: 1px solid var(--line-cool);
}

.article-body summary {
  padding: 14px 0;
  color: var(--paper);
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.2rem;
}

.article-body .embed {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 2em 0;
  overflow: hidden;
  border-radius: 14px;
}

.article-body .embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.article-body .callout,
.article-body .key-takeaways {
  margin: 2em 0;
  padding: 24px 26px;
  color: var(--paper-soft);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 1rem;
}

.article-body .callout--science {
  border-color: rgba(124, 131, 156, 0.4);
  background: rgba(38, 61, 102, 0.12);
}

.article-body .callout > :last-child,
.article-body .key-takeaways > :last-child {
  margin-bottom: 0;
}

.article-body .key-takeaways::before {
  display: block;
  margin-bottom: 12px;
  color: var(--gold);
  content: "Key takeaways";
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.article-body .small-print {
  color: var(--subdued);
  font-size: 0.88rem;
}

.article-disclaimer {
  margin-top: 2.4em !important;
  color: #6f717c;
  font-size: 0.85rem;
  line-height: 1.6;
}

.author-box {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin: 3em 0 0;
  padding: 26px 0 0;
  border-top: 1px solid var(--line-cool);
  font-size: 0.95rem;
}

.author-box img {
  flex: none;
  width: 64px;
  height: 64px;
  margin: 0;
  border-radius: 50%;
  object-fit: cover;
}

.author-box p {
  margin: 0;
  color: #9fa1ab;
}

.author-box__name {
  margin-bottom: 4px !important;
  color: var(--paper) !important;
  font-family: var(--serif);
  font-size: 1.15rem;
}

.author-box__name span {
  margin-left: 8px;
  color: var(--subdued);
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ── App Store box ([[cta]] and end of article) ─────────── */

.app-cta {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px 26px;
  margin: 2.6em 0;
  padding: 28px 30px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 12% 30%, rgba(239, 212, 158, 0.12), transparent 14rem),
    var(--ink-raised);
}

.app-cta__icon {
  width: 72px;
  height: 72px;
  margin: 0 !important;
  border-radius: 17px !important;
  box-shadow: 0 0 40px rgba(239, 212, 158, 0.18);
}

.app-cta__copy p {
  margin: 0;
  color: #a8a9b3;
  font-size: 0.97rem;
  line-height: 1.6;
}

.app-cta__copy .app-cta__title {
  margin-bottom: 6px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.2;
}

.app-cta__button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px 10px 16px;
  color: var(--ink) !important;
  background: var(--gold);
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 180ms ease, background 180ms ease;
}

.app-cta__button:hover {
  background: var(--gold-bright);
  transform: translateY(-2px);
}

.app-cta__button svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.app-cta__button span {
  display: flex;
  flex-direction: column;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.1;
}

.app-cta__button small {
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ── Email sign-up ──────────────────────────────────────── */

.newsletter {
  max-width: 560px;
  margin: 2.6em auto;
  text-align: center;
}

.blog-signup .newsletter {
  margin: 0 auto;
}

.newsletter__label {
  display: block;
  margin-bottom: 18px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.35;
}

.newsletter__row {
  display: flex;
  gap: 10px;
}

.newsletter input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-cool);
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
}

.newsletter input[type="email"]:focus {
  outline: none;
  border-color: var(--gold);
}

.newsletter button {
  padding: 14px 24px;
  color: var(--ink);
  background: var(--gold);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: background 180ms ease;
}

.newsletter button:hover {
  background: var(--gold-bright);
}

.newsletter button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.newsletter__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.newsletter__status {
  min-height: 1.4em;
  margin: 14px 0 0 !important;
  color: var(--gold);
  font-size: 0.92rem;
}

.newsletter__status.is-error {
  color: #e59a8c;
}

.newsletter.is-done .newsletter__row {
  display: none;
}

.newsletter__fine {
  margin: 4px 0 0 !important;
  color: #6f717c;
  font-size: 0.82rem;
}

/* ── Related ────────────────────────────────────────────── */

.related {
  padding: clamp(60px, 7vw, 90px) 0 20px;
  border-top: 1px solid var(--line-cool);
}

.related h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.post-grid--related {
  padding-top: 40px;
}

/* ── 404 ────────────────────────────────────────────────── */

.error-main .blog-hero {
  border-bottom: 0;
  padding-bottom: 140px;
}

.error-links {
  display: flex;
  gap: 28px;
  margin-top: 36px;
}

/* ── Small screens ──────────────────────────────────────── */

@media (max-width: 960px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-layout.has-toc {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-toc {
    position: static;
    padding: 0 0 8px;
  }
}

@media (max-width: 860px) {
  .post-card--featured .post-card__link {
    grid-template-columns: 1fr;
  }

  .app-cta {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .app-cta__button {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 600px) {
  .post-grid {
    grid-template-columns: 1fr;
  }

  .article-meta {
    gap: 4px 16px;
  }

  .article-meta > * + *::before {
    content: none;
  }

  .article-body {
    font-size: 1.04rem;
  }

  .article-cover {
    aspect-ratio: 4 / 3;
    border-radius: 12px;
  }

  .app-cta {
    grid-template-columns: 1fr;
    padding: 24px 22px;
  }

  .newsletter__row {
    flex-direction: column;
  }
}

@media print {
  .app-cta,
  .newsletter,
  .related,
  .article-toc {
    display: none;
  }
}
