/* michaelwilli.com
   Palette comes from the portrait: suit navy, shirt white, limestone, tie crimson.
   Type: Libre Caslon Display (headings) and Libre Franklin (text), both self-hosted. */

@font-face {
  font-family: "Libre Caslon Display";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/libre-caslon-display-latin-400.woff2") format("woff2");
}
@font-face {
  font-family: "Libre Franklin";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/libre-franklin-latin-wght.woff2") format("woff2");
}
/* Metric-matched fallbacks, so the page does not jump when the web fonts arrive. */
@font-face {
  font-family: "Caslon Fallback";
  src: local("Georgia");
  size-adjust: 84%;
  ascent-override: 115.5%;
  descent-override: 31.7%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Franklin Fallback";
  src: local("Arial");
  size-adjust: 101.9%;
  ascent-override: 94.8%;
  descent-override: 24.1%;
  line-gap-override: 0%;
}

:root {
  --navy: #18223d;
  --navy-deep: #0f1830;
  --stone: #e7e0d2;
  --stone-soft: #b8bccb;
  --navy-rule: rgba(223, 229, 242, 0.2);
  --shirt: #f6f7f9;
  --ink: #141b2d;
  --slate: #515b73;
  --rule: #d3d8e3;
  --tie: #a01c2f;

  --display: "Libre Caslon Display", "Caslon Fallback", "Big Caslon", Baskerville, Georgia, serif;
  --text: "Libre Franklin", "Franklin Fallback", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4.5vw, 3rem);
}

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

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

body {
  margin: 0;
  background: var(--shirt);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, dl, dd, ol, ul, figure, table { margin: 0; padding: 0; }
ol, ul { list-style: none; }
img { display: block; max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--tie);
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--tie); }
a:focus-visible {
  outline: 2px solid var(--tie);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 0.9rem;
  background: var(--stone);
  color: var(--navy-deep);
  text-decoration: none;
  font-weight: 600;
}
.skip:focus { top: 1rem; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Navy surface ---------- */

.navy {
  color: var(--stone);
  background-color: var(--navy);
}
.navy a { text-decoration-color: rgba(231, 224, 210, 0.55); }
.navy a:hover { color: #fff; text-decoration-color: #fff; }
.navy a:focus-visible { outline-color: var(--stone); }

/* ---------- Navigation ---------- */

.nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.6rem;
}
.brand {
  font-family: var(--display);
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem 1.9rem;
  font-size: 0.95rem;
  font-weight: 500;
}
.nav ul a { text-decoration: none; }
.nav ul a:hover { text-decoration: underline; text-decoration-color: currentColor; }
.nav [aria-current="page"] { text-decoration: underline; text-decoration-color: rgba(231, 224, 210, 0.55); }
.brand[aria-current="page"] { text-decoration: none; }

/* ---------- Hero ---------- */

.hero-grid {
  display: grid;
  gap: 1.75rem;
  padding-block: clamp(1.5rem, 5vw, 3.5rem) clamp(2.5rem, 6vw, 4.5rem);
}
.name {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(4.9rem, 23vw, 7.5rem);
  line-height: 0.92;
  letter-spacing: -0.012em;
  color: #f1ebdf;
}
.intro {
  max-width: 31em;
  font-size: clamp(1.15rem, 4.6vw, 1.3rem);
  line-height: 1.5;
  color: #f1ebdf;
  text-wrap: pretty;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.9rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.82em 1.3em;
  border: 1px solid var(--stone);
  border-radius: 2px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
  color: var(--stone);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn svg { width: 1.05em; height: 1.05em; flex: none; }
.btn-solid { background: var(--stone); color: var(--navy-deep); }
.navy .btn-solid:hover { background: #fff; border-color: #fff; color: var(--navy-deep); }
.navy .btn-line:hover { background: rgba(231, 224, 210, 0.12); color: #fff; }

.portrait img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: 50% 80%;
  background: #2a3454;
}

@media (min-width: 36rem) {
  .portrait { max-width: 21rem; }
  .portrait img { aspect-ratio: 4 / 5; }
}

.terms {
  display: grid;
  margin-top: 0.75rem;
  border-top: 1px solid var(--navy-rule);
  font-size: 0.98rem;
  line-height: 1.45;
}
.terms > div {
  display: grid;
  grid-template-columns: 7.6rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--navy-rule);
}
.terms dt { color: var(--stone-soft); font-weight: 500; }
.terms dd { color: #f1ebdf; }

@media (min-width: 46rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) clamp(15rem, 27vw, 21.5rem);
    grid-template-areas:
      "name portrait"
      "copy portrait"
      "terms terms";
    column-gap: clamp(2rem, 5vw, 4.5rem);
    row-gap: 1.6rem;
    align-items: start;
  }
  .name { grid-area: name; font-size: clamp(5.6rem, 10.6vw, 8.6rem); }
  .hero-copy { grid-area: copy; }
  .intro { font-size: clamp(1.1rem, 1.55vw, 1.35rem); }
  .hero-grid .portrait { grid-area: portrait; max-width: none; margin-top: 0.9rem; }
  .terms { grid-area: terms; margin-top: 2.25rem; }
}
@media (min-width: 62rem) {
  .terms {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, auto);
    grid-auto-flow: column;
    column-gap: clamp(2rem, 5vw, 4.5rem);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .terms > div {
    border-bottom-color: transparent;
    background: linear-gradient(var(--navy-rule), var(--navy-rule)) left bottom / 100% 1px no-repeat;
    animation: rule-in 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .terms > div:nth-child(2) { animation-delay: 0.08s; }
  .terms > div:nth-child(3) { animation-delay: 0.16s; }
  .terms > div:nth-child(4) { animation-delay: 0.24s; }
  .terms > div:nth-child(5) { animation-delay: 0.32s; }
  .terms > div:nth-child(6) { animation-delay: 0.4s; }
  @keyframes rule-in {
    from { background-size: 0% 1px; }
    to { background-size: 100% 1px; }
  }
}

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

.band { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.band-next { padding-top: 0; }
[id] { scroll-margin-top: 1.5rem; }

.h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.25rem, 5.2vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.008em;
  text-wrap: balance;
}
.lead {
  margin-top: 1.25rem;
  max-width: 34em;
  font-size: 1.2rem;
  line-height: 1.5;
}
.navy .h2 { color: #f1ebdf; }

.rows { margin-top: clamp(2rem, 5vw, 3.25rem); border-bottom: 1px solid var(--rule); }
.row {
  display: grid;
  gap: 0.75rem;
  padding-block: 1.75rem;
  border-top: 1px solid var(--rule);
}
.row-label {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.6rem, 2.8vw, 2rem);
  line-height: 1.1;
}
.row-when {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--text);
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--slate);
}
.row-body { max-width: 39em; }
.row-body p + p { margin-top: 0.9em; }

