/* ==========================================================
   Dave Criswell: site styles (v2)
   Colors and fonts are defined once here as "tokens".
   Change a value in :root and it updates everywhere.
   ========================================================== */

:root {
  --paper: #f7f5f0;        /* warm off-white page background */
  --panel: #eceee7;        /* soft sage panel background */
  --card: #fbfaf7;         /* slightly lighter than the page, for cards */
  --ink: #1f2420;          /* main text */
  --ink-soft: #5c625c;     /* secondary text */
  --ink-faint: #9a9d96;    /* the grey words in the intro */
  --rule: #d6d6cd;         /* thin divider lines */
  --accent: #2f4a3a;       /* deep pitch green */

  /* Status badge dot colors */
  --st-live: #2f7a4f;
  --st-auto: #2f4a3a;
  --st-partial: #b7832f;
  --st-testing: #4a6d8c;
  --st-pilot: #7a5c8c;
  --st-ready: #6b7a3a;
  --st-dev: #4a6d8c;

  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --width: 1040px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.wrap { max-width: var(--width); margin: 0 auto; padding: 0 24px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; background: var(--ink); color: var(--paper); padding: 8px 12px; }

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

/* Small typewriter-style label, used all over */
.label {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Header ---------- */

/* The header stays pinned to the top of the window while you scroll ("sticky"). */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 22px 0 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

/* Leave room for the pinned header when a link jumps to a section, like /work/#lead-funnel */
[id] { scroll-margin-top: 110px; }
.brand { text-decoration: none; }
.brand-name { display: block; font-weight: 600; font-size: 18px; color: var(--accent); }
.brand-tag {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.site-nav { display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 15px; }
.site-nav a { text-decoration: none; padding-bottom: 2px; border-bottom: 1px solid transparent; }
.site-nav a:hover { color: var(--accent); border-color: var(--accent); }
.site-nav a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }

/* ---------- Home intro (the big serif paragraph) ---------- */

.intro { padding: 72px 0 24px; max-width: 900px; }
.intro p {
  font-family: var(--serif);
  font-size: clamp(28px, 4.2vw, 44px);
  line-height: 1.22;
  letter-spacing: -0.01em;
  color: var(--ink-faint);
  margin: 0 0 0.8em;
}
.intro strong { font-weight: 400; color: var(--ink); }
.intro em { font-style: italic; color: var(--ink); }

/* ---------- Page intros (Work, Playbook, About, Writing) ---------- */

.page-intro { padding: 56px 0 8px; }
.page-intro h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 6px 0 12px;
}
.page-intro .lede { font-size: 19px; max-width: 720px; }

/* ---------- Sections ---------- */

.section { padding: 56px 0 8px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  border-top: 1px solid var(--ink);
  padding-top: 26px;
  margin-bottom: 8px;
}
.section-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 4.4vw, 44px);
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin: 0;
}
.section-note { color: var(--ink-soft); font-size: 15px; margin: 0; }
.lede { max-width: 680px; color: var(--ink-soft); margin: 12px 0 24px; }
.more-link { margin: 20px 0 0; font-size: 15px; }
.more-link a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 2px; }

/* ---------- Status badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
  border: 1px solid var(--rule);
  background: var(--paper);
  padding: 3px 8px;
}
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.badge[data-status="live"]::before { background: var(--st-live); }
.badge[data-status="auto"]::before { background: var(--st-auto); }
.badge[data-status="partial"]::before { background: var(--st-partial); }
.badge[data-status="testing"]::before { background: var(--st-testing); }
.badge[data-status="pilot"]::before { background: var(--st-pilot); }
.badge[data-status="ready"]::before { background: var(--st-ready); }
.badge[data-status="dev"]::before { background: var(--st-dev); }

/* ---------- Home: selected work cards ---------- */

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 22px 24px;
  text-decoration: none;
}
.card:hover { border-color: var(--accent); }
.card:hover .card-more { text-decoration: underline; text-underline-offset: 4px; }
.card.feature { background: var(--panel); border-top: 3px solid var(--accent); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 24px; }
.card-title { font-family: var(--serif); font-size: 27px; line-height: 1.2; }
.card-line { color: var(--ink-soft); }
.card-more { margin-top: auto; padding-top: 6px; font-size: 15px; color: var(--accent); }

/* ---------- Principles grid (How I work, workspace) ---------- */

.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 40px;
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
.principles li { border-top: 1px solid var(--rule); padding: 20px 0 24px; }
.principles h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.2; margin: 0 0 8px; }
.principles p { margin: 0; color: var(--ink-soft); font-size: 16px; }

/* ---------- Quotes ---------- */

.quotes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 40px; margin-top: 20px; }
.quotes figure { margin: 0; }
.quotes blockquote { margin: 0 0 14px; font-family: var(--serif); font-size: 22px; line-height: 1.35; }
.quotes figcaption { font-size: 14px; color: var(--ink-soft); }
.quotes figcaption strong { color: var(--ink); font-weight: 500; display: block; }

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

.timeline { list-style: none; margin: 12px 0 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 140px 1fr 1.3fr;
  gap: 4px 32px;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}
