/* Layout: a strict square grid. Everything on the page is a tile. Color blocks carry meaning
   (cobalt = leadership and scope, orange = results and delivery, teal = technology,
   mustard = community and credentials) and neutral tiles carry reading text. */
:root {
  --bg: #F2EFE8;
  --fg: #17181B;
  --muted: #55575E;
  --tile: #E2DED3;
  --orange: #FF5A1F;
  --cobalt: #2A4BFF;
  --mustard: #F5B700;
  --teal: #00A99D;
  --paper: #F2EFE8;
  --ink: #17181B;
  --display: "Dela Gothic One", "Arial Black", Impact, sans-serif;
  --body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141518;
    --fg: #F2EFE8;
    --muted: #A9AAB0;
    --tile: #232428;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141518;
  --fg: #F2EFE8;
  --muted: #A9AAB0;
  --tile: #232428;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  padding-inline: 16px;
  padding-block: 0 3rem;
}
.wrap { max-width: 1200px; margin-inline: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
.start :focus-visible, .contact :focus-visible, .cobalt :focus-visible { outline-color: #fff; }

.label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
}
h1, h2, h3 { font-family: var(--display); font-weight: 400; text-transform: uppercase; margin: 0; text-wrap: balance; }
h4 { font-family: var(--body); font-weight: 600; margin: 0; text-wrap: balance; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding-block: 0.6rem;
}
.nav ul { display: flex; gap: 4px; }
/* Phones: five compact tiles share one row so the sticky bar stays short. */
.nav li { flex: 1 1 auto; }
.nav a {
  display: block;
  text-decoration: none;
  text-align: center;
  background: var(--tile);
  padding: 0.7rem 0.3rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}
.nav a:hover { background: var(--fg); color: var(--bg); }
.nav li:nth-child(5) a { background: var(--orange); color: var(--ink); }
.nav li:nth-child(5) a:hover { background: var(--fg); color: var(--bg); }

section { scroll-margin-top: 4rem; }
.section { padding-top: 3.5rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
.section-head { display: grid; gap: 0.5rem; }
.section-head h2 { font-size: clamp(1.9rem, 6vw, 3.4rem); line-height: 1; }
.section-head p { color: var(--muted); max-width: 60ch; }

/* Hero */
.hero { padding-top: 1.5rem; display: grid; gap: 4px; grid-template-columns: minmax(0, 1fr); }
.name-tile { background: var(--tile); padding: clamp(1rem, 3vw, 2rem); display: grid; gap: 1.25rem; align-content: space-between; min-width: 0; }
.name-tile h1 { font-size: clamp(2.2rem, 10.5vw, 6.4rem); line-height: 0.92; letter-spacing: -0.01em; }
.name-tile h1 span { display: block; }
.intro { max-width: 52ch; font-size: 1.05rem; }
.roles { display: flex; flex-wrap: wrap; gap: 4px; }
.roles li { padding: 0.5rem 0.75rem; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500; }
.roles li:nth-child(1) { background: var(--orange); color: var(--ink); }
.roles li:nth-child(2) { background: var(--cobalt); color: #fff; }
.roles li:nth-child(3) { background: var(--mustard); color: var(--ink); }
.roles li:nth-child(4) { background: var(--teal); color: var(--ink); }

.start { background: var(--cobalt); color: #fff; padding: clamp(1rem, 3vw, 1.75rem); display: grid; gap: 1rem; align-content: start; min-width: 0; }
.start h2 { font-size: 1.5rem; line-height: 1.05; }
/* One two-column grid for all three metrics. The first column sizes to the widest number,
   so a number can never run into its caption whatever font renders. */
.start dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); row-gap: 0.5rem; }
.start dl div { display: contents; }
.start dt, .start dd { border-top: 2px solid rgba(255,255,255,0.35); padding-top: 0.5rem; }
.start dt { font-family: var(--display); font-size: 1.5rem; line-height: 1.3; padding-right: 0.9rem; }
.start dd { margin: 0; font-size: 0.92rem; }
.now { font-size: 0.95rem; }

.btns { display: flex; flex-wrap: wrap; gap: 4px; }
.btn {
  display: inline-block;
  text-decoration: none;
  padding: 0.75rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.btn:hover { transform: translate(-2px, -2px); }
.btn.alt { background: transparent; color: inherit; border-color: currentColor; }
button.btn { font-size: 0.78rem; }

/* Mosaic */
.mosaic-wrap { margin-top: 4px; display: grid; gap: 0.5rem; }
.mosaic {
  display: grid;
  grid-template-columns: repeat(var(--cols, 8), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 4), minmax(0, 1fr));
  aspect-ratio: var(--cols, 8) / var(--rows, 4);
  overflow: hidden;
  background: var(--bg);
}
.mosaic div { outline: 2px solid var(--bg); outline-offset: -1px; }
.shuffle-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.shuffle-row .label { color: var(--muted); }
.shuffle { font: inherit; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 500; background: var(--fg); color: var(--bg); border: 0; padding: 0.55rem 0.9rem; cursor: pointer; }
.shuffle:hover { background: var(--orange); color: var(--ink); }

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.legend li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.legend i { width: 0.9rem; height: 0.9rem; display: block; background: var(--c); }

/* Impact tiles */
.impact { display: grid; gap: 4px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat {
  container-type: inline-size;
  aspect-ratio: 1 / 1;
  background: var(--c);
  color: var(--on);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}
.stat b { font-family: var(--display); font-weight: 400; font-size: 17cqi; line-height: 1; letter-spacing: -0.01em; }
.stat span { font-size: clamp(0.72rem, 7.2cqi, 0.98rem); line-height: 1.3; }
.orange { --c: var(--orange); --on: var(--ink); }
.cobalt { --c: var(--cobalt); --on: #fff; }
.teal { --c: var(--teal); --on: var(--ink); }
.mustard { --c: var(--mustard); --on: var(--ink); }

/* Experience */
.roles-list { display: grid; gap: 4px; }
.role { display: grid; gap: 4px; grid-template-columns: minmax(0, 1fr); }
.role-head { container-type: inline-size; background: var(--c); color: var(--on); padding: 1.1rem; display: grid; gap: 0.35rem; align-content: start; min-width: 0; }
/* The company name never wraps: it shrinks with its tile instead. 10.5cqi fits ten capitals of the display face. */
.role-head h3 { font-size: min(1.7rem, 10.5cqi); line-height: 1; white-space: nowrap; }
.role-body { background: var(--tile); padding: 1.1rem; display: grid; gap: 1.5rem; min-width: 0; }
.job { display: grid; gap: 0.6rem; }
.job header { display: grid; gap: 0.15rem; }
.job header .label { color: var(--muted); }
.job h4 { font-size: 1.15rem; }
.job li { position: relative; padding-left: 1.25rem; margin-top: 0.45rem; max-width: 70ch; }
.job li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 0.55rem; height: 0.55rem; background: var(--c); }
.job + .job { border-top: 2px solid var(--bg); padding-top: 1.25rem; }

/* Skills */
.skills { display: grid; gap: 4px; grid-template-columns: minmax(0, 1fr); }
.skill { background: var(--c); color: var(--on); padding: 1.1rem; display: grid; gap: 0.85rem; align-content: start; min-width: 0; }
.skill h3 { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chips li { border: 2px solid currentColor; padding: 0.2rem 0.55rem; font-size: 0.9rem; line-height: 1.35; }
.edu { display: grid; gap: 4px; grid-template-columns: minmax(0, 1fr); }
.edu li { background: var(--mustard); color: var(--ink); padding: 1rem 1.1rem; display: grid; gap: 0.2rem; align-content: start; }
.edu strong { font-weight: 600; }

/* About and contact */
.about { display: grid; gap: 4px; grid-template-columns: minmax(0, 1fr); }
.about-text { background: var(--tile); padding: clamp(1.1rem, 3vw, 2rem); display: grid; gap: 1rem; align-content: start; min-width: 0; }
.about-text p { max-width: 62ch; }
.hoa { background: var(--mustard); color: var(--ink); padding: clamp(1.1rem, 3vw, 2rem); display: grid; gap: 0.75rem; align-content: space-between; min-width: 0; }
.hoa b { font-family: var(--display); font-weight: 400; font-size: clamp(2.6rem, 9vw, 4.4rem); line-height: 1; }
.contact { background: var(--cobalt); color: #fff; padding: clamp(1.25rem, 4vw, 2.5rem); display: grid; gap: 1.25rem; min-width: 0; }
.contact h2 { font-size: clamp(2rem, 8vw, 4.4rem); line-height: 0.95; }
.contact p { max-width: 50ch; }

/* Contact form */
.form { display: grid; gap: 0.9rem; max-width: 40rem; }
.form .field { display: grid; gap: 0.35rem; }
.form input, .form textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: 0.65rem 0.75rem;
}
.form textarea { resize: vertical; min-height: 7rem; }
.form input:focus-visible, .form textarea:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.form .cf-turnstile { min-height: 65px; }

/* Form results: shown by the #success, #error and #invalid hashes the handler redirects to */
.result { display: none; background: var(--paper); color: var(--ink); border-left: 12px solid var(--c); padding: 1.1rem 1.25rem; gap: 0.6rem; scroll-margin-top: 5rem; max-width: 40rem; }
.result:target { display: grid; }
.result h3 { font-size: 1.4rem; line-height: 1.05; }
.result a { font-weight: 600; }
#success { --c: var(--teal); }
#error, #invalid { --c: var(--orange); }

footer { padding-top: 2rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--muted); }

@media (min-width: 640px) {
  .nav ul { flex-wrap: wrap; }
  .nav li { flex: 0 0 auto; }
  .nav a { padding: 0.55rem 0.85rem; font-size: 0.72rem; letter-spacing: 0.1em; text-align: left; }
  .impact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .skills { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .edu { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { padding: 1.1rem; }
}
@media (min-width: 880px) {
  .hero { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .role { grid-template-columns: 18rem minmax(0, 1fr); }
  .about { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .role-head, .role-body { padding: 1.4rem; }
}
@media (max-width: 359px) {
  .section-head h2 { font-size: 1.55rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
  .btn:hover { transform: none; }
}

/* Print: the page becomes a plain, text-first CV. The PDF download is exported from this view. */
.print-only { display: none; }
@media print {
  @page { size: Letter; margin: 0.5in 0.6in; }
  :root, :root[data-theme] { --bg: #fff; --fg: #111; --muted: #444; --tile: #fff; color-scheme: light; }
  html { scroll-behavior: auto; }
  body { padding: 0; background: #fff; color: #111; font-size: 9.25pt; line-height: 1.36; }
  .nav, .mosaic-wrap, .legend, #contact, footer, .start, .btns, .about-text, #about .section-head,
  .section-head h2, .section-head p { display: none; }
  .print-only { display: block; font: 500 8pt "DM Mono", monospace; letter-spacing: 0.06em; color: #444; }
  a { text-decoration: none; }

  .hero { display: block; padding: 0; }
  .name-tile { background: none; padding: 0; gap: 4pt; }
  .name-tile h1 { font-size: 30pt; line-height: 1; letter-spacing: -0.01em; }
  .name-tile h1 span { display: inline; }
  .intro { max-width: none; font-size: 9.25pt; }
  .roles { display: block; }
  .roles li { display: inline; background: none !important; color: #111 !important; padding: 0; font: 500 7pt "DM Mono", monospace; letter-spacing: 0.04em; }
  .roles li:not(:last-child)::after { content: "  |  "; }

  .section { padding-top: 10pt; gap: 5pt; }
  .section-head { display: block; }
  .section-head .label, .hoa .label { display: block; font: 500 8.5pt "DM Mono", monospace; letter-spacing: 0.14em; color: #111; border-bottom: 1.5pt solid #111; padding-bottom: 3pt; }

  .impact { grid-template-columns: repeat(4, 1fr); gap: 6pt 10pt; }
  .stat { container-type: normal; aspect-ratio: auto; background: none; color: #111; padding: 0 0 0 6pt; gap: 1pt; border-left: 3pt solid var(--c); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .stat b { font-size: 15pt; }
  .stat span { font-size: 8pt; line-height: 1.25; }

  .roles-list { gap: 7pt; }
  .role { display: block; }
  .role-head { container-type: normal; display: flex; flex-wrap: wrap; align-items: baseline; gap: 1pt 10pt; background: none; color: #111; padding: 0 0 3pt; border-bottom: 0.5pt solid #bbb; break-after: avoid; }
  .role-head h3 { font-size: 12pt; white-space: normal; }
  .role-head .label { color: #444; }
  .role-body { background: none; padding: 4pt 0 0; gap: 5pt; }
  .job + .job { border-top: 0; padding-top: 3pt; }
  .job h4 { font-size: 10pt; break-after: avoid; }
  .job header { break-after: avoid; }
  .job li { margin-top: 2pt; padding-left: 10pt; max-width: none; break-inside: avoid; }
  .job li::before { width: 4pt; height: 4pt; print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  .skills { display: block; }
  .skill { display: block; background: none; color: #111; padding: 0; margin-top: 3pt; break-inside: avoid; }
  .skill h3 { display: inline; font: 500 8pt "DM Mono", monospace; letter-spacing: 0.08em; }
  .skill h3::after { content: ": "; }
  .chips { display: inline; }
  .chips li { display: inline; border: 0; padding: 0; font-size: 9.5pt; }
  .chips li:not(:last-child)::after { content: ", "; }
  .edu { display: block; margin-top: 4pt; }
  .edu li { display: block; background: none; padding: 0; margin-top: 2pt; }
  .edu li > * { display: inline; }
  .edu .label { margin-right: 6pt; color: #444; }
  .edu span:last-child::before { content: " | "; }

  .about { display: block; }
  .hoa { display: block; background: none; padding: 0; color: #111; }
  .hoa b { display: inline; font-size: 14pt; margin-right: 6pt; }
  .hoa p { display: inline; }
}
