:root {
  --bg: #fff;
  --bg-soft: #fff;
  --text: #161310;
  --text-dim: #5f5850;
  --accent: #8b6840;
  --accent-soft: rgba(139, 104, 64, 0.14);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Manrope", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --prose-max: min(94vw, 80rem);
  --title-max: min(96vw, 120rem);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 1.6rem;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

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

.glow {
  display: none;
}

.glow-a {
  width: 55vw;
  height: 55vw;
  top: -15vw;
  right: -10vw;
  background: radial-gradient(circle, rgba(196, 165, 116, 0.16) 0%, transparent 70%);
}

.glow-b {
  width: 45vw;
  height: 45vw;
  bottom: 10vh;
  left: -12vw;
  background: radial-gradient(circle, rgba(139, 104, 64, 0.10) 0%, transparent 70%);
}

.intro {
  position: relative;
  z-index: 1;
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3.2rem clamp(1rem, 4vw, 3.2rem) 2.4rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  width: 100%;
  max-width: var(--title-max);
}

.intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7.2vw, 4.4rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  width: 100%;
  max-width: var(--title-max);
}

.lede {
  margin: 1rem auto 0;
  width: 100%;
  max-width: var(--prose-max);
  font-size: 1.68rem;
  color: var(--text-dim);
}

.intro-highlight {
  margin: 1.6rem auto 0;
  width: min(96vw, 1184px);
}

.intro-highlight-loading {
  min-height: 12rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 1rem;
}

.intro-highlight-label {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.intro-highlight-grid {
  display: grid;
  grid-template-columns: 0.85fr 1fr 1fr 1fr;
  column-gap: clamp(1rem, 2vw, 1.6rem);
  row-gap: 0.8rem;
  align-items: start;
}

.intro-highlight-panel {
  margin: 0;
  min-width: 0;
}

.intro-highlight .intro-highlight-title {
  font-family: var(--font-display);
  margin-bottom: 0.45rem;
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.intro-highlight-panel canvas,
.intro-highlight-panel img,
.intro-highlight-panel video {
  display: block;
  width: 100%;
  height: auto;
}

.intro-highlight-panel img,
.intro-highlight-panel video {
  object-fit: contain;
}

.intro-highlight-panel .flat-toggle {
  margin-top: 0.35rem;
}

.intro-highlight-panel .flat-note {
  margin-top: 0.16rem;
  min-height: 1em;
  visibility: hidden;
}

.intro-highlight-panel .flat-note.is-visible {
  visibility: visible;
}

.intro-highlight-video-stack {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

.intro-highlight-video-stack video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.08s linear;
}

.intro-highlight-video-stack video.is-active {
  opacity: 1;
}

.intro-citation-block {
  margin: 1.35rem auto 0;
  width: 100%;
  max-width: min(88vw, 58rem);
}

.intro-citation-block .outro-citation {
  font-size: 1rem;
  line-height: 1.5;
}

.intro-citation-block .outro-links {
  margin-top: 0.35rem;
  font-size: 1rem;
  line-height: 1.5;
}

.story {
  position: relative;
  z-index: 1;
  width: 100%;
}

.story-section {
  --reveal: 1;
  width: 100%;
  max-width: 1184px;
  min-height: 88vh;
  margin: 0 auto;
  padding: clamp(4rem, 8vh, 6.4rem) 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(1.6rem, 3.2vw, 3.2rem);
}

.story-section--demo {
  min-height: 46vh;
  padding-bottom: 0;
}

.story-reveal {
  opacity: calc(0.08 + 0.92 * var(--reveal));
  transform: translateY(calc((1 - var(--reveal)) * 48px))
             scale(calc(0.97 + 0.03 * var(--reveal)));
  filter: blur(calc((1 - var(--reveal)) * 10px));
  transition: opacity 0.05s linear, transform 0.05s linear, filter 0.05s linear;
  will-change: opacity, transform, filter;
}

.story-copy {
  width: 100%;
}

.story-copy--center {
  margin: 0 auto;
  text-align: center;
}

.story-copy h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.08rem, 4vw, 3.84rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.story-copy p {
  margin: 0.96rem 0 0;
  font-size: clamp(1.24rem, 1.6vw, 1.64rem);
  line-height: 1.62;
  color: var(--text-dim);
}

.story-figure {
  margin: 0;
  width: 100%;
}

.story-figure img,
.story-figure video,
.story-figure object {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 4px;
  filter: none;
}

.story-figure img,
.story-figure video {
  height: auto;
}

.story-figure--wide {
  align-self: center;
}

.story-figure--document object {
  min-height: min(61vh, 608px);
  background: #fff;
}

.story-figure--document a {
  color: var(--accent);
}

.manifold-triptych {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.8rem, 2vw, 1.6rem);
  align-items: stretch;
}

.story-figure--panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.8rem;
}

