:root {
  --bg-0: #07100d;
  --bg-1: #0d1b16;
  --bg-2: #14271e;
  --paper: #d6cfbf;
  --paper-dim: rgba(214, 207, 191, 0.72);
  --accent: #b38a44;
  --accent-soft: rgba(179, 138, 68, 0.18);
  --trace: #88d6ab;
  --trace-soft: rgba(136, 214, 171, 0.14);
  --line: rgba(214, 207, 191, 0.12);
  --panel: rgba(8, 15, 12, 0.72);
  --shadow: rgba(0, 0, 0, 0.45);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(91, 126, 99, 0.2), transparent 32%),
    radial-gradient(circle at 85% 14%, rgba(179, 138, 68, 0.15), transparent 24%),
    linear-gradient(135deg, var(--bg-0), var(--bg-1) 40%, #050908 100%);
  color: var(--paper);
  font-family: Baskerville, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  overflow-x: hidden;
}

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

p,
h1,
h2 {
  margin: 0;
}

.page-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
}

.page-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.02), transparent 32%),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 3px
    );
  mix-blend-mode: soft-light;
  opacity: 0.45;
  pointer-events: none;
  z-index: -2;
}

.ambient-lights,
.scanlines,
.formula-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.ambient-lights {
  z-index: -4;
}

.glow {
  position: absolute;
  width: 40rem;
  height: 40rem;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.28;
}

.glow-left {
  left: -12rem;
  top: 8rem;
  background: rgba(102, 144, 113, 0.4);
}

.glow-right {
  right: -10rem;
  top: 18rem;
  background: rgba(161, 121, 57, 0.34);
}

.formula-field {
  z-index: -3;
  overflow: hidden;
}

.formula {
  position: absolute;
  color: rgba(214, 207, 191, 0.14);
  font-family: "Courier New", "Nimbus Mono PS", monospace;
  font-size: clamp(0.72rem, 1vw, 1rem);
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-shadow: 0 0 18px rgba(136, 214, 171, 0.06);
  animation: drift var(--duration, 26s) linear infinite;
  animation-delay: var(--delay, 0s);
}

.scanlines {
  z-index: -1;
  background:
    linear-gradient(transparent, rgba(12, 22, 18, 0.12), transparent),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 4px,
      rgba(255, 255, 255, 0.02) 5px,
      transparent 6px
    );
  opacity: 0.2;
}

.site-header,
main,
.site-footer {
  width: min(1120px, calc(100vw - 2rem));
  margin: 0 auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1.4rem 0 0;
  animation: rise-in 1s ease both;
}

.overline,
.header-note,
.eyebrow,
.section-label,
.card-index,
.panel-header,
.bandscale-header,
.scale-meta,
.formula-hint {
  font-family: "Courier New", "Nimbus Mono PS", monospace;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.overline,
.header-note,
.eyebrow,
.section-label,
.formula-hint,
.scale-meta,
.panel-header,
.bandscale-header {
  color: var(--paper-dim);
}

.overline,
.header-note {
  font-size: 0.72rem;
}

.brand {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  letter-spacing: 0.06em;
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 2rem;
  align-items: center;
  padding: 6rem 0 4rem;
}

.hero-copy {
  max-width: 40rem;
  animation: rise-in 1s ease 0.12s both;
}

.eyebrow,
.section-label {
  font-size: 0.74rem;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(3.3rem, 8vw, 5.9rem);
  line-height: 0.95;
  max-width: 12ch;
  text-wrap: balance;
}

.lede {
  margin-top: 1.4rem;
  max-width: 34rem;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.65;
  color: rgba(214, 207, 191, 0.86);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.4rem;
  align-items: center;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.85rem 1.35rem;
  border: 1px solid rgba(179, 138, 68, 0.55);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(179, 138, 68, 0.16), rgba(179, 138, 68, 0.04));
  box-shadow: 0 0 0 1px rgba(179, 138, 68, 0.14), 0 18px 40px rgba(0, 0, 0, 0.22);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(179, 138, 68, 0.9);
  box-shadow: 0 0 0 1px rgba(179, 138, 68, 0.22), 0 22px 48px rgba(0, 0, 0, 0.28);
}

.formula-hint {
  font-size: 0.7rem;
}

.hero-panel {
  position: relative;
  padding: 1.1rem;
  border: 1px solid rgba(214, 207, 191, 0.12);
  border-radius: 1.6rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
    rgba(7, 12, 10, 0.66);
  backdrop-filter: blur(8px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 28px 60px var(--shadow);
  animation: rise-in 1s ease 0.24s both;
}

.panel-header,
.bandscale-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.68rem;
  margin-bottom: 0.9rem;
}

.chalkboard {
  position: relative;
  overflow: hidden;
  min-height: 30rem;
  padding: 1.5rem;
  border-radius: 1rem;
  background:
    radial-gradient(circle at top left, rgba(136, 214, 171, 0.08), transparent 30%),
    radial-gradient(circle at 75% 24%, rgba(179, 138, 68, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(17, 33, 27, 0.94), rgba(7, 14, 11, 0.96));
  border: 1px solid rgba(214, 207, 191, 0.08);
}

.chalkboard::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 0 20%, rgba(255, 255, 255, 0.02) 36%, transparent 46%),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 39px,
      rgba(255, 255, 255, 0.02) 40px
    );
  opacity: 0.5;
}

