@font-face {
  font-family: "Instrument Serif";
  src: url("assets/fonts/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("assets/fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("assets/fonts/source-serif.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("assets/fonts/source-serif-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

/* Palette comes from the snowboard photo: snow at dusk, night sky, and the glow on the horizon. */
:root {
  --snow: #edf1f7;
  --night: #131a33;
  --dusk: #2f4fb5;
  --glow: #f08a24;

  --bg: var(--snow);
  --ink: var(--night);
  --soft: #55607f;
  --line: #c7d0e2;
  --link: var(--dusk);
  --accent: var(--glow);
  --lift: #ffffff;

  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --text: "Source Serif 4", "Iowan Old Style", Georgia, serif;

  --pad: clamp(1.25rem, 5vw, 4.5rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

[data-theme="dark"] {
  --bg: #0d1228;
  --ink: #e9eef8;
  --soft: #94a1c4;
  --line: #273158;
  --link: #a3b8ff;
  --accent: #ffa347;
  --lift: #161d3b;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: clamp(1.06rem, 0.98rem + 0.35vw, 1.25rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  font-synthesis: none;
  transition: background-color .4s ease, color .4s ease;
}

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

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  transition: text-decoration-color .2s, color .2s;
}
a:hover { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }

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

ul { list-style: none; margin: 0; padding: 0; }
p { margin: 0; }
b { font-weight: 600; }

/* ---------- top bar ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .9rem var(--pad);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: var(--display);
  font-size: 1.25rem;
}
.top-name {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.top-nav { display: flex; gap: clamp(.9rem, 2vw, 1.75rem); }
.top-nav a { color: var(--ink); text-decoration: none; }
.top-nav a:hover { color: var(--link); }

.theme {
  width: 2.6rem;
  height: 1.5rem;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 1rem;
  background: none;
  cursor: pointer;
  position: relative;
  flex: none;
}
.theme-dot {
  position: absolute;
  top: 50%;
  left: .2rem;
  width: .9rem;
  height: .9rem;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
  transition: left .3s var(--ease);
}
[data-theme="dark"] .theme-dot { left: calc(100% - 1.1rem); }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
  padding: clamp(2.5rem, 7vw, 6rem) var(--pad) clamp(3rem, 6vw, 5rem);
  min-height: calc(100svh - 3.5rem);
}

.name {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3.5rem, 9.5vw, 9.5rem);
  line-height: 1;
  letter-spacing: -.015em;
  cursor: default;
  width: fit-content;
}
.name-line { display: block; white-space: nowrap; overflow: hidden; padding-bottom: .12em; margin-bottom: -.12em; }
.name-line .ch {
  display: inline-block;
  transform: translateY(105%);
  animation: rise .9s var(--ease) forwards;
  animation-delay: calc(var(--i) * 55ms + 120ms);
}
@keyframes rise { to { transform: translateY(0); } }

.iam {
  position: relative;
  margin-top: clamp(2rem, 4.5vw, 4rem);
  font-family: var(--display);
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 3rem);
  font-weight: 500;
  line-height: 1.2;
  min-height: 1.2em;
  opacity: 0;
  animation: show .6s ease forwards .85s;
}
@keyframes show { to { opacity: 1; } }

#role { color: var(--link); }
.caret {
  display: inline-block;
  width: .08em;
  height: .95em;
  margin-left: .08em;
  background: var(--accent);
  vertical-align: -.1em;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.iam-role, .iam-sleep { display: block; transition: opacity .25s ease, transform .35s var(--ease); }
.iam-sleep {
  position: absolute;
  inset: 0 auto auto 0;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(.4em);
  pointer-events: none;
}
.iam-sleep b { font-weight: 700; color: var(--accent); }
.hero.is-peek .iam-role { opacity: 0; transform: translateY(-.4em); }
.hero.is-peek .iam-sleep { opacity: 1; transform: none; }

.hint {
  margin-top: .6rem;
  font-size: .95rem;
  font-style: italic;
  color: var(--soft);
  opacity: 0;
  animation: show .6s ease forwards 1.6s;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.5rem;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
  font-family: var(--display);
  font-size: 1.4rem;
}
.hero .links { opacity: 0; animation: show .6s ease forwards 1.1s; }

.hero-photo {
  margin: 0;
  opacity: 0;
  transform: translateY(1.5rem);
  animation: settle 1s var(--ease) forwards .5s;
}
@keyframes settle { to { opacity: 1; transform: none; } }
.hero-photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 4px;
}

.vitals {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: space-between;
  gap: .25rem 1rem;
  margin-top: 1rem;
  font-family: var(--display);
  font-style: normal;
  color: var(--ink);
}
.vital b {
  display: block;
  font-size: clamp(1.35rem, 1rem + 1.2vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.vital span { font-family: var(--text); font-size: .85rem; color: var(--soft); }
.sync {
  grid-column: 1 / -1;
  margin-top: .5rem;
  font-family: var(--text);
  font-size: .8rem;
  font-style: italic;
  color: var(--soft);
}
.hero.is-peek .vital:first-child b { color: var(--accent); }

/* ---------- skills ticker ---------- */

.ticker {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: .6rem 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 4vw, 3.25rem);
  line-height: 1.1;
  white-space: nowrap;
}
.ticker-track { display: inline-flex; animation: slide 38s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker span { padding-right: 1.4em; color: var(--ink); }
.ticker span:nth-child(3n + 2) { color: var(--link); }
.ticker span:nth-child(5n) { color: var(--accent); }
@keyframes slide { to { transform: translateX(-50%); } }

/* ---------- sections ---------- */

.block {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 8fr);
  gap: 1.5rem clamp(2rem, 6vw, 6rem);
  padding: clamp(3.5rem, 8vw, 7rem) var(--pad);
  border-bottom: 1px solid var(--line);
}
.block h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.75rem, 5.5vw, 4.75rem);
  line-height: 1;
  position: sticky;
  top: 5rem;
  align-self: start;
}
.block h3 {
  margin: clamp(3rem, 6vw, 4.5rem) 0 1rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.9rem;
}

.prose { max-width: 38em; }
.prose p + p { margin-top: 1.1em; }
#about .prose { font-family: var(--display); font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.4rem); line-height: 1.3; }
#about .prose p + p { margin-top: .9em; }
.small { font-size: .95em; color: var(--soft); }

/* project rows */

.rows { border-top: 1.5px solid var(--ink); }
.row { border-bottom: 1.5px solid var(--ink); }
.row-head {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) auto 1.25rem;
  align-items: baseline;
  gap: 1.25rem;
  width: 100%;
  padding: 1.1rem 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.row-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 1.2rem + 2.4vw, 3.25rem);
  line-height: 1;
  transition: color .2s, transform .35s var(--ease);
}
.row-head:hover .row-title { color: var(--link); transform: translateX(.35rem); }
.row-note { color: var(--soft); font-size: .95rem; }
.row-year { font-family: var(--display); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.row-mark { position: relative; width: 1.1rem; height: 1.1rem; align-self: center; }
.row-mark::before, .row-mark::after {
  content: "";
  position: absolute;
  inset: 50% 0 auto 0;
  height: 2px;
  background: var(--accent);
  transition: transform .35s var(--ease);
}
.row-mark::after { transform: rotate(90deg); }
.row-head[aria-expanded="true"] .row-mark::after { transform: rotate(0deg); }

.row-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .5s var(--ease);
}
.row-panel > .row-inner { overflow: hidden; min-height: 0; }
.row-head[aria-expanded="true"] + .row-panel { grid-template-rows: 1fr; }
.row-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
.row-inner:has(.row-fig) { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
.row-copy { max-width: 36em; padding-bottom: 2rem; }
.row-copy p + p { margin-top: .9em; }
.stack { font-size: .9rem; font-style: italic; color: var(--soft); }
.row-fig { margin: 0 0 2rem; }
.row-fig img, .honors-fig img { border-radius: 4px; }
.row-inner.is-stacked:has(.row-fig) { grid-template-columns: minmax(0, 1fr); gap: 0; }
.row-demo video { display: block; width: 100%; height: auto; border-radius: 4px; border: 1px solid var(--line); background: #fff; }
.row-links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
figcaption { margin-top: .5rem; font-size: .85rem; font-style: italic; color: var(--soft); }

/* plain lists */

.plain li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .15rem 1.5rem;
  padding: .9rem 0;
  border-top: 1px solid var(--line);
}
.plain-what { font-family: var(--display); font-size: 1.45rem; line-height: 1.2; }
.plain-when { font-family: var(--display); font-size: 1.2rem; color: var(--soft); font-variant-numeric: tabular-nums; grid-row: 1; grid-column: 2; }
.plain-where { grid-column: 1 / -1; color: var(--soft); font-size: .95rem; max-width: 44em; }

.honors { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
.honors-fig { margin: 0; max-width: 34rem; }

/* life */

.count {
  font-family: var(--display);
  font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2.25rem);
  font-weight: 500;
  line-height: 1.2;
  max-width: 22em;
}
.count b { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }

.pile {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(1rem, 2.5vw, 2rem);
  margin-top: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
}
.shot {
  --tilt: 0deg;
  --from: 0deg;
  margin: 0;
  padding: .55rem .55rem .2rem;
  background: var(--lift);
  border-radius: 3px;
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -22px rgba(19, 26, 51, .55);
  transform: rotate(var(--tilt));
  transition: transform .9s var(--ease), opacity .6s ease;
}
.shot img { width: 100%; object-fit: cover; border-radius: 2px; }
.shot figcaption { padding: .1rem .15rem .35rem; }
.shot:hover { transform: rotate(0deg) scale(1.02); }

.shot-game   { grid-column: 1 / span 7;  --tilt: -1.2deg; --from: -8deg; }
.shot-laptop { grid-column: 8 / span 5;  --tilt: 1.6deg;  --from: 9deg; }
.shot-snow   { grid-column: 1 / span 5;  --tilt: 1.1deg;  --from: 7deg; }
.shot-nsbe   { grid-column: 6 / span 7;  --tilt: -1.5deg; --from: -9deg; }
.shot-gym    { grid-column: 1 / span 4;  --tilt: -1.8deg; --from: -7deg; }
.shot-car    { grid-column: 5 / span 8;  --tilt: .9deg;   --from: 8deg; }

.shot-game img   { aspect-ratio: 3 / 2; }
.shot-laptop img { aspect-ratio: 4 / 5; object-position: 60% 40%; }
.shot-snow img   { aspect-ratio: 3 / 4; }
.shot-nsbe img   { aspect-ratio: 4 / 3; }
.shot-gym img    { aspect-ratio: 4 / 5; object-position: 50% 30%; }
.shot-car img    { aspect-ratio: 16 / 9; }

/* photos deal in once when they scroll into view */
.shot.is-waiting {
  opacity: 0;
  transform: translateY(4rem) rotate(var(--from));
}
.shot.is-done { transition-duration: .5s; }

/* resume viewer */

.resume {
  width: min(56rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--lift);
  color: var(--ink);
  overflow: auto;
  overscroll-behavior: contain;
  box-shadow: 0 30px 80px -20px rgba(19, 26, 51, .6);
}
.resume::backdrop { background: rgba(13, 18, 40, .62); }
.resume[open] { animation: resume-in .35s var(--ease); }
@keyframes resume-in { from { opacity: 0; transform: translateY(1.5rem); } }
.resume-bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: .7rem 1.1rem;
  background: var(--lift);
  border-bottom: 1px solid var(--line);
  font-family: var(--display);
  font-size: 1.3rem;
}
.resume-title { margin-right: auto; }
.resume-close {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}
.resume-close:hover { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.resume-pages img { width: 100%; height: auto; background: #fff; }
.resume-pages img + img { border-top: 1px solid var(--line); }

/* contact + footer */

.reach {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 1rem + 5vw, 5rem);
  line-height: 1;
  overflow-wrap: anywhere;
}
.reach a { color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 3px; }
.reach a:hover { color: var(--link); }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 2rem;
  padding: 1.5rem var(--pad) 2.5rem;
  font-size: .9rem;
  font-style: italic;
  color: var(--soft);
}

