/* ============================================================
   Bryan Kreitlow — CTO Web Resume
   Style: "Ink & rule" — burnt-orange marker, dates timeline rail
   Font: Avenir Next (macOS) with Mulish (Google Fonts) fallback
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #faf9f7;
  --ink: #1f1c1a;
  --muted: #5f5a53;
  --rule: #e2ded8;
  --accent: #b3541e;          /* 5.0:1 on white */
  --accent-strong: #96451a;
  --focus: #1a6fb5;
  --container: 54rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #171514;
    --surface: #1f1c1a;
    --ink: #ece9e6;
    --muted: #a8a29a;
    --rule: #35322e;
    --accent: #e07b3f;        /* 6.0:1 on #171514 */
    --accent-strong: #f0955c;
    --focus: #7db8e8;
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  font-family: 'Avenir Next', 'Avenir', 'Mulish', system-ui, -apple-system, sans-serif;
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}

main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* ---------- Accessibility helpers ---------- */

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  a { transition: color 120ms ease; }
}

/* ---------- Masthead ---------- */

.masthead {
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem) 1.5rem 1.5rem;
}

.masthead-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.masthead h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
  padding-left: 0.9rem;
  border-left: 6px solid var(--accent);
}

.tagline {
  margin: 0.5rem 0 0.75rem;
  padding-left: calc(0.9rem + 6px);
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  font-weight: 600;
  color: var(--accent);
}

.contact {
  font-style: normal;
  font-size: 0.85rem;
  color: var(--muted);
  padding-left: calc(0.9rem + 6px);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}

.contact a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 3px; }
.contact a:hover, .contact a:focus { color: var(--accent-strong); text-decoration-color: currentColor; }

.print-button {
  flex: none;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}
.print-button:hover { background: var(--surface); }

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

section { margin-top: 2.5rem; }

h2 {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin: 0 0 1.1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

.summary { margin: 0; max-width: 46rem; }

/* ---------- Entries (dates rail) ---------- */

.entry {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0 1.4rem;
  padding: 1.1rem 0 1.3rem;
  break-inside: avoid;
}

.entry + .entry { border-top: 1px solid var(--rule); }

.when {
  text-align: right;
  border-right: 1px solid var(--rule);
  padding-right: 1.25rem;
  padding-top: 0.15rem;
}
.when p { margin: 0; font-size: 0.78rem; color: var(--muted); }

.what { min-width: 0; }

h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  break-after: avoid;
}
h3 .org { font-weight: 600; color: var(--accent-strong); }

.meta {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.what ul {
  margin: 0.55rem 0 0;
  padding-left: 1.1rem;
}
.what li { margin: 0.3rem 0; }
.what li::marker { color: var(--accent); }

/* ---------- Skills ---------- */

.skills { margin: 0; }

.skill-row {
  display: grid;
  grid-template-columns: 14rem 1fr;
  gap: 0 1.75rem;
  padding: 0.5rem 0;
  break-inside: avoid;
}
.skill-row + .skill-row { border-top: 1px solid var(--rule); }

.skills dt {
  font-weight: 700;
  font-size: 0.9rem;
}
.skills dd {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- Footer ---------- */

.colophon {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2.5rem;
  border-top: 1px solid var(--rule);
}
.colophon p { margin: 0; font-size: 0.8rem; color: var(--muted); }

/* ---------- Narrow screens ---------- */

@media (max-width: 40rem) {
  .masthead-inner { flex-direction: column; }
  .entry { grid-template-columns: 1fr; gap: 0.25rem; }
  .when {
    text-align: left;
    border-right: 0;
    border-left: 3px solid var(--accent);
    padding: 0 0 0 0.6rem;
  }
  .skill-row { grid-template-columns: 1fr; gap: 0.1rem; }
  .skills dd { margin-bottom: 0.3rem; }
}

/* ---------- Print: always light, letter, 2 pages ---------- */

@page { size: letter; margin: 0.55in 0.65in; }

@media print {
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #ffffff;
    --ink: #1a1a1a;
    --muted: #4a4a4a;
    --rule: #cccccc;
    --accent: #96451a;
    --accent-strong: #7a3a15;
  }

  html, body { background: #fff; }
  body {
    font-size: 9.2pt;
    line-height: 1.32;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .skip-link, .print-button { display: none !important; }

  .masthead { padding: 0 0 0.45rem; max-width: none; }
  .masthead h1 { font-size: 19pt; }
  .tagline { font-size: 10pt; margin: 0.25rem 0 0.4rem; }
  .contact { font-size: 8.2pt; }
  main { max-width: none; padding: 0; }
  section { margin-top: 0.7rem; }

  .entry { padding: 0.28rem 0 0.38rem; break-inside: avoid; }
  .entry .when p { font-size: 8pt; }
  h2 { margin-bottom: 0.35rem; padding-bottom: 0.18rem; }
  .entry { grid-template-columns: 7.8rem 1fr; }
  .skill-row { grid-template-columns: 8.2rem 1fr; }
  h3 { font-size: 10.2pt; break-after: avoid; }
  .meta { font-size: 8.1pt; }
  .what ul { margin-top: 0.25rem; }
  .what li { margin: 0; }
  .skill-row { padding: 0.22rem 0; }

  .contact a { color: var(--ink); text-decoration: none; }

  .colophon { max-width: none; padding: 0.6rem 0 0; }
}
