:root {
  color-scheme: dark;
  --bg:        #0b0d10;
  --bg-card:   #14181d;
  --fg:        #eef2f6;
  --fg-muted:  #9aa5b1;
  --fg-faint:  #6b7681;
  --line:      #232a31;
  --line-hover:#39434d;
  --tag-bg:    #1d232a;
  --accent:    #6aa6ff;
  --shadow:    none;
  --shadow-lift: 0 14px 34px -14px rgba(0, 0, 0, .7);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 55% at 50% -12%, rgba(106, 166, 255, .16), transparent 58%),
    radial-gradient(ellipse 45% 40% at 100% 8%, rgba(106, 166, 255, .06), transparent 50%);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .04;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/></filter><rect width='80' height='80' filter='url(%23n)'/></svg>");
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 68rem;
  margin: 0 auto;
  padding: clamp(3rem, 9vw, 6.5rem) clamp(1.15rem, 5vw, 2rem) 4rem;
}

.eyebrow {
  margin: 0 0 .55rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.intro h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6.5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 680;
}

.tagline {
  margin: .85rem 0 0;
  max-width: 34rem;
  color: var(--fg-muted);
  font-size: clamp(1rem, 2.4vw, 1.09rem);
  text-wrap: pretty;
}

.social {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: 1.35rem;
  padding: .42rem .8rem .42rem .7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--fg);
  font-size: .92rem;
  font-weight: 520;
  text-decoration: none;
  transition: border-color .18s ease, transform .18s ease;
}

.social:hover { border-color: var(--line-hover); transform: translateY(-1px); }
.social svg   { flex: none; }

.section-label {
  margin: clamp(1.75rem, 4vw, 2.5rem) 0 1.25rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.projects {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.1rem, 2.5vw, 1.5rem);
  align-items: stretch;
}

@media (min-width: 40rem) {
  .projects {
    grid-template-columns: 1fr 1fr;
  }

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

.projects > li {
  display: flex;
  opacity: 0;
  animation: card-in .6s cubic-bezier(.2, .7, .3, 1) forwards;
}

.projects > li:nth-child(1) { animation-delay: 0ms; }
.projects > li:nth-child(2) { animation-delay: 90ms; }
.projects > li:nth-child(3) { animation-delay: 180ms; }
.projects > li:nth-child(4) { animation-delay: 270ms; }
.projects > li:nth-child(5) { animation-delay: 360ms; }
.projects > li:nth-child(6) { animation-delay: 450ms; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  perspective: 900px;
  transform: translateY(var(--ty, 0)) scale(var(--s, 1))
             rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .22s cubic-bezier(.2, .7, .3, 1),
              border-color .22s ease,
              box-shadow .22s ease;
}

.card:hover {
  --ty: -7px;
  --s: 1.015;
  border-color: var(--line-hover);
  box-shadow: var(--shadow-lift);
}

.card[data-accent="transit"]:hover { border-color: #6b8fb8; }
.card[data-accent="globe"]:hover    { border-color: var(--accent); }
.card[data-accent="ev"]:hover       { border-color: #5ec8b4; }

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

.card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
  background: var(--tag-bg);
}

.card .body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: clamp(1.05rem, 2.5vw, 1.35rem);
}

.card h3 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 640;
  text-wrap: balance;
}

.card p {
  margin: .4rem 0 0;
  color: var(--fg-muted);
  font-size: .94rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: .85rem 0 0;
  padding: 0;
}

.tags li {
  padding: .18rem .55rem;
  border-radius: 6px;
  background: var(--tag-bg);
  color: var(--fg-muted);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
}

.domain {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 1rem;
  color: var(--accent);
  font-size: .89rem;
  font-weight: 540;
}

.domain::after {
  content: " →";
  display: inline-block;
  transition: transform .22s cubic-bezier(.2, .7, .3, 1);
}

.card:hover .domain::after { transform: translateX(3px); }

@media (min-width: 52rem) {
  .featured .card {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    align-items: stretch;
  }

  .featured .card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }

  .featured .card .body {
    justify-content: center;
    padding: clamp(1.25rem, 3vw, 1.85rem) clamp(1.3rem, 3vw, 1.9rem);
  }

  .featured .card h3 {
    font-size: clamp(1.2rem, 2vw, 1.42rem);
  }

  .featured .card p {
    font-size: 1rem;
  }
}

footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(3.5rem, 9vw, 5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--fg-faint);
  font-size: .87rem;
}

footer p { margin: 0; }

.kofi {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem .9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--fg);
  font-size: .9rem;
  font-weight: 520;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease;
}

.kofi:hover {
  transform: translateY(-1px);
  border-color: var(--line-hover);
}

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

#starman {
  position: absolute;
  left: 0;
  top: 0;
  width: 46px;
  height: 68px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 50;
  will-change: transform;
  transform: translate3d(var(--sx, 0), var(--sy, 0), 0) rotate(var(--srot, 0deg));
}

#starman img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .6));
  transition: transform .18s ease;
  animation: starman-idle 2.8s ease-in-out infinite;
}

#starman.is-nudge img {
  animation: starman-nudge .55s ease;
}

#starman.is-flying img,
#starman:hover img {
  animation: none;
}

#starman:hover img { transform: scale(1.08); }

@keyframes starman-nudge {
  40% { transform: scale(1.14); }
}

@keyframes starman-idle {
  50% { transform: translateY(-5px); }
}

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

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