/* One full-width column with a sticky top menu; your intro and About sit side
   by side at the top on wide screens. One accent colour, from `accent:` in
   content/site.yaml. */

:root {
  --bg: #fbfbfa;
  --text: #1b1b1f;
  --text-soft: #45454d;
  --muted: #73737c;
  --line: #e7e7e4;
  --surface: #f1f1ee;
  --card: #ffffff;
  --accent: var(--accent-source, #5b4fe5);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --glow: color-mix(in srgb, var(--accent) 7%, transparent);
  --nav-bg: rgb(251 251 250 / 0.85);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px -12px rgb(0 0 0 / 0.12);

  /* Fonts (all free Google Fonts): a book serif for reading, a classic
     display serif for titles, and a typewriter-style mono for small labels. */
  --font-body: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --font-display: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: 1.5rem;
  --aside: 8rem;
  --radius: 6px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light dark;
}

/* Dark colours. The toggle sets data-theme on <html>; before it has (or
   without JavaScript) the visitor's system setting decides. */
:root[data-theme="dark"] {
  --bg: #111113;
  --text: #ececef;
  --text-soft: #c4c4cc;
  --muted: #8f8f99;
  --line: #26262b;
  --surface: #1d1d22;
  --card: #17171a;
  --accent: color-mix(in oklab, var(--accent-source, #5b4fe5) 55%, white);
  --glow: color-mix(in srgb, var(--accent-source, #5b4fe5) 14%, transparent);
  --nav-bg: rgb(17 17 19 / 0.85);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -16px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}
:root[data-theme="light"] {
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #111113;
    --text: #ececef;
    --text-soft: #c4c4cc;
    --muted: #8f8f99;
    --line: #26262b;
    --surface: #1d1d22;
    --card: #17171a;
    --accent: color-mix(in oklab, var(--accent-source, #5b4fe5) 55%, white);
    --glow: color-mix(in srgb, var(--accent-source, #5b4fe5) 14%, transparent);
    --nav-bg: rgb(17 17 19 / 0.85);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -16px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}

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

html {
  scroll-padding-top: 7rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16.5px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

p,
ul,
ol,
h1,
h2,
h3 {
  margin: 0;
}

strong {
  font-weight: 600;
  color: var(--text);
}

/* Links in running text grow an underline from the left. */
.prose a,
.entry-org a,
.entry-links a,
.section-intro a,
.books a,
.social a {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.3s var(--ease);
}
.prose a:hover,
.entry-org a:hover,
.entry-links a:hover,
.section-intro a:hover,
.books a:hover,
.social a:hover {
  background-size: 100% 1px;
}

.skip-link {
  position: absolute;
  left: -999px;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 20;
  background: var(--bg);
  padding: 0.5rem 0.75rem;
}

/* Smooth scrolling for menu and "Back to top" clicks. It's switched on only
   after the page has opened, so following a link straight to a section
   (e.g. /#community) lands there instantly instead of animating from the top. */
html.smooth-scroll {
  scroll-behavior: smooth;
}

/* ----- Scroll progress and cursor glow --------------------------------- */

.progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: 15;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(var(--progress, 0));
}

.spotlight {
  display: none;
}
@media (hover: hover) and (min-width: 1024px) {
  .spotlight {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(560px circle at var(--mx, 50%) var(--my, -20%), var(--glow), transparent 70%);
  }
}

/* ----- Top menu (phones and tablets) ----------------------------------- */

.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--nav-bg);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.topnav.is-scrolled {
  border-bottom-color: var(--line);
}
.topnav-inner {
  padding: 0.85rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.topnav-name {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--ease);
}
.topnav.is-scrolled .topnav-name {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
/* The links never wrap. They sit to the right when they fit; when the window
   is too narrow for all of them, the strip scrolls sideways instead. */
.topnav-links {
  list-style: none;
  padding: 0;
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 1.25rem;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav-links::-webkit-scrollbar {
  display: none;
}
.topnav-links li {
  flex: none;
}
/* Right-aligns the links (a margin, not justify-content, so nothing becomes
   unreachable when the strip overflows). */
.topnav-links li:first-child {
  margin-left: auto;
}
.topnav-links a {
  color: var(--muted);
  transition: color 0.2s;
}
.topnav-links a:hover,
.topnav-links a.is-active {
  color: var(--text);
}

/* ----- Layout ---------------------------------------------------------- */

.layout {
  position: relative;
  z-index: 1;
  padding: 0 var(--gutter);
}

.content-hero {
  padding: 3rem 0 2.5rem;
}
.portrait {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.25rem;
}
.name {
  font-size: 2.1rem;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.headline {
  margin-top: 0.5rem;
  font-size: 1.05rem;
  font-weight: 500;
}
.location {
  color: var(--muted);
  font-size: 0.925rem;
}
.tagline {
  margin-top: 1rem;
  max-width: 22rem;
  color: var(--text-soft);
}
.theme-toggle--side {
  display: none;
}

/* ----- Light / dark toggle ----- */
.theme-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: scale(1.06);
}
.theme-toggle svg {
  transition: transform 0.5s var(--ease);
}
.theme-toggle:hover svg {
  transform: rotate(-25deg);
}
[data-theme="dark"] .theme-toggle .icon-moon,
[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}
:root:not([data-theme]) .theme-toggle .icon-sun {
  display: none;
}
.theme-toggle--top {
  width: 2rem;
  height: 2rem;
}
/* The circular reveal replaces the browser's default cross-fade. */
html.vt-theme::view-transition-old(root),
html.vt-theme::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.social {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  font-size: 0.9rem;
}

.section {
  padding: 2.75rem 0;
  border-top: 1px solid var(--line);
}
.content {
  counter-reset: section;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 1.75rem;
}
/* A small numbered pill before each title: 01, 02, ... */
.section .section-title::before {
  counter-increment: section;
  content: counter(section, decimal-leading-zero);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}
.section-intro {
  color: var(--text-soft);
  margin-bottom: 2rem;
}
.group + .group {
  margin-top: 3rem;
}
.subheading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.subheading::before {
  content: "";
  flex: none;
  width: 4px;
  height: 1.1em;
  border-radius: 2px;
  background: var(--accent);
}
.subheading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.subheading-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}
.prose {
  color: var(--text-soft);
}
.prose p + p {
  margin-top: 1em;
}

/* Wide screens: one full-width column. Your intro and About sit side by
   side at the top; the sticky top menu handles navigation. */
@media (min-width: 1024px) {
  :root {
    --gutter: clamp(2rem, 4vw, 4.5rem);
    --aside: 9.5rem;
  }
  html {
    /* Top menu + sticky section bar, so menu links land just below them. */
    scroll-padding-top: 7.5rem;
  }
  .content {
    padding-top: 4.5rem;
  }
  .section {
    padding: 0 0 6rem;
    border-top: 0;
  }
  .lead {
    display: grid;
    grid-template-columns: minmax(20rem, 5fr) minmax(0, 7fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
    padding-bottom: 5rem;
  }
  .lead .section--about {
    padding-bottom: 0;
  }
  .content-hero {
    padding: 0;
  }
}

/* ----- Entries --------------------------------------------------------- */

.entries {
  display: grid;
  gap: 0.75rem;
}
.entry {
  display: grid;
  grid-template-columns: var(--aside) minmax(0, 1fr);
  column-gap: 1.5rem;
  padding: 0.9rem 0;
}
/* A list with no dates at all: no left column. */
.entries--no-aside .entry {
  grid-template-columns: minmax(0, 1fr);
}
.entries--no-aside .entry-aside {
  display: none;
}
@media (hover: hover) and (min-width: 1024px) {
  /* A soft panel fades in behind the entry you're reading. */
  .entry {
    position: relative;
  }
  .entry::before {
    content: "";
    position: absolute;
    inset: 0 -1.25rem;
    border-radius: 10px;
    background: var(--surface);
    opacity: 0;
    transition: opacity 0.25s;
    z-index: -1;
  }
  .entry:hover::before {
    opacity: 0.6;
  }
  .entry:hover .entry-title {
    color: var(--accent);
  }
}
.entry-aside {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}
.entry-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}
.entry-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  transition: color 0.2s;
}
.entry-org {
  color: var(--muted);
  font-size: 0.925rem;
}

/* Logo tile (or initials) beside an entry's title. */
.mark {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mark--initials {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.entry:hover .mark {
  transform: scale(1.06) rotate(-3deg);
  box-shadow: var(--shadow);
}
.entry-summary {
  margin-top: 0.5rem;
  color: var(--text-soft);
}
.entry-highlights {
  margin-top: 0.5rem;
  padding: 0;
  list-style: none;
  color: var(--text-soft);
  font-size: 0.95rem;
}
.entry-highlights li {
  position: relative;
  padding-left: 1rem;
}
.entry-highlights li + li {
  margin-top: 0.3rem;
}
.entry-highlights li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--muted);
}
.tags {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tags span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
}
.entry-links {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  font-size: 0.875rem;
}
.arrow {
  display: inline-block;
  margin-left: 0.2em;
  transition: transform 0.25s var(--ease);
}
a:hover > .arrow {
  transform: translate(2px, -2px);
}

/* ----- Cards (apps and talks) ------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr));
  gap: 1rem;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s, opacity 0.35s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.card-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface);
  overflow: hidden;
}
.card-cover-btn {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.card-cover-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: transform 0.6s var(--ease);
}
.card:hover .card-cover-btn img {
  transform: scale(1.04);
}
.card-cover-count {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: #fff;
  background: rgb(0 0 0 / 0.55);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.card-cover--empty {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, var(--accent-soft), transparent 60%),
    radial-gradient(circle at 80% 90%, var(--accent-soft), transparent 55%),
    var(--surface);
}
.card-icon {
  font-size: 3rem;
  line-height: 1;
  transition: transform 0.5s var(--ease);
}
.card:hover .card-icon {
  transform: scale(1.15) rotate(-6deg);
}
.card-body {
  padding: 1rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
}
.card-title-icon {
  margin-right: 0.4rem;
}
.status {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f5a524;
  animation: pulse 2s ease-out infinite;
}
.status--live::before {
  background: #22c55e;
  animation: none;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgb(245 165 36 / 0.55);
  }
  70%,
  100% {
    box-shadow: 0 0 0 6px rgb(245 165 36 / 0);
  }
}
.card-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.card-org {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.1rem;
}
/* Talk photos are of people, so frame the middle rather than the top. */
.section--speaking .card-cover-btn img {
  object-position: center 35%;
}
.card-summary {
  margin-top: 0.45rem;
  color: var(--text-soft);
  font-size: 0.925rem;
}
.card-body .tags {
  margin-top: auto;
  padding-top: 0.85rem;
}

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

/* One row per category: the category on the left, its skills as tags on the right. */
.skill-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.skill-group {
  position: relative;
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
  column-gap: 2rem;
  align-items: start;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.35s;
}
.skill-group:first-child {
  border-top: 1px solid var(--line);
}
.skill-heading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1rem;
  font-weight: 600;
}
.skill-icon {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  font-size: 1rem;
  line-height: 1;
}
.skill-heading .subheading-count {
  margin-left: 0.15rem;
}
.skill-list {
  /* Line the first row of tags up with the category name. */
  padding-top: 0.2rem !important;
}
@media (hover: hover) and (min-width: 1024px) {
  /* The same soft panel as Experience entries, behind the row you're on. */
  .skill-group::before {
    content: "";
    position: absolute;
    inset: 0 -1.25rem;
    border-radius: 10px;
    background: var(--surface);
    opacity: 0;
    transition: opacity 0.25s;
    z-index: -1;
  }
  .skill-group:hover::before {
    opacity: 0.6;
  }
}
@media (max-width: 640px) {
  .skill-group {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.75rem;
  }
}
.skill-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.skill-list li {
  font-size: 0.85rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-soft);
  transition: color 0.2s, border-color 0.2s, background-color 0.2s, transform 0.2s var(--ease);
}
.skill-list li:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

/* ----- Carousel (Speaking) ------------------------------------------- */

.carousel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}
.carousel-head .section-intro {
  margin-bottom: 0;
}
.carousel-controls {
  display: flex;
  gap: 0.5rem;
  flex: none;
}
.carousel-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s, transform 0.2s var(--ease);
}
.carousel-btn:hover:not([disabled]) {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.06);
}
.carousel-btn[disabled] {
  opacity: 0.35;
  cursor: default;
}
.carousel {
  position: relative;
  margin-inline: calc(-1 * var(--gutter));
}
/* A soft fade on the right edge hints there's more to scroll. */
.carousel::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4rem;
  pointer-events: none;
  background: linear-gradient(to right, transparent, var(--bg));
  transition: opacity 0.3s;
}
.carousel.at-end::after {
  opacity: 0;
}
.carousel-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(16rem, 19rem);
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  padding: 0.5rem var(--gutter) 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.carousel-track > .card {
  scroll-snap-align: start;
}
.carousel-track:focus-visible {
  outline-offset: -2px;
}

/* ----- Recognition badges -------------------------------------------- */

/* One award per row, every row the same height (the tallest one's). */
.badge-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: 1fr;
  gap: 1rem;
}
.badge {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
}
.badge:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
/* With photos: details on the left, photos on the right. */
.badge--with-photos {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}
/* Compact: the icon sits to the left; year, title and text stack beside it. */
.badge-body {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  grid-auto-rows: min-content;
  column-gap: 0.85rem;
  align-content: start;
  height: 100%;
}
.badge-top {
  display: contents;
}
.badge-body > :not(.badge-top) {
  grid-column: 2;
}
.badge-icon {
  grid-column: 1;
  grid-row: 1 / span 3;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  line-height: 1;
  border-radius: 50%;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.badge:hover .badge-icon {
  animation: badge-bounce 0.6s var(--ease);
}
@keyframes badge-bounce {
  30% {
    transform: translateY(-4px) rotate(-8deg) scale(1.08);
  }
  60% {
    transform: translateY(0) rotate(4deg);
  }
}
.badge-year {
  grid-column: 2;
  justify-self: start;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.badge-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}
.badge-org {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.badge-summary {
  margin-top: 0.3rem;
  color: var(--text-soft);
  font-size: 0.875rem;
  line-height: 1.5;
}
.badge-body .card-highlights {
  margin-top: 0.3rem;
  font-size: 0.85rem;
  line-height: 1.5;
}
.badge-foot {
  padding-top: 0.5rem;
}
.badge-foot .entry-links {
  margin-top: 0;
}

/* The award's photos, side by side, filling the right-hand column top to
   bottom so they grow with the row. */
.badge-media {
  display: flex;
  gap: 6px;
  min-height: 8rem;
  /* The text sets the row's height; photos just fill it. */
  contain: size;
}
/* Never cropped: each photo's share of the width matches its shape (set as
   flex-grow in the page), so the set lines up at one height and scales down
   together until it fits the card. */
.badge-photo {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}
.badge-photo img {
  /* Fill the box, but scale to fit inside it: the whole photo always shows. */
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.5s var(--ease);
}
.badge-photo:hover img {
  transform: scale(1.05);
}


/* Project and talk cards can carry a few bullet points. */
.card-highlights {
  margin-top: 0.5rem;
  padding: 0;
  list-style: none;
  color: var(--text-soft);
  font-size: 0.875rem;
}
.card-highlights li {
  position: relative;
  padding-left: 0.9rem;
}
.card-highlights li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--muted);
}
/* Project figures are diagrams and screens, so show them whole. */
.section--education .card-cover-btn img {
  object-fit: contain;
  object-position: center;
  background: #fff;
}

/* ----- Photos ---------------------------------------------------------- */

.photos {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.js .photos {
  flex-wrap: nowrap;
  overflow: hidden;
  padding: 3px 0; /* room for the hover lift */
}
.photos .photo {
  flex: none;
}
.photos .photo {
  position: relative;
  width: 68px;
  height: 68px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.photo[hidden] {
  display: none !important;
}
.photos .photo:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.photos .photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease);
}
.photos .photo:hover img {
  transform: scale(1.08);
}
.photo-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
}

