:root {
  --ink: #161616;
  --muted: #686868;
  --paper: #fbfaf7;
  --soft: #f0eee8;
  --line: #dfdbd1;
  --rose: #e96573;
  --mint: #70c8a7;
  --cobalt: #3157ff;
  --sun: #f7c65d;
  --shadow: 0 28px 80px rgba(22, 22, 22, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(112, 200, 167, 0.18), transparent 28rem),
    radial-gradient(circle at 86% 34%, rgba(233, 101, 115, 0.14), transparent 30rem),
    var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  overflow-x: hidden;
}

@supports (overflow: clip) {
  html,
  body {
    overflow-x: clip;
  }
}

img,
svg,
video {
  max-width: 100%;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(22, 22, 22, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 22, 22, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.48), transparent 78%);
}

a {
  color: inherit;
  text-decoration: none;
}

.cursor-glow {
  position: fixed;
  width: 18rem;
  height: 18rem;
  border-radius: 999px;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  transform: translate3d(-50%, -50%, 0);
  background: radial-gradient(circle, rgba(247, 198, 93, 0.36), transparent 68%);
  transition: opacity 200ms ease;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
  padding: 1.25rem clamp(1rem, 4vw, 4rem);
  backdrop-filter: blur(18px);
}

.brand,
.nav-links {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand {
  gap: 0.75rem;
  font-size: 0.88rem;
  font-weight: 800;
}

.brand-mark {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: conic-gradient(from 38deg, transparent 0 78deg, var(--sun) 78deg 360deg);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.72);
}

.nav-links {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: clamp(0.8rem, 3vw, 2rem);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.nav-links a {
  position: relative;
  padding: 0.4rem 0;
}

.nav-links a::after {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  content: "";
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 220ms ease;
}

.nav-links a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.section-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  max-width: 100%;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 0.78fr);
  gap: clamp(2rem, 6vw, 7rem);
  align-items: center;
  min-height: 100svh;
  padding: 7.5rem 0 4rem;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 12ch;
  margin-bottom: 1.5rem;
  font-size: clamp(3.6rem, 10vw, 8.8rem);
  line-height: 0.89;
  letter-spacing: 0;
}

h2 {
  max-width: 13ch;
  margin-bottom: 0;
  font-size: clamp(2.2rem, 5.8vw, 5rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.05;
}

.hero-intro,
.about-grid p,
.contact-copy p {
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.22rem);
  line-height: 1.75;
}

.hero-intro {
  max-width: 38rem;
}

a.link[href*="avvioreply"] {
  color: var(--sun);
  font-weight: 900;
}

a.link[href*="avvioreply"]:hover {
  color: var(--ink);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.9rem 1.2rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-weight: 800;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.button:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(22, 22, 22, 0.12);
}

.button.primary {
  color: #fff;
  background: var(--ink);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.52);
}

.retro-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  overflow: hidden;
  min-height: 38rem;
}

.retro-orbit {
  position: absolute;
  width: min(32rem, 82vw);
  aspect-ratio: 1;
  border: 1px solid rgba(22, 22, 22, 0.14);
  border-radius: 50%;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.16)),
    radial-gradient(circle at 35% 35%, rgba(247, 198, 93, 0.24), transparent 42%);
  box-shadow: var(--shadow);
}

.retro-orbit::before,
.retro-orbit::after {
  position: absolute;
  content: "";
  border-radius: 999px;
}

.retro-orbit::before {
  inset: 18%;
  border: 1px dashed rgba(22, 22, 22, 0.16);
}

.retro-orbit::after {
  right: 16%;
  bottom: 20%;
  width: 1rem;
  aspect-ratio: 1;
  background: var(--mint);
  box-shadow:
    -3.2rem 1.4rem 0 var(--rose),
    -6.3rem -1.8rem 0 var(--cobalt);
}

.maze-lines {
  position: absolute;
  inset: 13%;
  z-index: 1;
}

.maze-lines span {
  position: absolute;
  border: 2px solid rgba(49, 87, 255, 0.18);
  border-radius: 8px;
}

.maze-lines span:nth-child(1) {
  top: 9%;
  left: 7%;
  width: 38%;
  height: 22%;
  border-right: 0;
}

.maze-lines span:nth-child(2) {
  right: 8%;
  bottom: 14%;
  width: 36%;
  height: 24%;
  border-left: 0;
}

