/* ManaTech. Typographic poster over a living field.
   Engine is untouched; this file themes tokens and writes the page's own markup styles. */

:root {
  --sc-canvas:      #09090B;
  --sc-surface:     #121114;
  --sc-ink:         #FAFAF9;
  --sc-ink-soft:    #A8A29E;   /* stone, warm-tinted, never flat grey */
  --sc-accent:      #F59E0B;
  --sc-accent-ink:  #09090B;

  --sc-font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sc-font-text:    "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* poster scale, this grammar's one licence to exceed the 6rem display cap */
  --poster-hero: clamp(4rem, 12vw, 11rem);
  --poster-md:   clamp(2.8rem, 8vw, 7rem);
}

html { scroll-behavior: auto; }
body {
  background: var(--sc-canvas);
  color: var(--sc-ink);
  font-family: var(--sc-font-text);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

/* ---- ground ------------------------------------------------------------ */

.field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
main { position: relative; z-index: 1; }

/* the field must show through every stage */
.stage, [data-sc-stage] { background: transparent; }

/* ---- fixed chrome ------------------------------------------------------ */

.skip {
  position: absolute; left: var(--sc-gutter); top: -3rem;
  z-index: 50; padding: 0.5rem 0.75rem;
  background: var(--sc-accent); color: var(--sc-accent-ink);
  border-radius: var(--sc-r-sm); font-weight: 500;
}
.skip:focus { top: 1rem; }

.chrome-cta {
  position: fixed;
  top: clamp(1.1rem, 2.6vw, 1.9rem);
  right: var(--sc-gutter);
  z-index: 40;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--sc-hairline-strong);
  border-radius: var(--sc-r-pill);
  background: var(--sc-canvas);          /* occludes copy scrolling under it, same family as the readout */
  font-size: var(--sc-t-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--sc-accent);
  text-decoration: none;
  transition: border-color 140ms var(--sc-ease-out), translate 140ms var(--sc-ease-out);
}
.chrome-cta:hover { border-color: color-mix(in oklab, var(--sc-accent) 55%, transparent); }
.chrome-cta:active { translate: 0 1px; }

.readout {
  position: fixed;
  left: 50%;
  bottom: clamp(1rem, 2.4vw, 1.75rem);
  translate: -50% 0;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.9rem 0.5rem 0.8rem;
  border: 1px solid var(--sc-hairline-strong);
  border-radius: var(--sc-r-pill);
  background: var(--sc-canvas);
  font-size: var(--sc-t-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sc-ink-soft);
  pointer-events: none;
}
.readout__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--sc-accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--sc-accent) 18%, transparent);
}
.readout__word { min-width: 4.5ch; }

/* ---- type -------------------------------------------------------------- */

.poster {
  font-family: var(--sc-font-display);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.035em;
  text-wrap: balance;
  margin: 0;
}
.poster--hero   { font-size: var(--poster-hero); max-width: 7ch; } /* ch of its OWN face, never the container's */
.poster--md     { font-size: var(--poster-md); line-height: 0.96; }
.poster--lg     { font-size: var(--sc-t-3xl); line-height: 0.98; letter-spacing: -0.03em; }
.poster--italic { font-style: italic; }

.clarity { font-style: italic; color: var(--sc-accent); }

/* ---- act 1: hero ------------------------------------------------------- */

/* the stage stays position:sticky (engine); it is already a containing block for absolute children */

.wordmark {
  position: absolute;
  top: clamp(1.1rem, 2.6vw, 1.9rem);
  left: var(--sc-gutter);
  width: clamp(150px, 17vw, 250px);
  height: auto;
  opacity: 0.92;
}

.hero__type {
  position: absolute;
  left: var(--sc-gutter);
  right: var(--sc-gutter);
  bottom: clamp(5.5rem, 13vh, 9rem);
  transform-origin: left bottom;
  transform: scale(calc(1 - var(--sc-p, 0) * 0.06));
}
.hero__type .poster--italic {
  font-size: calc(var(--poster-hero) * 0.72);
  max-width: none;
  margin-top: 0.08em;
  margin-left: clamp(0rem, 8vw, 9rem);
  color: var(--sc-ink);
}
.hero__sub {
  margin: clamp(1.25rem, 3vh, 2rem) 0 0 clamp(0rem, 8vw, 9rem);
  max-width: 34ch;
  font-size: var(--sc-t-base);
  line-height: var(--sc-leading-body);
  color: var(--sc-ink-soft);
  text-wrap: pretty;
}

/* ---- act 2: pains ------------------------------------------------------ */

.act--pains { padding-block: clamp(3rem, 8vh, 6rem) var(--sc-section); }
.pains { display: flex; flex-direction: column; gap: clamp(2.5rem, 7vh, 5.5rem); }
.pain {
  font-family: var(--sc-font-display);
  font-size: var(--sc-t-2xl);
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 24ch;
  margin: 0;
  text-wrap: balance;
}
.pain--trail { margin-left: auto; text-align: right; }

/* ---- act 3: the turn --------------------------------------------------- */

.turn {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 var(--sc-gutter);
  text-align: center;
}
.turn__line { grid-area: 1 / 1; }
.turn__line.poster, .turn__reveal .poster { max-width: 14ch; } /* measure on the display face, never on a wrapper */
.turn__reveal { padding: 0.5em 1.4em; }                          /* room so the engine's 78% iris clears the corners */

