/* /mainline: landing page for the Mainline newsletter and podcast. One white
   ground with a single blue line down the page: episodes and issues are nodes
   on it, like commits on a main branch. #0047ff is ink only (headline, line,
   links, ASCII art) plus the subscribe button. Feature Display for headings,
   Aeonik for text, system mono for labels. */

@font-face {
  font-family: Featuredisplay;
  src: url('../fonts/FeatureDisplay-Light-Web.woff2') format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Aeonik;
  src: url('../fonts/Aeonik-Regular.woff2') format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Aeonik;
  src: url('../fonts/Aeonik-Medium.woff2') format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --ml-blue: #0047ff;
  --ml-navy: #12203c;
  --ml-muted: #5b6480;
  --ml-line: #dfe4f5;
  --ml-tint: #f3f5fd;
  --ml-pad: clamp(20px, 5vw, 56px);
  --ml-rail: 64px;
  --ml-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.ml-body {
  margin: 0;
  background: #fff;
  color: var(--ml-navy);
  font-family: Aeonik, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.ml-body a { color: var(--ml-blue); text-decoration: none; }
.ml-body a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ml-body [hidden] { display: none !important; }

.ml-shell {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding-left: var(--ml-pad);
  padding-right: var(--ml-pad);
}

.ml-mono {
  font-family: var(--ml-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ml-muted);
}

.ml-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- top bar ---------- */

.ml-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-top: 22px;
  padding-bottom: 18px;
}
.ml-top::after {
  content: "";
  position: absolute;
  left: var(--ml-pad);
  right: var(--ml-pad);
  top: 100%;
  border-bottom: 1px solid var(--ml-line);
}
.ml-top { position: relative; }
.ml-brand { margin: 0; display: flex; align-items: baseline; gap: 12px; }
.ml-wordmark {
  font-family: Featuredisplay, Georgia, serif;
  font-weight: 300;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.ml-body a.ml-wordmark:hover { text-decoration: none; }
.ml-body a.ml-by { color: var(--ml-muted); }
.ml-nav { display: flex; gap: clamp(16px, 3vw, 32px); font-size: 15px; }

/* ---------- the line ---------- */

/* Everything from the hero down to the oldest entry hangs off one blue rule:
   HEAD at the top beside the subscribe form, then each episode and issue as
   a node, newest first. js/mainline.js marks the last block ml-last so the
   rule stops at its node. */
.ml-on-line { position: relative; padding-left: var(--ml-rail); padding-top: var(--ml-pt); }
.ml-on-line::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--ml-blue);
}
.ml-on-line.ml-last::before { bottom: auto; height: calc(var(--ml-pt) + 12px); }
.ml-node { position: relative; margin: 0; }
.ml-node::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--ml-rail));
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--ml-blue);
  box-shadow: 0 0 0 6px #fff;
}
.ml-node-open::before { background: #fff; border: 2px solid var(--ml-blue); }
.ml-ref {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid var(--ml-blue);
  border-radius: 4px;
  color: var(--ml-blue);
  font-family: var(--ml-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* ---------- hero ---------- */

.ml-hero {
  --ml-pt: clamp(48px, 7vw, 88px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  align-items: end;
  padding-bottom: clamp(32px, 4vw, 56px);
}
.ml-hero.has-latest { grid-template-columns: 1fr 340px; }
.ml-h1 {
  margin: 22px 0 0;
  max-width: 12ch;
  text-wrap: balance;
  font-family: Featuredisplay, Georgia, serif;
  font-weight: 300;
  font-size: clamp(46px, 7vw, 96px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  color: var(--ml-blue);
}
.ml-sub {
  margin: clamp(20px, 3vw, 28px) 0 0;
  max-width: 34ch;
  font-size: clamp(18px, 1.7vw, 21px);
  line-height: 1.4;
}
.ml-latest-head { margin: 0 0 12px; }
.ml-log { margin: 0 0 6px; padding: 0; list-style: none; border-top: 1px solid var(--ml-line); }
.ml-log li { border-bottom: 1px solid var(--ml-line); }
.ml-log a { display: grid; grid-template-columns: 62px 1fr; gap: 4px 0; padding: 14px 0; color: var(--ml-navy); }
.ml-body .ml-log a:hover { text-decoration: none; }
.ml-log a:hover b { color: var(--ml-blue); }
.ml-log .ml-mono { padding-top: 3px; color: var(--ml-blue); }
.ml-log b { font-weight: 500; }
.ml-log-sub { grid-column: 2; color: var(--ml-muted); font-size: 15px; line-height: 1.35; }

/* ---------- subscribe form ---------- */

.ml-form { margin: clamp(24px, 3vw, 36px) 0 0; max-width: 460px; }
.ml-form-row {
  display: flex;
  border: 1px solid var(--ml-blue);
  border-radius: 6px;
  background: #fff;
}
.ml-form-row:focus-within { outline: 2px solid var(--ml-blue); outline-offset: 2px; }
.ml-input {
  flex: 1;
  min-width: 0;
  padding: 15px 16px;
  border: 0;
  border-radius: 6px 0 0 6px;
  background: transparent;
  color: var(--ml-navy);
  font: inherit;
  font-size: 16px;
}
.ml-input::placeholder { color: #8a93ad; }
.ml-input:focus { outline: none; }
.ml-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ml-btn {
  padding: 15px 24px;
  border: 0;
  border-radius: 0 5px 5px 0;
  background: var(--ml-blue);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}
.ml-btn:hover { background: #0039cc; }
.ml-btn:disabled { cursor: default; opacity: 0.7; }
.ml-form-note { min-height: 1.5em; margin: 10px 0 0; font-size: 14px; color: var(--ml-muted); }
.ml-form.is-error .ml-form-note { color: #d23f3f; }
.ml-form.is-error .ml-form-row { border-color: #d23f3f; }

/* ---------- entries on the line ---------- */

.ml-entry {
  --ml-pt: clamp(44px, 5.5vw, 72px);
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 56px;
  align-items: start;
  padding-bottom: clamp(44px, 5.5vw, 72px);
  scroll-margin-top: 12px;
}
.ml-entry.no-art { grid-template-columns: 1fr; }
.ml-entry-meta { color: var(--ml-blue); }
.ml-entry-meta span { color: var(--ml-muted); }
.ml-quote {
  margin: 22px 0 0;
  font-family: Featuredisplay, Georgia, serif;
  font-weight: 300;
  font-size: clamp(32px, 4.4vw, 60px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.ml-byline { margin: 20px 0 0; font-size: 18px; }
.ml-byline b { font-weight: 500; }
.ml-ctx { margin: 10px 0 0; max-width: 52ch; color: var(--ml-muted); }
.ml-diff { margin: 22px 0 0; padding: 0; list-style: none; font-family: var(--ml-mono); font-size: 14px; line-height: 1.9; }
.ml-diff li { display: flex; flex-wrap: wrap; align-items: baseline; }
.ml-diff .ml-sign { width: 22px; }
.ml-diff-add { color: var(--ml-blue); }
.ml-diff-drop { color: var(--ml-muted); }
.ml-diff-drop .ml-diff-text { text-decoration: line-through; }
.ml-diff small { padding-left: 18px; font-size: 12px; color: #6f7893; letter-spacing: 0.02em; }
.ml-links { margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 15px; }

.ml-art {
  position: relative;
  container-type: inline-size;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  background: var(--ml-tint);
}
.ml-art.ml-cover { aspect-ratio: 16 / 10; }
.ml-body a.ml-art:hover { text-decoration: none; }
/* 110 columns of a 0.6em-wide monospace fill the card: 100cqw / (110 * 0.6).
   The column counts in js/mainline.js must match. */
.ml-ascii {
  margin: 0;
  font-family: Menlo, "SF Mono", ui-monospace, Consolas, monospace;
  font-size: calc(100cqw / 66.3);
  line-height: 1;
  white-space: pre;
  color: var(--ml-blue);
  user-select: none;
}
.ml-cover .ml-ascii { font-size: calc(100cqw / 84.4); }
.ml-initials { font-family: Featuredisplay, Georgia, serif; font-size: 22cqw; color: var(--ml-blue); }
.ml-play {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 7px 11px;
  border-radius: 4px;
  background: var(--ml-blue);
  color: #fff;
  font-family: var(--ml-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
a.ml-art:hover .ml-play { background: #0039cc; }

/* an issue is a smaller node than an episode */
.ml-issue .ml-node::before { width: 10px; height: 10px; margin-top: -5px; left: calc(-1 * var(--ml-rail) + 2px); }
.ml-issue-title {
  margin: 18px 0 0;
  max-width: 20ch;
  font-family: Featuredisplay, Georgia, serif;
  font-weight: 300;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.ml-issue-title a { color: var(--ml-navy); }
.ml-body .ml-issue-title a:hover { color: var(--ml-blue); text-decoration: none; }
.ml-issue .ml-ctx { margin-top: 16px; }

/* ---------- closing subscribe ---------- */

.ml-close { padding: clamp(48px, 6vw, 72px) 0 clamp(64px, 8vw, 110px); border-top: 1px solid var(--ml-line); }
.ml-h2 {
  margin: 0;
  font-family: Featuredisplay, Georgia, serif;
  font-weight: 300;
  font-size: clamp(38px, 6vw, 80px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--ml-blue);
}

/* ---------- footer ---------- */

.ml-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  padding-top: 24px;
  padding-bottom: 40px;
  font-size: 14px;
  color: var(--ml-muted);
}
.ml-footer::before {
  content: "";
  position: absolute;
  left: var(--ml-pad);
  right: var(--ml-pad);
  top: 0;
  border-top: 1px solid var(--ml-line);
}
.ml-footer p { margin: 0; }

/* ---------- small screens ---------- */

@media (max-width: 900px) {
  .ml-hero.has-latest, .ml-entry { grid-template-columns: 1fr; gap: 32px; }
  .ml-art { max-width: 340px; }
}
@media (max-width: 640px) {
  :root { --ml-rail: 30px; }
  .ml-wordmark { font-size: 26px; }
  .ml-by { display: none; }
  .ml-on-line::before { left: 4px; }
  .ml-node::before { width: 10px; height: 10px; margin-top: -5px; box-shadow: 0 0 0 5px #fff; }
  .ml-issue .ml-node::before { width: 8px; height: 8px; margin-top: -4px; left: calc(-1 * var(--ml-rail) + 1px); }
}
