/* Matt Speck — mattspeck.com
   Type:  Newsreader (display + body), IBM Plex Mono (metadata)
   Paper: #fdfdfc   Ink: #14171a   Accent: #16564d */

:root {
  color-scheme: light;

  --paper:      #fdfdfc;
  --paper-sunk: #f5f5f1;
  --ink:        #14171a;
  --ink-soft:   #5a6169;
  --ink-faint:  #8b9299;
  --rule:       #dedcd4;
  --rule-firm:  #c3c0b5;
  --accent:     #16564d;
  --accent-lift:#1f7a6c;

  --serif: "Newsreader", ui-serif, Georgia, "Times New Roman", serif;
  --mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --gutter: clamp(1.5rem, 5vw, 6rem);
  --measure: 62ch;
  --rhythm: clamp(4.5rem, 9vw, 8rem);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.68;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul { padding: 0; list-style: none; }

a { color: inherit; }

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

img { max-width: 100%; height: auto; display: block; }

/* ── Shared atoms ───────────────────────────────────────── */

.eyebrow {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

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

.section {
  padding-block: var(--rhythm);
  border-top: 1px solid var(--rule);
}

.section__head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: clamp(2.5rem, 5vw, 3.75rem);
}

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

.section__count {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

/* ── Masthead ───────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar__name { font-weight: 500; text-decoration: none; }
.topbar__nav { display: flex; gap: 1.5rem; }
.topbar__nav a { color: var(--ink-soft); text-decoration: none; }
.topbar__nav a:hover { color: var(--accent); }

@media (max-width: 34rem) {
  .topbar__nav { display: none; }
}

/* ── Hero ───────────────────────────────────────────────── */

.hero {
  padding-block: clamp(3.5rem, 9vw, 7rem) var(--rhythm);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name portrait"
    "body portrait";
  column-gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.hero__name { grid-area: name; }
.hero__body { grid-area: body; }
.hero__portrait { grid-area: portrait; }

.hero__name {
  font-size: clamp(3.75rem, 13vw, 9rem);
  font-weight: 300;
  line-height: 0.86;
  letter-spacing: -0.035em;
  margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
}

.hero__name span { display: block; }
.hero__name em {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}

.hero__role {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding-block: 0.875rem;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
}

.hero__lede {
  font-size: clamp(1.25rem, 1.05rem + 0.85vw, 1.75rem);
  line-height: 1.44;
  font-weight: 350;
  max-width: 34ch;
  text-wrap: pretty;
  margin-bottom: clamp(2rem, 4vw, 2.75rem);
}

.hero__sub {
  max-width: 54ch;
  color: var(--ink-soft);
  text-wrap: pretty;
  margin-bottom: clamp(2.25rem, 4.5vw, 3rem);
}

.hero__portrait {
  width: clamp(9rem, 15vw, 13rem);
  border: 1px solid var(--rule-firm);
  padding: 0.5rem;
  background: var(--paper);
}

.hero__portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 18%;
  filter: grayscale(1) contrast(1.04);
}

.hero__caption {
  margin-top: 0.625rem;
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  line-height: 1.5;
}

@media (max-width: 46rem) {
  /* Narrow: portrait sits beside the name, body runs full width beneath. */
  .hero__grid {
    grid-template-areas:
      "name portrait"
      "body body";
    column-gap: 1.25rem;
    row-gap: 1rem;
  }

  .hero__portrait { width: min(7.5rem, 30vw); }
}

/* Current position callout */

.now {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  max-width: 40rem;
}

.now__label { padding-top: 0.35rem; }

.now__role {
  font-size: 1.1875rem;
  font-weight: 500;
  line-height: 1.4;
}

.now__role a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.now__note { color: var(--ink-soft); font-size: 0.9375rem; }

@media (max-width: 34rem) {
  .now { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
}

/* Contact links */

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin-top: 2.25rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.links a {
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--rule-firm);
  transition: color 0.18s ease, border-color 0.18s ease;
}

.links a:hover { color: var(--accent); border-color: var(--accent); }
.links a::after { content: " \2197"; color: var(--ink-faint); }
.links a:hover::after { color: var(--accent); }

/* ── Selected work ──────────────────────────────────────── */

.work {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border-block: 1px solid var(--rule);
}

.work__item {
  background: var(--paper);
  padding: clamp(1.75rem, 3vw, 2.5rem) clamp(1.5rem, 2.5vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.work__claim {
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.24;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.work__detail { color: var(--ink-soft); font-size: 0.9375rem; line-height: 1.62; }

.work__link {
  margin-top: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  align-self: flex-start;
  padding-bottom: 0.15rem;
}

.work__link:hover { border-color: var(--accent); }

/* ── Experience spine ───────────────────────────────────── */

.spine { display: grid; gap: 0; }

.role {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 0 clamp(1.5rem, 3vw, 3rem);
  position: relative;
  padding-bottom: clamp(2.5rem, 5vw, 3.5rem);
  /* --yrs encodes real tenure: height on the page tracks time served */
  min-height: calc(var(--yrs) * 4.75rem);
}

.role__time {
  position: relative;
  padding-top: 0.4rem;
  text-align: right;
}

/* the spine itself */
.role__time::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: calc(-1 * clamp(2.5rem, 5vw, 3.5rem));
  right: calc(clamp(1.5rem, 3vw, 3rem) / -2);
  width: 1px;
  background: var(--rule-firm);
}

.role:last-child .role__time::before { bottom: auto; height: 1.25rem; }

/* the year tick */
.role__time::after {
  content: "";
  position: absolute;
  top: 0.8rem;
  right: calc(clamp(1.5rem, 3vw, 3rem) / -2 - 3px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--rule-firm);
}

.role--now .role__time::after {
  background: var(--accent);
  border-color: var(--accent);
}

.role__year {
  display: block;
  font-family: var(--mono);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
}

.role__span {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.role__title {
  font-size: clamp(1.5rem, 1.3rem + 0.7vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.018em;
  line-height: 1.2;
}

.role__org {
  margin-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.875rem;
}

.role__co { font-size: 1.0625rem; font-weight: 500; }
.role__where { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }

.tag {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
}

.role__summary {
  margin-top: 1rem;
  max-width: var(--measure);
  color: var(--ink-soft);
  text-wrap: pretty;
}

/* Sub-roles held at one organization */
.stint {
  margin-top: 1rem;
  display: grid;
  gap: 0.35rem;
  max-width: 22rem;
}

.stint li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.stint li::after {
  content: "";
  order: 1;
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.stint__when { order: 2; color: var(--ink-faint); }

.role__points {
  margin-top: 1.125rem;
  max-width: var(--measure);
  display: grid;
  gap: 0.7rem;
}

.role__points li {
  position: relative;
  padding-left: 1.25rem;
  font-size: 0.9688rem;
  line-height: 1.62;
}

.role__points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 0.5rem;
  height: 1px;
  background: var(--rule-firm);
}

@media (max-width: 40rem) {
  .role { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; min-height: 0; }
  .role__time { text-align: left; padding-top: 0; }
  .role__time::before, .role__time::after { display: none; }
  .role__span { display: inline; margin-left: 0.75rem; }
}

/* ── Capabilities ───────────────────────────────────────── */

.caps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
  gap: clamp(1.75rem, 3vw, 2.75rem);
}

.caps__group h3 {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.caps__group li {
  padding: 0.28rem 0;
  font-size: 0.9688rem;
  color: var(--ink-soft);
}

.caps__group li strong { font-weight: 500; color: var(--ink); }

/* ── Education ──────────────────────────────────────────── */

.edu {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 0 clamp(1.5rem, 3vw, 3rem);
  max-width: 52rem;
}

.edu__degree { font-size: 1.375rem; font-weight: 400; line-height: 1.3; }
.edu__school { margin-top: 0.4rem; font-size: 1.0625rem; font-weight: 500; }
.edu__extras { margin-top: 1rem; display: grid; gap: 0.45rem; color: var(--ink-soft); font-size: 0.9375rem; }
.edu__extras li { padding-left: 1.25rem; position: relative; }
.edu__extras li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.72em;
  width: 0.5rem; height: 1px;
  background: var(--rule-firm);
}

/* Education reuses the time column but sits off the spine */
.edu__time::before,
.edu__time::after { content: none; }

.pub {
  margin-top: 1.75rem;
  padding-top: 1.125rem;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 0.5rem;
  max-width: var(--measure);
}

.pub cite {
  font-style: italic;
  font-size: 1.0625rem;
  color: var(--ink);
  line-height: 1.5;
}

@media (max-width: 40rem) {
  .edu { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
  .edu__time { text-align: left; padding-top: 0; }
  .edu__time .role__span { display: inline; margin-left: 0.5rem; }
}

/* ── Footer ─────────────────────────────────────────────── */

.foot {
  border-top: 1px solid var(--rule);
  padding-block: 3rem 4rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.foot a { color: var(--ink-soft); text-decoration: none; }
.foot a:hover { color: var(--accent); }
.foot__links { display: flex; flex-wrap: wrap; gap: 1.5rem; }

/* ── Entrance motion ────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .rise {
    opacity: 0;
    transform: translateY(0.75rem);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .rise.is-in { opacity: 1; transform: none; }

  .hero .rise { transition-delay: calc(var(--i, 0) * 90ms); }
}

/* Narrow: the portrait sits beside the name, so the two rise together. */
@media (prefers-reduced-motion: no-preference) and (max-width: 46rem) {
  .hero .hero__portrait { transition-delay: 0s; }
}
