/* davidcarr.me — shared styles
   Cream brand (see context/brand.md). 8px spacing rhythm (see context/spacing.md).
   Used by every page. Edit here once, change everywhere. */

:root {
  --bg:       #fbfaf6;
  --panel:    #ffffff;
  --soft:     #f1ede1;
  --ink:      #1a1a1a;
  --muted:    #5e5e5e;
  --rule:     #dcd8cc;
  --accent:   #0a4d8c;
  --accent-ink: #073a6b;
  --bad: #a13a3a;

  --s-1: 8px;
  --s-2: 16px;
  --s-3: 24px;
  --s-4: 32px;
  --s-5: 48px;
  --s-6: 64px;
  --s-7: 96px;

  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.sans { font-family: var(--sans); }
::selection { background: var(--soft); color: var(--ink); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

img { max-width: 100%; height: auto; }

/* ─── SITE HEADER + NAV ──────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.site-header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 56px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}
.site-brand {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.site-brand:hover { color: var(--accent); text-decoration: none; }

.site-nav { display: flex; align-items: center; gap: var(--s-4); }
.site-nav a {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--rule); text-decoration: none; }
.site-nav a.is-current { color: var(--ink); border-bottom-color: var(--accent); }

/* Hamburger button — hidden on desktop, shown on mobile */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
}
.nav-toggle:hover { border-color: var(--ink); }
.nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-toggle .bar,
.nav-toggle .bar::before,
.nav-toggle .bar::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle .bar::before,
.nav-toggle .bar::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle .bar::before { top: -6px; }
.nav-toggle .bar::after  { top:  6px; }

/* When open: animate to an X */
.nav-toggle[aria-expanded="true"] .bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .bar::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar::after  { transform: translateY(-6px) rotate(-45deg); }

/* ─── PAGE CONTAINER ─────────────────────────────────────────────── */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--s-4) 56px var(--s-7);
}
.page--wide { max-width: 880px; }

/* Newsletter opener — the lede paragraph between H1 and the first
   section. Bigger than body so it carries weight as the issue's voice. */
.prose .nl-opener {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.45;
  color: var(--ink);
  margin: 0 0 var(--s-4) 0;
  max-width: 640px;
}

/* ─── HERO TYPE ──────────────────────────────────────────────────── */

.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 var(--s-3) 0;
}
h1 {
  font-family: var(--serif);
  font-size: 48px;
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.015em;
  margin: 0 0 var(--s-3) 0;
  color: var(--ink);
}
.lede {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.55;
  color: var(--muted);
  font-style: italic;
  margin: 0 0 var(--s-5) 0;
  max-width: 600px;
}
.lede strong { color: var(--ink); font-style: normal; font-weight: 400; border-bottom: 1px solid var(--rule); }
.lede a { color: inherit; text-decoration: none; transition: none; }
.lede a:hover strong { border-bottom-color: var(--accent); }
.lede a:focus-visible { outline-offset: 4px; }

/* ─── SUBSCRIBE FORM ─────────────────────────────────────────────── */

.subscribe { margin: 0 0 var(--s-6) 0; }
.subscribe-row { display: flex; gap: var(--s-1); align-items: stretch; flex-wrap: nowrap; }
.subscribe-email {
  flex: 1 1 auto;
  min-width: 0;
  height: 48px;
  padding: 0 var(--s-2);
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.subscribe-email::placeholder { color: var(--muted); }
.subscribe-email:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 77, 140, 0.12);
}
.subscribe-btn {
  flex: 0 0 auto;
  height: 48px;
  padding: 0 var(--s-3);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--panel);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.subscribe-btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.subscribe-btn:active { transform: translateY(1px); }
.subscribe-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.subscribe-honeypot {
  position: absolute;
  left: -10000px; top: auto;
  width: 1px; height: 1px;
  overflow: hidden;
}
.subscribe-note {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  margin: var(--s-1) 0 0 0;
}
.subscribe-status {
  font-family: var(--sans);
  font-size: 13px;
  margin: var(--s-2) 0 0 0;
  min-height: 1.5em;
}
.subscribe-status[data-state="ok"] { color: var(--accent); }
.subscribe-status[data-state="err"] { color: var(--bad); }
.subscribe:target .subscribe-email {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 77, 140, 0.12);
}

/* ─── SECTION LABELS + RULES ─────────────────────────────────────── */