/* ---- act 4: what we build ---------------------------------------------- */

.act--build { padding-block: var(--sc-section); }
.build__h {
  font-family: var(--sc-font-text);
  font-size: var(--sc-t-sm);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sc-ink-soft);
  margin: 0 0 clamp(2.5rem, 6vh, 4.5rem);
}
.build__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: clamp(2rem, 6vw, 7rem);
  row-gap: clamp(3rem, 8vh, 6rem);
}
.cap { padding: 0.15em 0; }
.cap--offset { margin-top: clamp(2.5rem, 9vh, 7rem); }
.cap__name {
  font-family: var(--sc-font-display);
  font-weight: 400;
  font-size: var(--sc-t-xl);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 var(--sc-4);
}
.cap__body {
  margin: 0;
  max-width: 38ch;
  font-size: var(--sc-t-base);
  line-height: var(--sc-leading-body);
  color: var(--sc-ink-soft);
  text-wrap: pretty;
}

/* ---- act 5: method ----------------------------------------------------- */

.method {
  position: absolute;
  left: var(--sc-gutter);
  right: var(--sc-gutter);
  bottom: clamp(4rem, 12vh, 9rem);
  display: grid;
}
.step { grid-area: 1 / 1; max-width: 40ch; }
.step .poster {
  transform-origin: left bottom;
  transform: scale(calc(0.96 + var(--sc-p, 0) * 0.06));
}
.step__body {
  margin: var(--sc-5) 0 0;
  max-width: 40ch;
  font-size: var(--sc-t-base);
  line-height: var(--sc-leading-body);
  color: var(--sc-ink-soft);
  text-wrap: pretty;
}

/* ---- act 6: close ------------------------------------------------------ */

.act--close {
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding-block: var(--sc-section) clamp(5rem, 12vh, 8rem);
}
.close { max-width: 46rem; }
.close__h {
  font-family: var(--sc-font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--sc-t-xl);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 var(--sc-5);
}
.close__body {
  margin: 0;
  max-width: 44ch;
  font-size: var(--sc-t-sm);
  line-height: var(--sc-leading-body);
  color: var(--sc-ink-soft);
  text-wrap: pretty;
}
.close__cta-row { margin: var(--sc-6) 0 0; }
.close__cta {
  font-size: var(--sc-t-base);
  font-weight: 500;
  color: var(--sc-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.32em;
  text-decoration-color: color-mix(in oklab, var(--sc-accent) 55%, transparent);
  transition: text-decoration-color 140ms var(--sc-ease-out);
}
.close__cta:hover { text-decoration-color: var(--sc-accent); }

.colophon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  margin-top: clamp(4rem, 10vh, 7rem);
  padding-top: var(--sc-5);
  border-top: 1px solid var(--sc-hairline);
  font-size: var(--sc-t-xs);
  letter-spacing: 0.02em;
  color: var(--sc-ink-soft);
}
.colophon a { color: inherit; text-decoration: none; }
.colophon a:hover { color: var(--sc-ink); }
.colophon__copy { margin-left: auto; }

/* ---- focus, states ------------------------------------------------------ */

a:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ---- phones ------------------------------------------------------------ */

@media (max-width: 700px) {
  :root {
    --poster-hero: clamp(2.8rem, 14vw, 5.2rem);
    --poster-md:   clamp(2.2rem, 10vw, 3.6rem);
  }
  .chrome-cta { font-size: var(--sc-t-xs); padding: 0.42rem 0.75rem; }
  .wordmark { width: clamp(120px, 34vw, 160px); }
  .hero__type { max-width: none; bottom: clamp(5rem, 12vh, 7rem); }
  .hero__type .poster--italic, .hero__sub { margin-left: 0; }
  .hero__sub { max-width: 30ch; font-size: var(--sc-t-sm); }
  .pain { max-width: none; font-size: var(--sc-t-xl); }
  .pain--trail { text-align: left; margin-left: 0; }
  .turn__line { max-width: 11ch; }
  .build__grid { grid-template-columns: minmax(0, 1fr); }
  .cap--offset { margin-top: 0; }
  .step { max-width: none; }
  .readout { font-size: 0.68rem; padding: 0.42rem 0.75rem 0.42rem 0.65rem; }
  .act--close { align-items: flex-start; padding-top: clamp(3rem, 8vh, 5rem); }
  .colophon__copy { margin-left: 0; flex-basis: 100%; }
}

/* ---- reduced motion ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .hero__type, .step .poster { transform: none; }
  .chrome-cta, .close__cta, .readout { transition: none; }
}

/* ---- hero index (production): the reference's small clickable list, trail-anchored ---- */
.hero__index {
  position: absolute;
  right: var(--sc-gutter);
  bottom: clamp(5.5rem, 13vh, 9rem);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
  font-size: var(--sc-t-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.hero__index a {
  color: var(--sc-ink-soft);
  text-decoration: none;
  transition: color 140ms var(--sc-ease-out);
}
.hero__index a:hover { color: var(--sc-ink); }
@media (max-width: 700px) {
  .hero__index { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.1rem; margin: 1.4rem 0 0; font-size: var(--sc-t-xs); }
  .hero__type { bottom: clamp(4rem, 10vh, 6rem); }
}
