/**
 * prolegomenon.css — letterpress design for the landing prolegomenon.
 *
 * Typography is Georgia (prose) + Arial (labels/rules). No webfonts, no CDNs:
 * every face here is a system face, so the page ships zero third-party
 * requests. See the no-external-font rule in routes/index.tsx.
 *
 * This stylesheet is self-contained — it does NOT sit on top of main.css or
 * landing.css (the neon idiom would fight the paper/ink one). It carries its
 * own reset.
 */

/* ── reset ─────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0 solid;
}

html {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  line-height: 1.5;
}

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

h1,
h2,
h3 {
  font-size: inherit;
  font-weight: inherit;
}

canvas {
  display: block;
  vertical-align: middle;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background-color: transparent;
  border-radius: 0;
}

textarea {
  resize: vertical;
}

sup {
  position: relative;
  top: -0.5em;
  vertical-align: baseline;
  font-size: 75%;
  line-height: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ── palette ───────────────────────────────────────────────────────────── */
:root {
  --paper: #e8ddc5;
  --paper-light: #f3ead8;
  --ink: #171715;
  --muted: #776f62;
  --saffron: #d96512;
  --cyan: #078f9a;
  --rose: #a83b5b;
  --indigo: #4d4b8b;
  --olive: #66733d;
  --ochre: #c17b22;
  --verdigris: #188a82;
  --rule: #17171557;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
}

/* Paper grain. Purely decorative, sits above everything but eats no clicks. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: multiply;
  background-image:
    repeating-radial-gradient(circle at 30% 40%, transparent 0 2px, #41301a14 3px 4px),
    linear-gradient(90deg, #ffffff1f, transparent 42%, #3d2a120d);
  background-size: 7px 7px, 100% 100%;
}

/* ── header ────────────────────────────────────────────────────────────── */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  margin: 0 2.5vw;
  padding: 0.6rem 0.5vw;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-size: clamp(1.35rem, 2vw, 2rem);
  letter-spacing: -0.04em;
}

.site-header .wordmark {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: inherit;
  line-height: 1.05;
}