.section-label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 var(--s-3) 0;
}
hr.rule {
  border: none;
  height: 1px;
  background: var(--rule);
  margin: 0 0 var(--s-5) 0;
}

.block { margin: 0 0 var(--s-6) 0; }
.block:last-of-type { margin-bottom: 0; }
.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  margin: 0 0 var(--s-3) 0;
}
.block-head .section-label { margin: 0; }
.see-all {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-decoration: none;
}
.see-all:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }

/* ─── FEATURE CARD (the big one on top of each section) ──────────── */

.feature {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: var(--s-3) 28px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.feature:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(10, 77, 140, 0.08);
  text-decoration: none;
}
.feature-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-2);
  margin: 0 0 var(--s-1) 0;
  flex-wrap: wrap;
}
.feature .kicker {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
}
.feature .meta {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.feature h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--s-1) 0;
  line-height: 1.25;
}
.feature p {
  margin: 0 0 var(--s-2) 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
}
.feature .read {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.feature .read .arrow { display: inline-block; transition: transform 0.15s ease; }
.feature:hover .read .arrow { transform: translateX(3px); }

/* ─── PREVIOUS LIST (compact rows under featured) ─────────────────── */

.previous { margin-top: var(--s-4); }
.previous-label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 var(--s-2) 0;
}
.previous-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--rule);
}
.previous-list li { border-bottom: 1px solid var(--rule); }
.previous-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 14px 0;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.15s ease, padding 0.15s ease;
}
.previous-list a:hover { color: var(--accent); text-decoration: none; padding-left: 4px; }
.previous-list .p-title { font-family: var(--serif); font-size: 16px; line-height: 1.35; min-width: 0; flex: 1 1 auto; }
.previous-list .p-date { font-family: var(--sans); font-size: 12px; color: var(--muted); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; flex: 0 0 auto; white-space: nowrap; }

/* ─── INDEX PAGE LIST (used on /whitepapers/ /newsletters/) ───────── */

.index-list {
  list-style: none;
  padding: 0;
  margin: var(--s-4) 0 0 0;
  border-top: 1px solid var(--rule);
}
.index-list li { border-bottom: 1px solid var(--rule); }
.index-list a {
  display: block;
  padding: var(--s-3) 0;
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease, padding 0.15s ease;
}
.index-list a:hover { color: var(--accent); padding-left: 4px; text-decoration: none; }
.index-list .il-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-2);
  margin: 0 0 4px 0;
  flex-wrap: wrap;
}
.index-list .il-kicker {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
}
.index-list .il-date {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.index-list h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--s-1) 0;
  line-height: 1.3;
}
.index-list p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }
.index-list .il-meta-coming { color: var(--accent); font-style: italic; }

/* ─── PROJECTS GRID (homepage "Also building") ────────────────────── */

.projects { margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--rule); }
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-2);
  align-items: stretch;
}
.project {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: var(--s-2) 18px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.project:hover { border-color: var(--accent); transform: translateY(-1px); text-decoration: none; }
.project .name { font-family: var(--serif); font-weight: 400; font-size: 16px; color: var(--ink); margin: 0; min-width: 0; }
.project .ext {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin: 2px 0 var(--s-1) 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project .desc {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  margin-top: auto;
  padding-top: var(--s-1);
}

/* ─── BACK LINK (top of every subpage) ───────────────────────────── */

.back-link {
  display: inline-block;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  margin: 0 0 var(--s-4) 0;
  letter-spacing: 0.02em;
  transition: color 0.15s ease, transform 0.15s ease;
}
.back-link:hover {
  color: var(--accent);
  text-decoration: none;
  transform: translateX(-3px);
}

/* ─── PAGE-BOTTOM CTA (subscribe + share at end of every page) ───── */

.page-cta {
  margin-top: var(--s-6);
  padding: var(--s-4) 28px;
  background: var(--soft);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.page-cta-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0 0 var(--s-1) 0;
  color: var(--ink);
}
.page-cta-sub {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 var(--s-3) 0;
}
.page-cta .subscribe { margin-bottom: var(--s-3); }
.page-cta .share-row {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}
.share-prompt {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  margin-right: var(--s-1);
}
.share-btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.share-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--bg); }

@media (max-width: 420px) {
  .page-cta { padding: var(--s-3) 20px; }
}

/* ─── PROSE (used inside newsletter issues, about page) ──────────── */

