/* remedcu.com
   One stylesheet, no build step. Dark is the default theme; the header
   toggle sets html[data-theme="light"] and remembers it in localStorage. */

:root {
  color-scheme: dark;
  --bg: #121315;
  --fg: #e8e8e6;
  --muted: #a2a5ab;
  --line: #2a2c30;
  --accent: #5fd3b1;
  --surface: #1b1d21;
  --line-strong: #3f4247;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Noto Sans Mono", "DejaVu Sans Mono", "Liberation Mono", monospace;
  --measure: 68ch;
  /* 1rem = 17px (html is 106.25% of the 16px default). Media queries ignore
     that: "40rem" in a media query is 640px. */
  --step--1: 0.8235rem;  /* 14px: kickers, tags, table heads, footer */
  --step-s: 0.8824rem;   /* 15px: nav, link rows, compact notes */
  --step-m: 0.9412rem;   /* 16px: tables, evidence lists */
  --step-0: 1rem;        /* 17px: body */
  --step-1: 1.1765rem;   /* 20px */
  --step-2: 1.4118rem;   /* 24px */
  --step-3: clamp(1.9rem, 1.3rem + 2vw, 2.5rem); /* 32px to 42.5px */
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fcfcfb;
  --fg: #1b1b1b;
  --muted: #5c5f66;
  --line: #e4e4e0;
  --accent: #0b6b5b;
  --surface: #f3f3f0;
  --line-strong: #c4c4bf;
}

/* ---------- base ---------- */

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

html {
  font-size: 106.25%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: var(--step-3); font-weight: 650; letter-spacing: -0.015em; }
h2 { font-size: var(--step-2); font-weight: 600; }
h3 { font-size: var(--step-1); font-weight: 600; line-height: 1.25; }

p { margin: 0; text-wrap: pretty; }

ul, ol { margin: 0; }

code { font-family: var(--mono); font-size: 0.92em; }
p code, li code { background: var(--surface); padding: 0.1em 0.3em; border-radius: 3px; }

.muted { color: var(--muted); }

/* Monospace labels: kickers, tags, table heads, dates, case-study subheads. */
.mono, .kicker, .case h3, th, td.date {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.02em;
}

.kicker { color: var(--muted); }

/* ---------- layout ---------- */

.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 0 1.25rem 3.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Short pages (the 404) keep the footer at the bottom of the viewport. */
main { flex: 1 0 auto; }

.skip {
  position: absolute;
  inset-inline-start: -100vw;
  top: 0.75rem;
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.skip:focus { inset-inline-start: 0.75rem; z-index: 2; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  padding-top: 1.75rem;
}

.wordmark {
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.005em;
}

.wordmark:hover { text-decoration: underline; }

.site-nav {
  display: flex;
  align-items: baseline;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  font-size: var(--step-s);
}

.site-nav a { color: var(--fg); text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="page"] {
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

/* The button ships with [hidden] so it never shows without JS. theme.js sets
   html[data-js] in <head>, before first paint, so the button takes its space
   immediately; the fixed width keeps "Light" and "Dark" the same size. */
:root[data-js] .theme-toggle { display: inline-block; }

.theme-toggle {
  font: var(--step--1)/1.2 var(--mono);
  letter-spacing: 0.02em;
  min-inline-size: calc(5ch + 1.1rem + 2px);
  color: var(--muted);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
}

.theme-toggle:hover { color: var(--fg); border-color: var(--muted); }

.hero {
  padding: 4rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.page-intro {
  padding: 3.25rem 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lede { font-size: var(--step-1); line-height: 1.5; }

.links {
  display: flex;
  gap: 0.6rem 1.25rem;
  flex-wrap: wrap;
  font-size: var(--step-s);
}

.links a { overflow-wrap: anywhere; }

/* Small link targets keep a 24px minimum (WCAG 2.5.8). */
.site-nav a, .links a, .site-footer a { min-width: 24px; min-height: 24px; text-align: center; }

.section {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.plain, .timeline, .entries { list-style: none; padding: 0; }

.stack, .timeline, .entries { display: flex; flex-direction: column; gap: 1.4rem; }
.stack > * { display: flex; flex-direction: column; gap: 0.35rem; }

.bullets {
  padding-inline-start: 1.2em;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bullets li::marker { color: var(--muted); }

/* Hanging bullets on wide screens: the text lines up with the column edge. */
@media (min-width: 48rem) {
  .bullets { padding-inline-start: 0; }
}

.compact {
  font-size: var(--step-s);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* ---------- timeline ---------- */

.timeline > li {
  display: grid;
  gap: 0.15rem 1.5rem;
  align-items: baseline;
}

.timeline .role { display: flex; flex-direction: column; gap: 0.25rem; }
.timeline .role p:last-child { font-size: var(--step-s); color: var(--muted); }

@media (min-width: 40rem) {
  .timeline > li { grid-template-columns: 11rem 1fr; gap: 0.5rem 1.5rem; }
  .timeline + .compact { padding-inline-start: 12.5rem; }
}

/* ---------- case studies ---------- */

.case {
  border-top: 1px solid var(--line);
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.case h3 {
  font-weight: 600;
  color: var(--muted);
  margin-top: 0.75rem;
}

.case .kicker, .entries .kicker { text-wrap: balance; }

.evidence { font-size: var(--step-s); }
.evidence a {
  overflow-wrap: anywhere;
  text-decoration-color: color-mix(in srgb, currentColor 50%, transparent);
}
.evidence a:hover { text-decoration-color: currentColor; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step-m);
}

th {
  text-align: start;
  font-weight: 600;
  color: var(--muted);
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--line-strong);
}

td {
  padding: 0.6rem 0.75rem 0.6rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}

td.date {
  white-space: nowrap;
  color: var(--muted);
}

@media (max-width: 30rem) {
  table { font-size: var(--step--1); }
  th, td { padding-inline-end: 0.6rem; }
  td a { overflow-wrap: anywhere; }
}

/* ---------- talks ---------- */

.entries > li { display: flex; flex-direction: column; gap: 0.3rem; }

.entry-links {
  display: flex;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
  font-size: var(--step-s);
}

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

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: var(--step--1);
  color: var(--muted);
}

.site-footer p { display: flex; gap: 0.5rem 1.1rem; flex-wrap: wrap; }

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

@media (max-width: 40rem) {
  .hero { padding-block: 3rem 0.5rem; }
  .lede { font-size: 1.0588rem; } /* 18px, per the HomeMobile artboard */
}

/* At 344 to 374px the toggle would otherwise sit alone on a third header row. */
@media (max-width: 24rem) {
  .site-nav { column-gap: 1rem; }
}

/* ---------- print ---------- */

@media print {
  :root, :root[data-theme="light"] { color-scheme: light; --bg: #fff; --fg: #000; --muted: #333; --line: #bbb; --line-strong: #888; --accent: #000; --surface: #f2f2f2; }
  .site-nav, .skip, .site-footer p:first-child { display: none; }
  .wrap { max-width: none; padding: 0; }
  .table-wrap { overflow: visible; }
  a { text-decoration: none; }
  main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: var(--muted); overflow-wrap: anywhere; }
  main a[href*="/commits/"]::after, main a[href*="sovryn.com/all-things-sovryn/"]::after { content: none; }
  h2, h3 { break-after: avoid; }
  tr, .timeline > li, .entries > li { break-inside: avoid; }
  .bullets { padding-inline-start: 1.2em; }
}
