/* Life Returned — /intro/
   A kinetic manifesto poster: one viewport, about twenty seconds, then choice.
   The whole sequence is CSS. Nothing continues on its own after the end. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin-wdth-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --paper: #f3efe6;
  --ink: #161512;
  --ink-2: #5c574e;
  --orange: #ff4d00;
  --green: #c6ff3d;
  --gutter: clamp(1rem, 5vw, 4.5rem);
  /* The line: in from the top right, one turn, and down to its end. */
  --rx: calc(100% - 14px);
  --lx: 9px;
  --ty: 20svh;
  --ey: 52svh;
  --w: 3px;
}
@media (min-width: 40rem) {
  :root { --rx: 86%; --lx: calc(var(--gutter) / 2); --w: 4px; }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: "Archivo", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 4px; }

/* ---------- Stage ---------- */

.intro {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--ink);
  animation: to-paper 1.2s ease 16.6s both;
}
@keyframes to-paper { to { background: var(--paper); color: var(--ink); } }

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(1rem, 3vh, 2rem);
  padding: var(--gutter);
  padding-top: calc(var(--ty) + 2rem);
  opacity: 0;
  visibility: hidden;
}
@keyframes in { from { opacity: 0; } to { opacity: 1; visibility: visible; } }
@keyframes out { from { opacity: 1; visibility: visible; } to { opacity: 0; visibility: hidden; } }