.prose p, .prose ul, .prose ol { font-size: 18px; line-height: 1.75; color: var(--ink); margin: 0 0 var(--s-3) 0; }
.prose h2 { font-family: var(--serif); font-size: 28px; font-weight: 400; margin: var(--s-5) 0 var(--s-2) 0; letter-spacing: -0.01em; }
.prose h3 { font-family: var(--serif); font-size: 22px; font-weight: 400; margin: var(--s-4) 0 var(--s-2) 0; }
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px var(--s-3);
  margin: var(--s-4) 0;
  font-style: italic;
  color: var(--ink);
}
.prose ul, .prose ol { padding-left: var(--s-3); }
.prose li { margin-bottom: 6px; }
.prose hr {
  border: none;
  height: 1px;
  background: var(--rule);
  margin: var(--s-5) 0;
}

/* ─── NEWSLETTER: big serif margin-number + indented section content ─

   Visual model: oversized accent-blue "01" sits in the left margin,
   heading + take-home + body align together to its right. Take-home is
   serif italic (no blue box, no border) so the page doesn't read as
   AI-templated. The numeral does the visual work.

   Markup unchanged from before — same .nl-h / .nl-num / .nl-takeaway
   classes, so existing rendered HTMLs (issue-01..05) automatically pick
   up the new look. */

.prose h2.nl-h {
  display: flex;
  align-items: baseline;
  gap: 24px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 var(--s-2) 0;
  color: var(--muted);
}
.prose h2.nl-h .nl-num {
  flex: 0 0 auto;
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 400;
  letter-spacing: -0.04em;
  color: var(--accent);
  text-transform: none;
  padding: 0;
  line-height: 1;
}

/* Take-home sentence — big italic serif. Full-width above the body/image row. */
.prose .nl-takeaway {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.25;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
  color: var(--ink);
  border-left: none;
  margin: 0 0 var(--s-4) 0;
  padding: 0;
  max-width: 760px;
}

/* Empty image slot — when no image or onerror hid the <img>, the
   .nl-sec-img stays as a blank half-column so the body alignment
   doesn't shift. No placeholder dashed-box, no "Image" label. */
.prose .nl-sec-img:empty,
.prose .nl-sec-img > img[style*="display: none"] {
  /* Just whitespace — no visible border, no fill */
}

/* ─── NEWSLETTER sections — responsive: airy on laptop, tiled on phone ─
   Laptop / desktop: no card chrome. Sections are separated by a single
   hairline rule across the page width, with generous vertical breathing
   room. Feels like a magazine spread.
   Phone: each section becomes a soft warm-beige card with a hairline
   border — the tiled look that reads well on a narrow column. */
.prose .nl-sec {
  padding: var(--s-6) 0 var(--s-5);
  border-top: 1px solid var(--rule);
}
.prose .nl-sec:first-of-type {
  border-top: none;
  padding-top: var(--s-3);
}
.prose .nl-sec-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
  align-items: center;
  margin-top: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule);
}

/* Slightly larger margin numeral on laptop so it carries more weight as
   the section ornament now that there's no card frame around it. */
@media (min-width: 721px) {
  .prose h2.nl-h .nl-num { font-size: 88px; }
}

/* Phone — restore the tiled card look the way it was. */
@media (max-width: 720px) {
  .prose .nl-sec {
    background: var(--soft);
    border: 1px solid var(--rule);
    border-radius: 2px;
    padding: var(--s-4) var(--s-4) calc(var(--s-4) - 4px);
    margin: var(--s-3) 0;
  }
  .prose .nl-sec:first-of-type {
    border-top: 1px solid var(--rule);
    padding-top: var(--s-4);
  }
  .prose .nl-sec-row {
    gap: var(--s-4);
  }
}
.prose .nl-sec-row > p {
  font-size: 18px;
  line-height: 1.75;
  color: var(--ink);
  margin: 0;
}
.prose .nl-sec:nth-of-type(even) .nl-sec-row > .nl-sec-img {
  order: -1;
}
.prose .nl-sec-img img {
  display: block;
  width: 100%;
  /* Lock to a 3:4 portrait (3 wide × 4 tall) so every section's image has
     the same shape regardless of source file. Source images should be
     supplied at 3:4 (e.g. 1086×1448); off-ratio sources are center-cropped. */
  aspect-ratio: 3 / 4;
  height: auto;
  object-fit: cover;
  border-radius: 6px;
}