.maze-lines span:nth-child(3) {
  top: 42%;
  left: 27%;
  width: 44%;
  height: 14%;
  border-top: 0;
}

.pixel-trail {
  position: relative;
  z-index: 2;
  display: flex;
  gap: clamp(0.8rem, 2vw, 1.2rem);
  transform: translateX(3rem);
}

.pixel-trail span {
  width: clamp(0.65rem, 1.5vw, 1rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 10px 26px rgba(247, 198, 93, 0.34);
}

.pacman {
  position: absolute;
  z-index: 3;
  left: 16%;
  width: clamp(6rem, 14vw, 9rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(from 38deg, transparent 0 74deg, var(--sun) 74deg 360deg);
  filter: drop-shadow(0 24px 34px rgba(22, 22, 22, 0.16));
  animation: float-bite 2.8s ease-in-out infinite;
}

.pacman span {
  position: absolute;
  top: 26%;
  left: 52%;
  width: 0.68rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--ink);
}

@keyframes float-bite {
  0%,
  100% {
    transform: translate3d(0, -0.3rem, 0) rotate(-3deg);
  }

  50% {
    transform: translate3d(0.4rem, 0.45rem, 0) rotate(2deg);
  }
}

.floating-note {
  position: absolute;
  z-index: 3;
  padding: 0.68rem 0.86rem;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 16px 40px rgba(22, 22, 22, 0.1);
  font-size: 0.8rem;
  font-weight: 800;
  backdrop-filter: blur(14px);
}

.note-one {
  top: 22%;
  left: 1%;
}

.note-two {
  right: 0;
  bottom: 33%;
}

.note-three {
  left: 12%;
  bottom: 12%;
}

.about,
.contact {
  padding: clamp(6rem, 12vw, 10rem) 0;
}

.section-heading {
  display: grid;
  grid-template-columns: 0.62fr 1fr;
  gap: clamp(1rem, 6vw, 6rem);
  align-items: end;
  margin-bottom: clamp(2rem, 6vw, 4rem);
}

.section-heading.compact {
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 5vw, 6rem);
  margin-left: min(28vw, 20rem);
}

.strengths {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 3rem;
  margin-left: min(28vw, 20rem);
}

.strengths span {
  padding: 0.72rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.46);
  color: #333;
  font-weight: 700;
}

.projects {
  padding: clamp(5rem, 10vw, 8rem) 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(240, 238, 232, 0.82));
}

.project-list {
  display: grid;
  gap: 1rem;
}

.project-card {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(10rem, 0.48fr) minmax(12rem, 0.72fr) 1fr auto;
  grid-template-rows: auto auto;
  column-gap: clamp(1rem, 4vw, 3rem);
  row-gap: 1rem;
  align-items: center;
  min-height: 12rem;
  padding: clamp(1.25rem, 3.5vw, 2.6rem);
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 20px 70px rgba(22, 22, 22, 0.06);
  transition:
    transform 260ms ease,
    border-color 260ms ease,
    box-shadow 260ms ease;
}

.project-card::before {
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--rose), var(--sun), var(--mint));
  transform: scaleX(0.18);
  transform-origin: left;
  transition: transform 300ms ease;
}

.project-card::after {
  position: absolute;
  top: 50%;
  right: 8%;
  width: 9rem;
  aspect-ratio: 1;
  border-radius: 50%;
  content: "";
  background: rgba(233, 101, 115, 0.1);
  transform: translateY(-50%) scale(0.7);
  opacity: 0;
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}

.project-card.accent::after {
  background: rgba(112, 200, 167, 0.16);
}

.project-card.deep::after {
  background: rgba(49, 87, 255, 0.12);
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(22, 22, 22, 0.2);
  box-shadow: var(--shadow);
}

.project-card:hover::before {
  transform: scaleX(1);
}

.project-card:hover::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.project-media {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  aspect-ratio: 4 / 3;
  border: 1px dashed rgba(22, 22, 22, 0.22);
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(240, 238, 232, 0.58));
}

.project-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-media::after {
  position: absolute;
  content: "";
}

.project-media::after {
  width: 52%;
  height: 1px;
  background: rgba(22, 22, 22, 0.18);
  transform: rotate(-18deg) translateY(2.4rem);
}