.timeline li:last-child { border-bottom: 1px solid var(--rule); }
.timeline .years { font-family: var(--mono); font-size: 14px; color: var(--ink-soft); padding-top: 2px; }
.timeline .org { font-weight: 500; }
.timeline .role { color: var(--ink-soft); }

/* ---------- Work: case studies ---------- */

.case {
  border-top: 1px solid var(--rule);
  padding: 32px 0 36px;
}
.section-head + .case { border-top: 0; padding-top: 16px; }
.case-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.case-head h3 { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.15; margin: 4px 0 0; }
.case-head .badge { margin-top: 10px; }
.case-line { color: var(--ink-soft); font-size: 18px; margin: 8px 0 22px; max-width: 720px; }

.case-body, .three {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 40px;
  margin: 0;
}
.case-body.three { grid-template-columns: repeat(3, 1fr); }
.case-body dt, .play-body dt {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.case-body dd, .play-body dd { margin: 0; font-size: 16px; }
.page-intro .case-body { margin-top: 28px; }

.tools { margin: 24px 0 0; font-size: 14px; color: var(--ink-soft); display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.tools .label { display: inline; color: var(--accent); }
.tools a { color: var(--accent); font-size: 15px; text-underline-offset: 3px; }

/* ---------- Playbook: anatomy, sample play, skills, loop ---------- */

.anatomy {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.anatomy li { background: var(--paper); padding: 14px 16px; font-size: 15px; }
.anatomy .label { color: var(--accent); margin-bottom: 4px; }

.play { background: #fff; border: 1px solid var(--rule); box-shadow: 4px 4px 0 var(--panel); max-width: 820px; margin-top: 16px; }
.play-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--rule); }
.play-title { display: block; font-family: var(--serif); font-size: 28px; line-height: 1.2; margin-top: 4px; }
.play-body { margin: 0; }
.play-body > div { padding: 14px 24px; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 110px 1fr; gap: 16px; }
.play-body > div:last-child { border-bottom: 0; }
.play-body dt { margin: 3px 0 0; }
.play-body ol { margin: 0; padding-left: 20px; }
.play-body li { margin-bottom: 4px; }

.ai-list { list-style: none; margin: 0; padding: 0; }
.ai-list li { display: grid; grid-template-columns: 1fr 1.6fr; gap: 6px 32px; padding: 16px 0; border-top: 1px solid var(--rule); }
.ai-list li:last-child { border-bottom: 1px solid var(--rule); }
.ai-name { font-weight: 500; }
.ai-flow { color: var(--ink-soft); font-size: 16px; }
.ai-flow .arrow { color: var(--accent); padding: 0 4px; }

.loop { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.loop li { position: relative; background: var(--panel); border: 1px solid var(--rule); padding: 14px 14px 16px; font-size: 15px; color: var(--ink-soft); }
.loop li strong { display: block; color: var(--ink); font-weight: 500; margin: 2px 0 4px; }
.loop li:not(:last-child)::after {
  content: "\2192";
  position: absolute;
  right: -11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  background: var(--paper);
  font-size: 14px;
  line-height: 1;
  padding: 2px 0;
  z-index: 1;
}

.guardrail-list { columns: 2; column-gap: 40px; padding-left: 18px; margin: 16px 0 0; }
.guardrail-list li { break-inside: avoid; margin-bottom: 10px; }

/* ---------- About ---------- */

.about-grid { display: grid; grid-template-columns: 1fr 280px; gap: 56px; align-items: start; margin-top: 12px; }
.about-text p { margin: 0 0 1em; max-width: 640px; }
.about-lead { font-family: var(--serif); font-size: clamp(22px, 2.6vw, 28px); line-height: 1.35; }
/* The photo column is a fixed 280px wide on desktop; change it in .about-grid above. */
.photo { width: 100%; max-width: 280px; height: auto; aspect-ratio: 4 / 5; object-fit: cover; display: block; border: 1px solid var(--rule); }

.sub-label { margin: 28px 0 8px; font-weight: 400; }
.stat-list { list-style: none; margin: 0; padding: 0; max-width: 640px; }
.stat-list li { display: flex; gap: 16px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--rule); }
.stat-list li:last-child { border-bottom: 1px solid var(--rule); }
.stat-list .num { font-family: var(--serif); font-size: 30px; min-width: 64px; color: var(--accent); }
.stat-list em { color: var(--ink-soft); }

.epigraph { padding: 64px 0 16px; text-align: center; }
.epigraph blockquote { font-family: var(--serif); font-style: italic; font-size: 26px; margin: 0 auto 8px; max-width: 640px; line-height: 1.35; }
.epigraph cite { font-style: normal; font-size: 14px; color: var(--ink-soft); }

/* ---------- Writing ---------- */

.post-list { list-style: none; margin: 24px 0 0; padding: 0; }
.post-list li { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.post-list a { display: block; padding: 20px 0; text-decoration: none; }
.post-list a:hover .post-title { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.post-title { display: block; font-family: var(--serif); font-size: 26px; line-height: 1.25; margin-top: 4px; }
.draft-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 1px 6px;
  margin-left: 8px;
  vertical-align: 2px;
}

.article { max-width: 680px; padding: 56px 0 24px; }
.article h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 5vw, 48px); line-height: 1.12; letter-spacing: -0.015em; margin: 10px 0 24px; }
.article p, .article li { font-size: 18px; line-height: 1.7; }
.article h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 40px 0 8px; }
.article .back { font-size: 15px; color: var(--accent); }
.article .label { margin-top: 24px; }
.draft-note { background: var(--panel); border-left: 3px solid var(--accent); padding: 12px 16px; font-size: 15px; color: var(--ink-soft); }

