/* songcode blog.
 *
 * Self-contained: the blog does not load the app's stylesheet. The tokens
 * below are the app's (public/styles.css, section 1), copied so the two stay
 * one system. If a token changes there, change it here.
 *
 * Same rules as the app: dark only, one accent, and the accent is for the
 * primary action and for live state. Chrome is lowercase; prose is not.
 */

:root {
  color-scheme: dark;

  --bg: #070708;
  --surface-0: #0d0d0f;
  --surface-1: #131315;
  --surface-2: #1c1c1f;
  --surface-3: #26262a;
  --surface-4: #333338;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);

  --text: #f4f4f6;
  --text-2: rgba(235, 235, 245, 0.64);
  --text-3: rgba(235, 235, 245, 0.4);
  /* long-form body copy: between --text and --text-2, for reading at length */
  --prose: rgba(235, 235, 245, 0.84);

  --accent: #b8ff2e;
  --accent-ink: #0d1300;
  --accent-soft: rgba(184, 255, 46, 0.12);
  --accent-line: rgba(184, 255, 46, 0.4);

  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-1: 0.12s;
  --dur-2: 0.2s;

  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);

  --head-h: 60px;
  --page: 1120px;
  --measure: 680px;
  --gutter: clamp(20px, 5vw, 40px);
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--head-h) + 24px);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ol, ul, blockquote, pre { margin: 0; }
ol, ul { padding: 0; list-style: none; }
em { font-style: normal; }
::selection { background: rgba(184, 255, 46, 0.28); }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

.wrap {
  width: 100%;
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 50;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  font-size: 13px;
}
.skip:focus { top: 10px; }

/* ————————————————————————————— chrome ————————————————————————————— */

