:root {
  color-scheme: dark;
  --bg: #08090f;
  --surface: rgba(17, 20, 31, 0.72);
  --surface-strong: rgba(25, 29, 43, 0.88);
  --text: #f5f7fb;
  --muted: #a8b0c3;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #76f7d6;
  --accent-2: #ffcd6b;
  --accent-3: #ff7ba5;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --max: 1180px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f3ed;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --text: #16171c;
  --muted: #59606f;
  --line: rgba(10, 14, 24, 0.14);
  --accent: #0e8f7b;
  --accent-2: #c06a13;
  --accent-3: #b43b6b;
  --shadow: 0 24px 80px rgba(49, 43, 36, 0.16);
}

[data-theme="vibe"] {
  --bg: #0b0b12;
  --surface: rgba(18, 20, 35, 0.68);
  --surface-strong: rgba(25, 28, 44, 0.9);
  --text: #fffaf2;
  --muted: #bfc7d7;
  --line: rgba(255, 255, 255, 0.14);
  --accent: var(--vibe-a, #7df9ff);
  --accent-2: var(--vibe-b, #f7d56f);
  --accent-3: var(--vibe-c, #f486c0);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
  overflow-x: hidden;
}

body.loading {
  overflow: hidden;
}

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

button,
input,
textarea {
  font: inherit;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  background: var(--bg);
  transition: opacity 700ms ease, visibility 700ms ease;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loader p {
  margin: 0;
  color: var(--text);
  font-size: clamp(1rem, 3vw, 1.45rem);
  font-weight: 650;
}

.trace-logo {
  width: 88px;
  aspect-ratio: 1;
  color: var(--accent);
}

.trace-logo svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 5;
  stroke-linecap: round;
}

.trace-logo circle {
  fill: var(--accent-2);
  stroke: none;
}

.logo-orbit,
.logo-mark {
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: draw 1.8s ease forwards infinite alternate;
}

.logo-mark {
  animation-delay: 180ms;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

#cosmos {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 12%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 32%),
    radial-gradient(circle at 80% 20%, color-mix(in srgb, var(--accent-3) 18%, transparent), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 35%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px 22px;
  backdrop-filter: blur(18px);
}

.brand,
nav,
.theme-controls,
.hero-actions,
.contact-strip,
.inline-form {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 760;
}

.brand-mark {
  display: grid;
  width: 34px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  font-size: 0.8rem;
}

nav {
  gap: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

nav a:hover,
.contact-strip a:hover {
  color: var(--accent);
}

.theme-controls {
  gap: 8px;
}

.icon-button {
  width: 34px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 42px 22px 0;
}

.section-panel {
  margin: 0 0 26px;
  padding: clamp(22px, 4vw, 44px);
}

.hero {
  min-height: min(760px, calc(100svh - 86px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  gap: 24px;
  align-items: end;
  padding-top: min(14vh, 120px);
}

.hero-copy {
  max-width: 790px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  max-width: 920px;
  font-size: clamp(4.3rem, 14vw, 10.5rem);
  line-height: 0.82;
  font-weight: 850;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.96;
  font-weight: 820;
}

h3 {
  margin-bottom: 12px;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  line-height: 1.12;
}

.hero-text,
.bento-card p,
.artifact-copy p,
.tool-card p,
output,
footer {
  color: var(--muted);
  line-height: 1.65;
}

.hero-text {
  max-width: 690px;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
}

.hero-actions {
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.primary-link,
.ghost-link,
.mini-button,
.button-reset {
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.primary-link,
.button-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  background: var(--text);
  color: var(--bg);
  font-weight: 760;
}

.ghost-link,
.mini-button {
  min-height: 38px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
}

.primary-link:hover,
.mini-button:hover,
.ghost-link:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 56%, var(--line));
}

.trace-panel,
.bento-card,
.tool-card,
.signal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.trace-panel {
  padding: 18px;
}

.pulse-map {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  min-height: 170px;
  margin-bottom: 18px;
}

.pulse-map span {
  border-radius: 999px;
  background:
    radial-gradient(circle at 40% 36%, var(--accent), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent);
  animation: floaty 4s ease-in-out infinite;
}

.pulse-map span:nth-child(2n) {
  animation-delay: -1.3s;
}

.pulse-map span:nth-child(3n) {
  animation-delay: -2.2s;
}

@keyframes floaty {
  50% {
    transform: translateY(-10px) scale(0.94);
    opacity: 0.72;
  }
}

.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.bento-card {
  min-height: 250px;
  padding: 22px;
}

.identity-card {
  grid-column: span 3;
}

.bento-card:nth-child(2) {
  grid-column: span 2;
}

.bento-card:nth-child(3) {
  grid-column: span 1;
}

.thoughts {
  grid-column: span 6;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: end;
  min-height: 210px;
}

.thoughts p:last-of-type {
  max-width: 820px;
  font-size: clamp(1.15rem, 2.5vw, 2rem);
  color: var(--text);
}

.section-heading {
  max-width: 850px;
  margin-bottom: 26px;
}

.signal-grid,
.lab-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.signal-card {
  position: relative;
  min-height: 290px;
  padding: 18px;
  overflow: hidden;
}

.signal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.56)), var(--image);
  background-size: cover;
  background-position: center;
  opacity: 0.72;
  transition: transform 900ms ease;
}

.signal-card:hover::before {
  transform: scale(1.05);
}

.signal-card > * {
  position: relative;
  z-index: 1;
}

.signal-card p {
  color: rgba(255, 255, 255, 0.78);
}

.signal-card h3 {
  margin-top: 112px;
  color: #ffffff;
}

.artifact-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 390px);
  gap: 24px;
  align-items: end;
  min-height: 420px;
}

.artifact-copy {
  border-left: 1px solid var(--line);
  padding-left: 22px;
}

.lab-grid {
  grid-template-columns: 1.2fr 1fr;
  align-items: stretch;
}

.tool-card {
  padding: 20px;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

#signalGame {
  width: 100%;
  aspect-ratio: 31 / 19;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #05070d;
}

.fine-print {
  margin: 12px 0 0;
  font-size: 0.86rem;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented .active {
  background: var(--text);
  color: var(--bg);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  color: var(--text);
  outline: 0;
}

input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 116px;
  margin: 12px 0;
  padding: 12px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
}

output {
  display: block;
  min-height: 112px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 54%, transparent);
  white-space: pre-wrap;
}

.inline-form {
  gap: 10px;
}

.contact-strip {
  gap: 12px;
  flex-wrap: wrap;
}

.contact-strip a {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 22px 42px;
  font-size: 0.9rem;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
}

.reveal.is-visible {
  animation: rise 720ms ease forwards;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .site-header {
    align-items: start;
    flex-wrap: wrap;
  }

  nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .hero,
  .artifact-stage,
  .lab-grid {
    grid-template-columns: 1fr;
  }

  .bento,
  .signal-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .identity-card,
  .bento-card:nth-child(2),
  .bento-card:nth-child(3),
  .thoughts {
    grid-column: span 2;
  }
}

@media (max-width: 620px) {
  main {
    padding-inline: 12px;
  }

  .site-header {
    padding-inline: 12px;
  }

  .section-panel {
    padding: 22px 0;
  }

  .bento,
  .signal-grid {
    grid-template-columns: 1fr;
  }

  .identity-card,
  .bento-card:nth-child(2),
  .bento-card:nth-child(3),
  .thoughts {
    grid-column: span 1;
  }

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

  .signal-card {
    min-height: 250px;
  }

  footer {
    flex-direction: column;
  }
}

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