/* ============================================================
   Srivatsan Lab — Blog preview (cream / light reading theme)
   Self-contained; does not touch production styles.
   ============================================================ */

:root {
  /* Surface */
  --cream-bg:      #FAF6EE;   /* warm off-white page */
  --cream-surface: #FFFFFF;   /* cards */
  --cream-sunk:    #F1EBDD;   /* code blocks / insets */
  /* Ink */
  --ink:       #1C1B18;       /* warm near-black body text */
  --ink-soft:  #57544D;       /* captions, metadata */
  --ink-faint: #8A8578;       /* hairline labels */
  --rule:      #E7E0D2;       /* dividers */
  /* Accent (deepened for AA contrast on cream) */
  --accent:      #2F6BE0;     /* links & primary accent */
  --accent-warm: #E11552;     /* coral, sparing */
  --green:       #2f9e57;

  --radius: 14px;
  --measure: 40rem;           /* reading column width */

  --font-sans:  "DM Sans", system-ui, -apple-system, sans-serif;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono:  "DM Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  margin: 0;
  background: var(--cream-bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
}

a { color: var(--accent); }

img { max-width: 100%; display: block; }

/* ---- Reading progress bar ---- */
.progress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0;
  background: var(--accent);
  z-index: 200;
  transition: width .08s linear;
}