.story-figure--panel img,
.story-figure--panel video {
  flex: 1;
  min-height: 0;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: transparent;
}

.story-figure--retina img {
  width: 82%;
  margin: 0 auto;
}

.story-figure figcaption {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text-dim);
  text-align: center;
}

.scroll-hint {
  margin-top: 2.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.48rem;
  font-size: 1.12rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  animation: float 2.8s var(--ease-out) infinite;
}

.scroll-dot {
  animation: scroll-pulse 2.8s var(--ease-out) infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(6px); opacity: 1; }
}

@keyframes scroll-pulse {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(8px); opacity: 1; }
}

.sequence {
  position: relative;
  z-index: 1;
  max-width: 1184px;
  margin: 0 auto;
  padding: 0 1rem 3.2rem;
}

.beat {
  --reveal: 0;
  min-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.2rem 0;
  opacity: calc(0.08 + 0.92 * var(--reveal));
  transform: translateY(calc((1 - var(--reveal)) * 48px))
             scale(calc(0.97 + 0.03 * var(--reveal)));
  filter: blur(calc((1 - var(--reveal)) * 10px));
  transition: opacity 0.05s linear, transform 0.05s linear, filter 0.05s linear;
  will-change: opacity, transform, filter;
}

.fixation-set + .fixation-set {
  margin-top: 1.2rem;
}

.fixation-set {
  min-height: auto;
  padding: 1.2rem 0 2.4rem;
  align-items: flex-start;
}

.source-image-set {
  min-height: auto;
  padding: 1.2rem 0 2.4rem;
}

.fixation-set-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.fixation-source {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.fixation-views {
  width: 100%;
}

.beat-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.beat-index {
  font-family: var(--font-display);
  font-size: 1.76rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.source-frame {
  position: relative;
  width: min(92vw, 576px);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: none;
}

.source-frame canvas,
.source-frame img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.views-pair {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.8rem, 2vw, 1.6rem);
  align-items: start;
}

.view-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.52rem;
  width: 100%;
}

.view-subtitle {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-align: center;
}

.flat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.flat-toggle input {
  margin: 0;
  accent-color: var(--accent);
}

.flat-note {
  margin: -0.24rem 0 0;
  color: var(--text-dim);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-align: center;
}

@media (max-width: 900px) {
  .story-section {
    min-height: auto;
    padding-block: 3.2rem;
  }

  .intro-highlight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .manifold-triptych,
  .views-pair {
    grid-template-columns: 1fr;
  }
}

.view-frame {
  position: relative;
  border-radius: 2px;
  overflow: visible;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 144px;
  width: 100%;
}

.view-frame--global {
  max-height: min(56vh, 416px);
  width: 100%;
}

.view-frame--flat {
  aspect-ratio: 2 / 1;
  max-height: min(56vh, 416px);
}

.view-frame--manifold-3d {
  aspect-ratio: 3 / 2;
  max-height: min(56vh, 416px);
  overflow: hidden;
}

.view-frame img,
.view-frame video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: none;
}

.view-frame video {
  border-radius: 2px;
}

.view-frame--manifold-3d video {
  mix-blend-mode: normal;
}

.plotly-manifold {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plotly-manifold .js-plotly-plot,
.plotly-manifold .plot-container,
.plotly-manifold .svg-container {
  width: 100% !important;
  height: 100% !important;
}

.plotly-hint {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.26rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text-dim);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.plotly-hint svg {
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.outro {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4.8rem clamp(1rem, 4vw, 3.2rem) 9.6rem;
  --reveal: 0;
  opacity: calc(0.1 + 0.9 * var(--reveal));
  filter: blur(calc((1 - var(--reveal)) * 6px));
}

.outro-inner {
  width: 100%;
  max-width: var(--prose-max);
  text-align: center;
}

.outro-citation {
  margin: 0;
  font-size: 2.24rem;
  line-height: 1.65;
  color: var(--text-dim);
}

.outro-citation a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(196, 165, 116, 0.35);
}

.outro-citation a:hover {
  border-bottom-color: var(--accent);
}

.outro-links {
  margin: 1.6rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem 1rem;
  font-size: 2.24rem;
  line-height: 1.65;
}

.outro-links a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(196, 165, 116, 0.35);
}

.outro-links a:hover {
  border-bottom-color: var(--accent);
}

.outro-links-sep {
  color: var(--text-dim);
}

.loading {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.92rem;
}

.error {
  color: #9b4d37;
  text-align: center;
  padding: 2.4rem;
  font-size: 1.6rem;
}

@media (prefers-reduced-motion: reduce) {
  .beat,
  .story-reveal,
  .outro {
    filter: none;
    transform: none;
    opacity: 1;
    transition: none;
  }

  .scroll-hint {
    animation: none;
  }
}