.wordmark-glyphs {
  font-size: clamp(1.35rem, 2vw, 2rem);
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.wordmark-sub {
  color: var(--saffron);
  font: 600 clamp(0.52rem, 0.68vw, 0.64rem) / 1 Arial, Helvetica, sans-serif;
  letter-spacing: 0.2em;
  text-transform: lowercase;
}

.site-nav {
  display: flex;
  gap: clamp(1.4rem, 3.5vw, 4rem);
}

.site-nav a,
.eyebrow,
.enter,
.folio,
.movement-index,
.gate-eyebrow,
footer p,
footer .footer-return {
  font-family: Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.site-nav a {
  font-size: 0.69rem;
  font-weight: 600;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--saffron);
}

/* ── hero ──────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  align-items: center;
  gap: 6vw;
  min-height: calc(100vh - 76px);
  padding: 8vh 9vw 10vh 8vw;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}

.hero-copy {
  max-width: 790px;
  animation: rise 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-title {
  max-width: 760px;
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.hero-datestamp {
  max-width: 630px;
  margin: clamp(1.6rem, 3vw, 2.8rem) 0 0;
  color: var(--saffron);
  font: 600 clamp(0.6rem, 0.78vw, 0.76rem) / 1.7 Arial, Helvetica, sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  margin: clamp(2.5rem, 5vw, 4.5rem) 0 1.2rem;
  color: var(--saffron);
  font-size: clamp(0.58rem, 0.72vw, 0.68rem);
  font-weight: 700;
}

.incipit {
  max-width: 680px;
  margin: 0;
  font-size: clamp(1.7rem, 2.75vw, 3rem);
  line-height: 1.18;
  letter-spacing: -0.025em;
}

.hero-prose {
  max-width: 620px;
  margin-top: clamp(1.8rem, 3vw, 2.6rem);
}

.hero-prose p {
  margin: 0 0 1.1em;
  font-size: clamp(1rem, 1.15vw, 1.16rem);
  line-height: 1.62;
}

.hero-prose p:last-child {
  margin-bottom: 0;
}

.drop-cap {
  float: left;
  margin: 0.1em 0.13em 0 0;
  padding: 0.08em 0.1em 0.03em;
  border: 1px solid var(--saffron);
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px #1717156b;
  color: var(--ink);
  font-size: 3.75em;
  line-height: 0.73;
  text-shadow: 2px 2px #d965122e;
}

.enter {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-top: 4rem;
  color: var(--saffron);
  font-size: 0.7rem;
  font-weight: 700;
}

.enter > span {
  display: block;
  width: 76px;
  height: 1px;
  background: var(--saffron);
  transition: width 0.25s;
}

.enter b {
  font-size: 1.25rem;
  font-weight: 400;
}

.enter:hover > span,
.enter:focus-visible > span {
  width: 100px;
}

.enter:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 8px;
}

.mathematical {
  color: var(--rose);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.15em;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: none;
  white-space: nowrap;
}

.mathematical sup {
  vertical-align: super;
  font-size: 0.62em;
}

/* ── the figure ────────────────────────────────────────────────────────── */
/*
 * desire is a straight line — a linear slope, real-valued over expectation.
 * f(x) is possibility: convex, unbounded, diverging toward the asymptote it
 * never reaches (any possible value). They meet exactly once, at habit — the
 * force-point. Left of habit desire outruns possibility; that gap is misery.
 */
.geometry {
  position: relative;
  justify-self: end;
  width: min(27vw, 360px);
  margin: 0;
  animation: draw-in 1s 0.2s both;
}

.geometry svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.fig-axis {
  stroke: var(--ink);
  stroke-width: 1.25;
  fill: var(--ink);
  opacity: 0.55;
}

.fig-desire {
  stroke: var(--rose);
  stroke-width: 1.75;
  fill: none;
}

.fig-possibility {
  stroke: var(--saffron);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}

.fig-asymptote {
  stroke: var(--indigo);
  stroke-width: 1.25;
  stroke-dasharray: 3 5;
  fill: none;
  opacity: 0.75;
}

.fig-misery {
  fill: var(--rose);
  opacity: 0.09;
}

.fig-habit {
  fill: var(--paper);
  stroke: var(--cyan);
  stroke-width: 2.25;
}

.fig-label {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-style: italic;
  letter-spacing: 0.14em;
  fill: var(--muted);
}

.fig-label-real {
  font-style: normal;
  font-size: 13px;
  fill: var(--ink);
  text-anchor: end;
}

.fig-label-x {
  fill: var(--ink);
  text-anchor: middle;
}

.fig-label-desire {
  fill: var(--rose);
  text-anchor: start;
}

.fig-label-possibility {
  fill: var(--saffron);
  text-anchor: end;
}

.fig-label-habit {
  fill: var(--cyan);
  letter-spacing: 0.18em;
}

.fig-label-misery {
  fill: var(--rose);
  text-anchor: middle;
  opacity: 0.85;
}

.fig-label-asymptote {
  font-size: 9.5px;
  fill: var(--indigo);
  text-anchor: middle;
  opacity: 0.9;
}

/* ── quaternary spheroid (canvas island) ───────────────────────────────── */
.quaternary-spheroid {
  position: absolute;
  right: 7.2vw;
  bottom: 3.4vh;
  width: 268px;
  height: 268px;
  opacity: 1;
  cursor: crosshair;
  touch-action: none;
  will-change: transform;
  filter: saturate(1.12);
  transform: rotate(-8deg);
  animation: spheroid-enter 1.15s 0.55s both;
}

.quaternary-spheroid canvas {
  width: 100%;
  height: 100%;
}

/*
 * The sigil is anchored to the hero, not to the molecule. The molecule drifts
 * and tumbles beneath it; IV stays fixed and perpendicular to the page.
 */
.spheroid-sigil {
  position: absolute;
  right: 6.4vw;
  bottom: 2.2vh;
  color: var(--cyan);
  font: 600 0.62rem / 1 Arial, sans-serif;
  letter-spacing: 0.18em;
  text-shadow: 0 0 8px #078f9a47;
}

/* ── folio (vertical page marker) ──────────────────────────────────────── */
.folio {
  position: absolute;
  top: 6%;
  right: 2.9vw;
  bottom: 6%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding-left: 1.25rem;
  border-left: 1px solid var(--rule);
  font-size: 0.6rem;
}

.folio > span {
  writing-mode: vertical-rl;
}

.folio i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--saffron);
}

