:root {
  --paper: #fbfaf7;
  --ink: #18222d;
  --muted: #66737d;
  --line: rgba(24, 34, 45, 0.12);
  --wash-blue: #eef6fb;
  --wash-green: #eef7f1;
  --wash-amber: #fff5df;
  --page-accent: #2f7d68;
  --content-max: 1180px;
  --page-gutter: max(16px, calc((100vw - var(--content-max)) / 2));
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  background: var(--paper);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 18% 12%, rgba(47, 125, 104, 0.08), transparent 24rem),
    radial-gradient(circle at 84% 20%, rgba(181, 83, 69, 0.07), transparent 22rem),
    linear-gradient(180deg, #fffdfa 0%, var(--paper) 55%, #f7fbfd 100%);
  overflow-x: hidden;
}

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

button,
input {
  font: inherit;
}

.ambient-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: 100%;
  margin: 0;
  padding: 18px var(--page-gutter);
  background: rgba(251, 250, 247, 0.76);
  border-bottom: 1px solid rgba(24, 34, 45, 0.06);
  backdrop-filter: blur(18px);
}

.brand,
.site-nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  width: 20px;
  height: 20px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  box-shadow: inset 0 0 0 5px var(--paper), 0 0 0 1px rgba(24, 34, 45, 0.08);
}

.site-nav {
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-nav a {
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover {
  color: var(--ink);
  border-color: currentColor;
}

main {
  width: 100%;
}

.atlas-section,
.compiler-section,
.geometry-section,
.intro-band,
.author-section,
.motif-body,
.related-section,
.motif-pager {
  width: min(var(--content-max), calc(100% - 32px));
  margin-inline: auto;
}

.section-frame {
  width: 100%;
  margin-inline: 0;
  padding-inline: var(--page-gutter);
}

.hero,
.motif-hero {
  position: relative;
  display: grid;
  align-items: center;
  padding-block: 4rem 5rem;
}

.hero {
  min-height: calc(88vh - 72px);
  overflow: hidden;
}

.motif-hero {
  min-height: 72vh;
}

.hero::after,
.motif-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(24, 34, 45, 0.18), transparent);
}

.hero-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% center;
  opacity: 0.52;
  filter: saturate(0.92) contrast(0.96);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: block;
  width: min(var(--content-max), 100%);
  margin-inline: auto;
}

.motif-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.85fr);
  gap: clamp(2rem, 6vw, 7rem);
}

.hero-copy,
.motif-hero-copy {
  position: relative;
  z-index: 1;
}

.hero-copy {
  width: min(620px, 100%);
}

.eyebrow,
.section-kicker,
.motif-family,
.side-label {
  color: var(--page-accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1,
h2,
h3 {
  letter-spacing: 0;
}

h1 {
  margin-top: 0.8rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 10vw, 8.8rem);
  font-weight: 500;
  line-height: 0.86;
}

.hero-lede,
.motif-question {
  max-width: 720px;
  margin-top: 1.5rem;
  color: #31414f;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.icon-link,
.return-link,
.motif-pager a {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 42px;
  border-bottom: 1px solid rgba(24, 34, 45, 0.22);
  color: var(--ink);
  font-weight: 700;
}

.icon-link span,
.return-link span,
.motif-pager span {
  color: var(--page-accent);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.icon-link.primary {
  color: var(--page-accent);
}

.motif-visual-wrap,
.space-stage {
  position: relative;
  min-height: 440px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: 0 24px 70px rgba(24, 34, 45, 0.08);
  overflow: hidden;
}

.hero-orbit {
  position: absolute;
  top: 4%;
  right: 0;
  z-index: 0;
  width: min(560px, 45vw);
  height: min(560px, 58vh);
  pointer-events: none;
}

.hero-orbit canvas,
.motif-visual-wrap canvas,
.space-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.intro-band {
  display: grid;
  grid-template-columns: 0.45fr 0.9fr 1fr;
  gap: 2rem;
  padding: 5rem 0;
  border-bottom: 1px solid var(--line);
}

.intro-band h2,
.section-heading h2,
.geometry-copy h2,
.motif-main h2,
.related-section h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 4.2rem);
  font-weight: 500;
  line-height: 1.02;
}

.intro-band p:last-child,
.geometry-copy p,
.motif-main p,
.motif-side p,
.sic-copy p,
.download-panel p {
  color: #40505d;
  font-size: 1.05rem;
  line-height: 1.75;
}

.download-panel .scope-note {
  padding-top: 0.85rem;
  border-top: 1px solid rgba(24, 34, 45, 0.1);
  color: #55636e;
  font-size: 0.95rem;
  line-height: 1.55;
}

.sic-section {
  position: relative;
  scroll-margin-top: 78px;
  padding-block: 6rem;
  background:
    linear-gradient(90deg, rgba(238, 247, 241, 0.78), rgba(255, 245, 223, 0.5), rgba(238, 246, 251, 0.78)),
    rgba(255, 255, 255, 0.42);
  border-block: 1px solid rgba(24, 34, 45, 0.08);
}

.sic-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(320px, 0.52fr);
  gap: clamp(1.2rem, 4vw, 3rem);
  width: min(var(--content-max), 100%);
  margin-inline: auto;
  align-items: stretch;
}

