/*
 * SBN Labs homepage, v2. Dark first, Radix slate grays, one cool gradient (indigo → teal).
 * Lively but quiet: a drifting aurora, a cursor spotlight on cards, and a small looping sketch of each project.
 * Everything that moves stops under prefers-reduced-motion. System fonts, no third-party requests.
 */

:root {
  --bg: #09090b;
  --gray-11: #b0b4ba;
  --gray-12: #edeef0;
  --card: rgb(255 255 255 / 2.5%);
  --card-hover: rgb(255 255 255 / 4%);
  --border: rgb(255 255 255 / 8%);
  --border-hover: rgb(255 255 255 / 16%);
  --spot: rgb(158 177 255 / 10%);
  --sketch: rgb(255 255 255 / 9%);
  --sketch-ink: rgb(255 255 255 / 38%);
  --indigo: #9eb1ff;
  --teal: #6ee7d8;
  --aurora-a: rgb(110 128 255 / 30%);
  --aurora-b: rgb(70 220 200 / 16%);
  --aurora-c: rgb(190 120 255 / 14%);
  --title-from: #ffffff;
  --title-to: #8b9098;
  --badge: rgb(110 231 216 / 12%);
  --badge-ink: #6ee7d8;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fcfcfd;
    --gray-11: #60646c;
    --gray-12: #1c2024;
    --card: rgb(255 255 255 / 75%);
    --card-hover: #ffffff;
    --border: rgb(0 0 0 / 8%);
    --border-hover: rgb(0 0 0 / 16%);
    --spot: rgb(62 99 221 / 7%);
    --sketch: rgb(0 0 0 / 7%);
    --sketch-ink: rgb(0 0 0 / 40%);
    --indigo: #3e63dd;
    --teal: #12a594;
    --aurora-a: rgb(110 128 255 / 18%);
    --aurora-b: rgb(70 220 200 / 12%);
    --aurora-c: rgb(190 120 255 / 9%);
    --title-from: #1c2024;
    --title-to: #6b7079;
    --badge: rgb(14 150 135 / 10%);
    --badge-ink: #0d7d71;
    --pill-ink: #ffffff;
  }
}

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

html {
  background: var(--bg);
}

body {
  position: relative;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--gray-12);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
}

.wrap {
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Aurora: three soft lights drifting behind the hero ---------- */

.aurora {
  position: absolute;
  inset: 0 0 auto;
  height: 40rem;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
  mask-image: linear-gradient(to bottom, black 40%, transparent);
}

.aurora span {
  position: absolute;
  width: 34rem;
  height: 22rem;
  border-radius: 50%;
  filter: blur(70px);
  animation: drift 22s ease-in-out infinite alternate;
}

.aurora span:nth-child(1) {
  top: -6rem;
  left: 12%;
  background: var(--aurora-a);
}

.aurora span:nth-child(2) {
  top: -2rem;
  right: 8%;
  background: var(--aurora-b);
  animation-duration: 26s;
  animation-delay: -8s;
}

.aurora span:nth-child(3) {
  top: 6rem;
  left: 38%;
  width: 24rem;
  background: var(--aurora-c);
  animation-duration: 30s;
  animation-delay: -14s;
}

@keyframes drift {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(6rem, 2rem) scale(1.1);
  }
  100% {
    transform: translate(-4rem, -1rem) scale(0.95);
  }
}

/* A faint dot grid, fading out below the headline. */
body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 36rem;
  background-image: radial-gradient(var(--sketch) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(50rem 26rem at 50% 30%, black, transparent 75%);
  pointer-events: none;
  z-index: -1;
}

/* ---------- Nav and hero ---------- */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.navlinks {
  display: flex;
  gap: 1.5rem;
}

.navlink {
  color: var(--gray-11);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 120ms ease;
}

.navlink:hover {
  color: var(--gray-12);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6rem 0 5rem;
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
  padding: 0.3rem 0.85rem 0.3rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  backdrop-filter: blur(12px);
  color: var(--gray-11);
  font-size: 0.85rem;
  text-decoration: none;
  transition: border-color 150ms ease, color 150ms ease;
  animation: rise 700ms both;
}

.pill:hover {
  border-color: var(--border-hover);
  color: var(--gray-12);
}

.pill-new {
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--indigo), var(--teal));
  color: var(--pill-ink, #0b0b0f);
  font-size: 0.75rem;
  font-weight: 600;
}