@media (min-width: 50rem) {
  .row {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    column-gap: 2.5rem;
    padding-block: 2.1rem;
  }
}

/* ---------- Companies ledger ---------- */

.ledger {
  width: 100%;
  margin-top: clamp(2rem, 5vw, 3.25rem);
  border-collapse: collapse;
  border-bottom: 1px solid var(--rule);
}
.ledger th, .ledger td {
  padding: 1.5rem 2rem 1.5rem 0;
  border-top: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
  font-weight: 400;
}
.ledger th:last-child, .ledger td:last-child { padding-right: 0; }
.ledger thead th {
  padding-block: 0 0.7rem;
  border-top: 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--slate);
}
.ledger tbody th {
  width: 28%;
  font-family: var(--display);
  font-size: clamp(1.6rem, 2.4vw, 1.9rem);
  line-height: 1.1;
}
.ledger .what { width: 32%; }

@media (max-width: 49.99rem) {
  .ledger, .ledger tbody, .ledger tr, .ledger th, .ledger td { display: block; width: auto; }
  .ledger thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .ledger tr { padding-block: 1.6rem; border-top: 1px solid var(--rule); }
  .ledger th, .ledger td { padding: 0; border: 0; }
  .ledger tbody th { width: auto; }
  .ledger td { margin-top: 0.55rem; }
  .ledger .what { width: auto; }
}

.after { margin-top: 1.75rem; max-width: 39em; }

/* ---------- Training band ---------- */