.folio b {
  font-weight: 400;
  line-height: 2.2;
  text-align: center;
}

/* ── the sequence ──────────────────────────────────────────────────────── */
.sequence {
  background: var(--paper-light);
}

.epigraph {
  width: min(790px, 84vw);
  margin: 0 auto;
  padding: clamp(5rem, 10vw, 9rem) 0 clamp(1rem, 3vw, 3rem);
  color: #362f28;
}

.epigraph h2 {
  margin: 0 0 clamp(2.5rem, 5vw, 4.5rem);
  color: var(--ink);
  font-size: clamp(2.8rem, 6vw, 5.8rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.045em;
}

.epigraph blockquote {
  margin: 0;
}

.epigraph blockquote p {
  margin: 0 0 1.5em;
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  font-style: italic;
  line-height: 1.6;
}

.epigraph figcaption {
  margin-top: 2rem;
  color: var(--saffron);
  font: 600 0.64rem / 1.4 Arial, Helvetica, sans-serif;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.movement {
  width: min(1040px, 84vw);
  margin: 0 auto;
  padding: clamp(5rem, 10vw, 9rem) 0 0;
}

.movement p {
  width: min(790px, 100%);
  margin: 0 auto;
  font-size: clamp(1.3rem, 2.1vw, 1.95rem);
  line-height: 1.75;
  text-wrap: pretty;
}

.movement p::first-line {
  color: #362f28;
}

.prose-paragraph {
  display: block;
}

.prose-paragraph + .prose-paragraph {
  margin-top: 1.45em;
}

.first-movement > .prose-paragraph:first-child::first-letter {
  float: left;
  padding: 0.12em 0.11em 0 0;
  color: var(--saffron);
  font-size: 5.7em;
  line-height: 0.67;
}

.paragraph-break {
  display: block;
  height: 1.5em;
}

.question,
.answer {
  display: block;
}

.question {
  color: var(--muted);
  font-style: italic;
}

.answer {
  margin-top: 0.2em;
  color: var(--rose);
  font-size: 1.15em;
}

.inline-quotation {
  color: #4f473d;
  font-style: italic;
}

.movement-index {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.2rem;
  color: var(--muted);
  font-size: 0.62rem;
}

.movement-index i {
  width: 74px;
  height: 1px;
  background: var(--rule);
}

.section-break {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: clamp(4rem, 8vw, 7rem) 0 0;
  color: var(--saffron);
}

.section-break i {
  display: block;
  width: min(170px, 23vw);
  height: 1px;
  background: var(--rule);
}

.section-break span {
  font-size: 0.85rem;
}

.movement:last-of-type {
  padding-bottom: clamp(6rem, 12vw, 11rem);
}

/* ── the gate — where the prolegomenon terminates ──────────────────────── */
.gate-section {
  padding: clamp(5rem, 10vw, 8rem) 0 clamp(6rem, 12vw, 10rem);
  border-top: 1px solid var(--rule);
  background: var(--paper);
}

.gate-content {
  width: min(790px, 84vw);
  margin: 0 auto;
}

.gate-eyebrow {
  margin-bottom: 1.2rem;
  color: var(--saffron);
  font-size: clamp(0.58rem, 0.72vw, 0.68rem);
  font-weight: 700;
}

.gate-title {
  margin: 0 0 1.5rem;
  font-size: clamp(2.2rem, 4.5vw, 4rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.gate-description {
  margin: 0 0 clamp(3rem, 6vw, 4.5rem);
  color: #4f473d;
  font-size: clamp(1.15rem, 1.8vw, 1.5rem);
  font-style: italic;
  line-height: 1.65;
}

.form-group {
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.form-group label {
  display: block;
  margin-bottom: 1rem;
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.gate-form textarea,
.gate-form input[type='email'] {
  display: block;
  width: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  background: var(--paper-light);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.05rem;
  line-height: 1.6;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gate-form textarea::placeholder,
.gate-form input[type='email']::placeholder {
  color: var(--muted);
  font-style: italic;
}

.gate-form textarea:focus,
.gate-form input[type='email']:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px #078f9a1a;
}

.accessibility-note,
.privacy-notice {
  margin-top: 0.9rem;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  line-height: 1.65;
}

.accessibility-note a,
.privacy-notice a {
  color: var(--saffron);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gate-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1.15rem 2rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
}

.gate-submit:hover {
  background: var(--saffron);
  border-color: var(--saffron);
  color: var(--paper-light);
}

.gate-submit:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

.gate-error {
  margin-bottom: 2rem;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--rose);
  background: #a83b5b12;
  color: var(--rose);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ── footer ────────────────────────────────────────────────────────────── */
footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: end;
  gap: 2rem;
  min-height: 260px;
  padding: 4rem 6vw;
  background: var(--ink);
  color: var(--paper);
}

footer p {
  margin: 0;
  color: #bfb5a4;
  font-size: 0.58rem;
  text-align: center;
}

footer a {
  color: #dca064;
}

footer .footer-links {
  display: flex;
  gap: 1.5rem;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

footer .footer-return {
  font-size: 0.58rem;
  text-align: right;
}

/* ── motion ────────────────────────────────────────────────────────────── */
@keyframes rise {
  0% {
    opacity: 0;
    transform: translateY(24px);
  }
}

@keyframes draw-in {
  0% {
    opacity: 0;
    transform: scale(0.96);
  }
}

@keyframes spheroid-enter {
  0% {
    opacity: 0;
    transform: translateY(12px) rotate(-8deg) scale(0.92);
  }
}

/* ── responsive ────────────────────────────────────────────────────────── */
@media (width <= 900px) {
  .site-header {
    height: 68px;
  }

  .site-nav a:not(:first-child) {
    display: none;
  }

  .hero {
    display: block;
    min-height: calc(100svh - 68px);
    padding: 13vh 8vw 10vh;
  }

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

  .geometry {
    width: 260px;
    margin: 8vh 0 0 auto;
    opacity: 0.82;
  }

  .quaternary-spheroid {
    right: 7vw;
    bottom: 2.5vh;
    width: 190px;
    height: 190px;
    transform-origin: 100% 100%;
  }

  .folio {
    display: none;
  }

  footer {
    grid-template-columns: 1fr;
    align-items: start;
  }

  footer p,
  footer .footer-return {
    text-align: left;
  }
}

@media (width <= 580px) {
  .wordmark {
    font-size: 1.2rem;
  }

  .site-nav {
    display: none;
  }

  .hero {
    padding: 10vh 7vw 8vh;
  }

  .incipit {
    font-size: clamp(2rem, 10vw, 3.1rem);
  }

  .drop-cap {
    font-size: 3em;
  }

  .enter {
    margin-top: 3rem;
  }

  .geometry {
    width: 220px;
  }

  .quaternary-spheroid {
    position: relative;
    right: auto;
    bottom: auto;
    width: 172px;
    height: 172px;
    margin: -4.5rem 0 1rem auto;
  }

  .movement {
    width: 86vw;
  }

  .movement p {
    font-size: 1.22rem;
    line-height: 1.68;
  }
}

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