.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0c0c0e;
  color: #f2f2f4;
}
.lightbox[open] {
  display: flex;
  flex-direction: column;
  animation: fade-in 0.25s ease-out;
}
.lightbox[open] .lightbox-img {
  animation: zoom-in 0.35s var(--ease);
}
.lightbox::backdrop {
  background: transparent;
}
.lightbox-figure {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 1.5rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
}
.lightbox-img {
  max-width: min(100%, 1200px);
  max-height: calc(100% - 4rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}
.lightbox-img.is-swapping {
  animation: fade-in 0.3s ease-out;
}
.lightbox-caption {
  max-width: 40rem;
  text-align: center;
  font-size: 0.9rem;
  color: #c9c9d1;
}
.lightbox-caption a {
  color: #fff;
}
.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1.25rem;
}
.lightbox-count {
  font-size: 0.85rem;
  color: #9a9aa3;
  min-width: 4rem;
  font-variant-numeric: tabular-nums;
}
.lightbox-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 0.2);
  background: transparent;
  color: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.lightbox-btn:hover {
  background: rgb(255 255 255 / 0.1);
}
.lightbox-btn[disabled] {
  opacity: 0.3;
  cursor: default;
}

/* ----- Books & footer --------------------------------------------------- */

.books {
  list-style: none;
  padding: 0;
  columns: 2;
  column-gap: 2rem;
  font-size: 0.95rem;
}
.books li {
  break-inside: avoid;
  padding: 0.3rem 0;
}
.book-author {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 3rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
}
.footer a {
  color: var(--muted);
}