.sic-copy {
  align-self: center;
}

.sic-copy h2 {
  max-width: 760px;
  margin-top: 0.65rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 5vw, 5.8rem);
  font-weight: 500;
  line-height: 0.96;
}

.sic-copy p {
  max-width: 720px;
  margin-top: 1.25rem;
}

.download-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid rgba(24, 34, 45, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 24px 70px rgba(24, 34, 45, 0.08);
}

.download-label {
  color: var(--page-accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.download-panel h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 500;
  line-height: 1;
}

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 54px;
  margin-top: 0.4rem;
  padding: 0 1.1rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fffdfa;
  font-weight: 800;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.download-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(24, 34, 45, 0.16);
}

.download-button span {
  color: #a8dcc8;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.82rem;
}

.download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.25rem;
}

.download-links a {
  color: var(--page-accent);
  font-weight: 800;
  border-bottom: 1px solid rgba(47, 125, 104, 0.28);
}

.author-section {
  scroll-margin-top: 78px;
  padding: 6rem 0;
}

.author-letter {
  max-width: 880px;
  margin-inline: auto;
  padding: clamp(1.5rem, 4vw, 3rem);
  border-left: 2px solid rgba(47, 125, 104, 0.34);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.2)),
    rgba(255, 255, 255, 0.34);
}

.author-letter p {
  color: #263744;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.18rem, 2vw, 1.48rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.72;
}

.author-letter .letter-kicker {
  color: var(--page-accent);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
}

.author-letter p + p {
  margin-top: 1.15rem;
}

.author-letter .letter-signature {
  margin-top: 2rem;
  color: var(--ink);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-style: italic;
  text-align: right;
}

.atlas-section,
.compiler-section,
.geometry-section {
  scroll-margin-top: 78px;
}

.atlas-section,
.compiler-section,
.geometry-section,
.related-section {
  padding: 6rem 0;
}

.section-heading {
  display: grid;
  grid-template-columns: 0.38fr 1fr;
  gap: 2rem;
  align-items: start;
  margin-bottom: 2rem;
}

.atlas-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
}

.group-pill {
  min-height: 36px;
  padding: 0 0.9rem;
  border: 1px solid rgba(24, 34, 45, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: #4f5c65;
  cursor: pointer;
}

.group-pill.active,
.group-pill:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.motif-grid,
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.motif-card {
  position: relative;
  display: grid;
  min-height: 210px;
  align-content: space-between;
  padding: 1.05rem;
  border: 1px solid rgba(24, 34, 45, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.54)),
    linear-gradient(180deg, color-mix(in srgb, var(--accent), transparent 88%), transparent);
  overflow: hidden;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.motif-card[hidden] {
  display: none;
}

.motif-card::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0.28);
  transform-origin: left;
  transition: transform 220ms ease;
}

.motif-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent), #18222d 15%);
  box-shadow: 0 18px 45px rgba(24, 34, 45, 0.08);
}

.motif-card:hover::before {
  transform: scaleX(1);
}

