:root {
  --black: #000;
  --white: #fff;
  --dim: rgba(255, 255, 255, 0.58);
  --faint: rgba(255, 255, 255, 0.32);
  --line: rgba(255, 255, 255, 0.14);
  --gutter: clamp(16px, 4vw, 48px);
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.7, 0, 0.2, 1);
}

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

html {
  background: var(--black);
  color: var(--white);
  font-family: var(--font);
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--black);
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
html.intro body { overflow: hidden; }

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--white); color: var(--black); }

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

.ext { display: inline-block; font-weight: 400; transition: transform 0.25s var(--ease); }
a:hover .ext { transform: translate(2px, -2px); }

/* ---------- Intro splash ---------- */

.splash { display: none; }
html.intro .splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--black);
  cursor: pointer;
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.7s var(--ease);
}
html.intro .splash.out { clip-path: inset(0 0 100% 0); }

.splash-inner { position: relative; padding-bottom: 18px; }
.splash-word {
  font-size: clamp(2rem, 8vw, 5.5rem);
  font-weight: 300;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.splash-word .g { color: var(--faint); }
.splash-line {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 100%;
  background: var(--white);
  transform: scaleX(0);
  transform-origin: left;
  animation: line 1.1s 0.15s var(--ease) forwards;
}
@keyframes line { to { transform: scaleX(1); } }
.splash-skip {
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom));
  font-size: 0.8125rem;
  color: var(--faint);
}

/* ---------- Nav ---------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px var(--gutter);
  mix-blend-mode: difference;
}
.mark {
  font-weight: 800;
  font-variation-settings: "wdth" 125;
  font-size: 1.25rem;
  letter-spacing: -0.04em;
}
.nav nav { display: flex; gap: clamp(16px, 3vw, 32px); font-size: 0.9375rem; }
.nav nav a { color: var(--white); opacity: 0.7; transition: opacity 0.2s; }
.nav nav a:hover { opacity: 1; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
}
#field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}
/* Readable name for screen readers and search; the canvas draws the visible one. */
.hero-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.no-canvas .hero-name {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  clip: auto;
  display: grid;
  place-items: center;
  font-size: clamp(3rem, 13vw, 11rem);
  font-weight: 800;
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.hero-foot {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: max(32px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  pointer-events: none;
}
.hero-foot > * { pointer-events: auto; }
.hero-line {
  font-size: clamp(1rem, 1.6vw, 1.1875rem);
  line-height: 1.45;
  color: var(--dim);
  max-width: 34ch;
}
.hero-cta {
  flex: none;
  padding: 14px 22px;
  border: 1px solid var(--white);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background 0.25s, color 0.25s;
}
.hero-cta:hover { background: var(--white); color: var(--black); }
.hero-hint {
  position: absolute;
  left: 50%;
  bottom: max(44px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--faint);
  white-space: nowrap;
}

/* ---------- Sections ---------- */

.work, .skills, .contact {
  padding: clamp(96px, 14vw, 180px) var(--gutter) 0;
  max-width: 1440px;
  margin: 0 auto;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: clamp(28px, 4vw, 48px);
}
.section-head h2 {
  font-size: clamp(2.75rem, 7vw, 6rem);
  font-weight: 800;
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.045em;
  line-height: 0.9;
}
.section-head p {
  color: var(--dim);
  max-width: 38ch;
  font-size: 1rem;
}

/* ---------- Projects ---------- */

.projects { border-top: 1px solid var(--line); }
.project {
  position: relative;
  display: grid;
  grid-template-columns: minmax(200px, 1.1fr) 2fr minmax(180px, 0.8fr);
  gap: 24px 48px;
  padding: clamp(28px, 3.5vw, 44px) 0;
  border-bottom: 1px solid var(--line);
  isolation: isolate;
}
/* The row inverts on hover: black-on-white shows which project you are about to open. */
.project::before {
  content: "";
  position: absolute;
  inset: 0 calc(var(--gutter) * -1);
  z-index: -1;
  background: var(--white);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.45s var(--ease);
}
.project:hover::before,
.project:focus-within::before { transform: scaleY(1); }
.project, .project * { transition: color 0.3s var(--ease), border-color 0.3s var(--ease); }
.project:hover, .project:focus-within { color: var(--black); }
.project:hover .p-detail, .project:focus-within .p-detail,
.project:hover .p-stack, .project:focus-within .p-stack { color: rgba(0, 0, 0, 0.62); }
.project:hover .p-stack li, .project:focus-within .p-stack li { border-color: rgba(0, 0, 0, 0.22); }
.project:hover .status, .project:focus-within .status { border-color: rgba(0, 0, 0, 0.3); }
.project:hover .status::before, .project:focus-within .status::before { background: var(--black); border-color: var(--black); }
.project:hover :focus-visible { outline-color: var(--black); }

.p-name { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.p-name h3 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 700;
  font-variation-settings: "wdth" 112;
  letter-spacing: -0.04em;
  line-height: 0.95;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8125rem;
  line-height: 1.3;
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--white);
}
.status.live::before { background: var(--white); animation: pulse 2.4s ease-in-out infinite; }
.status.preview::before { background: linear-gradient(90deg, var(--white) 50%, transparent 50%); }
@keyframes pulse { 50% { opacity: 0.35; } }

.p-body { display: grid; gap: 14px; align-content: start; max-width: 62ch; }
.p-what { font-size: clamp(1.0625rem, 1.5vw, 1.25rem); line-height: 1.4; font-weight: 500; }
.p-detail { color: var(--dim); font-size: 0.9375rem; }
.p-stack { display: flex; flex-wrap: wrap; gap: 6px; color: var(--dim); }
.p-stack li {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.8125rem;
  font-variation-settings: "wdth" 80;
  letter-spacing: 0.01em;
}

.p-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9375rem;
}
.p-links a { position: relative; z-index: 2; border-bottom: 1px solid transparent; }
.p-links a:hover { border-bottom-color: currentColor; }
.p-main { font-weight: 600; }
/* The whole row opens the main link; "Source" sits above it. */
.p-links .p-main { position: static; }
.p-main::after { content: ""; position: absolute; inset: 0; }

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

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: clamp(32px, 4vw, 56px);
}
.filters button {
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.filters button:hover { border-color: var(--white); }
.filters button[aria-pressed="true"] { background: var(--white); color: var(--black); border-color: var(--white); }

.skill-groups {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.group { padding: 24px 24px 8px 0; }
.group + .group { padding-left: 24px; border-left: 1px solid var(--line); }
.group h3 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dim);
  padding-bottom: 18px;
}
.group li {
  font-size: clamp(1.0625rem, 1.4vw, 1.25rem);
  font-weight: 500;
  font-variation-settings: "wdth" 100;
  line-height: 1.3;
  padding: 7px 0;
  transition: opacity 0.35s var(--ease), font-variation-settings 0.35s var(--ease);
}
.skill-groups.filtered li { opacity: 0.18; }
.skill-groups.filtered li.on { opacity: 1; font-variation-settings: "wdth" 112; }