.site-head {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--head-h);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 7, 8, 0.72);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
}
.site-head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--r-sm);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.brand-mark { width: 26px; height: 26px; flex: none; border-radius: 7px; box-shadow: 0 0 0 1px var(--line-strong); }
.mark-tile { fill: #0a0b0d; }
.mark-bars { fill: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav .btn { margin-left: 8px; }
.nav-link {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
  transition: color var(--dur-1) var(--ease);
}
.nav-link:hover, .nav-link[aria-current='page'] { color: var(--text); }
/* the docs link gives way on a phone; the footer keeps it */
@media (max-width: 480px) { .nav-wide { display: none; } }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn-primary:hover { background: #c6ff52; }
.btn-primary:active { background: #a8ee1c; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 17px; }

.site-foot {
  margin-top: 96px;
  border-top: 1px solid var(--line);
}
.site-foot-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px 40px;
  flex-wrap: wrap;
  padding-block: 40px 56px;
}
.foot-tagline { margin-top: 12px; color: var(--text-3); font-family: var(--font-mono); font-size: 12.5px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 24px; }
.foot-links a { color: var(--text-2); font-size: 14px; transition: color var(--dur-1) var(--ease); }
.foot-links a:hover { color: var(--text); }
.foot-note { width: 100%; color: var(--text-3); font-size: 14px; }
.foot-note a { color: var(--text-2); }
.foot-note a:hover { color: var(--text); }

/* ————————————————————————————— shared bits ————————————————————————————— */

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.meta .tag { color: var(--text-2); }
.meta .dot { opacity: 0.6; }

/* the step strip: lit steps are neutral, the playhead step is live */
.strip {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  /* a soft light behind the playhead column; --pf is set per strip */
  background-image: radial-gradient(
    ellipse 24% 50% at calc(var(--strip-pad, 0px) + (100% - 2 * var(--strip-pad, 0px)) * var(--pf, 0.5)) 50%,
    rgba(184, 255, 46, 0.075),
    transparent
  );
}
.strip .off { fill: var(--surface-2); }
.strip .on { fill: var(--surface-4); }
.strip .live { fill: var(--accent); }
.strip .glow { fill: var(--accent); }
.strip .live-glow { opacity: 0.7; animation: strip-breathe 3.2s ease-in-out infinite alternate; }
/* a few lit steps blink, each on its own clock (--t period, --w offset) */
.strip .blink { animation: strip-blink var(--t, 9s) linear var(--w, 0s) infinite; }
.strip .blink-glow { animation: strip-blink-glow var(--t, 9s) linear var(--w, 0s) infinite; }
@keyframes strip-breathe { from { opacity: 0.4; } to { opacity: 0.9; } }
@keyframes strip-blink { 0%, 90%, 100% { fill: var(--surface-4); } 92%, 94.5% { fill: var(--accent); } }
@keyframes strip-blink-glow { 0%, 90%, 100% { opacity: 0; } 92%, 94.5% { opacity: 0.75; } }
@media (prefers-reduced-motion: reduce) {
  .strip .live-glow, .strip .blink, .strip .blink-glow { animation: none; }
}

/* ————————————————————————————— index ————————————————————————————— */

.hero { padding-block: 88px 56px; }
.hero h1 {
  font-size: clamp(38px, 6.4vw, 68px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.02;
  text-wrap: balance;
}
.hero-sub {
  max-width: 34em;
  margin-top: 20px;
  color: var(--text-2);
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.5;
}

.lead-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: stretch;
  border-radius: var(--r-xl);
  background: var(--surface-1);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
  transition: background var(--dur-2) var(--ease);
}
.lead-card:hover { background: #161618; }
.lead-strip {
  display: grid;
  place-items: center;
  padding: 48px 40px;
  background: var(--surface-0);
  border-right: 1px solid var(--line);
}
.lead-body { display: flex; flex-direction: column; align-items: flex-start; padding: 40px; }
.lead-body h2 {
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-wrap: balance;
}
.lead-desc { margin-top: 12px; color: var(--text-2); font-size: 16px; line-height: 1.5; }
.lead-body .meta { margin-top: 18px; }
.more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 28px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.arrow {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--dur-2) var(--ease);
}
.lead-card:hover .arrow { transform: translateX(3px); }

.post-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 56px;
  margin-top: 24px;
}
.post-row {
  display: block;
  height: 100%;
  padding-block: 28px;
  border-bottom: 1px solid var(--line);
}
/* no rule under the last row, whether it holds one post or two */
.post-list li:last-child .post-row,
.post-list li:nth-last-child(2):nth-child(odd) .post-row { border-bottom-color: transparent; }
.post-row h2 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
  transition: color var(--dur-1) var(--ease);
}
.post-desc { margin-top: 8px; color: var(--text-2); font-size: 15px; line-height: 1.5; }
.post-row .meta { margin-top: 14px; }
.post-row:hover h2 { color: #fff; }
.post-row:hover .post-desc { color: var(--prose); }

/* ————————————————————————————— post ————————————————————————————— */

.post-head, .prose, .post-strip { max-width: calc(var(--measure) + var(--gutter) * 2); }
.post-head { padding-block: 72px 0; }
.post-head h1 {
  font-size: clamp(32px, 5.4vw, 50px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.06;
  text-wrap: balance;
}
.standfirst {
  margin-top: 18px;
  color: var(--text-2);
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.45;
  text-wrap: pretty;
}
.post-head .meta { margin-top: 24px; }

.post-strip { padding-block: 40px 8px; }
.post-strip .strip {
  --strip-pad: 24px;
  padding: 22px 24px;
  border-radius: var(--r-lg);
  background-color: var(--surface-0);
  box-shadow: inset 0 0 0 1px var(--line);
}

.prose {
  padding-top: 32px;
  color: var(--prose);
  font-size: 17px;
  line-height: 1.7;
}
.prose > * + * { margin-top: 1.25em; }
.prose p, .prose li { text-wrap: pretty; }
.prose h2 {
  margin-top: 2.2em;
  color: var(--text);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  text-wrap: balance;
}
.prose h3 {
  margin-top: 1.9em;
  color: var(--text);
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.3;
}
.prose h2 + *, .prose h3 + * { margin-top: 0.7em; }
.prose strong { color: var(--text); font-weight: 600; }
/* a company's mark beside its name, in the text colour */
.prose .logo { width: 0.86em; height: 0.86em; margin-right: 0.42em; vertical-align: -0.07em; fill: currentColor; }
.prose td .logo, .prose th .logo { width: 1em; height: 1em; vertical-align: -0.14em; }
.prose em { font-style: italic; }
.prose a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--text-3);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-1) var(--ease);
}
.prose a:hover { text-decoration-color: var(--text); }

