/* =========================================================================
   Markset landing page
   Swiss baseline grid. Helvetica. Black on white, inverts in dark mode.
   Grid unit: 8px. Body: 16 / 24 (3u leading).
   ========================================================================= */

:root {
  --bg: #ffffff;
  --fg: #000000;
  --grid: 8px;
  --gutter: 32px;
  --max-w: 1280px;
  --hairline: 1px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --fg: #ffffff;
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* Browsers style [hidden] as display:none in the UA sheet without
   !important, so any class that sets its own display (e.g. flex)
   overrides it. This is the canonical defensive fix. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Helvetica Neue', Helvetica, 'Arial', sans-serif;
  font-size: 16px;
  line-height: 24px;  /* 3 grid units */
  font-weight: 400;
  font-feature-settings: 'kern';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* No overflow-x: hidden here — it breaks position: sticky. */
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover { text-decoration-thickness: 2px; }

code, kbd {
  font-family: 'Menlo', ui-monospace, 'SF Mono', Monaco, monospace;
  font-size: 0.85em;
  letter-spacing: -0.01em;
}

kbd {
  border: 1px solid currentColor;
  padding: 1px 6px 2px;
  font-size: 0.8em;
  line-height: 1;
  display: inline-block;
  vertical-align: baseline;
}

/* =========================================================================
   Brand — fixed top-left
   ========================================================================= */
.brand {
  position: fixed;
  top: var(--gutter);
  left: var(--gutter);
  z-index: 100;
}

.brand a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.mark { display: block; }

.wordmark {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* =========================================================================
   Hero — 300vh scroll area with a 100vh sticky inner
   ========================================================================= */
.hero {
  height: 300vh;
  position: relative;
}

.hero-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 96px var(--gutter) 32px;  /* 12u top, 4u sides, 4u bottom */
  display: grid;
  grid-template-rows: 1fr auto auto 96px;  /* content · subhead · cta · cookie */
  gap: 32px;  /* 4u */
}

/* Short viewports (iPad landscape, small laptops, resized windows): trim
   padding + cookie reservation so the display type has room to breathe. */
@media (max-height: 820px) {
  .hero-pin {
    padding-top: 56px;
    padding-bottom: 24px;
    grid-template-rows: 1fr auto auto 56px;
    gap: 20px;
  }
}

.hero-content {
  align-self: center;
  display: flex;
  flex-direction: column;
  position: relative;
}

.hero-line {
  /* Scale with the smaller of viewport width or height so we never overflow
     on short viewports (e.g. iPad mini landscape = 744px tall). Floor of
     44px matches the original phone feel — iPhone widths all hit this. */
  font-size: max(44px, min(7.5vw, 9vh, 88px));
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -0.035em;
  margin: 0;
  padding: 8px 0;  /* 1u */
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 450ms cubic-bezier(.2, 0, 0, 1),
              transform 450ms cubic-bezier(.2, 0, 0, 1);
  position: relative;
  will-change: opacity, transform;
}

.hero-line.revealed {
  opacity: 1;
  transform: none;
}

.hero-line::before {
  content: attr(data-line);
  position: absolute;
  left: -64px;
  top: 16px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  letter-spacing: 0.12em;
  opacity: 0.5;
}

@media (max-width: 900px) {
  .hero-line::before { display: none; }
}

/* Mobile: drop the scroll-pin so revealed content can flow. */
@media (max-width: 720px) {
  .hero { height: auto; }
  .hero-pin { position: static; height: auto; padding-top: 128px; }
  .hero-line, .hero-subhead p, .hero-cta { opacity: 1; transform: none; }
}

.hero-subhead {
  max-width: 640px;
}

.hero-subhead p {
  font-size: 16px;
  line-height: 24px;
  margin: 0;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 500ms cubic-bezier(.2, 0, 0, 1),
              transform 500ms cubic-bezier(.2, 0, 0, 1);
  transition-delay: 200ms;
}

.hero-subhead.revealed p {
  opacity: 0.7;
  transform: none;
}

.hero-cta {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 500ms cubic-bezier(.2, 0, 0, 1),
              transform 500ms cubic-bezier(.2, 0, 0, 1);
  transition-delay: 300ms;
}

.hero-cta.revealed {
  opacity: 1;
  transform: none;
}

.cta {
  display: inline-block;
  background: var(--fg);
  color: var(--bg);
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  padding: 16px 32px;
  text-decoration: none;
  letter-spacing: -0.005em;
  border: 1px solid var(--fg);
  transition: opacity 150ms ease;
}

.cta:hover {
  opacity: 0.85;
}

.cta:active {
  opacity: 0.7;
}

.meta {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.02em;
  opacity: 0.55;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* Subscribe form — revealed below .meta after the user clicks Download. */
.subscribe {
  width: 100%;
  max-width: 640px;  /* matches .hero-subhead */
  margin-top: 24px;  /* 3u above the input row */
  animation: subscribe-fade-in 350ms cubic-bezier(.2, 0, 0, 1);
}

@keyframes subscribe-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.subscribe-form {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin: 0;
}

.subscribe-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  color: var(--fg);
  border: 0;
  border-bottom: 1px solid var(--fg);
  padding: 8px 0;
  font-family: inherit;
  font-size: 14px;
  line-height: 24px;
  font-weight: 400;
  letter-spacing: -0.005em;
  outline-offset: 4px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}

.subscribe-input::placeholder {
  color: var(--fg);
  opacity: 0.4;
}

.subscribe-input:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 4px;
}