.training-grid {
  display: grid;
  gap: 3rem;
  margin-top: clamp(2.25rem, 5vw, 3.5rem);
}
.h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.75rem, 3vw, 2.2rem);
  line-height: 1.1;
}
.navy .h3 { color: #f1ebdf; }
.status { margin-top: 0.5rem; font-size: 0.95rem; color: var(--stone-soft); }
.block-copy { margin-top: 1.1rem; max-width: 37em; }
.block-copy + .block-copy { margin-top: 0.9em; }

.modules {
  margin-top: 1.75rem;
  counter-reset: module;
  border-bottom: 1px solid var(--navy-rule);
}
.modules li {
  counter-increment: module;
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  column-gap: 0.75rem;
  padding-block: 0.95rem;
  border-top: 1px solid var(--navy-rule);
  font-size: 0.98rem;
  line-height: 1.5;
}
.modules li::before {
  content: counter(module);
  font-family: var(--display);
  font-size: 1.7rem;
  line-height: 1;
  color: var(--stone-soft);
}
.modules strong { display: block; font-weight: 600; color: #f1ebdf; }

.certs { margin-top: 1.5rem; border-bottom: 1px solid var(--navy-rule); }
.certs li { padding-block: 1.05rem; border-top: 1px solid var(--navy-rule); }
.certs strong { display: block; font-weight: 600; color: #f1ebdf; }
.certs span { display: block; font-size: 0.95rem; color: var(--stone-soft); }
.certs p { margin-top: 0.45rem; font-size: 0.98rem; line-height: 1.5; }
.aside-block + .aside-block { margin-top: 2.75rem; }

@media (min-width: 62rem) {
  .training-grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    column-gap: clamp(3rem, 7vw, 6rem);
  }
}

/* ---------- Education and outside of work ---------- */

.pair { display: grid; gap: 3.25rem; }
.pair .h2 { font-size: clamp(2rem, 4vw, 2.75rem); }
.plain { margin-top: 1.5rem; border-bottom: 1px solid var(--rule); }
.plain li { padding-block: 0.95rem; border-top: 1px solid var(--rule); max-width: none; }
@media (min-width: 56rem) {
  .pair { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: clamp(3rem, 7vw, 6rem); }
}

/* ---------- Connect and footer ---------- */

.connect { padding-block: clamp(4rem, 10vw, 7.5rem) 0; }
.connect .h2 { font-size: clamp(3.4rem, 11vw, 7.5rem); line-height: 0.95; }
.connect .lead { color: var(--stone); }
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-top: clamp(3.5rem, 8vw, 6rem);
  padding-block: 1.5rem 2rem;
  border-top: 1px solid var(--navy-rule);
  font-size: 0.9rem;
  color: var(--stone-soft);
}
.foot p { max-width: 38em; }
.foot ul { display: flex; flex-wrap: wrap; gap: 0.35rem 1.4rem; }

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

.page-head { padding-block: clamp(1.5rem, 5vw, 3rem) clamp(2.75rem, 6vw, 4.5rem); }
.page-head-grid { display: grid; gap: 2rem; align-items: center; }
.page-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3rem, 9vw, 6rem);
  line-height: 0.98;
  letter-spacing: -0.01em;
  color: #f1ebdf;
  text-wrap: balance;
}
.page-lead { margin-top: 1.4rem; max-width: 33em; font-size: 1.2rem; line-height: 1.5; }
.page-head .portrait { max-width: 13.5rem; }
.page-head .portrait img { aspect-ratio: 4 / 5; }
@media (min-width: 56rem) {
  .page-head-grid { grid-template-columns: minmax(0, 1fr) 13.5rem; column-gap: 4rem; }
}

.chapter {
  display: grid;
  gap: 1.25rem;
  padding-block: clamp(2.5rem, 6vw, 4rem);
  border-top: 1px solid var(--rule);
}
.chapter:first-child { border-top: 0; }
.chapter .h2 { font-size: clamp(2rem, 3.6vw, 2.6rem); }
.prose { max-width: 40em; }
.prose p + p { margin-top: 1em; }
.prose h3 {
  margin-top: 2.2em;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
}
.prose h3:first-child { margin-top: 0; }
.prose h3 + p { margin-top: 0.45em; }
.prose .when {
  margin-left: 0.6em;
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--slate);
  white-space: nowrap;
}
.facts { border-bottom: 1px solid var(--rule); }
.facts > div {
  display: grid;
  gap: 0.15rem 1.5rem;
  padding-block: 0.85rem;
  border-top: 1px solid var(--rule);
}
.facts dt { color: var(--slate); font-weight: 500; }
@media (min-width: 36rem) {
  .facts > div { grid-template-columns: 9.5rem minmax(0, 1fr); }
}
@media (min-width: 56rem) {
  .chapter { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); column-gap: 2.5rem; }
  .chapter .h2 { position: sticky; top: 1.5rem; align-self: start; }
}

/* ---------- Not found ---------- */

.lost {
  min-height: 100vh;
  display: grid;
  place-content: center;
  text-align: left;
  padding: var(--gutter);
}
.lost .page-title { font-size: clamp(4rem, 16vw, 9rem); }

/* ---------- Larger text on wide screens, smaller nav on narrow ---------- */

@media (min-width: 48rem) {
  body { font-size: 1.125rem; }
}
@media (max-width: 47.99rem) {
  .nav-sec { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
