:root {
  --paper: #ffffff;
  --ink: #202124;
  --muted: #6f7175;
  --line: #dedfe1;
  --soft: #efefed;
  --link: #174ea6;
  --max-width: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
}

a {
  color: inherit;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--link);
}

a:focus-visible {
  border-radius: 2px;
  outline: 3px solid rgb(23 78 166 / 28%);
  outline-offset: 4px;
}

.site-header {
  display: flex;
  width: min(calc(100% - 80px), var(--max-width));
  min-height: 92px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.quiet-link {
  color: var(--muted);
  font-size: 0.95rem;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.home-main {
  width: min(calc(100% - 80px), var(--max-width));
  margin: 0 auto;
}

.hero {
  display: grid;
  min-height: calc(100vh - 92px);
  padding: 56px 0 104px;
  align-items: center;
  grid-template-columns: minmax(260px, 0.78fr) minmax(480px, 1.35fr);
  gap: clamp(56px, 8vw, 104px);
}

.portrait-placeholder,
.portrait {
  display: block;
  width: 100%;
  aspect-ratio: 0.742;
  border-radius: 1px;
  object-fit: cover;
}

.portrait-placeholder {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 18%, rgb(255 255 255 / 72%) 0 8%, transparent 26%),
    linear-gradient(145deg, #d9d7d2 0%, #ecebe8 48%, #c9c8c4 100%);
  isolation: isolate;
}

.portrait-placeholder::before {
  position: absolute;
  right: -28%;
  bottom: -8%;
  width: 92%;
  aspect-ratio: 1;
  border: 1px solid rgb(32 33 36 / 18%);
  border-radius: 50%;
  content: "";
}

.portrait-placeholder::after {
  position: absolute;
  top: 24px;
  right: 24px;
  color: rgb(32 33 36 / 58%);
  content: "ME / EE";
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.portrait-placeholder span {
  position: absolute;
  bottom: 24px;
  left: 24px;
  z-index: 1;
  font-size: clamp(4.5rem, 9vw, 7.5rem);
  font-weight: 700;
  letter-spacing: -0.09em;
  line-height: 0.8;
}

.intro {
  max-width: 700px;
}

.intro p {
  margin: 0 0 1.35em;
  font-size: clamp(1.12rem, 1.72vw, 1.38rem);
  letter-spacing: -0.014em;
  line-height: 1.52;
}

.intro p a {
  font-weight: 600;
}

.primary-links {
  display: flex;
  margin-top: 2.3rem;
  flex-wrap: wrap;
  gap: 18px 34px;
  font-size: 1.02rem;
  font-weight: 700;
}

.you-home-link {
  display: inline-block;
  margin: 0.95rem 0 0.6rem;
  color: #fff;
  font-weight: 650;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: default;
}

.you-home-link:hover,
.you-home-link:focus,
.you-home-link:active {
  color: #fff;
  background: transparent;
  cursor: default;
}

.you-home-link + .primary-links {
  margin-top: 0;
}

a.you-home-link,
a.you-home-link:link,
a.you-home-link:visited,
a.you-home-link:hover,
a.you-home-link:focus,
a.you-home-link:active {
  display: inline-block;
  margin: 0.95rem 0 0.6rem;
  color: #fff;
  font-weight: 650;
  text-decoration: none;
  background: transparent;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.you-home-link + .primary-links {
  margin-top: 0;
}

.projects-main,
.detail-main {
  width: min(calc(100% - 80px), 1040px);
  margin: 0 auto;
}

.projects-main {
  padding: 78px 0 72px;
}

.projects-intro {
  max-width: 800px;
  margin-bottom: 72px;
}

.projects-intro h1 {
  margin: 0 0 22px;
  font-size: clamp(3.2rem, 6.5vw, 5.7rem);
  letter-spacing: -0.07em;
  line-height: 0.92;
}

.projects-intro h1 span {
  color: #96989b;
  font-weight: 400;
}

.projects-intro > p:last-child {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.55;
}

.project-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 50px 28px;
}

.project-preview {
  min-width: 0;
}

.project-card {
  position: relative;
  display: block;
  color: var(--ink);
  text-decoration: none;
}

.project-index {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  padding: 6px 7px 5px;
  border: 1px solid rgb(32 33 36 / 12%);
  background: rgb(255 255 255 / 92%);
  color: #77797d;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.photo-stack {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1.42;
}

.stack-photo {
  position: absolute;
  display: block;
  width: 76%;
  height: 64%;
  overflow: hidden;
  border: 7px solid var(--paper);
  background: var(--soft);
  box-shadow: 0 7px 22px rgb(32 33 36 / 15%);
  object-fit: cover;
}

.firing-pistol {
  object-position: 58% 39%;
}

.firing-carbine {
  object-position: 54% 36%;
}

.firing-video {
  object-position: 50% 50%;
}

.snowkite-wide {
  object-position: 50% 48%;
}

.snowkite-canopy {
  object-position: 38% 18%;
}

.snowkite-rider {
  object-position: 50% 82%;
}

.defense-vehicle {
  object-position: 50% 48%;
}

.defense-pulsar {
  object-position: 50% 46%;
}

.defense-saildrone {
  object-position: 50% 48%;
}

.falcon-launch {
  object-position: 50% 47%;
}

.falcon-apollo {
  object-position: 50% 43%;
}

.falcon-nasa {
  object-position: 63% 45%;
}

.friends-street,
.friends-shop,
.open-dalek,
.open-trash,
.open-glow,
.rocketry-talk,
.rocketry-panel,
.rocketry-plane,
.chem-cleanroom,
.chem-microscopy,
.chem-beaker {
  object-position: 50% 46%;
}

.bio-wide {
  object-position: 50% 66%;
}

.bio-detail {
  object-position: 40% 70%;
}

.bio-edge {
  object-position: 68% 73%;
}

.equipment-vacuum,
.equipment-sem,
.equipment-cnc,
.mech-cad,
.mech-optics,
.mech-printers {
  object-position: 50% 50%;
}

.friends-game {
  object-position: 50% 62%;
}

.stack-photo-a {
  top: 28%;
  left: 4%;
  z-index: 1;
  transform: rotate(-5deg);
}

.stack-photo-b {
  top: 7%;
  left: 13%;
  z-index: 2;
  transform: rotate(3deg);
}

.stack-photo-c {
  top: 31%;
  left: 20%;
  z-index: 3;
  transform: rotate(7deg);
}

.project-copy,
.project-title {
  display: block;
}

.project-copy {
  display: block;
  margin-top: 10px;
}

.project-title {
  max-width: 24ch;
  margin-bottom: 0;
  font-size: clamp(1.05rem, 1.55vw, 1.28rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.12;
}

.project-card:hover {
  color: var(--ink);
}

.project-card:hover .project-title {
  color: var(--link);
}

.project-card:hover .stack-photo-a {
  transform: translate(-8px, 6px) rotate(-8deg);
}

.project-card:hover .stack-photo-b {
  transform: translateY(-7px) rotate(1deg);
}

.project-card:hover .stack-photo-c {
  transform: translate(10px, 5px) rotate(10deg);
}

.detail-main {
  padding: 54px 0 80px;
}

.detail-breadcrumb {
  display: flex;
  margin-bottom: 70px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
  gap: 10px;
}

.detail-hero {
  max-width: 920px;
  margin-bottom: 62px;
}

.detail-hero h1 {
  max-width: 900px;
  margin: 14px 0 26px;
  font-size: clamp(3rem, 7vw, 5.75rem);
  letter-spacing: -0.07em;
  line-height: 0.94;
}

.detail-gallery {
  display: grid;
  padding: 36px 0 68px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.friends-gallery {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-photo {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  margin: 0;
  background: var(--soft);
}

.detail-photo svg {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid #d4d5d7;
  background: var(--soft);
}

.detail-photo img {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid #d4d5d7;
  background: var(--soft);
  object-fit: cover;
}

.chemistry-argon {
  object-position: 50% 30%;
}

.chemistry-repaired-afm {
  object-position: 50% 42%;
}

.mech-far-rocket {
  object-position: 50% 38%;
}

.electrical-bci {
  object-position: 50% 22%;
}

.sonotrode-finished {
  object-position: 50% 16%;
}

.detail-photo video {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid #d4d5d7;
  background: #000;
  object-fit: contain;
}

.detail-photo figcaption {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: block;
  max-width: calc(100% - 20px);
  padding: 7px 9px;
  margin: 0;
  background: rgb(32 33 36 / 88%);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.detail-photo:hover figcaption {
  opacity: 1;
  transform: translateY(0);
}

.detail-footer {
  display: flex;
  padding-top: 30px;
  border-top: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  font-size: 0.92rem;
  font-weight: 700;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 800px) {
  .site-header,
  .home-main,
  .projects-main,
  .detail-main {
    width: min(calc(100% - 44px), var(--max-width));
  }

  .site-header {
    min-height: 76px;
  }

  .hero {
    min-height: auto;
    padding: 42px 0 78px;
    grid-template-columns: 1fr;
    gap: 44px;
  }

  .portrait-placeholder,
  .portrait {
    width: min(68vw, 310px);
  }

  .intro p {
    font-size: 1.08rem;
    line-height: 1.56;
  }

  .projects-main {
    padding-top: 52px;
  }

  .projects-intro {
    margin-bottom: 52px;
  }

  .projects-intro h1 span {
    display: block;
  }

  .project-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 48px 20px;
  }

  .detail-main {
    padding-top: 36px;
  }

  .detail-breadcrumb {
    margin-bottom: 54px;
  }

  .detail-gallery {
    padding: 28px 0 50px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

}

@media (max-width: 560px) {
  .project-list {
    grid-template-columns: 1fr;
    gap: 52px;
  }

  .photo-stack {
    aspect-ratio: 1.42;
  }

  .project-title {
    max-width: 28ch;
    font-size: 1.42rem;
  }
}

@media (hover: none) {
  .detail-photo figcaption {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  a {
    transition: color 140ms ease;
  }

  .stack-photo {
    transition: transform 180ms ease;
  }
}