.project-media span {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.project-tags {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.project-tags span {
  padding: 0.42rem 0.58rem;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: #333;
  font-size: 0.72rem;
  font-weight: 800;
}

.project-media,
.project-details,
.project-year {
  grid-row: 1 / span 2;
}

.project-media {
  grid-column: 1;
}

.project-details {
  grid-column: 2;
  min-width: 0;
}

.project-kicker,
.project-year {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.project-card p:not(.project-kicker) {
  position: relative;
  z-index: 1;
  grid-column: 3;
  grid-row: 1;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  min-width: 0;
}

.project-play {
  position: relative;
  z-index: 1;
  grid-column: 3;
  grid-row: 2;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.72rem 0.9rem;
  border: 1px solid rgba(22, 22, 22, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: 0 12px 30px rgba(22, 22, 22, 0.08);
  transition:
    color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.project-play span {
  display: block;
  width: 0.74rem;
  height: 0.86rem;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  background: var(--sun);
  filter: drop-shadow(2px 0 0 rgba(22, 22, 22, 0.18));
}

.project-play:hover {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 16px 34px rgba(22, 22, 22, 0.16);
  transform: translateY(-3px);
}

.project-year {
  grid-column: 4;
  margin: 0;
  color: var(--ink);
}

.contact {
  display: grid;
  grid-template-columns: 1fr minmax(18rem, 0.55fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: end;
  min-height: 80svh;
}

.contact h2 {
  max-width: 14ch;
}

.contact-copy p {
  max-width: 42rem;
  margin-top: 1.5rem;
}

.contact-actions {
  display: grid;
  gap: 0.8rem;
}

.contact-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 800;
  overflow-wrap: anywhere;
  transition:
    color 180ms ease,
    padding 180ms ease;
}

.contact-link span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.contact-link:hover {
  padding-left: 0.55rem;
  color: var(--cobalt);
}

[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 700ms ease,
    transform 700ms ease;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .site-header {
    align-items: flex-start;
  }

  .brand {
    max-width: 9rem;
  }

  .nav-links {
    gap: 0.85rem;
  }

  .hero,
  .section-heading,
  .about-grid,
  .contact {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 7rem;
  }

  h1 {
    max-width: 9ch;
  }

  .retro-stage {
    min-height: 39rem;
  }

  .about-grid,
  .strengths {
    margin-left: 0;
  }

  .project-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    min-height: 0;
  }

  .project-media,
  .project-details,
  .project-card p:not(.project-kicker),
  .project-play,
  .project-year {
    grid-column: auto;
    grid-row: auto;
  }

  .project-media {
    max-width: 22rem;
  }

  .project-year {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
  }

  .project-play {
    width: fit-content;
  }
}

@media (max-width: 540px) {
  body {
    min-width: 0;
  }

  .section-shell {
    width: min(1120px, calc(100% - 1.5rem));
  }

  .site-header {
    max-width: 100%;
    padding: 0.9rem 0.75rem;
  }

  .brand {
    flex: 0 0 auto;
    font-size: 0;
  }

  .brand-mark {
    width: 1.05rem;
    height: 1.05rem;
  }

  .nav-links {
    flex: 1 1 auto;
    font-size: 0.76rem;
    gap: clamp(0.6rem, 2.5vw, 0.85rem);
  }

  h1 {
    max-width: 100%;
    font-size: clamp(2.85rem, 15vw, 4.8rem);
  }

  .hero-actions,
  .button {
    width: 100%;
  }

  .retro-stage {
    min-height: 36rem;
  }

  .retro-orbit {
    width: min(28rem, 76vw);
  }

  .pixel-trail {
    transform: translateX(1.4rem);
  }

  .pacman {
    left: 10%;
    width: clamp(5rem, 22vw, 7rem);
  }

  .floating-note {
    max-width: calc(100% - 1rem);
    font-size: 0.72rem;
  }

  .note-one {
    top: 11%;
  }

  .note-two {
    right: 2%;
    bottom: 34%;
  }

  .note-three {
    left: 2%;
    bottom: 8%;
  }

  .project-card {
    padding: 1rem;
  }

  .project-media {
    max-width: 100%;
  }

  .project-year {
    top: 1rem;
    right: 1rem;
  }

  .contact-link {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.25rem 0.75rem;
  }

  .contact-link span {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