.subscribe-submit {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 8px 16px;
  font-family: inherit;
  font-size: 14px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, opacity 150ms ease;
  border-radius: 0;
  white-space: nowrap;
}

.subscribe-submit:hover {
  background: var(--fg);
  color: var(--bg);
}

.subscribe-submit:active { opacity: 0.7; }
.subscribe-submit:disabled { opacity: 0.5; cursor: progress; background: transparent; color: var(--fg); }

.subscribe-error {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 20px;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.subscribe-success {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 0;
  font-size: 14px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.005em;
  animation: subscribe-fade-in 350ms cubic-bezier(.2, 0, 0, 1);
}

.subscribe-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--fg);
  color: var(--bg);
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .subscribe,
  .subscribe-success {
    animation: none;
  }
}

.meta span::after {
  content: '·';
  margin-left: 16px;
  opacity: 0.5;
}

.meta span:last-child::after {
  content: none;
}

.cookie-space {
  /* Reserved for future cookie consent bar. Intentionally empty. */
}

/* =========================================================================
   Demo — looping video of the QuickLook moment
   ========================================================================= */
.demo {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 128px var(--gutter) 96px;
}

.demo .section-label {
  margin-bottom: 48px;
}

.demo-frame {
  max-width: 1200px;
  margin: 0 auto;
  line-height: 0;  /* kill inline-element baseline gap under the video */
}

.demo video {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg);
}

/* =========================================================================
   Features
   ========================================================================= */
.features {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 128px var(--gutter) 96px;  /* 16u top, 12u bottom */
}

.section-label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.55;
  margin: 0 0 48px;  /* 6u */
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 64px;  /* 8u */
  border-top: var(--hairline) solid currentColor;
  padding-top: 48px;  /* 6u */
}

@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
}

.feature {
  position: relative;
}

.feature-num {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.12em;
  opacity: 0.5;
  display: block;
  margin-bottom: 24px;  /* 3u */
}

.feature h3 {
  font-size: 28px;
  line-height: 32px;  /* 4u */
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 24px;  /* 3u */
}

.feature p {
  font-size: 16px;
  line-height: 24px;
  margin: 0;
}

/* =========================================================================
   Colophon — About + Proof, side-by-side at wide viewports.
   Shared rhythm: both columns land on the same 32px line-grid so the
   bold proof points sit visually paired with lines of the about copy.
   ========================================================================= */
.colophon {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 128px var(--gutter);
  display: grid;
  grid-template-columns: 2fr 1fr;
  column-gap: 96px;
  row-gap: 48px;
  grid-template-areas:
    "label-a label-p"
    "body-a  body-p";
}

.label-about   { grid-area: label-a; }
.label-proof   { grid-area: label-p; }
.colophon-about {
  grid-area: body-a;
  border-top: var(--hairline) solid currentColor;
  padding-top: 48px;
}
.colophon-trust {
  grid-area: body-p;
  border-top: var(--hairline) solid currentColor;
  padding-top: 48px;
}

/* Mobile: each label pairs with its content block. */
@media (max-width: 900px) {
  .colophon {
    grid-template-columns: 1fr;
    row-gap: 24px;
    grid-template-areas:
      "label-a"
      "body-a"
      "label-p"
      "body-p";
  }
  .label-proof {
    margin-top: 32px;
  }
}