/* ---------- smaller screens ---------- */

@media (max-width: 860px) {
  .top-nav { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); align-items: start; min-height: 0; gap: 2.5rem; }
  .name { font-size: clamp(3rem, 19.5vw, 7.5rem); }
  .hero-photo { max-width: 26rem; }
  .block { grid-template-columns: minmax(0, 1fr); }
  .block h2 { position: static; }
  .row-head { grid-template-columns: minmax(0, 1fr) auto 1.1rem; gap: .2rem 1rem; }
  .row-note { grid-column: 1 / -1; grid-row: 2; }
  .row-inner:has(.row-fig) { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .shot-game, .shot-nsbe { grid-column: 1 / -1; }
  .shot-laptop { grid-column: 1 / span 6; }
  .shot-snow { grid-column: 7 / span 6; }
  .shot-gym { grid-column: 1 / span 5; }
  .shot-car { grid-column: 6 / span 7; }
  .shot-car img { aspect-ratio: 4 / 3; }
}

@media (max-width: 480px) {
  .vitals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .vital span { font-size: .78rem; line-height: 1.25; display: block; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .name-line .ch { transform: none; }
  .iam, .hint, .hero .links, .hero-photo { opacity: 1; transform: none; }
  .shot.is-waiting { opacity: 1; transform: rotate(var(--tilt)); }
}
