/* Anupam Mukerji — Narratives
   Ink · paper · sindoor. Mobile-first. Words are the design.
   Grounds: blog night → ashram lamplight → machine parchment → dusk (one beat of night) → business daylight. */

:root {
  --ink: #191310;
  --paper: #f2e8d5;
  --paper-dim: #cfc2a8;
  --vermillion: #d4491a;
  --measure: 22ch;

  --blog-bg: #131015;
  --blog-fg: #ece4d6;
  --ashram-bg: #26130d;
  --ashram-fg: #f4e7cf;
  --machine-bg: #ece0c8;
  --machine-fg: #1c1410;
  --dusk-bg: #150e0a;
  --dusk-fg: #f0e6d2;
  --business-bg: #f7f0df;
  --business-fg: #191310;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 380;
  background: var(--blog-bg);
  color: var(--blog-fg);
  transition: background-color 1.4s ease, color 1.4s ease;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* The ground moves when the story moves */
body[data-act="blog"]     { background: var(--blog-bg);     color: var(--blog-fg); }
body[data-act="ashram"]   { background: var(--ashram-bg);   color: var(--ashram-fg); }
body[data-act="machine"]  { background: var(--machine-bg);  color: var(--machine-fg); }
body[data-act="dusk"]     { background: var(--dusk-bg);     color: var(--dusk-fg); }
body[data-act="business"] { background: var(--business-bg); color: var(--business-fg); }

/* Paper grain — makes ink and paper tactile */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Lamp glow — a warm light the reader carries; brightest in the ashram */
.glow {
  position: fixed;
  inset: -30% -20%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse 60% 45% at 50% 38%,
    rgba(212, 73, 26, 0.16), transparent 70%);
  transition: opacity 1.4s ease;
  opacity: 0.7;
}

body[data-act="ashram"] .glow,
body[data-act="dusk"] .glow { opacity: 1; }

body[data-act="machine"] .glow,
body[data-act="business"] .glow { opacity: 0.35; }

/* Progress — a thin sindoor line across the top; the reader always knows where they are */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 30;
  display: none;
}

.js .progress { display: block; }

.progress span {
  display: block;
  height: 100%;
  background: var(--vermillion);
  transform: scaleX(0);
  transform-origin: left;
}

/* The path — a sindoor line that winds down the page, drawn as the reader walks */
main { position: relative; }

.path {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  display: none;
}

.js .path { display: block; }

.path path {
  stroke: var(--vermillion);
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.35;
}

/* Stops */
.stop {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.75rem;
  position: relative;
}

.inner {
  max-width: var(--measure);
  position: relative;
  z-index: 1;
}

.stop p {
  font-size: clamp(1.45rem, 6vw, 2.4rem);
  line-height: 1.42;
  letter-spacing: -0.01em;
}

.stop p + p { margin-top: 1.6em; }

.beat {
  font-weight: 560;
}

/* Duo stops — setup holds the screen while the payoff waits below the fold.
   The section is taller than the viewport; the words pin; continued scroll lands the payoff. */
.js .duo {
  display: block;
  padding: 0;
  min-height: 195svh;
}

.js .duo .sticky {
  position: sticky;
  top: 0;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.75rem;
}

/* Breathe — the ashram scenes get slower scroll and more air */
.breathe { min-height: 120svh; }

.js .duo.breathe { min-height: 210svh; }

.breathe .inner p + p { margin-top: 2.3em; }

/* Typographic registers — each screen speaks in a different voice.
   One font (Fraunces), stretched across its optical range:
   whisper → body → thesis → litany → shout → vast. */

.inner.wide,
.inner:has(.step) {
  max-width: min(40rem, 100%);
}

.stop .whisper {
  font-size: clamp(1.1rem, 4.4vw, 1.35rem);
  font-weight: 350;
  opacity: 0.72;
}

/* Shout — full display voice, the confession moment */
.stop .shout {
  font-size: clamp(2.7rem, 12vw, 5.4rem);
  line-height: 1.02;
  font-weight: 640;
  letter-spacing: -0.03em;
}

/* Thesis — the big quiet truths, light weight at large size */
.stop .thesis {
  font-size: clamp(1.85rem, 7.8vw, 3.1rem);
  line-height: 1.2;
  font-weight: 310;
  letter-spacing: -0.015em;
}

/* Litany — stacked words, alternating roman-light / italic-bold */
.stop .litany {
  font-size: clamp(2.2rem, 10vw, 4rem);
  line-height: 1.14;
  font-weight: 300;
}

.litany em { font-weight: 620; }

/* Step names — the machine act reads as chapters of one system */
.stop .step {
  font-size: clamp(2.1rem, 9vw, 3.5rem);
  line-height: 1.05;
  font-weight: 560;
  letter-spacing: -0.02em;
  margin-bottom: 0.9em;
}