.big {
  font-weight: 850;
  font-stretch: 72%;
  text-transform: uppercase;
  font-size: clamp(2.4rem, 10vw, 8.5rem);
  line-height: .9;
  letter-spacing: -.01em;
}
.small-line {
  font-size: clamp(1.15rem, 3.4vw, 1.9rem);
  color: rgb(243 239 230 / .75);
}
.clock {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.3rem, 4vw, 2.2rem);
  color: var(--orange);
}
.js .clock { min-height: 1.2em; }
html:not(.js) .clock { display: none; }
.hl { background: var(--orange); color: var(--ink); padding: 0 .08em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* ---------- Timeline (seconds) ----------
   0.6  You opened this link.     2.0  That was your choice.
   4.5  the clock, attention      8.0  Who decides what happens next?
   11.2 the feed runs             14.6 …and stops: You don't have to.
   16.6 paper, the principle      18.6 the line ends; 18.9 the choices      */

.s-opened    { animation: in .8s ease .6s both, out .5s ease 4.2s forwards; }
.s-opened .small-line { animation: in .8s ease 2s both; }
.s-attention { animation: in .6s ease 4.5s both, out .5s ease 7.4s forwards; }
.s-attention .big { animation: in .8s ease 4.9s both; }
.s-next      { animation: in .8s ease 8s both, out .5s ease 10.9s forwards; }
.s-feed      { animation: in .3s linear 11.2s both, out .6s ease 16.2s forwards; padding-top: var(--gutter); }
.s-end       { animation: in 1.4s ease 17s both; justify-content: flex-start; padding-top: calc(var(--ty) + 3rem); }

/* The feed: rows keep coming — until they stop dead. */
.rows {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-weight: 850;
  font-stretch: 68%;
  text-transform: uppercase;
  font-size: clamp(2rem, 9vw, 5rem);
  line-height: .95;
  color: rgb(243 239 230 / .2);
  white-space: nowrap;
}
.rows span { animation: drift-l 3.4s linear 11.2s both, out .01s steps(1, start) 14.6s forwards; }
.rows span:nth-child(even) { animation: drift-r 3.4s linear 11.2s both, out .01s steps(1, start) 14.6s forwards; }
@keyframes drift-l { from { transform: translateX(0); } to { transform: translateX(-45%); } }
@keyframes drift-r { from { transform: translateX(-45%); } to { transform: translateX(0); } }
.feed-1, .feed-2 { position: relative; opacity: 0; }
.feed-1 { animation: in .5s ease 12.2s both, out .01s steps(1, start) 14.6s forwards; }
.feed-2 { position: absolute; left: var(--gutter); right: var(--gutter); animation: in .01s steps(1, start) 14.6s both; }

/* The end: space, the principle, then the choices. */
.principle {
  max-width: 18ch;
  font-weight: 650;
  font-size: clamp(2.1rem, 8.6vw, 4.8rem);
  line-height: 1.02;
  letter-spacing: -.02em;
}
.choices {
  display: grid;
  gap: .6rem;
  max-width: 44rem;
  margin-top: clamp(1.5rem, 6vh, 3.5rem);
  opacity: 0;
  animation: in .8s ease 18.9s both;
}
@media (min-width: 40rem) { .choices { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Three equal choices. None is promoted, none is greyed out. */
.choice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: .9rem 1rem;
  border: 1.5px solid var(--ink);
  font-size: .82rem;
  font-weight: 650;
  letter-spacing: .13em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
}
.choice:hover, .choice:focus-visible { background: var(--ink); color: var(--paper); }
.after {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  max-width: 44rem;
  margin-top: clamp(1.5rem, 5vh, 3rem);
  opacity: 0;
  animation: in 1s ease 19.6s both;
}
.credit { font-size: .82rem; line-height: 1.5; color: var(--ink-2); }
.replay {
  padding: .6rem 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: .25em;
  cursor: pointer;
}

/* ---------- The finite line ---------- */

.line { position: absolute; inset: 0; pointer-events: none; }
.seg { position: absolute; display: block; }
.seg-down, .seg-end {
  width: var(--w);
  background: repeating-linear-gradient(to bottom, var(--orange) 0 14px, transparent 14px 23px);
}
.seg-turn {
  height: var(--w);
  background: repeating-linear-gradient(to left, var(--orange) 0 14px, transparent 14px 23px);
}
.seg-down { left: var(--rx); top: 0; height: var(--ty); clip-path: inset(0 0 100% 0); animation: draw-down .9s ease-in 7.6s forwards; }
.seg-turn { left: var(--lx); right: calc(100% - var(--rx) - var(--w)); top: var(--ty); clip-path: inset(0 0 0 100%); animation: draw-left .9s ease-out 8.5s forwards; }
.seg-end  { left: var(--lx); top: var(--ty); height: calc(var(--ey) - var(--ty)); clip-path: inset(0 0 100% 0); animation: draw-down 1.6s ease-in-out 17s forwards; }
@keyframes draw-down { to { clip-path: inset(0); } }
@keyframes draw-left { to { clip-path: inset(0); } }
.dot {
  position: absolute;
  left: calc(var(--lx) - 7px + var(--w) / 2);
  top: calc(var(--ey) - 7px);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--orange);
  transform: scale(0);
  animation: dot .4s cubic-bezier(.2, .9, .3, 1.4) 18.6s forwards;
}
@keyframes dot { to { transform: scale(1); } }

/* ---------- Skip ---------- */

.skip {
  position: absolute;
  top: .5rem;
  right: .75rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: .4rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgb(243 239 230 / .62);
  animation: out .3s ease 16.4s forwards;
}
.skip:hover, .skip:focus-visible { color: var(--paper); }

/* ---------- The end, reached at once (skip, #end, or reduced motion done) ---------- */

.intro.done, .intro:has(#end:target) { animation: none; background: var(--paper); color: var(--ink); }
.intro.done *, .intro:has(#end:target) * { animation: none !important; }
.intro.done .scene, .intro:has(#end:target) .scene { opacity: 0; visibility: hidden; }
.intro.done .s-end, .intro:has(#end:target) .s-end,
.intro.done .choices, .intro:has(#end:target) .choices,
.intro.done .after, .intro:has(#end:target) .after { opacity: 1; visibility: visible; }
.intro.done .seg, .intro:has(#end:target) .seg { clip-path: inset(0); }
.intro.done .dot, .intro:has(#end:target) .dot { transform: none; }
.intro.done .skip, .intro:has(#end:target) .skip { visibility: hidden; }

/* The share lip arrives with the choices; it never interrupts the sequence. */
body .lip { top: auto; bottom: 10svh; }
@media (max-width: 40rem) { .after { padding-right: 2.75rem; } }
.lip { opacity: 0; visibility: hidden; animation: in .8s ease 18.9s both; }
body:has(.intro.done) .lip, body:has(#end:target) .lip { animation: none; opacity: 1; visibility: visible; }
body:has(#good:target) .lip { display: none; }

/* ---------- Reduced motion: the same sequence, as cuts ---------- */

@media (prefers-reduced-motion: reduce) {
  .intro *, .intro, .lip {
    animation-duration: .01s !important;
    animation-timing-function: steps(1, start) !important;
  }
  .rows span, .rows span:nth-child(even) { animation-name: in, out !important; }
}

/* ---------- Return to life ---------- */

.returned { display: none; }
body:has(#good:target) > :not(.returned) { display: none; }
#good:target {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .4rem;
  padding: var(--gutter);
  background: var(--paper);
  color: var(--ink);
  outline: none;
}
.good { margin: 0 0 clamp(1.5rem, 5vh, 3rem); font-weight: 850; font-stretch: 72%; text-transform: uppercase; font-size: clamp(4rem, 22vw, 14rem); line-height: .85; }
.returned p { font-size: clamp(1.4rem, 4vw, 2.4rem); line-height: 1.15; }
.returned .returned-strong { margin-top: clamp(1.5rem, 5vh, 3rem); font-weight: 650; }
.returned .returned-last { margin-top: clamp(3rem, 12vh, 7rem); font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
#good:target > * { animation: in 1.4s ease both; }
#good:target > :nth-child(2) { animation-delay: .8s; }
#good:target > :nth-child(3) { animation-delay: 1.6s; }
#good:target > :nth-child(4) { animation-delay: 2.6s; }
#good:target > .returned-last { animation-delay: 5s; }
@media (prefers-reduced-motion: reduce) { #good:target > * { animation: none !important; } }

/* Short screens (small phones, phones on their side): a compact final state.
   If it still does not fit, the final scene scrolls on its own. */
.s-end { overflow-y: auto; padding-bottom: var(--gutter); }
@media (max-height: 42rem) {
  :root { --ty: 12svh; }
  .s-end { padding-top: calc(var(--ty) + 1.25rem); gap: .75rem; }
  .principle { font-size: min(8.6vw, 7.5svh, 4.8rem); }
  .choices { margin-top: 1rem; }
  .choice { min-height: 2.9rem; padding-block: .6rem; }
  .after { margin-top: 1rem; }
}