.equation-group {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1rem;
  font-family: "Courier New", "Nimbus Mono PS", monospace;
  font-size: clamp(0.92rem, 1.25vw, 1rem);
  color: rgba(214, 207, 191, 0.9);
}

.equation-group p:nth-child(2n) {
  padding-left: 1.6rem;
}

.equation-group p:nth-child(3n) {
  padding-left: 0.7rem;
  color: rgba(136, 214, 171, 0.84);
}

.scope {
  position: relative;
  z-index: 1;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(214, 207, 191, 0.12);
}

.scope svg {
  width: 100%;
  height: auto;
}

.scope-grid {
  fill: none;
  stroke: rgba(214, 207, 191, 0.15);
  stroke-width: 1;
}

.scope-wave {
  fill: none;
  stroke: var(--trace);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px rgba(136, 214, 171, 0.35));
  stroke-dasharray: 640;
  stroke-dashoffset: 640;
  animation: trace-in 2.2s ease 0.5s forwards;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 1rem 0 4rem;
}

.insight-card,
.bandscale,
.closing-formulas {
  border: 1px solid rgba(214, 207, 191, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 18px 40px rgba(0, 0, 0, 0.18);
}

.insight-card {
  padding: 1.4rem;
  border-radius: 1.25rem;
  animation: rise-in 0.8s ease both;
}

.insight-card:nth-child(2) {
  animation-delay: 0.12s;
}

.insight-card:nth-child(3) {
  animation-delay: 0.2s;
}

.card-index {
  font-size: 0.68rem;
  margin-bottom: 1rem;
}

.insight-card h2,
.band-copy h2,
.closing-copy h2 {
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  margin-bottom: 0.8rem;
}

.insight-card p:last-child,
.band-copy p:not(.section-label),
.closing-copy p {
  line-height: 1.7;
  color: rgba(214, 207, 191, 0.82);
}

.band-section,
.closing-section {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 1.6rem;
  align-items: start;
  padding: 1rem 0 4rem;
}

.band-copy,
.closing-copy {
  padding: 1rem 0.2rem 0 0;
}

.bandscale {
  position: relative;
  padding: 1.2rem 1.2rem 1.6rem;
  border-radius: 1.4rem;
  overflow: hidden;
}

.ticks {
  position: relative;
  min-height: 4rem;
  margin-top: 1rem;
}

.ticks span {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  font-family: "Courier New", "Nimbus Mono PS", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: rgba(214, 207, 191, 0.78);
  white-space: nowrap;
}

.ticks span::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  width: 1px;
  height: 1.3rem;
  background: rgba(214, 207, 191, 0.28);
}

.scale-line {
  position: relative;
  height: 4px;
  margin-top: 0.3rem;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(136, 214, 171, 0.15), rgba(179, 138, 68, 0.5), rgba(136, 214, 171, 0.2));
}

.needle {
  position: absolute;
  top: 4.5rem;
  left: 61%;
  width: 2px;
  height: 5.3rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), var(--accent));
  box-shadow: 0 0 18px rgba(179, 138, 68, 0.4);
  transform: rotate(6deg);
  transform-origin: top center;
  animation: needle-sway 4.6s ease-in-out infinite;
}

.scale-meta {
  margin-top: 1.5rem;
  font-size: 0.66rem;
  display: grid;
  gap: 0.55rem;
}

.closing-section {
  padding-bottom: 5rem;
}

.closing-formulas {
  display: grid;
  gap: 1rem;
  align-self: stretch;
  padding: 1.4rem;
  border-radius: 1.4rem;
  font-family: "Courier New", "Nimbus Mono PS", monospace;
  font-size: clamp(0.95rem, 1.25vw, 1.05rem);
  color: rgba(214, 207, 191, 0.86);
}

.closing-formulas p:nth-child(2n) {
  color: rgba(136, 214, 171, 0.84);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 0 2rem;
  border-top: 1px solid rgba(214, 207, 191, 0.08);
  font-family: "Courier New", "Nimbus Mono PS", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

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

@keyframes trace-in {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes drift {
  from {
    transform:
      translate3d(-8vw, 0, 0)
      rotate(var(--rotation, 0deg))
      scale(var(--scale, 1));
  }

  to {
    transform:
      translate3d(8vw, -12vh, 0)
      rotate(var(--rotation, 0deg))
      scale(var(--scale, 1));
  }
}

@keyframes needle-sway {
  0%,
  100% {
    transform: rotate(6deg);
  }

  50% {
    transform: rotate(-4deg);
  }
}

@media (max-width: 900px) {
  .site-header,
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero,
  .band-section,
  .closing-section,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 4rem;
  }

  .hero h1 {
    max-width: 10ch;
  }

  .chalkboard {
    min-height: 24rem;
  }
}

@media (max-width: 640px) {
  .site-header,
  main,
  .site-footer {
    width: min(1120px, calc(100vw - 1.2rem));
  }

  .site-header {
    padding-top: 1rem;
  }

  .hero {
    gap: 1.25rem;
    padding: 3rem 0 3rem;
  }

  .hero h1 {
    font-size: clamp(2.6rem, 15vw, 4.4rem);
  }

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

  .ticks {
    min-height: 9rem;
  }

  .ticks span {
    writing-mode: vertical-rl;
    transform: translateX(-50%) rotate(180deg);
    bottom: 0.2rem;
  }

  .ticks span::before {
    bottom: auto;
    top: -1.7rem;
    height: 1rem;
  }

  .needle {
    top: 5.4rem;
    height: 4.6rem;
  }
}

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

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