.col-label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.55;
  margin: 0;
}

/* About column — long-form copy, 20/32 */
.colophon-about p {
  font-size: 20px;
  line-height: 32px;
  letter-spacing: -0.01em;
  margin: 0;
  max-width: 640px;
}

/* Proof column — short bold items, SAME 32px line-height as about.
   Each item occupies one 4u line, paired with a line of about copy. */
.colophon-trust ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.colophon-trust li {
  font-size: 14px;
  line-height: 32px;  /* matches .colophon-about p */
  font-weight: 700;
  letter-spacing: -0.005em;
}

/* Compensate for baseline drift: 14px text in a 32px line-box sits ~2px
   higher than 20px text in the same line-box because of different
   descender metrics. Nudge the whole proof column down so the first-line
   baselines match across columns. */
.colophon-trust ul {
  padding-top: 2px;
}

.colophon-trust li a {
  font-weight: 700;
}

/* =========================================================================
   Footer
   ========================================================================= */
footer {
  border-top: var(--hairline) solid currentColor;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 32px;
  font-size: 13px;
  line-height: 24px;
  letter-spacing: -0.005em;
}

.footer-copy {
  opacity: 0.55;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 720px) {
  .footer-inner { flex-direction: column; gap: 16px; }
}

/* =========================================================================
   Sub-page layout (release-notes, privacy, terms)
   ========================================================================= */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 192px var(--gutter) 128px;  /* leaves room for the fixed brand */
}

.page h1 {
  font-size: clamp(48px, 6vw, 64px);
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 64px;
}

.page h2 {
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 64px 0 16px;
  padding-top: 32px;
  border-top: var(--hairline) solid currentColor;
}

.page h2:first-of-type {
  margin-top: 0;
}

.page h3 {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  margin: 32px 0 8px;
  letter-spacing: -0.005em;
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.page p,
.page li {
  font-size: 18px;
  line-height: 32px;
  letter-spacing: -0.005em;
  margin: 0 0 16px;
}

.page ul {
  padding-left: 20px;
  margin: 0 0 32px;
}

.page li {
  margin-bottom: 8px;
}

.page code {
  background: color-mix(in srgb, currentColor 8%, transparent);
  padding: 1px 6px;
  border-radius: 3px;
}

/* =========================================================================
   Reduced motion — respect the user
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  .hero-line,
  .hero-subhead p,
  .hero-cta {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* =========================================================================
   Debug — baseline grid overlay.
   Toggled by a small script in base.njk (Shift+G, or ?grid URL param).
   When <html data-grid> is set, paint a 24px baseline grid across the
   viewport so it's trivial to verify elements land on the grid.
   ========================================================================= */
html[data-grid] body {
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(220, 38, 127, 0.32) 0,
    rgba(220, 38, 127, 0.32) 1px,
    transparent 1px,
    transparent 24px
  );
  background-attachment: fixed;   /* ruler stays put, content scrolls past */
}

html[data-grid] body::after {
  content: "grid · 24px baseline · shift+g to toggle";
  position: fixed;
  bottom: 16px;
  right: 16px;
  padding: 6px 10px;
  font-family: "Menlo", ui-monospace, "SF Mono", Monaco, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: rgba(220, 38, 127, 0.9);
  color: #fff;
  z-index: 9999;
  pointer-events: none;
}

/* When grid is on, outline the key structural boxes so we can see which
   edges land on grid lines and which don't. */
html[data-grid] .post-header h1,
html[data-grid] .post-date,
html[data-grid] .prose > :first-child {
  outline: 1px dashed rgba(0, 128, 255, 0.6);
  outline-offset: 0;
}

/* =========================================================================
   ▸▸▸ BLOG ADDITIONS — justin.stach.uk
   Appended to the markset design system. Do not interleave; keep as a
   single block so the markset portion can be refreshed wholesale.
   ========================================================================= */

/* Brand avatar — photo headshot replaces the glyph. */
.brand-avatar {
  width: 40px;
  height: 40px;
  object-fit: cover;
  object-position: center;
}

/* Top-right nav — section-label typography, three items.
   Height matches the brand's 40px avatar box so baselines align. */
.nav {
  position: fixed;
  top: var(--gutter);
  right: var(--gutter);
  z-index: 100;
  height: 40px;
  display: flex;
  align-items: center;
}

