/* Dave Peckham — CV (shared stylesheet for the HTML versions)
   Mirrors the design tokens in dave-peckham-cv.typ. */

:root {
  --ink: #1b2430;
  --muted: #5b6675;
  --rule: #d9dee5;
  --paper: #ffffff;
  --chip-bg: #f2f4f7;
  --side-bg: #16202c;
  --side-ink: #e9edf2;
  --side-muted: #9aa7b6;
  --side-chip-rule: rgb(154 167 182 / 0.45);
  --accent: #e8792b; /* rally orange */
  --accent-ink: #b8561a; /* AA-contrast orange for small text on white */

  --sans: "Avenir Next", Avenir, "Helvetica Neue", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --side-w: 17.5rem;
  --pad: clamp(1rem, 4vw, 3rem);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9edf2;
    --muted: #a3afbd;
    --rule: #2b3746;
    --paper: #0d131a;
    --chip-bg: #1c2633;
    --side-bg: #16202c;
    --accent-ink: #f0904a;
    color-scheme: dark;
  }
}

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

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

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

h1, h2, h3, p, ul {
  margin: 0;
}

a {
  color: inherit;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* ─── Layout ───────────────────────────────────────────────────────
   DOM order: identity → main content → sidebar details, so that on
   small screens (and for screen readers) experience comes right after
   the summary. On wide screens identity + details share a dark sidebar. */

.cv {
  display: grid;
  grid-template-columns: 1fr;
  /* Extra height goes to the last (dark) row, never to the header. */
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    "identity"
    "main"
    "details";
  min-height: 100vh;
  min-height: 100dvh;
}

.identity { grid-area: identity; }
.main { grid-area: main; }
.details { grid-area: details; }

.identity,
.details {
  background: var(--side-bg);
  color: var(--side-ink);
  padding-inline: var(--pad);
}

.identity {
  padding-block: 2.25rem 1.75rem;
}

.details {
  padding-block: 0.5rem 2.5rem;
}

.main {
  padding: 2rem var(--pad) 2.5rem;
}

/* Tablet: details become a two-column band under the main column. */
@media (min-width: 40rem) {
  .details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2.5rem;
    align-content: start;
  }
}

/* Desktop: classic sidebar, matching the PDF. */
@media (min-width: 62rem) {
  .cv {
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "identity main"
      "details  main";
  }

  .identity {
    padding: 3rem 2.25rem 0;
  }

  .details {
    display: block;
    padding: 0 2.25rem 3rem;
  }

  .main {
    padding: 3rem clamp(2.5rem, 5vw, 4.5rem) 3.5rem;
    max-width: 52rem;
  }
}

/* ─── Shared bits ──────────────────────────────────────────────── */

.kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

strong,
.em {
  font-weight: 700;
}

.em {
  color: var(--ink);
}

/* ─── Identity ─────────────────────────────────────────────────── */

.name {
  font-size: clamp(2.5rem, 9vw, 3.1rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.01em;
}

.name span {
  display: block;
}

.name span + span {
  color: var(--accent);
}

.tagline {
  margin-top: 0.9rem;
  color: var(--side-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.tagline span {
  white-space: nowrap;
}

.contact {
  list-style: none;
  padding: 0;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.contact a {
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contact a:hover {
  text-decoration: underline;
}

/* ─── Sidebar details ──────────────────────────────────────────── */

.side-section {
  padding-top: 1.6rem;
}

.side-section > h2 {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.7rem;
}

.side-section > h2::after {
  content: "";
  display: block;
  width: 1.6em;
  height: 2px;
  margin-top: 0.25rem;
  background: var(--accent);
}

.focus-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.side-muted {
  color: var(--side-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.focus-title + .side-muted {
  margin-top: 0.3rem;
}

.chips {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.35rem;
}

.chips li {
  padding: 0.22rem 0.5rem;
  border: 1px solid var(--side-chip-rule);
  border-radius: 3px;
  font-size: 0.8rem;
  line-height: 1.3;
}

.edu {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.edu strong,
.side-strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.3;
}

.edu span {
  display: block;
  color: var(--side-muted);
  font-size: 0.88rem;
}

.beyond {
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Span the wide "beyond work" note across both tablet columns. */
@media (min-width: 40rem) and (max-width: 61.999rem) {
  .details .wide {
    grid-column: 1 / -1;
  }
}

/* ─── Main column ──────────────────────────────────────────────── */

.headline {
  margin-top: 0.4rem;
  font-size: clamp(1.5rem, 4.2vw, 2.05rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.summary {
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.6;
  max-width: 44rem;
}

.summary .em {
  font-weight: 500;
}

.stats {
  list-style: none;
  padding: 1.1rem 0;
  margin-top: 1.6rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem 0.5rem;
  border-block: 1px solid var(--rule);
  text-align: center;
}

@media (min-width: 34rem) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stats b {
  display: block;
  font-size: 1.9rem;
  line-height: 1.1;
  color: var(--accent);
}

.stats span {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.section {
  margin-top: 2.2rem;
}

.section > h2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section > h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.role + .role {
  margin-top: 1.6rem;
}

.role-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.15rem 1rem;
  margin-bottom: 0.3rem;
}

.role-head h3 {
  font-size: 1.1rem;
  line-height: 1.35;
}

.role-head .org {
  font-weight: 500;
  color: var(--accent-ink);
}

.role-head .sep {
  color: var(--muted);
  font-weight: 400;
  padding-inline: 0.3em;
}

.role-head .kicker {
  color: var(--muted);
  font-size: 0.68rem;
}

.role p + .bullets {
  margin-top: 0.6rem;
}

.bullets {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.bullets li {
  position: relative;
  padding-left: 1.15rem;
  line-height: 1.5;
}

.bullets li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.58em;
  width: 0.4rem;
  height: 0.4rem;
  background: var(--accent);
}

.companies {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.companies li {
  padding: 0.35rem 0.65rem;
  border-radius: 3px;
  background: var(--chip-bg);
  font-size: 0.92rem;
  font-weight: 500;
}

/* ─── Print: one tidy page, keep the dark sidebar ─────────────── */

@media print {
  @page {
    size: letter;
    margin: 0;
  }

  :root {
    --ink: #1b2430;
    --muted: #5b6675;
    --rule: #d9dee5;
    --paper: #ffffff;
    --chip-bg: #f2f4f7;
    --accent-ink: #e8792b;
    color-scheme: light;
  }

  html {
    font-size: 10.5px;
  }

  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .skip-link {
    display: none;
  }

  .cv {
    grid-template-columns: 2.55in minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "identity main"
      "details  main";
    min-height: 11in;
  }

  .identity {
    padding: 0.55in 0.36in 0;
  }

  .details {
    display: block;
    padding: 0 0.36in 0.4in;
  }

  .main {
    padding: 0.55in 0.55in 0.4in 0.42in;
    max-width: none;
  }

  .role {
    break-inside: avoid;
  }

  .contact a {
    text-decoration: none;
  }
}