.motif-number {
  color: color-mix(in srgb, var(--accent), #18222d 18%);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.85rem;
}

.motif-card h3 {
  margin-top: 3rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 500;
}

.motif-card p {
  margin-top: 0.7rem;
  color: #4b5965;
  line-height: 1.48;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}

.pipe-step,
.concept-panel,
.motif-side,
.motif-main,
.motif-callout {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.pipe-step {
  position: relative;
  min-height: 112px;
  padding: 1rem;
  overflow: hidden;
}

.pipe-step::after {
  content: "";
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 0.9rem;
  height: 2px;
  background: linear-gradient(90deg, var(--page-accent), transparent);
  transform: translateX(calc((var(--i) + 1) * -8%));
  animation: glide 3.4s ease-in-out infinite alternate;
}

.pipe-step span {
  display: block;
  margin-bottom: 1.2rem;
  color: var(--page-accent);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.compiler-panels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.concept-panel {
  padding: 1.3rem;
}

.concept-panel h3 {
  margin-bottom: 0.8rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 500;
}

.concept-panel p {
  color: #4c5a66;
  line-height: 1.65;
}

.geometry-section {
  display: grid;
  grid-template-columns: 0.72fr 1fr;
  gap: 2rem;
  align-items: center;
  border-top: 1px solid var(--line);
}

.space-stage {
  min-height: 520px;
}

.return-link {
  margin-bottom: 1.8rem;
}

.motif-question {
  color: color-mix(in srgb, var(--accent), #18222d 24%);
}

.motif-visual-wrap {
  min-height: 500px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), color-mix(in srgb, var(--accent), transparent 94%)),
    #fff;
}

.motif-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.45fr);
  gap: 0.9rem;
  padding: 4rem 0;
}

.motif-main,
.motif-side {
  padding: clamp(1.25rem, 3vw, 2rem);
}

.motif-main p {
  margin-top: 1.4rem;
}

.motif-side {
  display: grid;
  align-content: start;
  gap: 2rem;
}

.domain-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.domain-list span {
  padding: 0.4rem 0.65rem;
  border: 1px solid rgba(24, 34, 45, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: #3b4b57;
  font-size: 0.9rem;
}

.motif-callout {
  margin-top: 2rem;
  padding: 1.15rem 1.3rem;
  border-color: color-mix(in srgb, var(--accent), #18222d 10%);
  color: color-mix(in srgb, var(--accent), #18222d 24%);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.related-section {
  border-top: 1px solid var(--line);
}

.related-section .motif-card {
  min-height: 180px;
}

.motif-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0 5rem;
  border-top: 1px solid var(--line);
}

.reveal {
  transform: translateY(18px);
  opacity: 0;
  transition: transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 700ms ease;
}

.reveal.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@keyframes glide {
  from {
    opacity: 0.35;
    transform: translateX(-12%);
  }
  to {
    opacity: 0.95;
    transform: translateX(12%);
  }
}

@media (max-width: 960px) {
  .hero-grid,
  .motif-hero,
  .intro-band,
  .section-heading,
  .geometry-section,
  .motif-body,
  .sic-inner {
    grid-template-columns: 1fr;
  }

  .motif-grid,
  .related-grid,
  .compiler-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .hero,
  .motif-hero {
    min-height: auto;
  }

  .hero-orbit {
    top: 18%;
    width: min(420px, 54vw);
    height: 360px;
    opacity: 0.7;
  }

  .sic-section,
  .author-section {
    padding-block: 4.5rem;
  }
}

@media (max-width: 640px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  .site-nav {
    width: 100%;
    justify-content: space-between;
    gap: 0.55rem;
    font-size: 0.86rem;
  }

  h1 {
    font-size: clamp(3.25rem, 18vw, 5rem);
  }

  .motif-visual-wrap,
  .space-stage {
    min-height: 320px;
  }

  .hero-orbit {
    top: auto;
    right: -16%;
    bottom: 0;
    width: 78vw;
    height: 260px;
    opacity: 0.55;
  }

  .sic-copy h2 {
    font-size: clamp(2.5rem, 14vw, 4rem);
  }

  .author-letter {
    padding-inline: 1.2rem;
  }

  .motif-grid,
  .related-grid,
  .compiler-panels {
    grid-template-columns: 1fr;
  }

  .motif-card {
    min-height: 170px;
  }

  .motif-pager {
    flex-direction: column;
  }
}

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