:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --soft: #f2f0ec;
  --border: #e7e4de;
  --border-strong: #d6d2ca;
  --text: #1c1b19;
  --text-dim: #57534d;
  --text-faint: #8d8880;
  --accent: var(--accent-light, #3b4cca);
  --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgba(28, 27, 25, 0.04), 0 12px 32px -16px rgba(28, 27, 25, 0.14);
  --radius: 18px;
  --serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141312;
    --surface: #1b1a18;
    --soft: #23211f;
    --border: #2d2b28;
    --border-strong: #3a3733;
    --text: #f1efeb;
    --text-dim: #b4aea5;
    --text-faint: #827c73;
    --accent: var(--accent-dark, #9aa5ff);
    --accent-ink: #141312;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 16px 40px -20px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #141312;
  --surface: #1b1a18;
  --soft: #23211f;
  --border: #2d2b28;
  --border-strong: #3a3733;
  --text: #f1efeb;
  --text-dim: #b4aea5;
  --text-faint: #827c73;
  --accent: var(--accent-dark, #9aa5ff);
  --accent-ink: #141312;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 16px 40px -20px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s, color 0.25s;
}

a {
  color: inherit;
}

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

svg {
  width: 1em;
  height: 1em;
  flex: none;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.muted {
  color: var(--text-faint);
}

.wrap {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 20;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
}

.skip:focus {
  top: 12px;
}

/* Header */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 72px;
}

.brand {
  font: 400 24px/1 var(--serif);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 28px;
  margin-left: auto;
  font-size: 15px;
}

.nav-links a,
.lang a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-links a:hover,
.lang a:hover {
  color: var(--text);
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang {
  display: flex;
  gap: 2px;
  font-size: 13px;
  font-weight: 500;
}

.lang a {
  padding: 4px 8px;
  border-radius: 999px;
}

.lang a[aria-current] {
  color: var(--text);
  background: var(--soft);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 17px;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--text);
}

.i-moon {
  display: none;
}

:root[data-theme="dark"] .i-sun {
  display: none;
}

:root[data-theme="dark"] .i-moon {
  display: inline;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun {
    display: none;
  }
  :root:not([data-theme="light"]) .i-moon {
    display: inline;
  }
}

@media (max-width: 720px) {
  .nav-links {
    display: none;
  }
  .nav-tools {
    margin-left: auto;
  }
}

/* Hero */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-bottom: 72px;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 64px;
  align-items: center;
  padding: 112px 0 88px;
}

.hero-inner.has-avatar {
  grid-template-columns: 1fr auto;
}

/* Soft drifting colour behind the hero, tinted by the chosen accent. */
.aurora {
  position: absolute;
  inset: -20% -10% auto;
  height: 120%;
  z-index: -1;
  filter: blur(70px);
  opacity: 0.55;
  pointer-events: none;
}

.aurora span {
  position: absolute;
  border-radius: 50%;
  animation: drift 22s ease-in-out infinite alternate;
}

.aurora span:nth-child(1) {
  width: 46vw;
  height: 46vw;
  left: 48%;
  top: 0;
  background: color-mix(in srgb, var(--accent) 45%, transparent);
}

.aurora span:nth-child(2) {
  width: 34vw;
  height: 34vw;
  left: 68%;
  top: 30%;
  background: color-mix(in srgb, #f5a97f 50%, transparent);
  animation-duration: 28s;
  animation-direction: alternate-reverse;
}

.aurora span:nth-child(3) {
  width: 30vw;
  height: 30vw;
  left: 8%;
  top: 40%;
  background: color-mix(in srgb, #8bd3c7 35%, transparent);
  animation-duration: 32s;
}

@keyframes drift {
  to {
    transform: translate(-8vw, 6vw) scale(1.15);
  }
}

:root[data-theme="dark"] .aurora {
  opacity: 0.32;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .aurora {
    opacity: 0.32;
  }
}

.avatar-wrap {
  position: relative;
  width: fit-content;
}

.avatar-wrap::before {
  content: "";
  position: absolute;
  inset: 18px -18px -18px 18px;
  border-radius: 32px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

.avatar {
  position: relative;
  width: 300px;
  height: 360px;
  border-radius: 32px;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.hero-lead {
  font-size: clamp(20px, 2.2vw, 24px);
  line-height: 1.5;
  color: var(--text-dim);
}

.hero-lead em {
  font: italic 400 1.25em/1 var(--serif);
  color: var(--accent);
}

/* Stats */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: 0;
  margin-bottom: 0;
  border-top: 1px solid var(--border);
}

.stat {
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  padding: 28px 24px 0 0;
}

.stat dd {
  margin: 0;
  font: 400 clamp(44px, 5vw, 60px)/1 var(--serif);
}

.stat dt {
  color: var(--text-dim);
  font-size: 15px;
}

/* Skills strip */

.marquee {
  overflow: hidden;
  border-block: 1px solid var(--border);
  background: var(--surface);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 40s linear infinite;
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

.marquee ul {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.marquee li {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 22px 0 22px 40px;
  font: italic 400 30px/1 var(--serif);
  color: var(--text-dim);
  white-space: nowrap;
}

.marquee li::after {
  content: "✦";
  font: normal 14px/1 var(--sans);
  color: var(--accent);
}

@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}

/* Services */

.services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 20px;
}

.service {
  position: relative;
  overflow: hidden;
  padding: 32px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.service-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 28px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 24px;
}

.service h3 {
  font: 400 28px/1.1 var(--serif);
}

.service p {
  margin: 12px 0 0;
  color: var(--text-dim);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 28px;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 14px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22a06b;
  box-shadow: 0 0 0 4px rgba(34, 160, 107, 0.15);
}

.hero h1 {
  font-size: clamp(56px, 9vw, 104px);
  line-height: 0.95;
}

.role {
  margin: 18px 0 0;
  font-size: 20px;
  font-weight: 500;
}

.lead {
  max-width: 58ch;
  margin: 20px 0 0;
  font-size: 19px;
  line-height: 1.65;
  color: var(--text-dim);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font: 500 15px var(--sans);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.btn-primary:hover {
  box-shadow: var(--shadow);
}

.btn-ghost {
  background: var(--surface);
}

.btn-ghost:hover {
  border-color: var(--text-faint);
}

@media (max-width: 760px) {
  .hero-inner,
  .hero-inner.has-avatar {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 56px 0 48px;
  }
  .avatar-wrap {
    order: -1;
  }
  .avatar-wrap::before {
    inset: 8px -8px -8px 8px;
    border-radius: 24px;
  }
  .avatar {
    width: 120px;
    height: 140px;
    border-radius: 24px;
  }
  .hero {
    padding-bottom: 40px;
  }
  .stat {
    padding-top: 20px;
  }
  .marquee li {
    font-size: 24px;
  }
  .status {
    margin-bottom: 20px;
  }
}

/* Sections */

.section {
  padding: 88px 0;
}

.section-title {
  margin-bottom: 40px;
  font-size: clamp(36px, 5vw, 52px);
}

.label {
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

@media (max-width: 760px) {
  .section {
    padding: 56px 0;
  }
  .section-title {
    margin-bottom: 28px;
  }
}

/* Projects */

.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
}

.grid > .card {
  grid-column: span var(--span, 3);
}

@media (max-width: 760px) {
  .grid > .card {
    grid-column: 1 / -1;
  }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.25s, border-color 0.25s;
}

.card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.card-wide {
  grid-column: 1 / -1;
  flex-direction: row;
}

.card-wide .card-media {
  flex: 1.35;
  aspect-ratio: auto;
  min-height: 360px;
  border-bottom: 0;
  border-right: 1px solid var(--border);
}

.card-wide .card-body {
  flex: 1;
  justify-content: center;
  padding: 40px;
}

.card-wide .card-head h3 {
  font: 400 44px/1.05 var(--serif);
  letter-spacing: -0.01em;
}

.card-wide .card-text {
  font-size: 17px;
}

.card-wide .card-links {
  margin-top: 12px;
}

@media (max-width: 760px) {
  .card-wide {
    flex-direction: column;
  }
  .card-wide .card-media,
  .card-wide .card-body {
    flex: none;
  }
  .card-wide .card-media {
    min-height: 0;
    aspect-ratio: 16 / 10;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .card-wide .card-body {
    padding: 24px;
  }
  .card-wide .card-head h3 {
    font-size: 32px;
  }
}

.card-media {
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--soft);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card:hover .card-media img {
  transform: scale(1.03);
}

.placeholder {
  height: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 90% at 20% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    radial-gradient(100% 80% at 90% 100%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%), var(--soft);
  font: italic 400 72px/1 var(--serif);
  color: color-mix(in srgb, var(--accent) 70%, var(--text));
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  padding: 24px 26px 26px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.card-head h3 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-head h3 a {
  text-decoration: none;
}

.card-head .muted {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.card-text {
  margin: 0;
  color: var(--text-dim);
}

.meta-line {
  margin: 0;
  font-size: 14px;
  color: var(--text-faint);
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin-top: auto;
  padding-top: 8px;
  font-size: 15px;
}

.card-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-dim);
  text-decoration: none;
}

.card-links a:hover {
  color: var(--text);
}

.card-links .link-strong {
  color: var(--accent);
  font-weight: 500;
}

.card-links .link-strong:hover {
  color: var(--accent);
  gap: 8px;
}

/* Timeline */

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

.timeline li {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}

.when {
  color: var(--text-faint);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.timeline h3 {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;
}

.org {
  font-weight: 400;
  color: var(--text-dim);
}

.org a {
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.timeline-text {
  margin-top: 8px;
  color: var(--text-dim);
  max-width: 64ch;
}

.timeline-text p {
  margin: 0 0 0.6em;
}

@media (max-width: 640px) {
  .timeline li {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* About */

.about {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 64px;
}

@media (max-width: 860px) {
  .about {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

.prose {
  max-width: 66ch;
  font-size: 18px;
  color: var(--text-dim);
}

.prose p {
  margin: 0 0 1.1em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
}

/* Contact */

.contact {
  padding: 72px 56px;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}

.contact h2 {
  font-size: clamp(40px, 6vw, 64px);
}

.contact .lead {
  margin-inline: auto;
}

.contact .actions {
  justify-content: center;
}

@media (max-width: 640px) {
  .contact {
    padding: 48px 24px;
  }
}

/* Project page */

.project {
  padding: 48px 0 88px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 40px;
  color: var(--text-dim);
  font-size: 15px;
  text-decoration: none;
}

.back:hover {
  color: var(--text);
}

.project-head h1 {
  font-size: clamp(48px, 8vw, 88px);
  line-height: 1;
}

.facts {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin: 0;
}

.facts dt {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.facts dd {
  margin: 4px 0 0;
}

.shot {
  margin: 56px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.shot img {
  width: 100%;
}

.project-year {
  margin: 0 0 12px;
  font: italic 400 22px/1 var(--serif);
  color: var(--accent);
}

.project-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 72px;
  align-items: start;
  margin-top: 48px;
}

.shot + .project-layout {
  margin-top: 0;
}

.project-aside {
  position: sticky;
  top: 100px;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.project-aside .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.project-aside .tags li {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text-dim);
  font-size: 13px;
}

.aside-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.aside-links .btn {
  justify-content: center;
}

.project-main > .prose:empty {
  display: none;
}

.project-main .gallery {
  margin-top: 8px;
}

@media (max-width: 860px) {
  .project-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .project-aside {
    position: static;
  }
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
  margin-top: 40px;
}

.gallery a {
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--soft);
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.gallery a:hover img {
  transform: scale(1.03);
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 80px;
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  transition: box-shadow 0.2s;
}

.pager a:hover {
  box-shadow: var(--shadow);
}

.pager span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.pager strong {
  font: 400 28px/1.1 var(--serif);
}

.pager-next {
  text-align: right;
  align-items: flex-end;
}

@media (max-width: 560px) {
  .pager {
    grid-template-columns: 1fr;
  }
}

/* Lightbox */

.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 24px;
  border: 0;
  background: rgba(10, 10, 10, 0.92);
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop {
  background: transparent;
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 48px);
  border-radius: 10px;
}

.lb-btn {
  position: fixed;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.lb-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lb-close {
  top: 20px;
  right: 20px;
}

.lb-prev {
  left: 20px;
  top: 50%;
}

.lb-next {
  right: 20px;
  top: 50%;
}

/* 404 */

.notfound {
  padding: 140px 0;
}

.notfound h1 {
  margin: 8px 0 32px;
  font-size: clamp(40px, 6vw, 64px);
}

/* Footer */

.footer {
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-faint);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 32px 0;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
}

/* Scroll reveal: only hidden when JS is there to show it again. */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .card,
  .card-media img,
  .btn {
    transition: none;
  }
}

/* Pointer-following glow on cards (position set from JS). */

.card::after,
.service::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%);
}

.card:hover::after,
.service:hover::after {
  opacity: 1;
}

.card-index {
  font: italic 400 18px/1 var(--serif);
  color: var(--accent);
}

.card-body .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.card-body .tags li {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text-dim);
  font-size: 13px;
}

/* Contact block: inverted colours with a glow. */

.contact {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.contact .lead {
  color: color-mix(in srgb, var(--bg) 72%, var(--text));
}

.contact .kicker {
  margin: 0 0 16px;
  font: italic 400 22px/1.2 var(--serif);
  color: color-mix(in srgb, var(--accent) 60%, var(--bg));
}

.contact-glow {
  position: absolute;
  z-index: -1;
  width: 520px;
  height: 520px;
  left: 50%;
  top: -260px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--accent);
  filter: blur(120px);
  opacity: 0.45;
}

.contact .btn-primary {
  background: var(--bg);
  border-color: var(--bg);
  color: var(--text);
}

.contact .btn-ghost {
  background: transparent;
  border-color: color-mix(in srgb, var(--bg) 30%, transparent);
  color: var(--bg);
}

/* Footer: the name, large and quiet. */

.footer-name {
  margin: 56px 0 0;
  font: 400 clamp(72px, 17vw, 240px)/0.9 var(--serif);
  letter-spacing: -0.03em;
  color: transparent;
  -webkit-text-stroke: 1px var(--border-strong);
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .aurora span,
  .marquee-track {
    animation: none;
  }
}

/* Smooth cross-page navigation; project covers morph into the project page. */

@view-transition {
  navigation: auto;
}

::view-transition-group(*) {
  animation-duration: 0.45s;
  animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Header: a hairline once the page scrolls, and the current section marked. */

.nav.scrolled {
  border-bottom-color: var(--border);
}

.nav-links a {
  position: relative;
}

.nav-links a[aria-current] {
  color: var(--text);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.25s;
}

.nav-links a[aria-current]::after {
  transform: scaleX(1);
}

/* Hero entrance. */

@media (prefers-reduced-motion: no-preference) {
  .hero-text > *,
  .avatar-wrap,
  .stats .stat {
    animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .hero-text > :nth-child(2) { animation-delay: 0.08s; }
  .hero-text > :nth-child(3) { animation-delay: 0.16s; }
  .hero-text > :nth-child(4) { animation-delay: 0.24s; }
  .hero-text > :nth-child(5) { animation-delay: 0.32s; }
  .avatar-wrap { animation-delay: 0.2s; }
  .stats .stat:nth-child(1) { animation-delay: 0.4s; }
  .stats .stat:nth-child(2) { animation-delay: 0.48s; }
  .stats .stat:nth-child(3) { animation-delay: 0.56s; }
  .stats .stat:nth-child(4) { animation-delay: 0.64s; }
  .stats .stat:nth-child(n + 5) { animation-delay: 0.72s; }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

.avatar-wrap {
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform;
}

.btn.done {
  border-color: #22a06b;
  color: #22a06b;
}

.contact .btn.done {
  color: #6ee7b7;
  border-color: #6ee7b7;
}


/* Contact: intro on the left, form on the right. */

.contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: start;
  text-align: left;
}

.contact .lead {
  margin-inline: 0;
}

.contact .actions {
  justify-content: flex-start;
  margin-top: 14px;
}

.contact .direct {
  margin: 36px 0 0;
  font-size: 14px;
  color: color-mix(in srgb, var(--bg) 60%, var(--text));
}

.btn-icon-only {
  width: 46px;
  padding: 0;
  justify-content: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--bg) 14%, transparent);
}

.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: color-mix(in srgb, var(--bg) 75%, var(--text));
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--bg) 22%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 6%, transparent);
  color: var(--bg);
  font: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.contact-form textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--bg));
  background: color-mix(in srgb, var(--bg) 10%, transparent);
}

.contact-form .btn {
  align-self: flex-start;
  margin-top: 4px;
}

.contact-form .btn:disabled {
  opacity: 0.6;
  transform: none;
}

.form-status {
  min-height: 1.4em;
  margin: 0;
  font-size: 14px;
  color: color-mix(in srgb, var(--bg) 70%, var(--text));
}

.form-status.bad {
  color: color-mix(in srgb, #ef4444 70%, var(--bg));
}

.contact-form.sent {
  justify-content: center;
  min-height: 300px;
}

.form-done {
  margin: 0;
  font: italic 400 28px/1.3 var(--serif);
  text-align: center;
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 860px) {
  .contact {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .contact-form {
    padding: 20px;
  }
}

/* Accented word in headings: "Selected *work*". */

.section-title em,
.contact h2 em {
  font-style: italic;
  color: var(--accent);
}

.contact h2 em {
  color: color-mix(in srgb, var(--accent) 55%, var(--bg));
}

/* Theme toggle spins as it switches. */

.icon-btn.spin svg {
  animation: spin-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes spin-in {
  from {
    transform: rotate(-120deg) scale(0.4);
    opacity: 0;
  }
}

.lang a {
  transition: color 0.15s, background-color 0.2s;
}

.lang a:hover:not([aria-current]) {
  background: color-mix(in srgb, var(--soft) 60%, transparent);
}

/* Mobile menu */

.menu-btn {
  display: none;
  position: relative;
}

.menu-btn span {
  position: absolute;
  left: 11px;
  right: 11px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.3s, top 0.3s;
}

.menu-btn span:first-child {
  top: 14px;
}

.menu-btn span:last-child {
  top: 20px;
}

.menu-btn[aria-expanded="true"] span:first-child {
  top: 17px;
  transform: rotate(45deg);
}

.menu-btn[aria-expanded="true"] span:last-child {
  top: 17px;
  transform: rotate(-45deg);
}

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 9;
  padding-top: 72px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.mobile-menu.open {
  opacity: 1;
  transform: none;
}

.mobile-menu nav {
  display: flex;
  flex-direction: column;
  padding-top: 32px;
}

.mobile-menu nav > a {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font: 400 44px/1.1 var(--serif);
  text-decoration: none;
}

.mobile-menu-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding-top: 28px;
  color: var(--text-dim);
}

.mobile-menu-links a {
  text-decoration: none;
}

/* Only the root may stop scrolling: hiding overflow on body as well turns it
   into its own scroller and the sticky header (with the close button) slides
   out of view. */
.menu-open {
  overflow: hidden;
}

.menu-open .nav {
  border-bottom-color: var(--border);
}

.mobile-menu-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.mobile-menu-tools .lang {
  font-size: 15px;
}

.mobile-menu-tools .lang a {
  padding: 8px 14px;
}

.mobile-menu-tools .icon-btn {
  width: 44px;
  height: 44px;
  font-size: 19px;
}

@media (max-width: 480px) {
  .nav-tools > .lang,
  .nav-tools > [data-theme-toggle] {
    display: none;
  }
}

@media (min-width: 481px) {
  .mobile-menu-tools {
    display: none;
  }
}

@media (max-width: 720px) {
  .menu-btn {
    display: block;
  }
}

@media (min-width: 721px) {
  .mobile-menu {
    display: none;
  }
}