.step .num {
  display: block;
  font-size: clamp(0.8rem, 3.2vw, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.34em;
  color: var(--vermillion);
  margin-bottom: 1.2em;
}

/* Slogan — the promise, set like a poster */
.stop .slogan {
  font-size: clamp(2.4rem, 10.5vw, 4.4rem);
  line-height: 1.05;
  font-weight: 640;
  letter-spacing: -0.025em;
}

/* Ask — the closing line leans forward without shouting */
.stop .ask {
  font-size: clamp(1.7rem, 7vw, 2.7rem);
  line-height: 1.18;
}

/* Hot — a word the sindoor touches */
.hot {
  font-style: italic;
  color: var(--vermillion);
}

/* Big voices sit closer to the line before them (em scales with their size) */
.stop p + .shout,
.stop p + .thesis,
.stop p + .litany,
.stop p + .slogan,
.stop p + .ask {
  margin-top: 0.7em;
}

/* The machine — a glyph that assembles as belief does */
.glyph {
  width: 58px;
  height: 58px;
  margin-bottom: 1.8rem;
  color: var(--vermillion);
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  overflow: visible;
}

.glyph-small { width: 50px; height: 50px; }

.js .glyph [data-draw] {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 1.6s ease 0.4s;
}

.js .reveal.in .glyph [data-draw] { stroke-dashoffset: 0; }

.js .glyph .fade {
  opacity: 0;
  transition: opacity 1.1s ease 1.2s;
}

.js .reveal.in .glyph .fade { opacity: 1; }

/* Hero cue — a sindoor thread that draws itself downward, over the word "scroll".
   JS shows it after the confession lands; it leaves on the first scroll. */
.hero .cue {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  color: var(--vermillion);
  transition: opacity 0.9s ease;
}

.js .hero .cue { opacity: 0; }

.js .hero .cue.show { opacity: 1; }

.cue-thread {
  width: 2px;
  height: 3rem;
  overflow: hidden;
  position: relative;
}

.cue-thread::before {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  animation: thread 2.2s cubic-bezier(0.7, 0, 0.3, 1) infinite;
}

@keyframes thread {
  0%   { transform: translateY(-100%); }
  55%  { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

.cue-word {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

/* Reveals — only hidden once JS arrives; no-JS and crawlers see everything.
   One entrance for the whole page: a clean fade-up. */
.js .reveal p {
  opacity: 0;
  transform: translateY(1.1rem);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.js .reveal.in p { opacity: 1; transform: none; }

.js .reveal.in p:nth-child(2) { transition-delay: 0.35s; }
.js .reveal.in p:nth-child(3) { transition-delay: 0.7s; }
.js .reveal.in p:nth-child(4) { transition-delay: 1.05s; }
.js .reveal.in p:nth-child(5) { transition-delay: 1.4s; }

/* Payoffs wait for the scroll, not the clock */
.js .reveal.in p.payoff,
.js .reveal.in p.payoff-2 {
  opacity: 0;
  transform: translateY(1.1rem);
  transition-delay: 0s;
}

.js .reveal.in.stage-1 p.payoff,
.js .reveal.in.stage-2 p.payoff-2 {
  opacity: 1;
  transform: none;
}

/* Hero payoffs auto-play on the clock — JS adds the stage classes on timers.
   The confession gets a longer, heavier fade. */
.js .hero .reveal.in p.payoff-2 { transition-duration: 1.4s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal p,
  .js .reveal.in p.payoff,
  .js .reveal.in p.payoff-2 { opacity: 1; transform: none; transition: none; }
  .js .duo, .js .duo.breathe { min-height: 100svh; }
  .cue-thread::before { animation: none; transform: none; }
  .js .glyph [data-draw] { stroke-dashoffset: 0; transition: none; }
  .js .glyph .fade { opacity: 1; transition: none; }
}

/* Forms — bare, bottom-ruled */
form {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  max-width: 20rem;
}

.field input {
  width: 100%;
  font-family: inherit;
  font-size: 1.05rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid currentColor;
  color: inherit;
  padding: 0.6rem 0.1rem;
  border-radius: 0;
}

.field input::placeholder { color: inherit; opacity: 0.45; }

.field input:focus {
  outline: none;
  border-bottom-color: var(--vermillion);
}

button {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 560;
  align-self: flex-start;
  background: var(--vermillion);
  color: var(--paper);
  border: none;
  padding: 0.85rem 2.4rem;
  cursor: pointer;
}

button:hover { background: #b93c12; }

.field-error {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--vermillion);
}

.form-note p { font-size: 1.05rem; opacity: 0.8; }

.book-call {
  display: inline-block;
  margin-top: 1.2rem;
  font-size: 1.05rem;
  font-weight: 560;
  color: var(--vermillion);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 0.1rem;
}

/* Footer — the ink bookend */
footer {
  background: var(--ink);
  color: var(--paper);
  padding: 5rem 1.75rem 4rem;
}

footer .inner { max-width: 34ch; }

footer .bio {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--paper-dim);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Desktop expansion */
@media (min-width: 720px) {
  :root { --measure: 30ch; }
  .stop p { font-size: clamp(1.6rem, 2.4vw, 2.2rem); }
  .stop p + p { margin-top: 1.4em; }
  footer { padding: 6rem 3rem 5rem; }
  footer .inner { margin-inline: auto; }
}
