/* Arimo: Arial's shapes and widths, bundled so every device renders the same.
   Only regular and bold ship, so medium weights fall back to regular like Arial did */
@font-face {
  font-family: "Arimo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/arimo-400.woff2?v=7nIvvhT7HU-b") format("woff2");
}

@font-face {
  font-family: "Arimo";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/arimo-700.woff2?v=5Bk7jtI3t6--") format("woff2");
}

:root {
  color-scheme: dark;
  --background: #080808;
  --surface: #1a1a1d;
  --surface-hover: #222226;
  --border: #2f2f31;
  --border-strong: #3d3d3f;
  --text: #f7f7f7;
  --muted: #a1a1a6;
  --nav-muted: #828286;
  --stack-logo-filter: none;
  --stack-logo-hover-filter: brightness(1.74);
  /* QR files are drawn off-black; dark theme inverts them to the off-white text colour */
  --qr-filter: invert(1);
  /* Ease-out curve for anything that slides */
  --ease-slide: cubic-bezier(0.22, 1, 0.36, 1);
  /* Body copy that should read softer than headings but stronger than hints */
  --text-soft: color-mix(in srgb, var(--text) 75%, var(--muted));
  --divider-gradient: linear-gradient(
    90deg,
    transparent 0%,
    var(--divider-color) 12%,
    var(--divider-color) 88%,
    transparent 100%
  );
  /* Starts solid, fades out on the right: Résumé timeline and Recommendations */
  --divider-fade-right: linear-gradient(
    90deg,
    var(--divider-color) 0%,
    var(--divider-color) 88%,
    transparent 100%
  );
  --danger: #ff453a;
  --divider-color: #1f1f21;
  --heading-gradient-end: #bbbbbb;
  --white: #f7f7f7;
  --ink: #080808;
  --led-off: #1d1d20;
  --led-on: var(--text);
  --contrast-fill: var(--white);
  --contrast-text: var(--ink);
  --content-width: 1120px;
  --reading-width: 720px;
  --radius: 8px;
  --radius-pill: 999px;
  --radius-inline: 4px;
  --link-arrow-gap: 0.3rem;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --background: #f7f7f7;
    --surface: #eeeef3;
    --surface-hover: #e6e6eb;
    --border: #dcdce1;
    --border-strong: #bbbbc2;
    --text: #080808;
    --muted: #616164;
    --nav-muted: #67676b;
    --stack-logo-filter: brightness(0.68);
    --stack-logo-hover-filter: brightness(0.06);
    --qr-filter: none;
    --danger: #d1000f;
    --divider-color: #e6e6eb;
    --heading-gradient-end: #636366;
    --led-off: #e6e6e9;
    --led-on: var(--text);
    --contrast-fill: var(--text);
    --contrast-text: var(--white);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #f7f7f7;
  --surface: #eeeef3;
  --surface-hover: #e6e6eb;
  --border: #dcdce1;
  --border-strong: #bbbbc2;
  --text: #080808;
  --muted: #616164;
  --nav-muted: #67676b;
  --stack-logo-filter: brightness(0.68);
  --stack-logo-hover-filter: brightness(0.06);
  --qr-filter: none;
  --danger: #d1000f;
  --divider-color: #e6e6eb;
  --heading-gradient-end: #636366;
  --led-off: #e6e6e9;
  --led-on: var(--text);
  --contrast-fill: var(--text);
  --contrast-text: var(--white);
}

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