.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 24px;  /* 3u */
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.nav a {
  text-decoration: none;
  opacity: 0.55;
  transition: opacity 150ms ease;
}

.nav a:hover,
.nav a[aria-current="page"] {
  opacity: 1;
}

@media (max-width: 720px) {
  .brand, .nav { position: static; }
  .brand { padding: var(--gutter) var(--gutter) 0; }
  .nav { padding: 8px var(--gutter) 0; }
}

/* Visually hidden — for labels we want announced but not shown. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Generic uppercase label — same visual token as .section-label/.col-label. */
.label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.55;
  margin: 0;
}

/* =========================================================================
   Home — excerpt feed
   ========================================================================= */
.home-feed {
  max-width: 720px;
  margin: 0 auto;
  padding: 192px var(--gutter) 128px;
}

/* Display page title — same rule as post h1 for typographic consistency.
   Used on /, /weeknotes/, and any other page-level H1 outside .page. */
.page-title {
  font-size: clamp(48px, 6vw, 64px);
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 48px;           /* 2u gap before the content that follows */
}

.excerpt-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.excerpt-item {
  padding: 24px 0;            /* 1u top/bottom — card breathing room, hairline sits at item edge */
}

.excerpt-item:not(:last-child) {
  border-bottom: var(--hairline) solid currentColor;
}

.excerpt-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.excerpt-link:hover .excerpt-title {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.excerpt-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gutter);
  margin-bottom: 8px;
}

.excerpt-title {
  font-size: 24px;              /* Heading tier — semantic <h2> */
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  flex: 1 1 auto;
}

.excerpt-head time {
  flex: 0 0 auto;
  white-space: nowrap;
}