/* ---------- Footer (contact, every page) ---------- */

.site-footer { margin-top: 80px; border-top: 1px solid var(--ink); padding: 48px 0 32px; }
.contact-line { font-family: var(--serif); font-size: clamp(26px, 3.6vw, 36px); line-height: 1.25; max-width: 760px; margin: 0 0 22px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.contact-links a { border-bottom: 1px solid var(--ink); text-decoration: none; padding-bottom: 2px; }
.contact-links a:hover { color: var(--accent); border-color: var(--accent); }
.fine-print {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 48px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Phones and small screens ---------- */

@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .site-header { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 0 12px; }
  .brand-tag { display: none; }   /* keeps the pinned header short on phones */
  .site-nav { gap: 4px 14px; font-size: 15px; }
  [id] { scroll-margin-top: 132px; }   /* room for a two-line menu on narrow phones */
  .intro { padding: 44px 0 16px; }
  .page-intro { padding: 40px 0 8px; }
  .section-head { flex-direction: column; gap: 4px; }
  .cards, .principles, .quotes, .about-grid,
  .case-body, .case-body.three { grid-template-columns: 1fr; }
  .timeline li, .ai-list li { grid-template-columns: 1fr; }
  .case-head { flex-direction: column; gap: 8px; }
  .case-head .badge { margin-top: 0; }
  .case-head h3 { font-size: 27px; }
  .anatomy { grid-template-columns: 1fr 1fr; }
  .loop { grid-template-columns: 1fr; gap: 14px; }
  .loop li:not(:last-child)::after { content: "\2193"; right: auto; left: 18px; top: auto; bottom: -13px; transform: none; }
  .play-head { flex-direction: column; }
  .play-body > div { grid-template-columns: 1fr; gap: 4px; padding: 14px 18px; }
  .guardrail-list { columns: 1; }
  .photo { max-width: 220px; }
}

/* ---------- Essays ---------- */

.post-dek { display: block; color: var(--ink-soft); margin-top: 6px; max-width: 640px; }
.essay h2 { margin-top: 48px; }
.essay ul { padding-left: 22px; }
.essay li { margin-bottom: 10px; }
.essay a:not(.back) { color: var(--accent); text-underline-offset: 3px; }
.essay blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.5;
  color: var(--ink);
}
.essay blockquote p { font-size: inherit; margin: 0; }
.essay-cont { padding-top: 8px; }

/* ---------- Architecture diagram (in "The Club Platform I Keep Sketching") ---------- */

.arch { max-width: 860px; margin: 8px 0 8px; padding: 0; }
.arch-row { display: grid; gap: 10px; }
.arch-people { grid-template-columns: repeat(3, 1fr); }
.arch-outside { grid-template-columns: repeat(4, 1fr); }
.arch-box {
  background: #fff;
  border: 1px solid var(--rule);
  padding: 12px 14px;
  text-align: center;
  font-weight: 500;
  font-size: 15px;
}
.arch-box span { display: block; font-weight: 400; font-size: 13px; color: var(--ink-soft); }
.arch-link {
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--accent);
  padding: 8px 0;
}
.arch-ai { background: var(--accent); color: var(--paper); padding: 14px 18px; text-align: center; }
.arch-ai strong { display: block; font-weight: 500; }
.arch-ai span { font-size: 14px; opacity: 0.85; }
.arch-group { border: 1px solid var(--rule); background: var(--panel); padding: 14px 16px 16px; }
.arch-group > .label { margin-bottom: 10px; color: var(--accent); }
.arch-modules {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.arch-modules li { background: var(--card); border: 1px solid var(--rule); padding: 8px 10px; font-size: 14px; }
.arch-core { background: #e9eef0; }
.arch-core-lead { font-size: 15px; margin: 0 0 12px; }
.arch-entities {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.arch-entities li { background: #fff; border: 1px solid var(--rule); padding: 10px 12px; font-size: 13px; color: var(--ink-soft); }
.arch-entities strong { display: block; color: var(--ink); font-size: 15px; font-weight: 500; margin-bottom: 2px; }
.arch-note { font-size: 13px; color: var(--ink-soft); margin: 12px 0 0; }
.arch figcaption { margin-top: 12px; font-size: 14px; color: var(--ink-soft); }

@media (max-width: 760px) {
  .arch-people { grid-template-columns: 1fr 1fr 1fr; }
  .arch-box { padding: 10px 6px; font-size: 13px; }
  .arch-outside, .arch-modules, .arch-entities { grid-template-columns: 1fr 1fr; }
  .essay blockquote { font-size: 19px; }
}