html,
body {
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

html {
  background: var(--background);
  font-family: "Arimo", Arial, Helvetica, sans-serif;
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.menu-active {
  overflow: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

main h1[tabindex="-1"]:focus {
  outline: none;
}

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

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

/* Page titles sit one step above section headings */
h1 {
  margin-bottom: 2rem;
  font-weight: 500;
  font-size: clamp(1.25em, 2.45vw, 1.65em);
}

/* One explaining sentence tucked under a page title */
h1:has(+ .page-lede) {
  margin-bottom: 0.5rem;
}

/* Every page intro runs the full width of its content area, so all pages wrap it the same way */
.page-lede {
  margin-bottom: 3.5rem;
  color: var(--muted);
}

h2 {
  margin-bottom: 0.75rem;
  font-weight: 500;
  font-size: clamp(1.05em, 1.75vw, 1.25em);
}

h3 {
  margin-bottom: 0.35rem;
  font-size: 1.05em;
}

p {
  margin-bottom: 1rem;
  color: var(--muted);
}

header {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 1.25rem;
  border-bottom: 0;
  background: var(--background);
}

header::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--border);
  content: "";
  pointer-events: none;
}

.logo a {
  border-radius: var(--radius-inline);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.hamburger-btn {
  position: relative;
  z-index: 50;
  width: 32px;
  height: 32px;
}

/* Menu and close icons share one cell and swap instantly, with no animation */
.hamburger-btn a {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--text);
}

.hamburger-icon {
  width: 20px;
  height: 20px;
  grid-area: 1 / 1;
}

.hamburger-icon-close,
.hamburger-btn.active .hamburger-icon-open {
  opacity: 0;
}

.hamburger-btn.active .hamburger-icon-close {
  opacity: 1;
}

main {
  min-height: calc(100vh - 60px);
  font-size: 0.98rem;
}

.box {
  width: min(100% - 2.5rem, var(--content-width));
  margin: 0 auto;
  padding: 3.5rem 0 5rem;
}

.nav-out {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: flex;
  visibility: hidden;
  padding: 5rem 1.25rem 1.25rem;
  background: var(--background);
  flex-direction: column;
}

/* Opens and closes instantly, with no fade */
.nav-out.active {
  visibility: visible;
}

.sidebar-logo {
  display: none;
}

.nav-out nav {
  margin: auto 0;
}

.nav-out ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-section + .nav-section {
  margin-top: 1.25rem;
}

.nav-out nav a {
  display: inline-flex;
  padding: 0.35rem 0;
  align-items: center;
  gap: 0.6em;
  color: var(--nav-muted);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.035em;
  transition: color 150ms ease;
}

.nav-icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

.nav-out nav a:focus-visible,
.nav-out nav a[aria-current="page"] {
  color: var(--text);
}

@media (hover: hover) {
  .nav-out nav a:hover {
    color: var(--text);
  }
}

.btn-primary,
button.btn-primary {
  display: inline-flex;
  min-height: 32px;
  padding: 0.75rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  align-items: center;
  justify-content: center;
  color: var(--contrast-text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  background: var(--contrast-fill);
}

/* Outlined partner to the primary button */
.btn-secondary {
  display: inline-flex;
  min-height: 32px;
  gap: var(--link-arrow-gap);
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

/* Pill buttons: dim on hover, press in on click (the user's exception to the no-scale rule) */
.btn-primary:not(.project-back-link),
.btn-secondary {
  transition: opacity 150ms ease, transform 100ms ease;
}

@media (hover: hover) {
  .btn-primary:not(.project-back-link):hover,
  .btn-secondary:hover {
    opacity: 0.8;
  }
}

.btn-primary:not(.project-back-link):active,
.btn-secondary:active {
  opacity: 1;
  transform: scale(0.96);
}

.nav-indicator {
  display: none;
}

.nav-indicator-track {
  display: none;
}

[class^="icon-"],
[class*=" icon-"] {
  display: none;
}

/* Homepage */

/* Spacing and LED sizes for the homepage, set once per screen size below */
.home-page {
  --led-pitch: 3px;
  --hero-inset: 80px;
  --hero-name-inset: 72px;
  --hero-kicker-top: 72px;
  --hero-name-bottom: 72px;
  --hero-cta-bottom: 96px;
  /* View Projects (about 128px) plus the 80px gap the name always keeps from it */
  --hero-cta-room: 208px;
  --hero-name-max: 168px;
}

/* LED dots: one round dot per cell, anchored bottom-left so the board and lit text share a grid */
.led-board,
.led-lit {
  background-image: radial-gradient(circle, var(--led-color) calc(var(--led-dot-pitch) * 0.32), transparent calc(var(--led-dot-pitch) * 0.32 + 0.5px));
  background-position: left bottom;
  background-size: var(--led-dot-pitch) var(--led-dot-pitch);
}

.led-board {
  --led-color: var(--led-off);
  --led-dot-pitch: var(--led-pitch, 3px);
  background-color: var(--background);
}

.led-lit {
  --led-color: var(--led-on);
  --led-dot-pitch: var(--led-pitch, 3px);
  color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-hero {
  position: relative;
  container-type: inline-size;
  /* 80% of the screen, with a floor so the kicker never meets the name on short windows */
  min-height: max(80vh, 32rem);
  overflow: hidden;
}

/* The board is solid up top, then darkness eats it toward the hero's bottom edge.
   It shares the hero's box, so its bottom-left dot grid still lines up with the name */
.home-hero-board {
  position: absolute;
  inset: 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, rgba(0, 0, 0, 0.75) 70%, rgba(0, 0, 0, 0.4) 82%, rgba(0, 0, 0, 0.12) 92%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 55%, rgba(0, 0, 0, 0.75) 70%, rgba(0, 0, 0, 0.4) 82%, rgba(0, 0, 0, 0.12) 92%, transparent 100%);
}

.home-hero-kicker {
  position: absolute;
  top: var(--hero-kicker-top);
  left: var(--hero-inset);
  max-width: calc(100% - var(--hero-inset) * 2);
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Name offsets are whole multiples of the LED pitch, so its dots land on the board's dots */
.home-hero-name {
  position: absolute;
  bottom: var(--hero-name-bottom);
  left: var(--hero-name-inset);
  width: max-content;
  max-width: calc(100% - var(--hero-name-inset) - var(--hero-inset));
  margin: 0;
  padding-bottom: 0.2em;
  font-family: "Arimo", Arial, Helvetica, sans-serif;
  /* "Francis" is about 3.3em wide: fill the width left over after the insets and the button's room */
  font-size: min(var(--hero-name-max), calc((100cqw - var(--hero-name-inset) - var(--hero-inset) - var(--hero-cta-room)) / 3.3));
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.9;
}

.home-hero-cta {
  position: absolute;
  right: var(--hero-inset);
  bottom: var(--hero-cta-bottom);
  white-space: nowrap;
}

.home-sections {
  display: grid;
  width: min(100%, calc(var(--content-width) + 160px));
  margin: 0 auto;
  padding: 96px 80px 120px;
  gap: 96px;
}

.home-counter-board {
  margin: 0;
  padding: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  list-style: none;
}

.home-counter-board,
.home-principle-board {
  display: grid;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
  overflow: hidden;
}

.home-counter {
  display: flex;
  min-width: 0;
  height: 100%;
  padding: 28px 24px;
  flex-direction: column;
  align-items: flex-start;
  background: var(--background);
  transition: background-color 150ms ease;
}

.home-counter:focus-visible {
  outline-offset: -2px;
  background: var(--surface-hover);
}

@media (hover: hover) {
  .home-counter:hover {
    background: var(--surface-hover);
  }
}

.home-counter-number {
  margin-bottom: 0.2em;
  padding-bottom: 0.2em;
  font-size: 96px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.home-counter-label {
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
}

.home-counter-note {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.home-summary-section {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
  gap: 40px;
}

/* Keeps the site's heading brush (the global h2 gradient), like headings on every other page */
.home-section-title {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.home-experience-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.home-experience-item,
.home-experience-more {
  display: grid;
  padding: 22px 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}

.home-experience-title {
  margin: 0;
  color: var(--text);
  background: none;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.3;
  -webkit-text-fill-color: currentColor;
}

.home-experience-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.home-experience-date {
  color: var(--muted);
  font-size: 14px;
  text-align: right;
  white-space: nowrap;
}

.home-experience-more {
  grid-template-columns: minmax(0, 1fr);
}

.home-more-link {
  width: fit-content;
  color: var(--muted);
  font-size: 14px;
  transition: color 150ms ease;
}

.home-more-link:focus-visible {
  color: var(--text);
}

@media (hover: hover) {
  .home-more-link:hover {
    color: var(--text);
  }
}

.home-recommendation-content {
  min-width: 0;
}

.home-recommendation {
  margin: 0;
}

.home-recommendation-quote,
.home-about-intro {
  margin: 0;
  color: var(--text-soft);
  font-size: 30px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.home-recommendation-quote {
  margin-bottom: 20px;
}

.home-recommendation figcaption {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.home-recommendation-content > .home-more-link {
  display: inline-block;
  margin-top: 24px;
}

.home-about {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 40px;
}

.home-principle-board {
  margin: 0;
  padding: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
}

.home-principle {
  display: flex;
  padding: 24px;
  flex-direction: column;
  gap: 10px;
  background: var(--background);
}

.home-principle-title {
  margin: 0;
  color: var(--text);
  background: none;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.3;
  -webkit-text-fill-color: currentColor;
}

.home-principle p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.home-closing {
  display: flex;
  container-type: inline-size;
  padding-top: 72px;
  border-top: 1px solid var(--border);
  flex-direction: column;
  align-items: flex-start;
  gap: 28px;
}

.home-closing-title {
  margin: 0;
  padding-bottom: 0.15em;
  /* About 8.9em wide on one line: shrink with the section instead of wrapping */
  font-size: min(88px, calc(100cqw / 9));
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.home-closing > p {
  max-width: 480px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.home-closing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

@media (max-width: 1199px) {
  .home-page {
    --hero-inset: 48px;
    --hero-name-inset: 48px;
    --hero-kicker-top: 48px;
    --hero-name-bottom: 48px;
    --hero-cta-bottom: 72px;
  }

  .home-sections {
    width: min(100%, calc(var(--content-width) + 80px));
    padding: 96px 40px 120px;
  }

  .home-counter-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 899px) {
  .home-page {
    --hero-inset: 42px;
    --hero-name-inset: 42px;
    --hero-kicker-top: 42px;
    --hero-name-bottom: 42px;
    --hero-cta-bottom: 48px;
    /* The sidebar goes away below 900px and the hero suddenly widens; cap at the size the name had
       just above it (680px hero) so it never jumps back up while the window shrinks */
    --hero-name-max: 112px;
  }

  .home-hero {
    min-height: max(calc((100svh - 60px) * 0.8), 26rem);
  }
}

@media (max-width: 639px) {
  .home-page {
    --hero-inset: 24px;
    --hero-name-inset: 24px;
    --hero-kicker-top: 24px;
    --hero-name-bottom: 96px;
    --hero-cta-bottom: 24px;
    /* The button sits under the name here, so the name needs no room beside it */
    --hero-cta-room: 0px;
    /* Cap at the size the name had at 640px, so moving the button below doesn't make the name jump */
    --hero-name-max: 104px;
  }

  .home-hero-kicker {
    font-size: 11px;
    letter-spacing: 0.1em;
  }

  .home-hero-cta {
    right: auto;
    left: var(--hero-inset);
  }

  .home-sections {
    width: 100%;
    padding: 64px 20px 120px;
    gap: 64px;
  }

  .home-counter {
    padding: 24px 20px;
  }

  .home-counter-number {
    font-size: 80px;
  }

  .home-principle-board {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-about-intro {
    font-size: 24px;
  }

  .home-summary-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .home-experience-item {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 8px;
  }

  .home-experience-date {
    text-align: left;
  }

  .home-closing {
    padding-top: 56px;
    gap: 24px;
  }

  /* Two lines on phones: "Let's work" is about 5em wide */
  .home-closing-title {
    font-size: min(52px, calc(100cqw / 5));
  }
}

/* Form buttons: flat theme-contrast pill */
.form-actions .btn-primary {
  position: relative;
  min-height: 32px;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-pill);
  background: var(--contrast-fill);
  color: var(--contrast-text);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1;
  width: fit-content;
  min-width: 0;
  max-width: 100%;
}

.form-actions .btn-primary:focus-visible {
  background: var(--contrast-fill);
  color: var(--contrast-text);
}

@media (hover: hover) {
  .form-actions .btn-primary:hover {
    background: var(--contrast-fill);
    color: var(--contrast-text);
  }
}

h1,
h2,
.year-entry-title,
.home-counter-label,
.connect-email,
.project-stat-value,
.logo a > span {
  color: var(--text);
  background: linear-gradient(
    to bottom,
    var(--text) 0%,
    var(--text) 60%,
    var(--heading-gradient-end) 100%
  );
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Ruled boards: the 1px gap shows the border color between flat cells */
.project-board,
.connect-socials-board {
  display: grid;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
  overflow: hidden;
}

/* Projects: Experience-style rows, thumbnail first; the whole row opens the project and dims on hover */
.project-row {
  transition: opacity 150ms ease;
}

@media (hover: hover) {
  .project-row:hover {
    opacity: 0.85;
  }
}

/* The frame keeps the zoom inside its rounded border */
.project-row-media {
  margin-bottom: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* Full column width, not the Robotics strip height */
.project-row .year-entry-thumb {
  width: 100%;
  height: auto;
  border: 0;
  border-radius: 0;
  transition: transform 300ms ease;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .project-row:hover .year-entry-thumb {
    transform: scale(1.04);
  }
}

/* Ruled rows: a hairline above each row, none above the first, in the Résumé's divider color.
   Experience stays solid; Recommendations fade out on the right like the Résumé timeline */
.year-group,
.certification,
.recommendation-list > li,
.recommendation-more blockquote p {
  border-top: 1px solid var(--divider-color);
}

.recommendation-list > li,
.recommendation-more blockquote p {
  border-image: var(--divider-fade-right) 1;
}

.year-group:first-of-type,
.certification:first-child,
.recommendation-list > li:first-child {
  border-top: 0;
}

/* Year list: big year on the left, entries on the right, hairline between years */
.year-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  padding: 1.25rem 0;
}

.year-number {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.year-entries {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1rem;
}

/* Every entry: title leads with its month, then a subtitle, then smaller details */
.year-entry {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* Photo strip between the details and the source links: whole, uncropped photos at one height that scroll sideways
   when they overflow. Each photo opens the full-size viewer */
.year-entry-photos {
  display: flex;
  margin-top: 0.2rem;
  /* Room under the photos keeps overlay scrollbars in their own lane */
  padding-bottom: 0.75rem;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.year-entry-photo {
  flex: 0 0 auto;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: none;
  cursor: zoom-in;
  transition: opacity 150ms ease;
}

.year-entry-photo:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

@media (hover: hover) {
  .year-entry-photo:hover {
    opacity: 0.85;
  }
}

.year-entry-thumb {
  display: block;
  width: auto;
  max-width: 100%;
  height: 8.5rem;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* Full-size photo viewer: the whole uncropped photo, with previous, next and close */
.photo-viewer {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: color-mix(in srgb, var(--background) 94%, transparent);
  color: var(--text);
}

/* The viewer holds focus on open; only its buttons show a focus ring */
.photo-viewer:focus {
  outline: none;
}

.photo-viewer::backdrop {
  background: transparent;
}

.photo-viewer[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: max(1rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) max(1rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
  gap: 0.75rem;
}

.photo-viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.photo-viewer-image {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

/* Previous and next sit beside the caption so they stay reachable on phones */
.photo-viewer-footer {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem;
  align-items: center;
  gap: 0.75rem;
}

.photo-viewer-caption {
  max-width: 62ch;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: center;
}

.photo-viewer-button {
  display: inline-grid;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.photo-viewer-button:disabled {
  opacity: 0;
  pointer-events: none;
}

.photo-viewer-button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

@media (hover: hover) {
  .photo-viewer-button:hover {
    background: var(--surface-hover);
  }
}

/* Every source for the entry, wrapping onto new lines when narrow */
.year-entry-sources {
  display: flex;
  margin: 0.1rem 0 0;
  padding: 0;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  list-style: none;
}

/* Quiet text links: dim at rest, full text colour on hover. Colour only, so nothing jitters */
.year-entry-sources a {
  color: color-mix(in srgb, var(--text) 70%, var(--background));
  transition: color 150ms ease;
}

/* Bright links inside muted text: full text colour, dimming on hover */
.page-lede-link {
  color: var(--text);
  transition: color 150ms ease;
}

.year-entry-sources a:focus-visible,
.page-lede-link:focus-visible,
.recommendation-more summary:focus-visible,
.logo a:focus-visible {
  color: var(--text);
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

@media (hover: hover) {
  .year-entry-sources a:hover {
    color: var(--text);
  }

  .page-lede-link:hover {
    color: color-mix(in srgb, var(--text) 70%, var(--background));
  }
}

/* Plain inline, so its text shares the sentence's line box and selects at the same height */
.page-lede-link {
  border-radius: var(--radius-inline);
}

.page-lede-link .external-arrow {
  margin-left: var(--link-arrow-gap);
  vertical-align: middle;
}

.year-entry-sources a {
  display: inline-flex;
  align-items: center;
  gap: var(--link-arrow-gap);
  border-radius: var(--radius-inline);
  font-size: 0.75rem;
  text-decoration: none;
}

.year-side {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.year-location {
  display: flex;
  margin: 0;
  flex-direction: column;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.year-location b {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Title on the left, month pinned to the right edge */
.year-entry-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.year-entry-heading .year-entry-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.year-entry-heading time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.year-entry-subtitle,
.year-entry-detail {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.year-entry-subtitle {
  font-size: 0.95rem;
}

.year-entry-detail {
  font-size: 0.78rem;
}

/* Hover fill for linked tech stack tiles */
a.stack-item:focus-visible {
  background: var(--surface-hover);
}

@media (hover: hover) {
  a.stack-item:hover {
    background: var(--surface-hover);
  }
}

/* Up-right arrow pinned to the top right of a cell that opens another site.
   It takes its link's text colour, at rest and on hover */
.external-arrow {
  --arrow-size: 1rem;
  --arrow-inset: 1.25rem;
  position: absolute;
  top: var(--arrow-inset);
  right: var(--arrow-inset);
  width: var(--arrow-size);
  height: var(--arrow-size);
  background: currentColor;
  -webkit-mask: url("/assets/icons/arrow-up-right.svg?v=JxErJpReLk6U") center / contain no-repeat;
  mask: url("/assets/icons/arrow-up-right.svg?v=JxErJpReLk6U") center / contain no-repeat;
  transition: background-color 150ms ease;
}

/* The same arrow inline after a link's text: source links, Credly links, Connect pills */
.external-arrow.is-inline {
  --arrow-size: 0.75rem;
  position: static;
  display: inline-block;
  flex-shrink: 0;
}

/* Small uppercase label for tile headers */
.project-board-label,
.connect-social-label,
.connect-social-qr figcaption {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Content pages share one reading width */
.projects-page .box,
.experience-page .box,
.stack-page .box,
.recommendations-page .box,
.resume-page .box,
.certifications-page .box,
.project-details-page .box,
.connect-page .box {
  max-width: var(--reading-width);
}

/* Recommendations: a list of letters, newest first; lead quote, who wrote it, the rest folded away */
.recommendation-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recommendation-list > li {
  padding: 2rem 0;
}

.recommendation-list > li:first-child {
  padding-top: 0;
}

.recommendation {
  display: grid;
  margin: 0;
  gap: 1.25rem;
}

.recommendation blockquote {
  margin: 0;
}

.recommendation blockquote p {
  margin: 0;
}

/* Large quote text in the soft body shade, so it reads softer than headings */
.recommendation-lead p {
  color: var(--text-soft);
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  letter-spacing: -0.015em;
  line-height: 1.4;
}

.recommendation-lead p::before {
  content: "\201C";
}

.recommendation-lead p::after {
  content: "\201D";
}

.recommendation-source {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.recommendation-initials {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 50%;
  place-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.recommendation-person {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.85rem;
}

.recommendation-person b {
  font-weight: 500;
}

.recommendation-person span {
  color: var(--muted);
}

.recommendation-more summary {
  width: fit-content;
  border-radius: var(--radius-inline);
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  list-style: none;
  transition: color 150ms ease;
}

.recommendation-more summary::-webkit-details-marker {
  display: none;
}


@media (hover: hover) {
  .recommendation-more summary:hover {
    color: var(--text);
  }
}

.recommendation-more-open,
.recommendation-more[open] .recommendation-more-closed {
  display: none;
}

.recommendation-more[open] .recommendation-more-open {
  display: inline;
}

.recommendation-more blockquote {
  display: grid;
  margin-top: 1rem;
}

.recommendation-more blockquote p {
  padding: 1rem 0;
  color: var(--muted);
  line-height: 1.5;
}

/* Certifications: exam certifications, then course badges; badge on the left, the entry text from Experience on the right */
/* Résumé: image preview of the one-page PDF, with view and download links */
.resume-actions {
  display: flex;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.resume-preview {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.certification-group + .certification-group {
  margin-top: 2.5rem;
}

.certification-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.certification {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 0;
}

.certification-badge {
  display: block;
  width: 100%;
  height: auto;
}

.certification-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

/* Tech Stack: one board per group, spaced apart. Category headings are plain section headings, like Certifications */
.stack-board {
  display: grid;
  gap: 3.5rem;
}

/* Fixed columns with auto-fit: empty columns collapse, so the board hugs its tools instead of spanning the row.
   Each tile draws its own full border, overlapping its neighbours by 1px, so a part-filled last row ends in a
   step, like an unfinished puzzle, instead of an empty box. */
.stack-cells {
  display: grid;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0;
  grid-template-columns: repeat(auto-fit, 128px);
  list-style: none;
}

.stack-cell {
  display: grid;
  margin: 0 -1px -1px 0;
  border: 1px solid var(--border);
  overflow: hidden;
}

/* Rounded outer corners, in CSS so they paint with the first frame.
   Tiles are 128px, so a category of width W holds floor(W / 128) tiles per row (up to 6; the page caps at 720px).
   Per row count: the end of the first row, the start of the last row, and the end of the row above a short
   last row. Change these breakpoints if the tile width changes. */
.stack-board > section {
  container: stack-category / inline-size;
}

.stack-cell:first-child {
  border-top-left-radius: var(--radius);
}

.stack-cell:last-child {
  border-bottom-right-radius: var(--radius);
}

@container stack-category (width < 256px) {
  .stack-cell:nth-child(1),
  .stack-cell:last-child:nth-child(-n + 1) {
    border-top-right-radius: var(--radius);
  }

  .stack-cell:nth-child(1n + 1):nth-last-child(-n + 1) {
    border-bottom-left-radius: var(--radius);
  }

  .stack-cell:nth-child(1n):nth-last-child(-n + 1) {
    border-bottom-right-radius: var(--radius);
  }
}

@container stack-category (256px <= width < 384px) {
  .stack-cell:nth-child(2),
  .stack-cell:last-child:nth-child(-n + 2) {
    border-top-right-radius: var(--radius);
  }

  .stack-cell:nth-child(2n + 1):nth-last-child(-n + 2) {
    border-bottom-left-radius: var(--radius);
  }

  .stack-cell:nth-child(2n):nth-last-child(-n + 2) {
    border-bottom-right-radius: var(--radius);
  }
}

@container stack-category (384px <= width < 512px) {
  .stack-cell:nth-child(3),
  .stack-cell:last-child:nth-child(-n + 3) {
    border-top-right-radius: var(--radius);
  }

  .stack-cell:nth-child(3n + 1):nth-last-child(-n + 3) {
    border-bottom-left-radius: var(--radius);
  }

  .stack-cell:nth-child(3n):nth-last-child(-n + 3) {
    border-bottom-right-radius: var(--radius);
  }
}

@container stack-category (512px <= width < 640px) {
  .stack-cell:nth-child(4),
  .stack-cell:last-child:nth-child(-n + 4) {
    border-top-right-radius: var(--radius);
  }

  .stack-cell:nth-child(4n + 1):nth-last-child(-n + 4) {
    border-bottom-left-radius: var(--radius);
  }

  .stack-cell:nth-child(4n):nth-last-child(-n + 4) {
    border-bottom-right-radius: var(--radius);
  }
}

@container stack-category (640px <= width < 768px) {
  .stack-cell:nth-child(5),
  .stack-cell:last-child:nth-child(-n + 5) {
    border-top-right-radius: var(--radius);
  }

  .stack-cell:nth-child(5n + 1):nth-last-child(-n + 5) {
    border-bottom-left-radius: var(--radius);
  }

  .stack-cell:nth-child(5n):nth-last-child(-n + 5) {
    border-bottom-right-radius: var(--radius);
  }
}

@container stack-category (width >= 768px) {
  .stack-cell:nth-child(6),
  .stack-cell:last-child:nth-child(-n + 6) {
    border-top-right-radius: var(--radius);
  }

  .stack-cell:nth-child(6n + 1):nth-last-child(-n + 6) {
    border-bottom-left-radius: var(--radius);
  }

  .stack-cell:nth-child(6n):nth-last-child(-n + 6) {
    border-bottom-right-radius: var(--radius);
  }
}

.stack-item {
  position: relative;
  display: flex;
  min-height: 92px;
  padding: 1rem;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.8rem;
}

a.stack-item {
  transition: background-color 150ms ease, color 150ms ease;
}

a.stack-item:focus-visible {
  color: var(--text);
}

@media (hover: hover) {
  a.stack-item:hover {
    color: var(--text);
  }
}

a.stack-item:focus-visible {
  outline-offset: -2px;
}

.stack-item .external-arrow {
  --arrow-size: 0.85rem;
  --arrow-inset: 1rem;
}

.music-page .box {
  max-width: 980px;
}

.music-intro {
  position: relative;
  max-width: 720px;
  padding-bottom: 3rem;
}

.music-intro::after,
.music-section-heading::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  border-radius: var(--radius-pill);
  background: var(--divider-gradient);
  content: "";
}

.music-intro h1 {
  margin-bottom: 0.75rem;
}

.music-intro > p:last-child {
  max-width: 620px;
  margin-bottom: 0;
  font-size: 1.05em;
}

.music-section {
  margin-top: 3.5rem;
}

.music-section-heading {
  position: relative;
  display: flex;
  padding-bottom: 1rem;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
}

.music-section-heading h2 {
  margin-bottom: 0;
}

.music-section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.85em;
  text-align: right;
}

.music-notes h3,
.music-demo h3 {
  margin-bottom: 0.3rem;
  font-size: 1em;
}

.music-notes p,
.music-demo-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9em;
}

.music-notes {
  display: grid;
  gap: 0;
}

.music-notes article {
  position: relative;
  padding: 1.15rem 0;
}

.music-notes article:not(:first-child)::before,
.music-note-list li:not(:first-child)::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  border-radius: var(--radius-pill);
  background: var(--divider-gradient);
  content: "";
}

.music-notes > article > span {
  display: inline-block;
  margin-top: 0.65rem;
  color: var(--text);
  font-size: 0.78em;
}

.music-note-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.music-note-list li {
  position: relative;
  display: grid;
  padding: 0.65rem 0;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  gap: 0.5rem;
}

.music-note-index {
  padding-top: 0.1rem;
  color: var(--text);
  font-size: 0.72em;
  font-variant-numeric: tabular-nums;
}

.music-note-list strong,
.music-note-list small {
  display: block;
}

.music-note-list strong {
  color: var(--text);
  font-size: 0.85em;
}

.music-note-list small {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.78em;
  line-height: 1.45;
}

.music-demo-grid {
  display: grid;
  gap: 1.5rem;
}

.music-demo {
  padding: 1.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.music-demo-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.music-status {
  flex: none;
  color: var(--muted);
  font-size: 0.75em;
  text-align: right;
}

.music-demo.is-ready .music-status {
  color: var(--text);
}

.music-demo audio {
  display: block;
  width: 100%;
  margin: 1.25rem 0 1rem;
  accent-color: var(--text);
}

.music-source-toggle {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.music-source-button {
  padding: 0.55rem 0.7rem;
  border: 1px solid transparent;
  border-bottom-width: 2px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82em;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

@media (hover: hover) {
  .music-source-button:hover {
    border-color: var(--muted);
    color: var(--text);
  }
}

.music-source-button.is-active {
  border-bottom-color: var(--text);
  color: var(--text);
}

.music-demo-note {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 0.78em;
}

.skill-icons {
  display: flex;
  min-width: 26px;
  height: 26px;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
}

.skill-icons img {
  width: 26px;
  height: 26px;
  backface-visibility: hidden;
  object-fit: contain;
  transform: translateZ(0);
}

/* Tiles: label, logo and arrow share one colour, muted at rest and full text colour on hover.
   Logo files are baked in the dark theme's muted gray; brightness filters shift them to each theme's colour */
.stack-item .skill-icons {
  min-width: 20px;
  height: 20px;
  color: inherit;
}

.stack-item .skill-monogram {
  color: inherit;
}

.stack-item .skill-icons img {
  width: 20px;
  height: 20px;
  filter: var(--stack-logo-filter);
  transition: filter 150ms ease;
}

a.stack-item:focus-visible .skill-icons img {
  filter: var(--stack-logo-hover-filter);
}

@media (hover: hover) {
  a.stack-item:hover .skill-icons img {
    filter: var(--stack-logo-hover-filter);
  }
}

.paired-icons img {
  width: 21px;
  height: 21px;
}

.skill-monogram {
  color: var(--muted);
  font-size: 1em;
  font-weight: 700;
  letter-spacing: -0.04em;
}

/* Connect: the email is the headline, socials and QR codes below, the form folded away */
/* Connect's exception: its heading is a plain kicker, and the email carries the heading gradient */
.connect-kicker {
  margin: 0 0 0.75rem;
  background: none;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 400;
  -webkit-text-fill-color: currentColor;
}

.connect-email-row {
  display: flex;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

/* Scales with the screen so the whole address fits on a phone. Same gradient as headings, no hover change */
.connect-email {
  display: inline-block;
  max-width: 100%;
  background-repeat: no-repeat;
  font-size: clamp(1.6rem, 6.2vw, 3.25rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.connect-lede {
  margin: 0 0 3.5rem;
  color: var(--muted);
}

.connect-elsewhere {
  margin-top: 3.5rem;
}

/* Socials: one ruled board, the list on the left and a single QR on the right.
   Phones and touch screens drop the QR column */
.connect-socials-board {
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 900px) and (hover: hover) {
  .connect-socials-board {
    grid-template-columns: minmax(0, 1fr) 15rem;
  }
}

.connect-socials {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 1px;
  list-style: none;
}

.connect-social {
  display: flex;
  min-height: 3.5rem;
  padding: 0 1.25rem;
  align-items: center;
  gap: 1rem;
  /* The arrow takes this colour: gray at rest, white on hover and focus */
  color: var(--muted);
  background: var(--background);
  transition: background-color 150ms ease, color 150ms ease;
}

.connect-social:focus-visible {
  outline-offset: -2px;
  color: var(--text);
  background: var(--surface-hover);
}

@media (hover: hover) {
  .connect-social:hover {
    color: var(--text);
    background: var(--surface-hover);
  }
}

.connect-social-label {
  width: 6rem;
  flex-shrink: 0;
}

.connect-social-handle {
  min-width: 0;
  flex: 1;
  color: var(--text-soft);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.connect-social-qr-panel {
  display: none;
}

@media (min-width: 900px) and (hover: hover) {
  .connect-social-qr-panel {
    display: grid;
    padding: 1.5rem;
    place-items: center;
    background: var(--background);
  }
}

.connect-social-qr {
  display: grid;
  margin: 0;
  justify-items: center;
  gap: 0.85rem;
}

.connect-social-qr[hidden] {
  display: none;
}

.connect-social-qr img {
  display: block;
  width: 10.5rem;
  height: 10.5rem;
  filter: var(--qr-filter);
}

/* Form sits in its own card, one question at a time */
.connect-message {
  margin-top: 3.5rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.connect-message [hidden] {
  display: none;
}

.connect-message-header {
  display: flex;
  margin-bottom: 1.25rem;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.connect-message-header h2 {
  margin: 0;
}

.connect-step-count {
  color: var(--muted);
  font-size: 0.8rem;
}

/* One continuous rail, like the sidebar's; a lit line grows per step, solid from the left, fading at its leading edge */
.connect-step-bar {
  position: relative;
  height: 1px;
  margin-bottom: 2rem;
  border-radius: var(--radius-pill);
  background: var(--border);
}

.connect-step-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(var(--step-progress, 0) * 100%);
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--text) 0%, var(--text) 60%, transparent 100%);
  opacity: 0.9;
  transition: width 360ms var(--ease-slide);
}

/* Sending: the heading reads Sending…, fields, count and buttons step aside,
   and the full line sweeps with its tail fading out on the left */
.connect-compose.is-sending .connect-step-count,
.connect-compose.is-sending .connect-form {
  display: none;
}

.connect-compose.is-sending .connect-step-bar {
  margin-bottom: 0;
}

.connect-compose.is-sending .connect-step-fill {
  width: 100%;
  background: linear-gradient(90deg, transparent 0%, var(--text) 85%, transparent 100%) no-repeat;
  background-size: 40% 100%;
  animation: connect-step-sweep 1.1s linear infinite;
}

@keyframes connect-step-sweep {
  from { background-position: -70% 0; }
  to { background-position: 170% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .connect-step-fill {
    transition: none;
  }

  .connect-compose.is-sending .connect-step-fill {
    background: var(--text);
    animation: none;
  }
}

/* Result panels: sent keeps a copy of what went out, failed offers a retry */
.connect-result h2 {
  margin: 0 0 0.5rem;
}

.connect-result h2:focus {
  outline: none;
}

/* Card padding alone closes each panel */
.connect-result > :last-child {
  margin-bottom: 0;
}

.connect-result-lede {
  margin: 0 0 1.75rem;
  color: var(--muted);
}

.connect-sent-email {
  color: var(--text);
  overflow-wrap: anywhere;
}

.connect-sent-recap {
  display: grid;
  margin: 0 0 1.75rem;
  gap: 1rem;
}

.connect-sent-recap dt {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.connect-sent-recap dd {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Back hugs the left, Next and Send the right, even when Back is hidden */
.connect-form .form-actions .btn-primary {
  margin-left: auto;
}

.connect-form.is-stepped .form-field:not(.is-current) {
  display: none;
}

.connect-form {
  --control-gap: 0.625rem;
  --section-gap: 1.75rem;
  display: grid;
  row-gap: var(--section-gap);
}

.form-field {
  display: grid;
  margin: 0;
  padding: 0;
  border: 0;
  gap: var(--control-gap);
}

.form-field label,
.form-field legend {
  color: color-mix(in srgb, var(--text) 70%, var(--background));
  font-size: 0.875rem;
  font-weight: 400;
}

.required-mark {
  color: var(--danger);
}

/* Bare fields: big type, no box or rule */
.form-field {
  --field-line-height: 1.2;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 0.5rem 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.5rem;
  line-height: var(--field-line-height);
}

/* Starts one input tall, then grows with its text: no scrollbar, no resize handle */
.form-field textarea {
  min-height: calc(1.5rem * var(--field-line-height) + 1rem);
  overflow: hidden;
  resize: none;
  field-sizing: content;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
}

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-primary.project-back-link {
  display: flex;
  width: fit-content;
  min-height: auto;
  margin-bottom: 2rem;
  padding: 0;
  gap: 0.45rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  transition: color 150ms ease;
}

/* Lucide chevron-left, trimmed to its stroke and sized to the text's cap height */
.btn-primary.project-back-link::before {
  height: 0.72em;
  aspect-ratio: 8 / 14;
  flex-shrink: 0;
  content: "";
  background: currentColor;
  -webkit-mask: url("/assets/icons/chevron-left.svg?v=Ll2r0temhB-3") center / contain no-repeat;
  mask: url("/assets/icons/chevron-left.svg?v=Ll2r0temhB-3") center / contain no-repeat;
}

@media (hover: hover) {
  .btn-primary.project-back-link:hover {
    background: transparent;
    color: var(--text);
  }
}

/* Project detail: the thumbnail, intro and status share one ruled board; every section below gets its own board */
.project-hero {
  margin-bottom: 0.5rem;
}

.project-board-media {
  background: var(--surface);
}

.project-board-media img {
  display: block;
  width: 100%;
  height: auto;
}

.project-board-cell {
  display: grid;
  margin: 0;
  padding: 1.25rem;
  align-content: start;
  gap: 0.5rem;
  background: var(--background);
}

.project-board-cell h1 {
  margin: 0;
}

.project-board-cell h3,
.project-board-cell .project-board-value {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.3;
}

.project-board-cell p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.project-board-cell .project-hero-lede {
  color: var(--text-soft);
  font-size: 1rem;
}

.project-hero-intro {
  gap: 0.85rem;
  padding: 1.75rem;
}

.project-hero-intro .btn-primary {
  justify-self: start;
  margin-top: 0.4rem;
}

.project-hero-status {
  padding: 1.75rem;
  align-content: space-between;
  gap: 1.5rem;
}

.project-hero-status h2 {
  margin: 0;
}

.project-status-facts {
  display: grid;
  gap: 0.35rem;
}

.project-board-cell .project-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.project-status-dot {
  width: 0.6rem;
  height: 0.6rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text);
}

.project-board-cell .project-board-soft {
  color: var(--text-soft);
  font-size: 0.95rem;
}

.project-board-cell .project-board-note {
  font-size: 0.8rem;
}

.project-board-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text);
}

.project-board-cell .project-stat-value {
  font-size: 2.25rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
}

.project-stat {
  padding-block: 1.5rem;
}

.project-details-page article > h2 {
  margin-top: 2.5rem;
}

.project-board {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Theme toggle left, social icons right, on one row */
.sidebar-bottom {
  display: flex;
  margin-top: auto;
  padding-inline: 0.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.sidebar-social {
  display: flex;
  gap: 2px;
}

/* Icon masked on a pseudo-element, so the link's own focus ring isn't clipped by the mask */
.sidebar-social-link {
  position: relative;
  display: block;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-inline);
  color: var(--nav-muted);
  transition: color 150ms ease;
}

.sidebar-social-link::before {
  position: absolute;
  inset: 0;
  background: currentColor;
  content: "";
  -webkit-mask: var(--social-icon) center / 16px no-repeat;
  mask: var(--social-icon) center / 16px no-repeat;
}

.sidebar-social-link:focus-visible {
  color: var(--text);
  outline-offset: 0;
}

@media (hover: hover) {
  .sidebar-social-link:hover {
    color: var(--text);
  }
}

.sidebar-social-link--github {
  --social-icon: url("/assets/icons/github.svg?v=APRS7MtRhwmL");
}

.sidebar-social-link--linkedin {
  --social-icon: url("/assets/icons/linkedin.svg?v=YcS-UNIb25Vf");
}

.theme-toggle {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  gap: 2px;
}

.theme-toggle button {
  display: inline-flex;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--nav-muted);
  cursor: pointer;
  transition: color 150ms ease;
}

.theme-toggle button[aria-pressed="true"] {
  color: var(--text);
}

@media (hover: hover) {
  .theme-toggle button:hover {
    color: var(--text);
  }
}

/* One pill slides under the chosen mode, like the old top-bar tabs.
   Buttons are 26px with a 2px gap, so each step is 28px */
.theme-toggle {
  position: relative;
}

.theme-toggle button {
  position: relative;
}

.theme-toggle-pill {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--border-strong) 30%, var(--border));
  opacity: 0;
  transition: transform 360ms var(--ease-slide), opacity 150ms ease;
}

.theme-toggle:has([aria-pressed="true"]) .theme-toggle-pill {
  opacity: 1;
}

.theme-toggle:has([data-theme-option="light"][aria-pressed="true"]) .theme-toggle-pill {
  transform: translateX(28px);
}

.theme-toggle:has([data-theme-option="dark"][aria-pressed="true"]) .theme-toggle-pill {
  transform: translateX(56px);
}

.theme-toggle svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

@media (min-width: 640px) {
  .box {
    width: min(100% - 4rem, var(--content-width));
  }

  .year-group {
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: 1.5rem;
  }

  .project-board {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .project-board > * {
    grid-column: span 2;
  }

  .project-board > .project-board-media,
  .project-board > .project-board-full {
    grid-column: 1 / -1;
  }

  .project-board > .project-hero-intro,
  .project-board > .project-board-wide {
    grid-column: span 4;
  }

  .project-board > .project-board-half {
    grid-column: span 3;
  }
}

@media (max-width: 899px) {
  /* The top bar stays pinned while the page scrolls underneath it; anchor jumps land below it */
  html {
    scroll-padding-top: 60px;
  }

  body {
    padding-top: 60px;
  }

  /* Frosted glass: 90% background over a blur of the content scrolling beneath */
  header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    background: color-mix(in srgb, var(--background) 90%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  /* Open menu: lock the page so nothing scrolls behind it */
  html:has(body.menu-active) {
    overflow: hidden;
  }

  .nav-out {
    overflow-y: auto;
    overscroll-behavior: contain;
  }


}

@media (min-width: 900px) {
  header {
    display: none;
  }

  main {
    min-height: 100vh;
    margin-left: 220px;
  }

  body.menu-active {
    overflow-y: auto;
  }

  .nav-out,
  .nav-out.active {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    display: flex;
    visibility: visible;
    width: 220px;
    height: 100vh;
    height: 100dvh;
    padding: 1.5rem 1rem;
    border-right: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--background);
    opacity: 1;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .sidebar-logo {
    display: flex;
    height: auto;
    margin-bottom: 1.25rem;
    padding-inline: 0.75rem;
    align-items: center;
  }

  .nav-out nav {
    position: relative;
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .nav-out nav ul {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .nav-section + .nav-section {
    margin-top: 1.5rem;
  }

  /* Links hug their icon and label, so only the text area is clickable */
  .nav-out nav a {
    display: flex;
    width: fit-content;
    min-height: 28px;
    padding: 0.1rem 0.75rem;
    border-radius: var(--radius-pill);
    align-items: center;
    font-size: 0.85rem;
    letter-spacing: 0;
    transition: color 150ms ease, background-color 150ms ease;
  }

  .nav-indicator {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    display: block;
    width: 1px;
    height: 1px;
    border: 0;
    border-radius: var(--radius-pill);
    background: linear-gradient(
      180deg,
      transparent 0%,
      var(--text) 40%,
      var(--text) 60%,
      transparent 100%
    );
    background-position: center;
    background-size: 100% 100%;
    transform: translate(
      var(--nav-indicator-left, 0px),
      var(--nav-indicator-top, 0px)
    );
    opacity: 0;
    pointer-events: none;
  }

  .nav-indicator-track {
    position: fixed;
    z-index: 41;
    top: 0;
    bottom: 0;
    left: 219px;
    display: block;
    width: 1px;
    pointer-events: none;
    overflow: visible;
  }

  .nav-indicator.is-ready {
    transition: transform 360ms var(--ease-slide),
      width 360ms var(--ease-slide),
      height 360ms var(--ease-slide),
      border-radius 360ms var(--ease-slide),
      border-color 360ms var(--ease-slide),
      background-color 360ms var(--ease-slide),
      opacity 150ms var(--ease-slide);
  }

  .nav-indicator.is-ready.has-target {
    opacity: 0.8;
  }

  .music-notes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
  }

  .music-notes article:not(:first-child)::before {
    top: 0.75rem;
    bottom: 0.75rem;
    left: -0.75rem;
    width: 1px;
    height: auto;
    background: linear-gradient(
      180deg,
      transparent 0%,
      var(--divider-color) 12%,
      var(--divider-color) 88%,
      transparent 100%
    );
  }

  .music-demo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .theme-toggle-pill {
    transition: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