.excerpt-body {
  font-size: 16px;
  line-height: 24px;
  margin: 0;
  opacity: 0.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Home-feed tag chips — same reversed-out style as .post-tags,
   sits outside .excerpt-link so each chip is its own anchor. */
.excerpt-tags {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.excerpt-tags a {
  display: inline-block;
  background: var(--fg);
  color: var(--bg);
  padding: 4px 8px;
  font-size: 10px;
  line-height: 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 120ms ease;
}

.excerpt-tags a:hover { opacity: 0.85; }

@media (max-width: 640px) {
  .excerpt-head { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* =========================================================================
   Archives — compact date | title grid
   ========================================================================= */
.archives {
  max-width: 720px;
  margin: 0 auto;
  padding: 192px var(--gutter) 128px;
}

.archives > .label {
  display: block;
  margin-bottom: 48px;
}

.weeknotes-intro {
  font-size: 18px;
  line-height: 24px;
  letter-spacing: -0.005em;
  opacity: 0.7;
  margin: 0 0 48px;           /* 2u below before the list */
  max-width: 56ch;
}

.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.archive-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 12px 0;            /* 24 line + 12+12 = 48 per row, 2u */
  align-items: baseline;
}

.archive-item:not(:last-child) {
  border-bottom: var(--hairline) solid currentColor;
}

.archive-item a {
  text-decoration: none;
  font-size: 18px;
  line-height: 24px;            /* 1u on grid */
  letter-spacing: -0.005em;
}

.archive-item a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

@media (max-width: 640px) {
  .archive-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  /* Tags index keeps the 1fr/auto inline layout on mobile too —
     counts are short enough not to warrant stacking. */
  .archive-item:has(.tag-count) {
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: baseline;
  }
}

/* =========================================================================
   Post — article header + prose
   ========================================================================= */
/* Post h1 — matches markset's .page h1 exactly: tight 1.04 leading on a
   responsive clamp. Prioritises typographic tightness over grid-snap; the
   h1 block may drift a few px off the 24 baseline, same trade markset
   makes on its own sub-pages. */
.post-header h1 {
  font-size: clamp(48px, 6vw, 64px);
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 24px;
}

/* Post date — grid-locked 24/24. Hairline rendered via box-shadow so it
   doesn't add a stray 1px to layout height. Total block = 24 line +
   24 pad-below + 24 margin-below = 72px (3u).
   Qualified as `p.post-date` so specificity (0,1,1) matches markset's
   `.page p` rule — source order then wins. */
p.post-date {
  font-size: 24px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
  padding-bottom: 24px;
  box-shadow: inset 0 -1px 0 currentColor;
}

p.post-date time { font-variant-numeric: tabular-nums; }
p.post-date .sep { margin: 0 12px; opacity: 0.4; font-weight: 400; }

/* Heading line-breaks — balance avoids widows on short h1/h2. */
.post-header h1,
.prose h2,
.prose h3,
.prose h4,
.excerpt-title,
.archive-item a {
  text-wrap: balance;
}

/* -------------------------------------------------------------------------
   Prose — Brockmann-disciplined article body.

   Baseline grid: 24px (matches markset's body scale 16/24).
   All vertical measurements are integer multiples of one grid unit.
   Headings carry their block-rhythm on the top margin and flow straight
   into the next element (margin-bottom: 0) — the Stamped pattern.
   h2 + post-date keep 32px leading inside 48px external margins — this is
   the single block-snap exception, the same trade markset makes on h2.
   Bullets hang outside the content column, into the .page gutter.
   ------------------------------------------------------------------------- */

.prose p {
  font-size: 18px;
  line-height: 24px;          /* 1u */
  letter-spacing: -0.005em;
  margin: 0 0 24px;           /* 1u after */
}

/* Heading → body spacing rule:
   Every heading gets 1u (24px) margin-below — a breath before the next
   paragraph. Space above scales with level: h2 = 2u (section break),
   h3/h4 = 1u. All heading blocks stay grid-multiples (h2=4u, h3/h4=3u). */

.prose h2 {
  font-size: 24px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 48px 0 24px;        /* 2u above, 1u below */
  padding-top: 0;
  border-top: 0;
  text-transform: none;
  opacity: 1;
}
.prose h2:first-child { margin-top: 0; }

.prose h3 {
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 24px 0 24px;        /* 1u above, 1u below */
  padding-top: 0;
  text-transform: none;
  opacity: 1;
}

.prose h4 {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin: 24px 0 24px;        /* 1u above, 1u below */
  text-transform: none;
  opacity: 1;
}

/* Hanging bullets. padding-left:0 + list-style-position:outside puts the
   marker to the left of the content column — it hangs in the .page gutter
   (32px wide). Text starts flush with body left-edge, bullets don't
   disrupt the grid. */
.prose ul,
.prose ol {
  padding-left: 0;
  list-style-position: outside;
  margin: 0 0 24px;
}
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }

.prose li {
  font-size: 18px;
  line-height: 24px;          /* 1u per line */
  letter-spacing: -0.005em;
  margin-bottom: 24px;        /* 1u between items */
}
.prose li:last-child { margin-bottom: 0; }
.prose li > p { margin-bottom: 0; }
.prose li > ul,
.prose li > ol {
  margin-top: 0;
  padding-left: 24px;         /* 1u inset for nested lists */
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.prose a:hover { text-decoration-thickness: 2px; }

.prose img,
.prose video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 24px 0;             /* 1u — grid-snapped */
}

/* YouTube embeds — 16:9 responsive wrapper inserted at migration time
   for each standalone youtu.be / youtube.com URL. */
.prose .video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;     /* 16:9 */
  height: 0;
  margin: 24px 0;
  overflow: hidden;
}
.prose .video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.prose figure { margin: 24px 0; }
.prose figure img { margin: 0; }
.prose figure figcaption {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-top: 16px;
}

.prose blockquote {
  margin: 24px 0;
  padding-left: 24px;         /* 1u */
  border-left: var(--hairline) solid currentColor;
}

/* Google Charts Sankey wrapper — fixed min-width so labels read; viewport
   narrower than the chart scrolls horizontally. */
.prose .sankey-chart {
  margin: 24px 0;
  overflow-x: auto;
  min-height: 1000px;          /* matches height option so layout doesn't pop */
}
.prose blockquote p { margin: 0 0 24px; }
.prose blockquote p:last-child { margin: 0; }

.prose code {
  font-family: "Menlo", ui-monospace, "SF Mono", Monaco, monospace;
  font-size: 0.85em;
  letter-spacing: -0.01em;
}
.prose pre {
  font-family: "Menlo", ui-monospace, "SF Mono", Monaco, monospace;
  font-size: 14px;
  line-height: 24px;
  padding: 16px;
  border: var(--hairline) solid currentColor;
  overflow-x: auto;
  margin: 24px 0;
  background: transparent;
}
.prose pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  letter-spacing: inherit;
}