h1 {
  margin: 0;
  font: 650 clamp(2.4rem, 7vw, 4.25rem) / 1.05 -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  letter-spacing: -0.045em;
  background: linear-gradient(180deg, var(--title-from) 30%, var(--title-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise 700ms 80ms both;
}

h2 {
  margin: 0 0 1rem;
  color: var(--gray-11);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(4px);
  }
}

/* ---------- Project cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.grid li {
  animation: rise 700ms both;
}

.grid li:nth-child(1) { animation-delay: 160ms; }
.grid li:nth-child(2) { animation-delay: 220ms; }
.grid li:nth-child(3) { animation-delay: 280ms; }
.grid li:nth-child(4) { animation-delay: 340ms; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  backdrop-filter: blur(12px);
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, transform 200ms ease;
}

/* The spotlight follows the cursor (index.html sets --x / --y). */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(22rem circle at var(--x, 50%) var(--y, 0%), var(--spot), transparent 60%);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.card:hover {
  background: var(--card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.card:hover::before {
  opacity: 1;
}

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

.visual {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 320 / 140;
  border-bottom: 1px solid var(--border);
}

.meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
}

/* Each app's own logo, on a neutral tile so they read as one set. */
.meta img {
  flex: none;
  padding: 3px;
  border-radius: 8px;
  background: #f4f4f5;
}

.text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.desc {
  color: var(--gray-11);
  font-size: 0.875rem;
}

.badge {
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--badge);
  color: var(--badge-ink);
  font-size: 0.7rem;
  font-weight: 500;
}

.arrow {
  margin-left: auto;
  color: var(--gray-11);
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.card:hover .arrow,
.card:focus-visible .arrow {
  opacity: 1;
  transform: none;
}

/* ---------- The sketches ---------- */

.visual text {
  fill: var(--sketch-ink);
  font: 500 11px -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
}

.visual .num,
.v-start text {
  font-variant-numeric: tabular-nums;
}

/* Ramen Fellow: low–high ranges that settle as the estimate firms up. */
.v-ramen .rows line {
  stroke: var(--sketch);
  stroke-width: 2;
  stroke-linecap: round;
}

.v-ramen .range {
  fill: var(--indigo);
  opacity: 0.85;
  transform-box: fill-box;
  transform-origin: left center;
  animation: range 6s ease-in-out infinite;
}

.v-ramen .r2 { fill: var(--teal); animation-delay: -1.5s; }
.v-ramen .r3 { animation-delay: -3s; }
.v-ramen .r4 { fill: var(--teal); animation-delay: -4.5s; }

.v-ramen .dv {
  stroke: var(--sketch-ink);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

@keyframes range {
  0%,
  100% {
    transform: translateX(10px) scaleX(1.6);
  }
  50% {
    transform: translateX(70px) scaleX(0.7);
  }
}

/* Plant Footprints: plots grow in, biggest first, to scale. */
.v-plants .plot {
  transform-box: fill-box;
  transform-origin: left bottom;
  animation: grow 7s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.v-plants .p1 { fill: color-mix(in srgb, var(--teal) 18%, transparent); stroke: var(--teal); stroke-width: 1.5; }
.v-plants .p2 { fill: color-mix(in srgb, var(--indigo) 18%, transparent); stroke: var(--indigo); stroke-width: 1.5; animation-delay: 0.25s; }
.v-plants .p3 { fill: color-mix(in srgb, #c084fc 22%, transparent); stroke: #c084fc; stroke-width: 1.5; animation-delay: 0.5s; }
.v-plants .p4 { fill: #f0abfc; animation-delay: 0.75s; }

.v-plants .ground {
  stroke: var(--sketch);
  stroke-width: 1.5;
}

@keyframes grow {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  14%,
  80% {
    transform: scale(1);
    opacity: 1;
  }
  94%,
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

/* Ample: the median draws itself through the band while the retirement handle drifts. */
.v-ample .band {
  fill: color-mix(in srgb, var(--teal) 16%, transparent);
}

.v-ample .median {
  fill: none;
  stroke: var(--teal);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 340;
  animation: draw 6s ease-in-out infinite;
}

.v-ample .handle line {
  stroke: var(--indigo);
  stroke-width: 1.5;
}

.v-ample .handle rect {
  fill: var(--indigo);
}

.v-ample .handle {
  animation: slide 6s ease-in-out infinite alternate;
}

@keyframes draw {
  0% {
    stroke-dashoffset: 340;
  }
  45%,
  85% {
    stroke-dashoffset: 0;
  }
  100% {
    stroke-dashoffset: -340;
  }
}

@keyframes slide {
  from {
    transform: translateX(-40px);
  }
  to {
    transform: translateX(40px);
  }
}

/* Start List Maker: the "now" bar steps down the list, one athlete every few seconds. */
.v-start .list rect {
  fill: var(--sketch);
}

.v-start .now {
  fill: color-mix(in srgb, var(--indigo) 16%, transparent);
  stroke: color-mix(in srgb, var(--indigo) 40%, transparent);
  animation: tick 7.5s steps(5, jump-none) infinite;
}

@keyframes tick {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(96px);
  }
}

/* ---------- Footer ---------- */

/* footer.wrap, not footer: .wrap's padding shorthand would otherwise win. */
footer.wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: auto;
  padding-top: 6rem;
  padding-bottom: 2rem;
  color: var(--gray-11);
  font-size: 0.8rem;
}

footer a {
  text-decoration: none;
}

footer a:hover {
  color: var(--gray-12);
}

/* ---------- Reduced motion: everything holds still ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    animation: none !important;
    transition: none !important;
  }
  .card:hover {
    transform: none;
  }
  /* Still ranges, so the sketch doesn't freeze as four identical bars. */
  .v-ramen .r1 { transform: translateX(40px) scaleX(1.1); }
  .v-ramen .r2 { transform: translateX(20px) scaleX(0.8); }
  .v-ramen .r3 { transform: translateX(60px) scaleX(1.4); }
  .v-ramen .r4 { transform: translateX(10px) scaleX(0.9); }
}
