:root {
  color-scheme: dark;
  --bg: #07100f;
  --bg-deep: #030807;
  --surface: rgba(12, 28, 25, 0.72);
  --surface-solid: #0d1d1a;
  --line: rgba(193, 255, 224, 0.14);
  --line-strong: rgba(193, 255, 224, 0.28);
  --text: #f1f7ef;
  --muted: #9cafaa;
  --accent: #a8ffcf;
  --accent-2: #5ad8cf;
  --accent-soft: rgba(168, 255, 207, 0.16);
  --glow: rgba(78, 255, 181, 0.24);
  --shadow: rgba(0, 0, 0, 0.38);
  --radius: 28px;
  --page: min(1180px, calc(100vw - 48px));
  font-family:
    ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    sans-serif;
  font-synthesis: none;
}

html[data-palette="ember"] {
  --bg: #150c0a;
  --bg-deep: #080403;
  --surface: rgba(39, 18, 13, 0.72);
  --surface-solid: #24110d;
  --line: rgba(255, 213, 179, 0.15);
  --line-strong: rgba(255, 213, 179, 0.3);
  --text: #fff4e8;
  --muted: #c4a89a;
  --accent: #ffbd7a;
  --accent-2: #ff7262;
  --accent-soft: rgba(255, 154, 99, 0.16);
  --glow: rgba(255, 102, 73, 0.26);
}

html[data-palette="ion"] {
  --bg: #080b18;
  --bg-deep: #03040a;
  --surface: rgba(15, 20, 50, 0.72);
  --surface-solid: #10152f;
  --line: rgba(214, 222, 255, 0.14);
  --line-strong: rgba(214, 222, 255, 0.28);
  --text: #f3f4ff;
  --muted: #9da7c7;
  --accent: #b8bcff;
  --accent-2: #7c6cff;
  --accent-soft: rgba(139, 130, 255, 0.17);
  --glow: rgba(105, 88, 255, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg-deep);
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 75% 5%, var(--glow), transparent 32rem),
    linear-gradient(150deg, var(--bg) 0%, var(--bg-deep) 74%);
  transition: background 600ms ease, color 400ms ease;
}

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

button {
  font: inherit;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--bg-deep);
  background: var(--accent);
  transform: translateY(-150%);
}

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

#sky,
.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#sky {
  z-index: 0;
  opacity: 0.44;
}

.grain {
  z-index: 1;
  opacity: 0.055;
  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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.topbar,
main,
footer {
  position: relative;
  z-index: 2;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: var(--page);
  min-height: 88px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.brand,
.topbar-meta,
.eyebrow,
.micro-label,
.card-frequency,
.field-footer,
.console-topline,
footer {
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
}

.brand-mark {
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-radius: 2px 8px 8px 8px;
  box-shadow: 0 0 18px var(--glow);
  transform: rotate(45deg);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.68rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}

.meta-divider {
  width: 1px;
  height: 14px;
  margin: 0 4px;
  background: var(--line-strong);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(420px, 1.12fr);
  gap: clamp(36px, 6vw, 88px);
  align-items: center;
  width: var(--page);
  min-height: calc(100svh - 88px);
  margin: 0 auto;
  padding: 64px 0 94px;
}

.eyebrow {
  display: flex;
  gap: 22px;
  margin: 0 0 28px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 28px;
  font-size: clamp(3.5rem, 7.2vw, 7.4rem);
  font-weight: 580;
  letter-spacing: -0.072em;
  line-height: 0.9;
}

.ink {
  color: transparent;
  background: linear-gradient(95deg, var(--accent) 0%, var(--accent-2) 88%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 25px var(--glow));
}

.lede {
  max-width: 560px;
  margin-bottom: 34px;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.85;
}

.hero-actions {
  display: flex;
  gap: 24px;
  align-items: center;
}

.primary-button,
.generate-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 54px;
  padding: 0 21px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--bg-deep);
  background: var(--accent);
  box-shadow: 0 14px 42px var(--shadow), 0 0 22px var(--glow);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 300ms ease;
}

.primary-button:hover,
.generate-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 52px var(--shadow), 0 0 30px var(--glow);
}

.primary-button:active,
.generate-button:active {
  transform: translateY(0) scale(0.98);
}

.text-link {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
  transition: color 180ms ease;
}

.text-link:hover {
  color: var(--text);
}

.field-shell {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 30%),
    var(--surface);
  box-shadow: 0 34px 90px var(--shadow), inset 0 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  isolation: isolate;
}

.field-heading,
.field-footer {
  position: absolute;
  z-index: 4;
  right: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-heading {
  top: 22px;
}

.field-heading > div {
  display: grid;
  gap: 5px;
}

.field-heading strong {
  font-size: 1rem;
  font-weight: 560;
}

.field-heading > span,
.field-footer {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.62rem;
}

#constellation {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.field-orbit {
  position: absolute;
  z-index: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  pointer-events: none;
}

.orbit-one {
  top: 16%;
  left: 8%;
  width: 70%;
  aspect-ratio: 1;
  animation: orbit-drift 18s linear infinite;
}

.orbit-two {
  right: -18%;
  bottom: -2%;
  width: 64%;
  aspect-ratio: 1;
  border-style: dashed;
  animation: orbit-drift 25s linear infinite reverse;
}

.field-footer {
  bottom: 20px;
}

.field-footer span:last-child {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--accent);
}

.field-footer i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.scroll-note {
  position: absolute;
  bottom: 22px;
  left: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  writing-mode: vertical-rl;
}

