:root {
  color-scheme: dark;
  --black: #050505;
  --white: #f5f5f2;
  --gray-light: #b8b8b3;
  --gray-dark: #222222;
  --line: rgba(245, 245, 242, .25);
  --font: "Fragment Mono", monospace;
  --frame: clamp(14px, 1.25vw, 24px);
  --edge: clamp(58px, 4.2vw, 82px);
  --ease: 220ms ease;
}

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

html {
  scroll-behavior: smooth;
  background: var(--black);
}

html,
body,
button,
input,
textarea,
select,
a {
  font-family: var(--font);
  font-synthesis: none;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--black);
  color: var(--white);
  line-height: 1.45;
}

a {
  color: inherit;
}

::selection {
  background: var(--white);
  color: var(--black);
}

.viewport-frame {
  position: fixed;
  inset: var(--frame);
  z-index: 1000;
  border: 1px solid var(--line);
  pointer-events: none;
}

.skip-link {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 1100;
  padding: 8px 10px;
  background: var(--white);
  color: var(--black);
  font-size: .72rem;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

a:focus-visible {
  outline: 1px solid var(--white);
  outline-offset: 5px;
}

/* Fixed editorial chrome */
.site-chrome {
  position: fixed;
  inset: var(--edge) var(--edge) auto;
  z-index: 100;
  pointer-events: none;
}

.site-chrome a {
  pointer-events: auto;
}

.identity {
  position: absolute;
  top: 0;
  left: 0;
}

.identity > a {
  display: block;
  min-height: .92em;
  font-size: clamp(2.65rem, 3.2vw, 3.85rem);
  font-weight: 400;
  line-height: .92;
  letter-spacing: -.085em;
  text-decoration: none;
}

.identity p {
  min-height: 1.3em;
  max-width: 360px;
  margin: 9px 0 0;
  color: var(--gray-light);
  font-size: clamp(.6rem, .62vw, .7rem);
  line-height: 1.3;
}

.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;
}

.typing-target::after {
  content: "";
  display: inline-block;
  width: .075em;
  height: .85em;
  margin-left: .12em;
  background: currentColor;
  opacity: 0;
  transform: translateY(.06em);
}

.typing-target.is-typing::after {
  opacity: 1;
}

.typing-target.is-complete::after {
  opacity: 1;
  animation: identity-caret-blink .82s steps(1, end) infinite;
}

@keyframes identity-caret-blink {
  50% {
    opacity: 0;
  }
}

.side-nav {
  position: absolute;
  top: clamp(144px, 17vh, 182px);
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.side-nav::before {
  content: "●";
  margin-bottom: 12px;
  color: var(--white);
  font-size: .54rem;
  line-height: 1;
}

.side-nav a {
  padding: 2px 0;
  color: var(--gray-light);
  font-size: .68rem;
  text-decoration: none;
  opacity: .58;
  transition: color var(--ease), opacity var(--ease);
}

.side-nav a:hover,
.side-nav a[aria-current="true"] {
  color: var(--white);
  opacity: 1;
}

.external-links {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 22px;
}

.external-links a,
.contact-links a,
.project-meta a {
  position: relative;
  font-size: .7rem;
  text-decoration: none;
  transition: opacity var(--ease);
}

.external-links a::after,
.contact-links a::after,
.project-meta a::after,
.email::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--ease);
}

.external-links a:hover,
.contact-links a:hover,
.project-meta a:hover {
  opacity: .58;
}

.external-links a:hover::after,
.contact-links a:hover::after,
.project-meta a:hover::after,
.email:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Hero */
.hero {
  position: relative;
  min-height: 100svh;
  padding: var(--edge);
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 20px;
}

.hero-code {
  position: absolute;
  bottom: var(--edge);
  left: var(--edge);
  margin: 0;
  color: var(--gray-light);
  font-size: .58rem;
  text-transform: uppercase;
}