.prose hr {
  border: 0;
  border-top: var(--hairline) solid currentColor;
  margin: 48px 0;             /* 2u — a confident break */
  opacity: 1;
}

/* markdown-it-footnote emits its own <hr class="footnotes-sep"> — hide it
   so our border-top is the sole divider. */
.prose hr.footnotes-sep { display: none; }

.prose .footnotes {
  margin-top: 48px;
  padding-top: 24px;
  border-top: var(--hairline) solid currentColor;
}
.prose .footnotes ol { padding-left: 0; }
.prose .footnotes li {
  font-size: 14px;
  line-height: 24px;
  margin-bottom: 0;
}

/* =========================================================================
   Post tags — topical tag chips below the body, above post-nav.
   ========================================================================= */
.post-tags {
  margin-top: 48px;                 /* 2u above — no border, label + chips stack */
}

.post-tags > .label {
  display: block;
  margin-bottom: 8px;
}

.post-tags ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.post-tags ul a {
  display: inline-block;
  background: var(--fg);
  color: var(--bg);
  padding: 4px 8px;
  font-size: 10px;
  line-height: 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 120ms ease;
}

.post-tags ul a:hover { opacity: 0.85; }

/* =========================================================================
   Tag archive pages — /tagged/{tag}/
   ========================================================================= */
.tag-archive {
  max-width: 720px;
  margin: 0 auto;
  padding: 192px var(--gutter) 128px;
}

.tag-archive > .label { display: block; margin-bottom: 24px; }

.tag-archive-title {
  font-size: clamp(40px, 6vw, 56px);
  line-height: 72px;                /* 3u — matches post h1 desktop */
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 48px;                 /* 2u — flows into list */
  text-wrap: balance;
}

.tag-archive-back {
  margin-top: 48px;
  font-size: 12px;
  line-height: 24px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.55;
}

.tag-archive-back a { text-decoration: none; }
.tag-archive-back a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }

/* Tags index row — tag name left, post count right-aligned.
   Overrides the default .archive-item grid (140px | 1fr) with (1fr | auto)
   so the count sits flush-right of the tag name on every row. */
.archive-item:has(.tag-count) {
  grid-template-columns: 1fr auto;
}

/* =========================================================================
   Post navigation — Previous / Next at the bottom of each article.
   Previous = older (left); Next = newer (right).
   ========================================================================= */
.post-nav {
  margin-top: 72px;                 /* 3u above the block */
}

.post-nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gutter);
}

.post-nav-item {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 24px 0;                  /* 1u */
}

.post-nav-prev { grid-column: 1; }
.post-nav-next { grid-column: 2; }

.post-nav-item .label {
  display: block;
  margin-bottom: 16px;
}

/* .post-nav-title is a <span> (not a heading) — it's a card title inside
   a navigation aid, not a section header. Subhead tier, 20/24, with a top
   hairline dividing it from the PREVIOUS / NEXT label above. */
.post-nav-title {
  display: block;
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  padding-top: 16px;
  border-top: var(--hairline) solid currentColor;
  text-wrap: balance;
}

p.post-nav-excerpt {
  font-size: 16px;                  /* Support tier — matches excerpt body */
  line-height: 24px;
  letter-spacing: -0.005em;
  opacity: 0.7;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-nav-item:hover .post-nav-title {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

@media (max-width: 640px) {
  .post-nav-grid { grid-template-columns: 1fr; gap: 48px; }
  .post-nav-next { grid-column: 1; }
}

/* =========================================================================
   Site footer (blog) — full-bleed hairline, 720px constrained content.
   Hairline comes from markset's `footer { border-top }` rule; keeping
   `.site-footer` unconstrained lets it run edge-to-edge.
   ========================================================================= */
.site-footer {
  /* intentionally no max-width or horizontal padding — the <footer>
     element carries a full-bleed border-top from markset base */
}

.site-footer-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px var(--gutter) 72px;    /* 2u top, 3u bottom on the 24 grid */
  display: grid;
  gap: 0;                              /* rows sit on the 24px baseline */
}

.site-footer-row {
  display: grid;
  grid-template-columns: 96px 1fr;     /* 4u label column */
  gap: 24px;
  align-items: baseline;
  font-size: 16px;                     /* Support tier */
  line-height: 24px;                   /* 1u — on the baseline grid */
  letter-spacing: -0.005em;
}

.site-footer-row a { text-decoration: none; }
.site-footer-row a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
