/* nealford.com — single stylesheet. Black, white, red. */

@font-face {
  font-family: "Karla";
  src: url("/fonts/karla-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("/fonts/karla-italic-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #111111;
  --muted: #5e5e5e;
  --line: #e4e4e4;
  --soft: #f5f5f4;
  --accent: #c8102e;
  --accent-strong: #9b0c23;
  --on-accent: #ffffff;
  --ink-band: #0d0d0d;
  --on-ink: #f2f2f2;

  --font: "Karla", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0: clamp(1.05rem, 1rem + 0.25vw, 1.15rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --step-3: clamp(2rem, 1.6rem + 2vw, 3rem);
  --step-4: clamp(2.6rem, 1.9rem + 3.5vw, 4.5rem);
  --wrap: 72rem;
  --measure: 42rem;
  --gap: clamp(1rem, 0.6rem + 2vw, 2rem);
  --radius: 4px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0d;
    --fg: #f1f1f1;
    --muted: #a6a6a6;
    --line: #2b2b2b;
    --soft: #171717;
    --accent: #ff4458;
    --accent-strong: #ff7a89;
    --on-accent: #0d0d0d;
    --ink-band: #000000;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  border-top: 4px solid var(--accent);
  text-rendering: optimizeLegibility;
}
img, video, iframe { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.015em; font-weight: 800; margin: 1.6em 0 0.5em; }
h1 { font-size: var(--step-3); letter-spacing: -0.03em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
h4 { font-size: var(--step-0); }
h1 a, h2 a, h3 a { color: inherit; text-decoration: none; }
h1 a:hover, h2 a:hover, h3 a:hover { color: var(--accent); }
p, ul, ol, dl, table, blockquote, pre { margin: 0 0 1.1em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
small, .fine { font-size: var(--step--1); }
code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code { background: var(--soft); padding: 0.1em 0.35em; border-radius: var(--radius); }
pre { background: var(--soft); padding: 1rem 1.25rem; overflow-x: auto; border-left: 3px solid var(--accent); }
blockquote, cite { display: block; border-left: 3px solid var(--accent); padding: 0.25rem 0 0.25rem 1.25rem; color: var(--muted); font-style: normal; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; }
::selection { background: var(--accent); color: var(--on-accent); }

.wrap { width: min(100% - 2 * var(--gap), var(--wrap)); margin-inline: auto; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--fg); color: var(--bg); padding: 0.5rem 1rem; z-index: 10; }
.skip-link:focus { left: 1rem; }

/* ---------- header / footer ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 4rem; }
.wordmark { font-size: 1.4rem; font-weight: 300; letter-spacing: -0.02em; color: var(--fg); text-decoration: none; white-space: nowrap; margin: 0; }
.wordmark b { font-weight: 800; color: var(--accent); }
.wordmark:hover { color: var(--fg); }
.site-nav ul { list-style: none; display: flex; gap: clamp(0.75rem, 2vw, 1.75rem); margin: 0; padding: 0; }
.site-nav a { color: var(--fg); text-decoration: none; font-weight: 600; font-size: 0.98rem; padding: 0.4rem 0; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current] { border-bottom-color: var(--accent); color: var(--fg); }
@media (max-width: 46rem) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 0.25rem; padding-block: 0.75rem 0.5rem; }
  .site-nav { width: 100%; }
  .site-nav ul { flex-wrap: wrap; gap: 0.2rem 1.1rem; padding-bottom: 0.25rem; }
  .site-header { position: static; }
}

.site-footer { background: var(--ink-band); color: var(--on-ink); margin-top: 5rem; padding-block: 3rem; }
.footer-inner { display: grid; gap: 1rem; grid-template-columns: auto 1fr auto; align-items: center; }
.site-footer .wordmark { color: var(--on-ink); }
.site-footer .wordmark b { color: #ff4458; }
.site-footer ul { list-style: none; display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0; padding: 0; justify-content: center; }
.site-footer a { color: var(--on-ink); text-decoration: none; }
.site-footer a:hover { color: #ff4458; }
.site-footer .fine { margin: 0; color: #9a9a9a; }
@media (max-width: 46rem) { .footer-inner { grid-template-columns: 1fr; } .site-footer ul { justify-content: flex-start; } }

/* ---------- shared pieces ---------- */
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: var(--step--1); font-weight: 700; color: var(--muted); margin: 0 0 0.75rem; }
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { color: var(--accent); }
.dek { font-size: var(--step-1); color: var(--muted); line-height: 1.35; margin-top: 0; }
.button { display: inline-block; background: var(--fg); color: var(--bg); text-decoration: none; font-weight: 700; padding: 0.75rem 1.35rem; border-radius: var(--radius); border: 2px solid var(--fg); }
.button:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.ghost { background: transparent; color: var(--fg); }
.button.ghost:hover { background: transparent; color: var(--accent); border-color: var(--accent); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-top: 3px solid var(--fg); padding-top: 1rem; margin: 5rem 0 2rem; }
.section-head h2 { margin: 0; font-size: var(--step-2); }
.section-head a { font-weight: 700; text-decoration: none; white-space: nowrap; }

/* ---------- generic pages (legacy content lives here) ---------- */
.page { padding-top: 2.5rem; }
.page > article, .page > section { max-width: 60rem; padding-block: 2rem; }
.page > article + article, .page > span + article, .page > article + span, .page > span + span { border-top: 1px solid var(--line); }
.page > h1:first-child, .page > article:first-child > h1:first-child { margin-top: 0; }
.page img[align="left"], .prose img[align="left"] { float: left; margin: 0.4rem 2rem 1rem 0; padding: 0 !important; max-width: 40%; }
.page img[align="right"], .prose img[align="right"] { float: right; margin: 0.4rem 0 1rem 2rem; max-width: 40%; }
.page article::after, .prose::after { content: ""; display: block; clear: both; }
.page [align="center"] { text-align: center; }
.page center img, .page div[align="center"] img { margin-inline: auto; }
.page p, .page ul, .page ol, .page li { max-width: var(--measure); }
.page ul { padding-left: 1.2rem; }
.page li { margin-bottom: 0.35rem; }
.page li::marker { color: var(--accent); }
@media (max-width: 40rem) {
  .page img[align="left"], .page img[align="right"], .prose img[align] { float: none; display: block; max-width: 60%; margin: 0 0 1.25rem; }
}

/* ---------- blog posts ---------- */
.post { max-width: var(--measure); padding-top: 3rem; }
.post-header h1 { margin: 0 0 0.75rem; }
.prose { font-size: var(--step-0); }
.prose h2 { font-size: var(--step-1); }
.prose img { display: block; margin: 1.5rem auto; }
.prose li { margin-bottom: 0.4rem; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; border-top: 3px solid var(--fg); margin-top: 4rem; padding-top: 1.25rem; }
.post-nav a { text-decoration: none; color: var(--fg); font-weight: 700; line-height: 1.3; }
.post-nav a:hover { color: var(--accent); }
.post-nav span { display: block; font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; margin-bottom: 0.3rem; }
.post-nav .next { text-align: right; }
.archive-link { margin-top: 2rem; font-weight: 700; }
.archive-link a { text-decoration: none; }

/* post lists (home + archive) */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { display: grid; grid-template-columns: 9rem 1fr; gap: 0.25rem 2rem; padding: 1.5rem 0; border-bottom: 1px solid var(--line); max-width: none !important; }
.post-list time { color: var(--muted); font-size: var(--step--1); font-weight: 600; padding-top: 0.35rem; }
.post-list h3 { margin: 0 0 0.35rem; font-size: var(--step-1); }
.post-list p { margin: 0; color: var(--muted); max-width: var(--measure); }
@media (max-width: 40rem) { .post-list li { grid-template-columns: 1fr; } }

/* ---------- books ---------- */
.book-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 2.5rem 1.75rem; }
.book-grid li { max-width: none !important; margin: 0; }
.book-grid a { text-decoration: none; color: var(--fg); display: block; }
.book-grid .cover-frame { aspect-ratio: 3 / 4; background: var(--soft); display: flex; align-items: flex-end; justify-content: center; margin-bottom: 0.8rem; overflow: hidden; }
.book-grid img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; transition: transform 0.2s ease; }
.book-grid a:hover img { transform: translateY(-4px); }
.book-grid strong { display: block; line-height: 1.25; font-size: 1rem; }
.book-grid a:hover strong { color: var(--accent); }
.book-grid span { color: var(--muted); font-size: var(--step--1); }
.book-hero { display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; padding: 3rem 0 2.5rem; border-bottom: 1px solid var(--line); margin-bottom: 2.5rem; }
.book-hero .cover { width: 100%; box-shadow: 0 1px 2px rgb(0 0 0 / 0.15), 0 12px 30px -12px rgb(0 0 0 / 0.35); }
.book-hero h1 { margin: 0 0 0.5rem; }
.book .prose { max-width: var(--measure); }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.25rem; margin: 1.5rem 0; font-size: var(--step--1); }
.meta dt { font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.meta dd { margin: 0; }
@media (max-width: 40rem) { .book-hero { grid-template-columns: 1fr; } .book-hero .cover { max-width: 12rem; } }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; padding: clamp(3rem, 8vw, 6rem) 0 2rem; }
.hero h1 { font-size: var(--step-4); margin: 0 0 1rem; line-height: 0.98; letter-spacing: -0.045em; }
.hero h1 span { color: var(--accent); }
.hero .lede { font-size: var(--step-1); line-height: 1.4; max-width: 34rem; margin-bottom: 2rem; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero figure { margin: 0; justify-self: end; max-width: 22rem; }
.hero figure { border-bottom: 6px solid var(--accent); }
.hero figure img { display: block; width: 100%; }
@media (max-width: 46rem) { .hero { grid-template-columns: 1fr; } .hero figure { justify-self: start; max-width: 9rem; order: -1; } }

.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 2rem; }
.role { border-top: 1px solid var(--line); padding-top: 1.25rem; }
.role .num { font-weight: 800; color: var(--accent); font-size: var(--step--1); letter-spacing: 0.1em; }
.role h3 { margin: 0.25rem 0 0.6rem; }
.role p { color: var(--muted); }
.role ul { padding-left: 1.1rem; color: var(--muted); font-size: 0.95em; }
.role li::marker { color: var(--accent); }