.hero-statement {
  position: absolute;
  right: var(--edge);
  bottom: var(--edge);
  width: min(330px, 25vw);
}

.hero h1 {
  margin: 0;
  font-size: clamp(.78rem, .82vw, .96rem);
  font-weight: 400;
  line-height: 1.36;
  letter-spacing: -.035em;
}

.hero h1 span {
  display: inline;
}

.hero-meta {
  display: block;
  margin-top: 18px;
  color: var(--gray-light);
  font-size: .6rem;
  line-height: 1.45;
}

.hero-meta p {
  margin: 0;
}

/* Content */
.content-section {
  min-height: 76vh;
  padding: clamp(120px, 16vh, 190px) var(--edge);
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 20px;
}

.content-inner {
  width: auto;
  margin-right: clamp(0px, 3vw, 48px);
  margin-left: clamp(280px, 32vw, 520px);
}

.section-heading {
  margin-bottom: clamp(56px, 7vw, 96px);
}

.section-number {
  margin: 0 0 18px;
  color: var(--gray-light);
  font-size: .68rem;
}

.section-heading h2 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -.045em;
}

/* Projects */
.project-list {
  border-bottom: 1px solid var(--line);
}

.project {
  position: relative;
  padding: clamp(48px, 6vw, 76px) 0;
  border-top: 1px solid var(--line);
}

.project-number {
  margin: 0 0 24px;
  color: var(--gray-light);
  font-size: .68rem;
}

.project h3 {
  max-width: 800px;
  margin: 0;
  font-size: clamp(2.2rem, 4.2vw, 4.25rem);
  font-weight: 400;
  line-height: .98;
  letter-spacing: -.045em;
}

.project-description {
  max-width: 560px;
  margin: clamp(28px, 4vw, 48px) 0 0 auto;
  color: var(--gray-light);
  font-size: clamp(.95rem, 1.25vw, 1.12rem);
}

.project-meta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-top: clamp(32px, 4vw, 48px);
  color: var(--gray-light);
  font-size: .66rem;
}

.project-meta p {
  max-width: 480px;
  margin: 0;
}

.project-meta a {
  flex: 0 0 auto;
  color: var(--white);
}

/* About */
.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .8fr);
  gap: clamp(56px, 9vw, 130px);
  align-items: start;
}

.about-layout .section-heading {
  margin: 0;
}

.about-layout .section-heading h2 {
  font-size: clamp(2rem, 3.8vw, 3.75rem);
}

.about-copy {
  padding-top: 35px;
  border-top: 1px solid var(--line);
}

.about-copy p {
  margin: 0 0 28px;
  color: var(--gray-light);
  font-size: clamp(.98rem, 1.25vw, 1.12rem);
}

.about-copy p:first-child {
  color: var(--white);
}