/* ---------- Contact + footer ---------- */

.contact { padding-bottom: clamp(96px, 12vw, 160px); }
.contact h2 {
  font-size: clamp(3.5rem, 13vw, 12rem);
  font-weight: 800;
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.05em;
  line-height: 0.85;
}
.contact-line {
  max-width: 52ch;
  margin-top: clamp(28px, 4vw, 48px);
  color: var(--dim);
  font-size: clamp(1rem, 1.5vw, 1.1875rem);
}
.contact-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  margin-top: 32px;
  font-size: 1rem;
}
.contact-mail {
  padding: 14px 22px;
  background: var(--white);
  color: var(--black);
  border-radius: 999px;
  font-weight: 600;
  overflow-wrap: anywhere;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}
.contact-mail:hover { background: var(--black); color: var(--white); box-shadow: inset 0 0 0 1px var(--white); }
.contact-links a:not(.contact-mail):hover { text-decoration: underline; text-underline-offset: 4px; }

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px var(--gutter) max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--faint);
}

/* ---------- Smaller screens ---------- */

@media (max-width: 960px) {
  .project { grid-template-columns: 1fr; gap: 18px; }
  .p-name { flex-direction: row; align-items: center; justify-content: space-between; }
  .p-links { flex-direction: row; gap: 24px; }
  .skill-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group:nth-child(3) { padding-left: 0; border-left: 0; }
  .group:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
@media (max-width: 900px) { .hero-hint { display: none; } }
@media (max-width: 600px) {
  .hero-foot { flex-direction: column; align-items: flex-start; }
  .hero-hint { display: none; }
  .skill-groups { grid-template-columns: 1fr; }
  .group, .group + .group { padding: 20px 0 8px; border-left: 0; }
  .group + .group { border-top: 1px solid var(--line); }
  .foot { flex-direction: column; gap: 4px; }
}

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