.prose ul, .prose ol { padding-left: 1.3em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: 0.45em; }
.prose li::marker { color: var(--text-3); }

.prose code {
  padding: 0.12em 0.36em;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.86em;
}
.prose pre.code {
  margin-block: 1.6em;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--surface-0);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow-x: auto;
  color: #d5d7de;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  tab-size: 2;
}
.prose pre.code code { padding: 0; background: none; color: inherit; font-size: inherit; }
.tok-comment { color: var(--text-3); }
.tok-string { color: #c5e88a; }
.tok-number { color: #8cc8ff; }

.prose blockquote {
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--line-strong);
  color: var(--text);
  font-size: 19px;
  line-height: 1.5;
}

.prose hr { height: 1px; margin-block: 2.4em; border: 0; background: var(--line); }

.table-wrap {
  margin-block: 1.8em;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow-x: auto;
}
.prose table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; line-height: 1.45; }
.prose th, .prose td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose thead th {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.prose tbody th { color: var(--text); font-weight: 600; white-space: nowrap; }
.prose tbody td { color: var(--text-2); }
.prose tbody tr:last-child th, .prose tbody tr:last-child td { border-bottom: 0; }

/* sources: the last list in a post reads as reference, not prose */
.prose h2#sources { font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--text-2); }
.prose h2#sources ~ * { color: var(--text-2); font-size: 14px; line-height: 1.55; }
.prose h2#sources ~ * a { color: var(--text-2); }
.prose h2#sources ~ * a:hover { color: var(--text); }

/* ————————————————————————————— after the post ————————————————————————————— */

.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 88px;
  padding: 40px;
  border-radius: var(--r-xl);
  background: var(--surface-1);
  box-shadow: inset 0 0 0 1px var(--line);
}
.cta h2 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
}
.cta h2 em { color: var(--accent); }

.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.pager-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background var(--dur-1) var(--ease);
}
.pager-link:hover { background: var(--surface-2); }
.pager-next { align-items: flex-end; text-align: right; }
.pager-dir { color: var(--text-3); font-size: 12px; font-weight: 500; }
.pager-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; text-wrap: balance; }

/* ————————————————————————————— small screens ————————————————————————————— */

@media (max-width: 860px) {
  .lead-card { grid-template-columns: 1fr; }
  .lead-strip { padding: 32px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .lead-body { padding: 28px 24px 30px; }
  .post-list { grid-template-columns: 1fr; }
  .post-list li:nth-last-child(2):nth-child(odd) .post-row { border-bottom-color: var(--line); }
}

@media (max-width: 600px) {
  :root { --gutter: 20px; }
  .hero { padding-block: 56px 36px; }
  .post-head { padding-top: 44px; }
  .post-strip { padding-top: 28px; }
  .post-strip .strip { --strip-pad: 16px; padding: 16px; }
  .prose { font-size: 16.5px; line-height: 1.68; }
  .prose h2 { font-size: 23px; }
  .prose pre.code { margin-inline: calc(var(--gutter) * -1); border-radius: 0; padding-inline: var(--gutter); font-size: 12.5px; }
  .cta { margin-top: 64px; padding: 28px 24px; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { align-items: flex-start; text-align: left; }
  .site-foot { margin-top: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