.scroll-note span {
  width: 1px;
  height: 44px;
  background: linear-gradient(var(--accent), transparent);
}

.signals,
.lab {
  width: var(--page);
  margin: 0 auto;
  padding: 110px 0;
  border-top: 1px solid var(--line);
}

.section-intro {
  display: grid;
  grid-template-columns: 0.52fr 1.15fr 0.75fr;
  gap: 40px;
  align-items: start;
  margin-bottom: 62px;
}

.micro-label {
  margin: 0;
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 750;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2.4rem, 5vw, 5.4rem);
  font-weight: 560;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.section-intro > p:last-child,
.lab-copy > p:nth-child(3) {
  color: var(--muted);
  line-height: 1.8;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.signal-card {
  position: relative;
  display: flex;
  min-height: 390px;
  padding: 26px;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.025);
  transition: transform 240ms ease, border-color 240ms ease, background 240ms ease;
}

.signal-card:hover {
  border-color: var(--line-strong);
  background: var(--accent-soft);
  transform: translateY(-8px);
}

.featured-card {
  background: linear-gradient(155deg, var(--accent-soft), rgba(255, 255, 255, 0.02));
}

.card-index {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
}

.signal-glyph {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 38px auto auto;
}

.signal-glyph::before,
.signal-glyph::after {
  position: absolute;
  content: "";
  inset: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.signal-glyph::after {
  inset: 28%;
  border-color: var(--accent);
  box-shadow: 0 0 28px var(--glow);
}

.glyph-drift::before {
  border-radius: 50% 28% 58% 42%;
  transform: rotate(28deg);
}

.glyph-bloom::before {
  border-style: dashed;
  transform: scale(1.08);
}

.glyph-echo::before {
  transform: scaleX(0.58) rotate(-34deg);
}

.signal-card h3 {
  margin: 38px 0 13px;
  font-size: 1.15rem;
  font-weight: 580;
}

.signal-card p {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.75;
}

.card-frequency {
  margin-top: auto;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.57rem;
}

.lab {
  display: grid;
  grid-template-columns: 0.78fr 1.22fr;
  gap: clamp(48px, 8vw, 120px);
  align-items: center;
}

.lab-copy h2 {
  margin: 18px 0 24px;
}

.palette-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 30px;
}

.palette-chip,
.motion-toggle {
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.palette-chip {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  font-size: 0.72rem;
}

.palette-chip:hover,
.palette-chip.active,
.motion-toggle:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

.message-console {
  position: relative;
  min-height: 440px;
  padding: clamp(28px, 5vw, 58px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.05), transparent 36%),
    var(--surface);
  box-shadow: 0 34px 90px var(--shadow);
}

.message-console::after {
  position: absolute;
  right: -100px;
  bottom: -160px;
  width: 360px;
  height: 360px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  box-shadow: 0 0 80px var(--glow);
  content: "";
  pointer-events: none;
}

.console-topline {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.58rem;
}

.console-topline b {
  color: var(--accent);
}

.motion-toggle {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.56rem;
  letter-spacing: 0.1em;
}

blockquote {
  position: relative;
  z-index: 1;
  max-width: 620px;
  min-height: 150px;
  margin: 70px 0 54px;
  font-size: clamp(1.9rem, 4vw, 4.2rem);
  font-weight: 520;
  letter-spacing: -0.045em;
  line-height: 1.12;
  transition: opacity 180ms ease, transform 180ms ease;
}

blockquote.changing {
  opacity: 0;
  transform: translateY(12px);
}

.generate-button {
  position: relative;
  z-index: 1;
  min-width: 230px;
}

footer {
  display: flex;
  justify-content: space-between;
  width: var(--page);
  margin: 0 auto;
  padding: 32px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.58rem;
}

footer p {
  margin: 0;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

@keyframes orbit-drift {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  :root {
    --page: min(100% - 34px, 720px);
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 76px;
  }

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

  .field-shell {
    min-height: min(620px, 78svh);
  }

  .scroll-note {
    display: none;
  }

  .section-intro,
  .lab {
    grid-template-columns: 1fr;
  }

  .section-intro {
    gap: 24px;
  }

  .section-intro > p:last-child {
    max-width: 520px;
  }

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

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

  .signal-glyph {
    width: 96px;
    height: 96px;
    margin: 20px 0 auto;
  }
}

@media (max-width: 560px) {
  :root {
    --page: calc(100% - 28px);
    --radius: 22px;
  }

  .topbar {
    min-height: 72px;
  }

  .topbar-meta .meta-divider,
  .topbar-meta time {
    display: none;
  }

  .hero {
    gap: 46px;
    padding: 54px 0 78px;
  }

  h1 {
    font-size: clamp(3rem, 16vw, 4.5rem);
  }

  .lede {
    font-size: 0.96rem;
  }

  .hero-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .field-shell {
    min-height: 470px;
  }

  .field-heading,
  .field-footer {
    right: 18px;
    left: 18px;
  }

  .field-heading > span,
  .field-footer > span:first-child {
    display: none;
  }

  .signals,
  .lab {
    padding: 82px 0;
  }

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

  .message-console {
    min-height: 400px;
    padding: 28px 22px;
  }

  .console-topline {
    align-items: flex-start;
    gap: 18px;
  }

  blockquote {
    min-height: 168px;
    margin: 58px 0 42px;
  }

  .generate-button {
    width: 100%;
    min-width: 0;
  }

  footer {
    gap: 10px;
    align-items: flex-start;
    flex-direction: column;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