/* ----- Sticky "where am I" bar ---------------------------------------- */
/* Sits at the top while you scroll: name, section number and title, and the
   group you're in. It takes no space of its own (negative margin), and stays
   invisible until the first section heading has scrolled under it. */

.context-bar {
  --bar-h: 2.9rem;
  position: sticky;
  top: var(--topnav-h, 0px);
  z-index: 6;
  height: var(--bar-h);
  margin-bottom: calc(-1 * var(--bar-h));
  margin-inline: calc(-1 * var(--gutter));
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
  overflow: hidden;
  background: var(--nav-bg);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.35s var(--ease);
}
.context-bar.is-shown {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.ctx-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text);
}
.ctx-name::after {
  content: "·";
  margin-left: 0.55rem;
  color: var(--muted);
}
.ctx-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
}
.ctx-num:empty {
  display: none;
}
.ctx-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text);
}
.ctx-group {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
}
.ctx-group:not(:empty)::before {
  content: "›";
  margin-right: 0.55rem;
  color: var(--muted);
}
/* A small slide whenever the text changes. */
.ctx-swap {
  animation: ctx-swap 0.35s var(--ease);
}
@keyframes ctx-swap {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@media (min-width: 1024px) {
  .context-bar {
    --bar-h: 3.2rem;
  }
}
/* From tablet size up, the top menu already shows your name. */
@media (min-width: 641px) {
  .ctx-name {
    display: none;
  }
}
@media (max-width: 640px) {
  .ctx-name {
    font-size: 1rem;
    max-width: 8.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: none;
  }
  .ctx-title {
    font-size: 1.15rem;
  }
  .ctx-group {
    font-size: 0.82rem;
  }
}

/* ----- Typography ----------------------------------------------------- */

/* Titles: the classic serif. It has one weight, so size does the work. */
.name,
.section-title,
.content-hero .name {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.01em;
}
.name {
  font-size: 2.6rem;
  line-height: 1.05;
}
.section-title {
  font-size: 2.1rem;
  line-height: 1.1;
}
@media (min-width: 1024px) {
  .name {
    font-size: 3.4rem;
  }
  .section-title {
    font-size: 2.5rem;
  }
}

/* Subheadings (groups, skill groups, the bar's subsection): the serif too. */
.subheading-text,
.skill-heading > span:not(.skill-icon):not(.subheading-count),
.ctx-group {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0;
}
.subheading {
  font-size: 1.55rem;
  line-height: 1.2;
}
.skill-heading {
  font-size: 1.35rem;
}
.ctx-group {
  font-size: 1.1rem;
  color: var(--text-soft);
}
@media (max-width: 640px) {
  .ctx-group {
    font-size: 0.98rem;
  }
}

/* Small labels: the typewriter mono. */
.entry-aside,
.badge-year,
.card-kicker,
.status,
.tags span,
.subheading-count,
.section .section-title::before,
.topnav-links,
.location,
.footer,
.lightbox-count,
.card-cover-count,
.photo-more {
  font-family: var(--font-mono);
}
.section .section-title::before {
  font-size: 0.72rem;
  letter-spacing: 0;
  /* Sit the number pill on the serif's baseline rather than its cap height. */
  align-self: center;
}
.tags span {
  font-size: 0.72rem;
  letter-spacing: -0.01em;
}
.entry-aside {
  font-size: 0.78rem;
  letter-spacing: 0;
}

/* ----- Reading focus --------------------------------------------------- */
/* Desktop only: the item you're pointing at stays bright while its
   neighbours fade back, and the line or bullet under the cursor gets a soft
   highlighter behind it. */

@media (hover: hover) and (min-width: 1024px) {
  .entries:hover > .entry:not(:hover),
  .card-grid:hover > .card:not(:hover),
  .carousel-track:hover > .card:not(:hover),
  .badge-grid:hover > .badge:not(:hover),
  .skill-grid:hover > .skill-group:not(:hover) {
    opacity: 0.45;
  }
  .entry-summary,
  .entry-highlights li,
  .card-summary,
  .card-highlights li,
  .badge-summary,
  .prose p,
  .section-intro {
    border-radius: 4px;
    transition: background-color 0.2s, box-shadow 0.2s, color 0.2s;
  }
  .entry-summary:hover,
  .entry-highlights li:hover,
  .card-summary:hover,
  .card-highlights li:hover,
  .badge-summary:hover,
  .prose p:hover,
  .section-intro:hover {
    color: var(--text);
    background-color: var(--accent-soft);
    box-shadow: 0 0 0 0.3rem var(--accent-soft);
  }
}

/* ----- Animations ------------------------------------------------------ */
/* Only when JavaScript is on (so nothing stays hidden without it), and never
   for people who ask their device for reduced motion. */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes zoom-in {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* The intro arrives line by line on load. */
  .js .content-hero > * {
    animation: fade-up 0.7s var(--ease) both;
  }
  .js .content-hero > :nth-child(2) { animation-delay: 0.06s; }
  .js .content-hero > :nth-child(3) { animation-delay: 0.12s; }
  .js .content-hero > :nth-child(4) { animation-delay: 0.18s; }
  .js .content-hero > :nth-child(5) { animation-delay: 0.24s; }
  .js .content-hero > :nth-child(6) { animation-delay: 0.3s; }
  .js .content-hero > :nth-child(7) { animation-delay: 0.36s; }
  .js .content-hero > :nth-child(8) { animation-delay: 0.42s; }


  /* Everything else rises in as it scrolls into view. */
  .js .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s ease-out, transform 0.7s var(--ease);
    transition-delay: calc(var(--stagger, 0) * 70ms);
  }
  .js .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
  /* Skill chips pop in one after another as their group appears. */
  .js .skill-group.reveal li {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  .js .skill-group.reveal.is-visible li {
    opacity: 1;
    transform: none;
    transition: opacity 0.4s ease-out, transform 0.4s var(--ease), color 0.2s, border-color 0.2s, background-color 0.2s;
    transition-delay: calc(0.15s + var(--i, 0) * 35ms);
  }
  .js .skill-group.reveal.is-visible li:hover {
    transform: translateY(-2px);
    transition-delay: 0s;
  }
  /* Once in, fades are quick so the reading-focus dimming feels responsive. */
  .js .reveal.is-visible {
    transition-duration: 0.35s, 0.7s;
  }
  /* Keep hover lifts snappy once a card has appeared. */
  .js .card.reveal.is-visible,
  .js .badge.reveal.is-visible {
    transition: opacity 0.35s ease-out, transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ----- Small screens --------------------------------------------------- */

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }
  .topnav-name {
    display: none;
  }
  .topnav-links {
    gap: 1.1rem;
    mask-image: linear-gradient(to right, #000 85%, transparent);
  }
  .topnav-links li:first-child {
    margin-left: 0;
  }
  .content-hero {
    padding: 2.5rem 0 2rem;
  }
  .name {
    font-size: 1.85rem;
  }
  .portrait {
    width: 64px;
    height: 64px;
  }
  .entry {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Dates become a small pill under the title. */
  .entry-aside {
    order: 2;
    justify-self: start;
    margin-top: 0.5rem;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.75rem;
  }
  .entry-aside:empty {
    display: none;
  }
  .entry-main {
    display: contents;
  }
  .entry-head {
    order: 1;
  }
  .entry-main > :not(.entry-head) {
    order: 3;
  }
  .entry {
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--line);
  }
  .entry:last-child {
    border-bottom: 0;
  }
  .section-title {
    font-size: 1.4rem;
  }
  .card-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .carousel-track {
    grid-auto-columns: 82%;
  }
  .badge-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 85%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    margin-inline: calc(-1 * var(--gutter));
    padding: 0.5rem var(--gutter) 1rem;
    scrollbar-width: none;
  }
  .badge {
    scroll-snap-align: start;
  }
  /* Cards off to the side never scroll into view vertically, so don't wait
     for that before showing them. */
  .js .badge-grid > .badge.reveal {
    opacity: 1;
    transform: none;
  }
  .carousel-controls {
    display: none;
  }
  .badge--with-photos {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }
  .badge-media {
    min-height: 0;
    height: 8.5rem;
  }
  .books {
    columns: 1;
  }
}


/* ----- Print: a clean one-column resume -------------------------------- */

@media print {
  :root {
    --bg: #fff;
    --text: #000;
    --text-soft: #222;
    --muted: #555;
  }
  body {
    font-size: 10.5pt;
  }
  .topnav,
  .context-bar,
  .theme-toggle,
  .progress,
  .spotlight,
  .photos,
  .card-cover,
  .lightbox,
  .footer a,
  .skip-link {
    display: none !important;
  }
  .layout {
    display: block;
    max-width: none;
  }
  .content-hero {
    padding: 0 0 1rem;
  }
  .section {
    padding: 1rem 0;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
  .entry,
  .card {
    break-inside: avoid;
  }
  a {
    color: inherit;
  }
}
