:root {
  color-scheme: dark;
  --bg: #060916;
  --panel: rgba(13, 22, 43, 0.66);
  --line: rgba(156, 185, 221, 0.15);
  --line-strong: rgba(111, 255, 216, 0.32);
  --text: #eef5ff;
  --muted: #91a0b8;
  --accent: #6fffd8;
  --accent-blue: #70a5ff;
  --display: "Avenir Next", "SF Pro Display", "PingFang SC", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 82% 8%, rgba(45, 97, 145, 0.24), transparent 31rem),
    radial-gradient(circle at 5% 52%, rgba(74, 44, 134, 0.18), transparent 38rem),
    var(--bg);
  font: 400 1rem/1.7 var(--body);
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.84' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#projects,
#about {
  scroll-margin-top: 0;
}

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

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  padding: 0.65rem 1rem;
  border-radius: 0.5rem;
  color: #03110d;
  background: var(--accent);
  transform: translateY(-180%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.starfield {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

.cursor-glow {
  --cursor-x: 50vw;
  --cursor-y: 30vh;
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(34rem circle at var(--cursor-x) var(--cursor-y), rgba(111, 255, 216, 0.075), transparent 58%);
  transition: opacity 300ms ease;
}

.cursor-glow.is-visible {
  opacity: 1;
}

.site-header {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 10;
  display: flex;
  width: min(100% - 3rem, 78rem);
  height: 6rem;
  align-items: center;
  justify-content: space-between;
  transform: translateX(-50%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font: 700 1.12rem/1 var(--display);
  letter-spacing: 0.08em;
}

.brand-mark {
  width: 1rem;
  height: 1rem;
  background: var(--accent);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  filter: drop-shadow(0 0 0.45rem rgba(111, 255, 216, 0.8));
}

.site-header nav {
  display: flex;
  gap: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-header nav a {
  transition: color 180ms ease;
}

.site-header nav a:hover {
  color: var(--text);
}

.eyebrow {
  color: var(--accent);
  font: 600 0.78rem/1.4 var(--display);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.section-shell {
  width: min(100% - 3rem, 78rem);
  margin: 0 auto;
}

.projects {
  min-height: 100svh;
  padding: clamp(6.5rem, 12vh, 8rem) 0 clamp(2.5rem, 5vh, 4rem);
}

.section-heading {
  display: grid;
  grid-template-columns: 1fr minmax(18rem, 30rem);
  align-items: end;
  gap: 3rem;
}

.section-heading h2,
.about-copy h2 {
  margin-top: 0.85rem;
  font: 650 clamp(2.3rem, 4.6vw, 3.8rem)/1.12 var(--display);
  letter-spacing: -0.04em;
}

.section-heading > p,
.about-copy > p {
  color: var(--muted);
}

.project-grid {
  display: grid;
  margin-top: clamp(2.25rem, 5vh, 3.25rem);
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.project-card {
  position: relative;
  display: flex;
  min-height: 25rem;
  flex-direction: column;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background:
    linear-gradient(135deg, rgba(112, 165, 255, 0.075), transparent 42%),
    var(--panel);
  box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, 0.12);
  overflow: hidden;
  transition: transform 300ms var(--ease), border-color 300ms ease, background 300ms ease;
}

.project-card::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -80%;
  width: 55%;
  height: 200%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.065), transparent);
  transform: rotate(18deg);
  transition: left 700ms var(--ease);
}

.project-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-number {
  color: #52617a;
  font: 600 0.75rem/1 var(--display);
  letter-spacing: 0.15em;
}

.project-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.project-status i {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #738097;
}

.project-status.is-live i {
  background: var(--accent);
  box-shadow: 0 0 0.8rem rgba(111, 255, 216, 0.8);
}

.project-status.is-building i {
  background: var(--accent-blue);
  box-shadow: 0 0 0.8rem rgba(112, 165, 255, 0.65);
}

.project-category {
  margin-top: 2.5rem;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.project-card h3 {
  margin-top: 0.55rem;
  font: 650 clamp(1.65rem, 2.3vw, 2.2rem)/1.2 var(--display);
  letter-spacing: -0.035em;
}

.project-description {
  margin-top: 1.1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.project-progress {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: auto;
  padding: 1.2rem 0;
  border-top: 1px solid var(--line);
}

.project-progress strong {
  font-size: 0.9rem;
  font-weight: 600;
}

.project-progress span {
  color: #6f7e95;
  font-size: 0.76rem;
}

.project-link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 0.65rem;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
}

.project-link span {
  transition: transform 180ms ease;
}

.project-link.is-disabled {
  color: #65738a;
  cursor: default;
}

.about {
  display: grid;
  min-height: calc(100svh - 6.75rem);
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 0.78fr);
  align-items: center;
  gap: clamp(3rem, 6vw, 6rem);
  padding: clamp(3rem, 7vh, 5rem) 0;
  border-top: 1px solid var(--line);
}

.about-constellation svg {
  width: 100%;
  overflow: visible;
}

.about-constellation path {
  fill: none;
  stroke: rgba(111, 255, 216, 0.22);
  stroke-width: 1;
  stroke-dasharray: 6 9;
}

.about-constellation circle {
  fill: var(--accent);
  filter: drop-shadow(0 0 0.45rem rgba(111, 255, 216, 0.75));
}

.about-copy > p:not(.eyebrow) {
  margin-top: 1.7rem;
  font-size: 1.03rem;
}

.principles {
  display: grid;
  margin-top: 2.5rem;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}

.principles div {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.principles dt {
  color: var(--accent);
  font: 600 0.68rem/1 var(--display);
}

.principles dd {
  margin-top: 0.55rem;
  font-size: 0.86rem;
}

footer {
  display: grid;
  width: min(100% - 3rem, 78rem);
  min-height: 6.75rem;
  margin: 0 auto;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2rem;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  color: #6f7e95;
  font-size: 0.8rem;
}

footer p:last-child {
  justify-self: end;
}

.reveal {
  opacity: 0;
  transform: translateY(1.4rem);
  transition: opacity 750ms var(--ease), transform 750ms var(--ease);
  transition-delay: calc(var(--card-index, 0) * 90ms);
}

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

@media (hover: hover) and (pointer: fine) {
  .project-card:hover {
    border-color: var(--line-strong);
    background:
      linear-gradient(135deg, rgba(111, 255, 216, 0.1), transparent 45%),
      rgba(13, 22, 43, 0.85);
    transform: translateY(-0.45rem);
  }

  .project-card:hover::after {
    left: 130%;
  }

  .project-link:hover span {
    transform: translate(0.15rem, -0.15rem);
  }
}

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

  .project-card:last-child {
    grid-column: 1 / -1;
    min-height: 23rem;
  }

  .about {
    grid-template-columns: 0.8fr 1fr;
    gap: 3rem;
  }
}

@media (min-width: 901px) and (max-height: 820px) {
  .projects {
    padding-top: 5.5rem;
    padding-bottom: 2rem;
  }

  .section-heading h2 {
    margin-top: 0.55rem;
    font-size: 3rem;
  }

  .section-heading {
    gap: 2rem;
  }

  .project-grid {
    margin-top: 1.5rem;
  }

  .project-card {
    min-height: 22rem;
    padding: 1.15rem;
  }

  .project-category {
    margin-top: 1.65rem;
  }

  .project-description {
    margin-top: 0.8rem;
    line-height: 1.6;
  }

  .project-progress {
    padding: 0.85rem 0;
  }
}

@media (max-width: 767px) {
  body {
    display: flex;
    height: 100svh;
    height: 100dvh;
    flex-direction: column;
    overflow: hidden;
  }

  main {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .site-header,
  .section-shell,
  footer {
    width: min(100% - 2rem, 78rem);
  }

  .site-header {
    flex: 0 0 auto;
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    min-height: calc(4.25rem + env(safe-area-inset-top));
    height: auto;
    padding-top: env(safe-area-inset-top);
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: 0;
    padding-left: max(1rem, env(safe-area-inset-left));
    margin: 0;
    background: rgba(6, 9, 22, 0.88);
    border-bottom: 1px solid rgba(156, 185, 221, 0.09);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    transform: none;
  }

  .site-header nav {
    gap: 0.25rem;
  }

  .site-header nav a {
    display: inline-flex;
    min-width: 3.25rem;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
  }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 1.4rem;
  }

  .projects {
    min-height: 100%;
    padding: 2.5rem 0 4.5rem;
  }

  .project-grid {
    margin-top: 2.25rem;
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .project-card,
  .project-card:last-child {
    min-height: 0;
    grid-column: auto;
    padding: 1.25rem;
    border-radius: 1rem;
  }

  .project-status,
  .project-number,
  .project-category,
  .project-progress span {
    font-size: 0.8rem;
  }

  .project-category {
    margin-top: 2.1rem;
  }

  .project-card h3 {
    font-size: 1.75rem;
  }

  .project-description {
    font-size: 1rem;
    line-height: 1.7;
  }

  .project-progress {
    margin-top: 2.2rem;
  }

  .project-progress strong,
  .project-link {
    font-size: 0.9rem;
  }

  .project-link {
    min-height: 2.75rem;
    align-items: center;
  }

  .about {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 4.5rem 0;
  }

  .about-constellation {
    max-width: 28rem;
  }

  .about-copy h2,
  .section-heading h2 {
    font-size: clamp(2.15rem, 10vw, 3.2rem);
  }

  .about-copy > p:not(.eyebrow) {
    font-size: 1rem;
    line-height: 1.75;
  }

  .principles {
    gap: 0.5rem;
  }

  footer {
    min-height: 0;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }

  footer > p:first-of-type {
    display: none;
  }
}

@media (max-width: 380px) {
  .site-header,
  .section-shell,
  footer {
    width: min(100% - 1.5rem, 78rem);
  }

  .site-header {
    width: 100%;
    padding-right: max(0.75rem, env(safe-area-inset-right));
    padding-left: max(0.75rem, env(safe-area-inset-left));
  }

  .principles dd {
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

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