.events { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.5rem; }
.event { border: 1px solid var(--line); padding: 1.25rem; display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem; align-items: start; }
.event img { width: 4.5rem; height: 4.5rem; object-fit: contain; background: #fff; }
.event h3 { font-size: 1.05rem; margin: 0 0 0.35rem; }
.event p { margin: 0; color: var(--muted); font-size: var(--step--1); }
.events-empty { color: var(--muted); }

.podcasts { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 2rem; }
.podcast { background: var(--soft); padding: 1.75rem; border-left: 4px solid var(--accent); }
.podcast h3 { margin-top: 0; }
.podcast p { color: var(--muted); margin-bottom: 0.75rem; }
.podcast p:last-child { margin-bottom: 0; }

/* blog archive intro */
.definition { display: grid; gap: 0.25rem; font-size: var(--step-1); margin: 1.5rem 0 2rem; }
.definition b { font-style: italic; }

/* single photos (races) */
.pic { text-align: center; padding-top: 3rem; }
.pic img { display: inline-block; }
.pic figcaption { font-weight: 700; margin: 1rem 0; }

/* ---------- syntax highlighting (rouge) ---------- */
.highlight .c, .highlight .c1, .highlight .cm { color: var(--muted); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kt, .highlight .nt { color: var(--accent); font-weight: 600; }
.highlight .s, .highlight .s1, .highlight .s2 { color: #2f7d32; }
@media (prefers-color-scheme: dark) { .highlight .s, .highlight .s1, .highlight .s2 { color: #8bd48e; } }

@media print {
  .site-header, .site-footer, .post-nav, .skip-link { display: none; }
  body { border: 0; }
}

/* page intros, disclosure, org exports */
.page-intro { max-width: var(--measure); padding-bottom: 1rem; }
.page-intro h1 { margin: 0 0 0.75rem; }
details { margin: 1rem 0; }
summary { cursor: pointer; font-weight: 700; }
summary::marker { color: var(--accent); }
.org ol.org-ol { padding-left: 0; list-style: none; }
.org .section-number-2, .org .section-number-3 { color: var(--accent); margin-right: 0.4rem; }
.page > article > h1:first-child, .page > article > h2:first-child, .page > article .org > h1:first-child { margin-top: 0; }