/* Knowledge */
.knowledge-list {
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.knowledge-list > div {
  display: grid;
  grid-template-columns: minmax(150px, .45fr) minmax(0, 1.55fr);
  gap: 32px;
  align-items: baseline;
  padding: clamp(26px, 4vw, 44px) 0;
  border-top: 1px solid var(--line);
}

.knowledge-list dt {
  color: var(--gray-light);
  font-size: .67rem;
}

.knowledge-list dd {
  margin: 0;
  font-size: clamp(1.55rem, 3.3vw, 3.25rem);
  font-weight: 400;
  letter-spacing: -.045em;
}

/* Education */
.education-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(230px, .7fr);
  gap: clamp(40px, 8vw, 100px);
  align-items: end;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.education-row > p {
  max-width: 640px;
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 4rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.05em;
}

.education-row > div {
  color: var(--gray-light);
  font-size: .68rem;
}

.education-row > div p {
  margin: 6px 0;
}

.education-row > div p:first-child {
  color: var(--white);
}

/* Contact */
.contact {
  min-height: 90vh;
}

.contact .section-heading h2 {
  max-width: 900px;
  font-size: clamp(2.2rem, 4vw, 4rem);
}

.email {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin-top: clamp(20px, 3vw, 48px);
  font-size: clamp(1.15rem, 2.5vw, 2.5rem);
  font-weight: 400;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
  text-decoration: none;
  transition: opacity var(--ease);
}

.email:hover {
  opacity: .58;
}

.contact-links {
  display: flex;
  gap: 24px;
  margin-top: 48px;
}

/* Footer */
.site-footer {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 20px;
  padding: 26px var(--edge) 34px;
  color: var(--gray-light);
  font-size: .65rem;
}

.site-footer p {
  margin: 0;
}

/* Short, opacity-only reveals */
.reveal {
  opacity: 1;
}

html.motion-ready .reveal {
  opacity: 0;
  transition: opacity 260ms ease;
}

html.motion-ready .reveal.is-visible {
  opacity: 1;
}

@media (max-width: 900px) {
  :root {
    --edge: 26px;
  }

  .viewport-frame {
    inset: 8px;
  }

  .site-chrome {
    position: relative;
    inset: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 28px 18px;
    padding: 28px 26px 0;
    pointer-events: auto;
  }

  .identity,
  .side-nav,
  .external-links {
    position: static;
  }

  .identity {
    grid-column: 1 / -1;
  }

  .identity > a {
    font-size: clamp(2.2rem, 9vw, 3.6rem);
  }

  .external-links {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
  }

  .side-nav {
    grid-column: 1 / -1;
    grid-row: 3;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }

  .side-nav::before {
    margin: 0;
  }

  .side-nav a {
    padding: 2px 0;
  }

  .hero {
    display: flex;
    flex-direction: column;
    min-height: 72svh;
    padding: 80px 26px 34px;
  }

  .hero-code {
    display: none;
  }

  .hero-statement {
    position: static;
    width: 100%;
    margin-top: auto;
  }

  .hero h1 {
    font-size: clamp(1.8rem, 7vw, 2.8rem);
  }

  .hero-meta {
    margin-top: 28px;
  }

  .content-section {
    min-height: auto;
    padding: 100px 26px;
  }

  .content-inner {
    margin: 0;
  }

  .about-layout {
    grid-template-columns: 1fr;
  }

  .about-layout .section-heading {
    margin-bottom: 60px;
  }
}

@media (max-width: 560px) {
  .site-chrome {
    padding: 26px 22px 0;
  }

  .identity p {
    margin-top: 12px;
  }

  .external-links {
    gap: 18px;
  }

  .side-nav {
    justify-content: space-between;
    gap: 6px 10px;
  }

  .hero {
    min-height: 76svh;
    padding: 78px 22px 34px;
  }

  .hero h1 span {
    display: inline;
  }

  .hero-meta {
    flex-direction: column;
    gap: 5px;
  }

  .content-section {
    padding: 88px 22px;
  }

  .section-heading {
    margin-bottom: 64px;
  }

  .section-heading h2,
  .about-layout .section-heading h2,
  .contact .section-heading h2 {
    font-size: clamp(2rem, 9vw, 3rem);
  }

  .project {
    padding: 56px 0;
  }

  .project h3 {
    font-size: clamp(2rem, 9vw, 3rem);
  }

  .project-description {
    margin-left: 0;
  }

  .project-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .knowledge-list > div,
  .education-row {
    grid-template-columns: 1fr;
  }

  .knowledge-list > div {
    gap: 12px;
  }

  .education-row {
    gap: 38px;
  }

  .contact-links {
    margin-top: 38px;
  }

  .site-footer {
    grid-template-columns: 1fr auto;
    padding: 24px 22px 30px;
  }

  .site-footer p:nth-child(2) {
    display: none;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
  }

  html.motion-ready .reveal,
  html.motion-ready .reveal.is-visible {
    opacity: 1;
  }

  .typing-target.is-complete::after {
    animation: none;
  }
}