/* ---- Header ---- */
.blog-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--cream-bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.blog-header .inner {
  max-width: 68rem; margin: 0 auto;
  padding: .9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
/* Lab logo (black, top-left) + hamburger menu (top-right).
   Pure-CSS toggle via a hidden checkbox — no per-page JS. */
.brand-logo { display: inline-flex; align-items: center; }
.brand-logo img {
  height: 26px; display: block;
  filter: brightness(0);          /* the site logo SVG is white → render it black */
}
.menu-btn {
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: .3rem; margin: -.3rem;
}
.menu-btn img { height: 22px; display: block; filter: brightness(0); }
.nav-toggle:checked ~ .inner .menu-btn { opacity: .55; }

.blog-nav { display: none; }
.nav-toggle:checked ~ .blog-nav {
  display: flex; flex-direction: column;
  background: var(--cream-bg);
  border-top: 1px solid var(--rule);
}
.blog-nav a {
  width: 100%; max-width: 68rem; margin: 0 auto;
  padding: .85rem 1.5rem;
  font-family: var(--font-sans); font-weight: 600; font-size: 1rem;
  color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.blog-nav a:last-child { border-bottom: none; }
.blog-nav a:hover { color: var(--accent); }

/* ---- Layout ---- */
.wrap { max-width: 68rem; margin: 0 auto; padding: 0 1.5rem; }
.reading { max-width: var(--measure); margin: 0 auto; padding: 0 1.5rem; }

/* ---- Masthead (listing) ---- */
.masthead { padding: 5rem 0 2.5rem; max-width: var(--measure); margin: 0 auto; }
.kicker {
  font-family: var(--font-mono); font-size: .72rem;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 1rem;
}
.masthead h1 {
  font-family: var(--font-sans); font-weight: 700;
  font-size: clamp(2.6rem, 6vw, 3.6rem); line-height: 1.03;
  letter-spacing: -.03em; margin: 0 0 1rem;
}
.masthead .lede {
  font-family: var(--font-serif); font-size: 1.3rem; line-height: 1.55;
  color: var(--ink-soft); margin: 0; max-width: 34rem;
}

/* ---- Post cards (listing) ---- */
.feed { padding: 1rem 0 4rem; }
.post-card {
  display: grid; grid-template-columns: 1fr; gap: 1.4rem;
  max-width: var(--measure); margin: 0 auto;
  padding: 2.4rem 0; border-top: 1px solid var(--rule);
  text-decoration: none; color: inherit;
}
.post-card:hover .card-title { color: var(--accent); }
.card-thumb {
  aspect-ratio: 16 / 9; border-radius: var(--radius);
  overflow: hidden; background: var(--cream-sunk);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s cubic-bezier(.16,.8,.3,1); }
.post-card:hover .card-thumb img { transform: scale(1.03); }
.card-meta-row {
  display: flex; align-items: center; gap: .7rem;
  font-family: var(--font-mono); font-size: .72rem;
  letter-spacing: .05em; color: var(--ink-faint); margin-bottom: .2rem;
}
.card-title {
  font-family: var(--font-sans); font-weight: 700;
  font-size: 1.9rem; line-height: 1.12; letter-spacing: -.02em;
  margin: .3rem 0 .5rem; transition: color .2s ease;
}
.card-summary {
  font-family: var(--font-serif); font-size: 1.18rem; line-height: 1.55;
  color: var(--ink-soft); margin: 0 0 1rem;
}
.card-foot { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* ---- Tag pills ---- */
.tag {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .12em; text-transform: uppercase;
  padding: .28rem .6rem; border-radius: 999px;
  background: rgba(225,21,82,.10); color: var(--accent-warm);
}
.tag.update    { background: rgba(47,107,224,.10); color: var(--accent); }
.tag.explainer { background: rgba(15,118,110,.12); color: #0F766E; }
.tag.paper     { background: rgba(138,90,0,.13);   color: #8A5A00; }
.tag.link      { background: rgba(87,84,77,.10);   color: var(--ink-soft); }

/* ---- Repo badge ---- */
.repo-badge {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--font-mono); font-size: .74rem;
  color: var(--ink-soft); text-decoration: none;
  padding: .35rem .6rem; border: 1px solid var(--rule);
  border-radius: 8px; background: var(--cream-surface);
}
.repo-badge:hover { border-color: var(--ink-faint); color: var(--ink); }
.repo-badge svg { width: 15px; height: 15px; }

/* ---- Post page ---- */
.post-head { padding: 4rem 0 2rem; max-width: var(--measure); margin: 0 auto; }
.back-link {
  font-family: var(--font-sans); font-size: .9rem; font-weight: 500;
  color: var(--ink-soft); text-decoration: none;
  display: inline-flex; align-items: center; gap: .4rem; margin-bottom: 2rem;
}
.back-link:hover { color: var(--ink); }
.post-head h1 {
  font-family: var(--font-sans); font-weight: 700;
  font-size: clamp(2.3rem, 5.2vw, 3.2rem); line-height: 1.06;
  letter-spacing: -.03em; margin: 1rem 0 1.2rem;
}
.byline {
  display: flex; align-items: center; gap: .7rem;
  font-family: var(--font-mono); font-size: .78rem;
  letter-spacing: .04em; color: var(--ink-soft);
}
.byline .dot { color: var(--ink-faint); }

.hero-figure { max-width: 62rem; margin: 2.5rem auto; padding: 0 1.5rem; }
.hero-figure img {
  width: 100%; border-radius: var(--radius);
  aspect-ratio: 16 / 9; object-fit: cover;
}
.hero-figure figcaption {
  font-family: var(--font-sans); font-size: .82rem; color: var(--ink-faint);
  text-align: center; margin-top: .8rem;
}

/* ---- In-article figures (Substack captioned images, cleaned by the sync) ---- */
.article-body .post-figure { margin: 2.4rem 0; }
.article-body .post-figure img {
  width: 100%; height: auto; border-radius: var(--radius);
}
.article-body .post-figure figcaption {
  font-family: var(--font-sans); font-size: .72rem; line-height: 1.4;
  color: var(--ink-faint); text-align: center; margin: .45rem auto 0;
  max-width: 42rem;
}
.article-body .post-cta {
  margin: 1.8rem 0; display: flex; justify-content: center;
}
.article-body .post-cta a {
  display: inline-flex; align-items: center;
  font-family: var(--font-sans); font-weight: 600; font-size: .95rem;
  color: var(--cream-surface); background: var(--ink);
  padding: .75rem 1.3rem; border-radius: 10px; text-decoration: none;
  transition: transform .15s ease, background .15s ease;
}
.article-body .post-cta a:hover {
  background: #000; color: #fff; transform: translateY(-1px);
}

/* ---- GitHub call-to-action ---- */
.gh-cta-block {
  max-width: var(--measure); margin: 0 auto; padding: 1rem 1.5rem 0;
}
.gh-cta {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--font-sans); font-weight: 600; font-size: .95rem;
  color: var(--cream-surface); background: var(--ink);
  padding: .75rem 1.15rem; border-radius: 10px; text-decoration: none;
  transition: transform .15s ease, background .15s ease;
}
.gh-cta:hover { background: #000; color: #fff; transform: translateY(-1px); }
.gh-cta svg { width: 19px; height: 19px; }
.gh-cta .repo { font-family: var(--font-mono); font-weight: 400; opacity: .85; }

/* ---- Article body (serif reading) ---- */
.article-body {
  font-family: var(--font-serif);
  font-size: 1.27rem; line-height: 1.72; color: var(--ink);
  max-width: var(--measure); margin: 2.5rem auto 0; padding: 0 1.5rem;
}
.article-body p { margin: 0 0 1.5em; }
.article-body > p:first-of-type::first-letter {
  font-weight: 600; font-size: 3.4rem; line-height: .8;
  float: left; padding: .05em .12em 0 0; color: var(--ink);
}
.article-body h2 {
  font-family: var(--font-sans); font-weight: 700;
  font-size: 1.75rem; line-height: 1.18; letter-spacing: -.02em;
  margin: 2.4em 0 .5em; color: var(--ink);
}
.article-body h1 { display: none; } /* dupe of page title in source content */
.article-body a {
  color: var(--accent); text-decoration: underline;
  text-underline-offset: 2px; text-decoration-thickness: 1px;
}
.article-body ol, .article-body ul { margin: 0 0 1.5em; padding-left: 1.4em; }
.article-body li { margin: .55em 0; }

/* ---- Newsletter callout ---- */
.newsletter {
  max-width: var(--measure); margin: 4rem auto; padding: 2.4rem;
  background: var(--cream-surface);
  border-radius: var(--radius); text-align: center;
}
.newsletter h3 {
  font-family: var(--font-sans); font-weight: 700; font-size: 1.5rem;
  letter-spacing: -.02em; margin: 0 0 .5rem;
}
.newsletter p { font-family: var(--font-serif); font-size: 1.12rem;
  color: var(--ink-soft); margin: 0 0 1.4rem; }
.subscribe-form { display: flex; gap: .6rem; max-width: 26rem; margin: 0 auto; }
.subscribe-form input {
  flex: 1; font-family: var(--font-sans); font-size: .95rem;
  padding: .7rem .9rem; border: 1px solid var(--rule);
  border-radius: 9px; background: var(--cream-bg); color: var(--ink);
}
.subscribe-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.subscribe-form button {
  font-family: var(--font-sans); font-weight: 600; font-size: .95rem;
  color: #fff; background: var(--accent); border: none;
  padding: .7rem 1.2rem; border-radius: 9px; cursor: pointer;
}
.subscribe-form button:hover { background: var(--accent-ink, #1f4fb0); }
.newsletter .fine {
  font-family: var(--font-sans); font-size: .78rem; color: var(--ink-faint);
  margin: 1rem 0 0;
}

/* ---- Footer (site-matching, in cream): logo + about + nav + social ---- */
.blog-footer {
  border-top: 1px solid var(--rule); margin-top: 4rem; padding: 3.5rem 0;
}
.blog-footer .inner {
  max-width: 68rem; margin: 0 auto; padding: 0 1.5rem;
  display: flex; justify-content: space-between; gap: 3rem; flex-wrap: wrap;
}
.foot-brand { max-width: 32rem; }
.foot-logo {
  height: 32px; display: block; margin-bottom: 1.1rem;
  filter: brightness(0);          /* white site logo → black on cream */
}
.foot-about {
  font-family: var(--font-sans); font-size: .9rem; line-height: 1.6;
  color: var(--ink-soft); margin: 0 0 1rem;
}
.foot-legal {
  font-family: var(--font-mono); font-size: .72rem;
  color: var(--ink-faint); margin: 0;
}
.foot-nav { display: flex; flex-direction: column; gap: .5rem; text-align: right; }
.foot-nav > a {
  font-family: var(--font-sans); font-weight: 500; font-size: .95rem;
  color: var(--ink-soft); text-decoration: none;
}
.foot-nav > a:hover { color: var(--ink); }
.foot-social { display: flex; gap: 1rem; margin-top: .9rem; justify-content: flex-end; }
.foot-social img { height: 19px; display: block; filter: brightness(0); opacity: .65; }
.foot-social a:hover img { opacity: 1; }

@media (max-width: 640px) {
  .blog-footer .inner { gap: 2rem; }
  .foot-nav, .foot-social { text-align: left; justify-content: flex-start; }
}

/* ---- Scroll reveal ---- */
.reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity .7s cubic-bezier(.16,.8,.3,1),
              transform .7s cubic-bezier(.16,.8,.3,1);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .progress { display: none; }
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .header-nav .browse { display: none; }
  .masthead { padding-top: 3.5rem; }
  .article-body { font-size: 1.18rem; }
}

/* ============================================================
   Blog posts on the site's dark chrome (.blog-post):
   native .global-header + .global-footer (dark, like the paper
   pages) wrap a cream reading body. The Webflow stylesheets are
   loaded before this file, so blog.css still wins for the cream
   article; these rules cover the seams.
   ============================================================ */
/* dark header bar so the white site logo + hamburger read on a cream page.
   Position stays absolute (from staging) like every other site page, so it
   scrolls away rather than sticking. The reading content clears it below. */
.blog-post .global-header {
  background-color: var(--midnight-blue, #01182e);
}
.blog-post .post-head { padding-top: 9rem; }
/* blog.css sets body line-height:1.5, which the nav links inherit and space
   them wider than the site. Reset it on the menu *container* (not .nav-link
   directly) so the links inherit 1.3em at desktop width, while the site's own
   responsive .nav-link rules (e.g. line-height:1em <=991px) still win. */
.blog-post .nav-menu { line-height: 1.3em; }
/* Mark "Updates" as the current section in the menu. Webflow's JS clears
   .w--current on blog posts (the link points to the listing, not the post),
   so target the Updates link by href instead. */
.blog-post .nav-link[href*="news-updates.html"] { color: var(--hot-coral, #ff1a5e); }
/* staging sets a global `p { color: white }` — keep the cream article text dark */
.blog-post .article-body p,
.blog-post .article-body li { color: var(--ink); }