@media (max-width: 720px) {
  .prose .nl-sec-row { grid-template-columns: 1fr; }
  .prose .nl-sec:nth-of-type(even) .nl-sec-row > .nl-sec-img { order: 0; }
  .prose .nl-sec-img img { max-width: 480px; }
}

/* Soft section divider, lighter than <hr>. */
.prose .nl-rule {
  border: none;
  height: 1px;
  width: 60px;
  background: var(--rule);
  margin: var(--s-5) 0;
}

@media (max-width: 600px) {
  .prose h2.nl-h { gap: 16px; font-size: 18px; }
  .prose h2.nl-h .nl-num { font-size: 48px; }
  .prose .nl-takeaway { font-size: 26px; }
}

/* ─── PREV/NEXT NAV (bottom of every subpage) ────────────────────── */

.pn-nav {
  margin-top: var(--s-6);
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
}
.pn-nav a {
  display: block;
  padding: var(--s-2) 0;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.15s ease;
}
.pn-nav a:hover { color: var(--accent); text-decoration: none; }
.pn-nav .pn-label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.pn-nav .pn-title {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.3;
}
.pn-nav .pn-next { text-align: right; }
.pn-back {
  text-align: center;
  margin-top: var(--s-3);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
}
.pn-back a { color: var(--muted); border-bottom: 1px solid var(--rule); }
.pn-back a:hover { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }

/* ─── FOOTER ─────────────────────────────────────────────────────── */

footer.site-footer {
  margin-top: var(--s-7);
  padding: var(--s-3) 56px;
  border-top: 1px solid var(--rule);
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2);
}
footer.site-footer a {
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  transition: color 0.15s ease, border-color 0.15s ease;
}
footer.site-footer a:hover { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }
footer.site-footer .connect a + a { margin-left: 18px; }

/* ─── RESPONSIVE ─────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .site-header-inner { padding: 0 24px; }
  .page { padding: var(--s-5) 24px var(--s-6); }
  footer.site-footer { padding: var(--s-3) 24px; flex-direction: column; align-items: flex-start; }
  h1 { font-size: 34px; letter-spacing: -0.01em; }
  .lede { font-size: 18px; }
  .feature { padding: 20px 22px; }
  .feature h2 { font-size: 21px; }
  .projects-grid { grid-template-columns: 1fr; }
  .pn-nav { grid-template-columns: 1fr; gap: var(--s-3); }
  .pn-nav .pn-next { text-align: left; }

  /* Hamburger takes over: hide horizontal nav, show toggle, drawer */
  .nav-toggle { display: inline-flex; }
  .site-nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--s-1) 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .site-nav.is-open { max-height: 400px; }
  .site-nav a {
    padding: 14px 24px;
    font-size: 15px;
    border-bottom: none;
    border-left: 3px solid transparent;
  }
  .site-nav a:hover { background: var(--soft); border-bottom-color: transparent; }
  .site-nav a.is-current { border-left-color: var(--accent); border-bottom-color: transparent; }
}

@media (max-width: 420px) {
  .site-brand { font-size: 16px; }
  .page { padding: var(--s-4) 18px var(--s-5); }
  h1 { font-size: 30px; }
  .subscribe-row { flex-direction: column; }
  .subscribe-btn { width: 100%; }
}

/* ─── SUBSCRIBE MODAL (popup on newsletter / whitepaper pages) ───── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-3);
  background: rgba(26, 26, 26, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: var(--s-5) var(--s-4) var(--s-4);
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  transform: translateY(10px);
  transition: transform 0.25s ease;
}
.modal-backdrop.is-open .modal { transform: translateY(0); }
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s ease, color 0.15s ease;
}
.modal-close:hover { background: var(--soft); color: var(--ink); }
.modal-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.modal-eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--s-1) 0;
}
.modal-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 var(--s-2) 0;
}
.modal-sub {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 var(--s-3) 0;
}
.modal .subscribe { margin: 0; }
.modal-later {
  display: block;
  width: 100%;
  margin-top: var(--s-2);
  padding: var(--s-1) 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
}
.modal-later:hover { color: var(--ink); text-decoration: underline; }

@media (max-width: 480px) {
  .modal { padding: var(--s-4) var(--s-3) var(--s-3); }
  .modal-title { font-size: 22px; }
  .modal-sub { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop, .modal { transition: none; }
}
