:root {
  --bg: #090c14;
  --bg-alt: #121726;
  --ink: #f2f7ff;
  --muted: #a6b2ce;
  --line: #2f3b5e;
  --aqua: #31f6dd;
  --pink: #ff6ebb;
  --sun: #ffca67;
  --panel: #101728d4;
  --panel-strong: #151f37f2;
  --motion-rate: 1;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at -10% -15%, #00ffc31f, transparent 55%),
    radial-gradient(900px 550px at 110% -5%, #ff4ea829, transparent 52%),
    linear-gradient(155deg, var(--bg), #0d1220 55%, var(--bg-alt));
  min-height: 100vh;
  overflow-x: hidden;
}

body.beat-a .hero-stage {
  filter: drop-shadow(0 0 18px #31f6dd44);
}

body.beat-b .hero-stage {
  filter: drop-shadow(0 0 20px #ff6ebb52);
}

a {
  color: var(--aqua);
  text-decoration: none;
}

h1,
h2,
h3 {
  margin: 0 0 0.7rem;
  line-height: 1.08;
  font-family: "Audiowide", sans-serif;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(2.2rem, 6vw, 4.4rem);
}

h2 {
  font-size: clamp(1.5rem, 3.4vw, 2.3rem);
}

.container {
  width: min(1140px, 92%);
  margin: 0 auto;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.22;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    #ffffff08 4px,
    transparent 5px
  );
}

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(75px);
  z-index: -2;
  pointer-events: none;
}

.ambient-a {
  width: 460px;
  height: 460px;
  left: -140px;
  top: 35%;
  background: #2fffd242;
  animation: drift-a calc(13s / var(--motion-rate)) ease-in-out infinite alternate;
}

.ambient-b {
  width: 390px;
  height: 390px;
  right: -130px;
  top: 8%;
  background: #ff6eba3d;
  animation: drift-b calc(15s / var(--motion-rate)) ease-in-out infinite alternate;
}

.tempo-console {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 110;
  width: min(260px, calc(100vw - 2rem));
  border: 1px solid #3f5a8f;
  border-radius: 14px;
  background: #0d1528de;
  backdrop-filter: blur(8px);
  box-shadow: 0 14px 30px #02040f8f;
  padding: 0.62rem 0.7rem 0.72rem;
}

.tempo-console label {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #d2def8;
  margin-bottom: 0.5rem;
}

.tempo-console output {
  color: #86ffe8;
  font-weight: 700;
}

.tempo-console input {
  width: 100%;
  accent-color: #31f6dd;
}

.tempo-console input:disabled {
  opacity: 0.45;
}

.spotlight {
  position: fixed;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #31f6dd30, #ff6ebb15 45%, transparent 70%);
  z-index: -1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #314369b8;
  background: #090f1dbd;
}

.header-row {
  padding: 0.9rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-family: "Audiowide", sans-serif;
  color: #fff;
  letter-spacing: 0.07em;
  font-size: 1rem;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.main-nav a {
  font-weight: 600;
  color: #d5deef;
  position: relative;
  padding-bottom: 0.28rem;
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--aqua), var(--pink));
  transition: transform 0.22s ease;
}

.main-nav a:hover::after {
  transform: scaleX(1);
}

.hero {
  min-height: 84vh;
  padding: 5rem 0 2.2rem;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 2.3rem;
}

.kicker {
  display: inline-block;
  margin: 0 0 1rem;
  border: 1px solid #3f5687;
  background: #131a2c;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d0ffe6;
}

.hero-copy p {
  color: var(--muted);
  max-width: 60ch;
}

.hero-copy h1 {
  animation: headline-jolt calc(4.2s / var(--motion-rate)) ease-in-out infinite;
}

.hero-actions {
  margin-top: 1.4rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.btn {
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 0.72rem 1.04rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.btn-primary {
  color: #07231d;
  background: linear-gradient(130deg, #6dffdb, #44f3ff);
  box-shadow: 0 12px 24px #2effd944;
}

.btn-secondary {
  color: #f8f7ff;
  border-color: #3f5586;
  background: #161f35;
}

.btn-ghost {
  color: #ffd7ee;
  border-color: #75466e;
  background: #231726;
}

.hero-stage {
  width: min(430px, 100%);
  aspect-ratio: 1;
  margin-left: auto;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
}

.orbital {
  position: absolute;
  border-radius: 50%;
  border: 1px solid #44639e;
}

.orbital-1 {
  inset: 0;
  animation: spin 20s linear infinite;
}

.orbital-2 {
  inset: 16%;
  border-style: dashed;
  animation: spin-rev 13s linear infinite;
}

.core {
  width: 136px;
  height: 136px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #ff9ad0, #ffcb67);
  color: #2f0e22;
  font-weight: 700;
  box-shadow: 0 0 38px #ff6ebb66;
  animation: boogie-core calc(2.8s / var(--motion-rate)) ease-in-out infinite;
}

.tag {
  position: absolute;
  border-radius: 9px;
  border: 1px solid #3f5a90;
  background: #0f1628d6;
  color: #dfecff;
  font-size: 0.76rem;
  padding: 0.32rem 0.56rem;
  font-weight: 700;
}

.t1 { left: 43%; top: 8%; animation: bob calc(3.5s / var(--motion-rate)) ease-in-out infinite; }
.t2 { right: 2%; top: 44%; animation: bob calc(4.2s / var(--motion-rate)) ease-in-out infinite; }
.t3 { left: 44%; bottom: 8%; animation: bob calc(3.8s / var(--motion-rate)) ease-in-out infinite; }
.t4 { left: 2%; top: 43%; animation: bob calc(4.6s / var(--motion-rate)) ease-in-out infinite; }

.ticker {
  overflow: hidden;
  border-top: 1px solid #2e4067;
  border-bottom: 1px solid #2e4067;
  background: #0e1527d3;
}

.ticker-track {
  width: max-content;
  padding: 0.65rem 0;
  display: flex;
  gap: 0.75rem;
  animation: marquee calc(14s / var(--motion-rate)) linear infinite;
}

.ticker-track span {
  color: #dae4ff;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.ticker-track span::after {
  content: " /";
  color: var(--sun);
}

.section {
  padding: 2.3rem 0;
}

.glass-panel,
.timeline-card,
.matrix-card,
.project-card,
.contact-shell {
  border: 1px solid #344971;
  background: linear-gradient(180deg, var(--panel), var(--panel-strong));
  border-radius: 18px;
  box-shadow: 0 14px 36px #02040f80;
}

.glass-panel,
.contact-shell {
  padding: 1rem;
}

.stats-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.stats-grid article {
  border: 1px solid #3f5888;
  border-radius: 12px;
  background: #121c31;
  padding: 0.78rem;
}

.stats-grid strong {
  display: block;
  color: #75ffe0;
  font-family: "Audiowide", sans-serif;
}

.stats-grid span {
  font-size: 0.86rem;
  color: #b4c2e1;
}

.timeline-grid {
  display: grid;
  gap: 0.9rem;
}

.timeline-card {
  padding: 1rem;
  position: relative;
  overflow: hidden;
  animation: sway-l calc(4.4s / var(--motion-rate)) ease-in-out infinite;
}

.timeline-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, #31f6dd10, #ff6ebb0f 60%, transparent 100%);
  pointer-events: none;
}

.when {
  margin: 0 0 0.4rem;
  color: #ffb2dd;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.matrix-grid,
.projects-grid {
  display: grid;
  gap: 0.9rem;
}

.matrix-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.projects-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.matrix-card,
.project-card {
  padding: 1rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.matrix-card:nth-child(even) {
  animation: sway-r calc(4.9s / var(--motion-rate)) ease-in-out infinite;
}

.matrix-card:nth-child(odd) {
  animation: sway-l calc(5.3s / var(--motion-rate)) ease-in-out infinite;
}

.project-card:nth-child(1) {
  animation: sway-l calc(3.8s / var(--motion-rate)) ease-in-out infinite;
}

.project-card:nth-child(2) {
  animation: sway-r calc(4.1s / var(--motion-rate)) ease-in-out infinite;
}

.project-card:nth-child(3) {
  animation: sway-l calc(4.6s / var(--motion-rate)) ease-in-out infinite;
}

.matrix-card:hover,
.project-card:hover {
  border-color: #5f80bb;
}

.project-type {
  display: inline-block;
  margin: 0 0 0.5rem;
  border-radius: 999px;
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #331f05;
  background: linear-gradient(130deg, #ffe6b0, #ffca67);
  padding: 0.22rem 0.52rem;
}

.chip {
  margin-top: 0.75rem;
  border: 1px solid #466293;
  border-radius: 10px;
  background: #14203a;
  color: #d5e5ff;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  font-weight: 600;
}

.contact-shell p {
  margin: 0.45rem 0;
}

.site-footer {
  padding: 1.9rem 0;
  border-top: 1px solid #2e4068;
  color: #a5b4d1;
}

.popup-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 120;
  background: #050812bf;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.popup-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.popup-card {
  width: min(560px, 92%);
  border-radius: 18px;
  border: 1px solid #496395;
  background: linear-gradient(180deg, #121a30f5, #0f1528f5);
  box-shadow: 0 24px 48px #01030a99;
  padding: 1rem;
  transform: translateY(18px) scale(0.96);
  transition: transform 0.32s cubic-bezier(0.2, 0.72, 0.2, 1);
}

.popup-backdrop.open .popup-card {
  transform: translateY(0) scale(1);
}

.popup-close {
  float: right;
  border: 1px solid #4b6799;
  border-radius: 9px;
  background: #15213d;
  color: #dfebff;
  padding: 0.38rem 0.6rem;
  cursor: pointer;
}

.popup-kicker {
  margin: 0.2rem 0;
  color: #8fffe6;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.72rem;
}

.popup-tags {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.popup-tags span {
  border-radius: 999px;
  border: 1px solid #456191;
  background: #141f38;
  color: #d5e3ff;
  font-size: 0.73rem;
  padding: 0.23rem 0.5rem;
}

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

.reveal.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.section.reveal:nth-of-type(odd) {
  transform: translate(-26px, 34px) scale(0.96);
}

.section.reveal:nth-of-type(even) {
  transform: translate(26px, 34px) scale(0.96);
}

.boogie,
.boogie-soft {
  transform-origin: center;
}

.boogie {
  animation: boogie calc(1.55s / var(--motion-rate)) ease-in-out infinite;
}

.boogie-soft {
  animation: boogie-soft calc(2.5s / var(--motion-rate)) ease-in-out infinite;
}

.boogie.boogie-boost {
  animation-duration: calc(0.62s / var(--motion-rate));
}

.tilt {
  transition: transform 0.2s ease;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes spin-rev {
  to { transform: rotate(-360deg); }
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

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

@keyframes drift-a {
  0% { transform: translate(0, 0); }
  100% { transform: translate(72px, -54px); }
}

@keyframes drift-b {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-68px, 58px); }
}

@keyframes boogie {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  20% { transform: translateY(-3px) rotate(-1.8deg); }
  40% { transform: translateY(1px) rotate(1.3deg); }
  60% { transform: translateY(-2px) rotate(-1deg); }
  80% { transform: translateY(2px) rotate(1.4deg); }
}

@keyframes boogie-soft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes boogie-core {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-1deg) scale(1.04); }
  50% { transform: rotate(1.3deg) scale(0.98); }
  75% { transform: rotate(-1deg) scale(1.06); }
}

@keyframes sway-l {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(-0.7deg); }
}

@keyframes sway-r {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(0.7deg); }
}

@keyframes headline-jolt {
  0%, 100% { transform: translateX(0); text-shadow: 0 0 0 transparent; }
  15% { transform: translateX(-1px); }
  16% { transform: translateX(1px); }
  17% { transform: translateX(0); }
  50% { text-shadow: 0 0 14px #31f6dd40; }
  80% { text-shadow: 0 0 14px #ff6ebb40; }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: unset;
    padding-top: 4.6rem;
  }

  .hero-stage {
    margin: 0 auto;
    width: min(360px, 100%);
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .matrix-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .spotlight {
    display: none;
  }

  .tempo-console {
    width: min(230px, calc(100vw - 1.2rem));
    right: 0.6rem;
    bottom: 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  .spotlight,
  .ambient,
  .scanlines {
    display: none;
  }
}
