/* The homepage's moving parts, loaded only on the homepage (landing.html's head block).
   Andrew, 2026-11-16: the first hero animation was "too visually heavy + complicated, and
   transition too quickly to process"; the light second one then got its detail back (hooks in
   quotes with green arrows, a script typed out by section, a carousel photo swapped from a
   message, the full Schedule, an icon by each title). So:
   - The hero card (_hero_demo.html): four scenes on a 36 s loop, 9 s each, soft fades, the
     site's own palette, thin rules instead of dark blocks.
   - "Research, Draft, Edit, Schedule, Repeat." (landing.html): four tiles; a gold line walks
     from tile to tile on a 16 s loop and each tile's small sketch moves once while it's lit.
   Only opacity and transform animate (the typing is a mask sliding off the text in steps). With
   prefers-reduced-motion everything is still: the hero shows the Edit scene and every tile its
   finished sketch. */

/* ------------------------------------------------------------------ the hero card */

.hd {
  container-type: inline-size;
  display: grid;
  grid-template-rows: auto 1fr;
  aspect-ratio: 6 / 5;
  overflow: hidden;
  border-radius: 10px;
  background: var(--card);
  color: var(--espresso);
}
.hd-top, .hd-stage { font: 400 clamp(10px, 3.5cqw, 16px)/1.45 var(--sans); }
.hd-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1em;
  padding: 5cqw 6cqw 3.4cqw;
  border-bottom: 1px solid var(--line);
}
.hd-mark { font: 400 1.6em/1 var(--serif); }
.hd-steps {
  display: flex;
  gap: 1.1em;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hd-steps li { position: relative; padding-bottom: 0.45em; opacity: 0.45; }
.hd-steps li::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
}
.hd-stage { position: relative; }
.hd-scene { position: absolute; inset: 6cqw 6cqw 5cqw; opacity: 0; }
.hd-title {
  display: flex;
  align-items: center;
  gap: 0.4em;
  margin: 0 0 0.9em;
  font: 400 1.5em/1.15 var(--serif);
  letter-spacing: -0.01em;
}
/* A line icon by each title (inline SVG, decorative: the figure is aria-hidden). */
.hd-icon {
  flex: none;
  width: 0.95em;
  height: 0.95em;
  fill: none;
  stroke: var(--gold-ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hd-rows { margin: 0; padding: 0; list-style: none; }
.hd-rows li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1em;
  padding: 0.62em 0;
  border-top: 1px solid var(--line);
}
.hd-rows li:last-child { border-bottom: 1px solid var(--line); }

/* Research: each hook in quotes and italics, with its green arrow and number. */
.hd-hooks q { font-style: italic; color: var(--espresso); quotes: "\201C" "\201D"; }
.hd-hooks b { flex: none; font-weight: 600; color: var(--ok); white-space: nowrap; }
.hd-hooks b i { font-style: normal; }

/* Draft: the script, section by section, each line typed out: a mask (the line's <i>, in the
   card's colour) slides off it in character-sized steps, its gold caret (::before) showing only
   while it types. */
.hd-script { display: grid; gap: 0.8em; }
.hd-sec {
  display: grid;
  grid-template-columns: 4.6em 1fr;
  align-items: baseline;
  gap: 0.6em;
  margin: 0;
  padding-bottom: 0.8em;
  border-bottom: 1px solid var(--line);
}
.hd-sec b {
  font-size: 0.68em;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-ink);
}
.hd-type { position: relative; width: fit-content; overflow: hidden; white-space: nowrap; }
.hd-sec:first-child .hd-type { font-weight: 600; }
.hd-type i {
  position: absolute;
  inset: 0 -2px 0 0;
  background: var(--card);
  transform: translateX(101%);
}
.hd-type i::before {
  content: "";
  position: absolute;
  inset: 0.1em auto 0.1em 0;
  width: 2px;
  background: var(--gold);
  opacity: 0;
}

/* Edit: a carousel slide whose photo changes when the creator asks for it. */
.hd-edit { display: grid; grid-template-columns: 1.15fr 1fr; gap: 1.1em; align-items: start; }
.hd-slide {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}
.hd-old, .hd-new { position: absolute; inset: 0; }
/* The photo before: a plate on a warm table. */
.hd-old { background: linear-gradient(160deg, var(--butter), var(--sand)); }
.hd-plate {
  position: absolute;
  left: 22%;
  top: 14%;
  width: 56%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold) 0 34%, var(--white) 35% 100%);
  box-shadow: 0 0.4em 0.9em rgb(51 33 28 / 0.18);
}
/* The photo after: a sheet pan from above. */
.hd-new { background: linear-gradient(160deg, var(--powder), var(--sand)); opacity: 0; }
.hd-tray {
  position: absolute;
  inset: 13% 11% 30%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  place-items: center;
  border: 0.35em solid var(--field-line);
  border-radius: 6px;
  background: var(--tint);
}
.hd-tray i { width: 52%; aspect-ratio: 1; border-radius: 50%; background: var(--stop); }
.hd-tray i:nth-child(2), .hd-tray i:nth-child(6) { background: var(--ok); }
.hd-tray i:nth-child(3), .hd-tray i:nth-child(4) { background: var(--gold); }
.hd-caption {
  position: absolute;
  inset: auto 0 0;
  margin: 0;
  padding: 0.5em 0.7em;
  background: rgb(255 253 248 / 0.92);
  font: 400 1.15em/1.1 var(--serif);
}
.hd-caption em { color: var(--gold-ink); }
.hd-count {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  padding: 0.1em 0.5em;
  border-radius: 1em;
  background: rgb(51 33 28 / 0.7);
  color: var(--white);
  font-size: 0.72em;
}
.hd-dots { display: flex; justify-content: center; gap: 0.35em; margin: 0.6em 0 0; }
.hd-dots i { width: 0.4em; height: 0.4em; border-radius: 50%; background: var(--line); }
.hd-dots i:nth-child(2) { background: var(--espresso); }
.hd-chat { display: grid; gap: 0.7em; padding-top: 0.4em; }
.hd-ask, .hd-reply {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0.55em 0.85em;
  font-size: 0.9em;
}
.hd-ask {
  justify-self: end;
  border-radius: 1.1em 1.1em 0.3em;
  background: var(--espresso);
  color: var(--white);
}
.hd-reply {
  border: 1px solid var(--line);
  border-radius: 1.1em 1.1em 1.1em 0.3em;
  background: var(--white);
  color: var(--body);
  opacity: 0;
}

/* Schedule: the reel, its caption and where it goes, each platform in its own format. */
.hd-s4 { font-size: 0.92em; }
.hd-post { display: grid; grid-template-columns: 30% 1fr; gap: 1.1em; align-items: start; }
.hd-thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(170deg, var(--tint), var(--sand) 55%, var(--gold));
}
.hd-thumb-hook {
  position: absolute;
  inset: 0.6em 0.6em auto;
  font: 400 0.92em/1.15 var(--serif);
}
.hd-play {
  position: absolute;
  left: 50%;
  top: 62%;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0.55em 0 0.55em 0.9em;
  border-color: transparent transparent transparent var(--white);
  transform: translate(-40%, -50%);
}
.hd-label {
  margin: 0 0 0.2em;
  font-size: 0.68em;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-ink);
}
.hd-cap { margin: 0 0 0.6em; color: var(--body); }
.hd-cap span { color: var(--denim); }
.hd-where li { padding: 0.45em 0; }
.hd-where span { flex: 1; }
.hd-where small { color: var(--body); font-size: 0.85em; }
/* A drawn tick (the sans has no check glyph): the b fades and scales, its ::before is the mark. */
.hd-where b { position: relative; flex: none; width: 1em; height: 1em; }
.hd-where b::before {
  content: "";
  position: absolute;
  left: 0.2em;
  top: 0.1em;
  width: 0.35em;
  height: 0.65em;
  border: solid var(--ok);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.hd-note { margin: 0.8em 0 0; color: var(--body); font-size: 0.92em; }

/* The loop: 36 s, a 9 s window per scene. Each scene, its step label and the label's line share
   one timeline, offset by a negative delay so scene 1 starts at once and each next one follows
   9 s later (25% of the loop). Everything inside a scene changes only while it's on screen, and
   resets at 26%, after the scene has faded out. */
.hd-scene, .hd-steps li, .hd-steps li::after, .hd-hooks li, .hd-hooks b, .hd-type i,
.hd-type i::before, .hd-ask, .hd-old, .hd-new, .hd-reply, .hd-where b {
  animation-duration: 36s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-fill-mode: both;
}
.hd-scene { animation-name: hd-scene; }
.hd-steps li { animation-name: hd-step; }
.hd-steps li::after { animation-name: hd-bar; }
.hd-hooks li { animation-name: hd-row; }
.hd-hooks b { animation-name: hd-up; }
/* Typing: each step of the mask is a character's width or so. */
.hd-type i { animation-name: hd-type; animation-timing-function: steps(32, end); }
.hd-type i::before { animation-name: hd-caret; }
.hd-ask { animation-name: hd-ask; }
.hd-old { animation-name: hd-old; }
.hd-new { animation-name: hd-new; }
.hd-reply { animation-name: hd-reply; }
.hd-where b { animation-name: hd-check; }

/* Research's rows come in one after another (positive delays: they start with the scene). */
.hd-hooks li:nth-child(2), .hd-hooks li:nth-child(2) b { animation-delay: 0.5s; }
.hd-hooks li:nth-child(3), .hd-hooks li:nth-child(3) b { animation-delay: 1s; }
.hd-hooks li:nth-child(4), .hd-hooks li:nth-child(4) b { animation-delay: 1.5s; }
/* Draft: scene 2 (-27 s); its four lines type one after another, 1.6 s apart. */
.hd-s2, .hd-steps .hd-s2::after, .hd-sec:nth-child(1) .hd-type i,
.hd-sec:nth-child(1) .hd-type i::before { animation-delay: -27s; }
.hd-sec:nth-child(2) .hd-type i, .hd-sec:nth-child(2) .hd-type i::before { animation-delay: -25.4s; }
.hd-sec:nth-child(3) .hd-type i, .hd-sec:nth-child(3) .hd-type i::before { animation-delay: -23.8s; }
.hd-sec:nth-child(4) .hd-type i, .hd-sec:nth-child(4) .hd-type i::before { animation-delay: -22.2s; }
.hd-s3, .hd-steps .hd-s3::after, .hd-s3 .hd-ask, .hd-s3 .hd-old, .hd-s3 .hd-new,
.hd-s3 .hd-reply { animation-delay: -18s; }
.hd-s4, .hd-steps .hd-s4::after, .hd-s4 .hd-where li:nth-child(1) b { animation-delay: -9s; }
.hd-s4 .hd-where li:nth-child(2) b { animation-delay: -8.4s; }
.hd-s4 .hd-where li:nth-child(3) b { animation-delay: -7.8s; }

@keyframes hd-scene {
  0% { opacity: 0; transform: translateY(0.5em); }
  3.5%, 22% { opacity: 1; transform: none; }
  25%, 100% { opacity: 0; transform: translateY(-0.3em); }
}
@keyframes hd-step {
  0%, 25.5%, 100% { opacity: 0.45; }
  3%, 23% { opacity: 1; }
}
@keyframes hd-bar {
  0% { opacity: 1; transform: scaleX(0); }
  22%, 24% { opacity: 1; transform: scaleX(1); }
  25.5% { opacity: 0; transform: scaleX(1); }
  26%, 100% { opacity: 0; transform: scaleX(0); }
}
@keyframes hd-row {
  0%, 2.5%, 26%, 100% { opacity: 0; transform: translateY(0.5em); }
  5%, 25% { opacity: 1; transform: none; }
}
@keyframes hd-up {
  0%, 5%, 26%, 100% { opacity: 0; transform: translateY(0.4em); }
  7.5%, 25% { opacity: 1; transform: none; }
}
@keyframes hd-type {
  0%, 4%, 26%, 100% { transform: none; }
  8%, 25% { transform: translateX(101%); }
}
@keyframes hd-caret {
  0%, 3.9%, 9%, 100% { opacity: 0; }
  4%, 8.5% { opacity: 1; }
}
@keyframes hd-ask {
  0%, 4%, 26%, 100% { opacity: 0; transform: translateY(0.4em); }
  6.5%, 25% { opacity: 1; transform: none; }
}
@keyframes hd-old {
  0%, 10%, 26%, 100% { opacity: 1; }
  12%, 25% { opacity: 0; }
}
@keyframes hd-new {
  0%, 12%, 26%, 100% { opacity: 0; transform: scale(1.04); }
  14.5%, 25% { opacity: 1; transform: none; }
}
@keyframes hd-reply {
  0%, 15%, 26%, 100% { opacity: 0; transform: translateY(0.4em); }
  17.5%, 25% { opacity: 1; transform: none; }
}
@keyframes hd-check {
  0%, 5%, 28%, 100% { opacity: 0; transform: scale(0.6); }
  7.5%, 26% { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ the four tiles */

.loop-grid { display: grid; gap: 1.25rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
@media (min-width: 40rem) { .loop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .loop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.loop-tile h3 {
  margin: 0 0 0.4rem;
  font: 400 1.5rem/1.15 var(--serif);
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--espresso);
}
.loop-tile p { margin: 0; }
.loop-art {
  position: relative;
  aspect-ratio: 4 / 3;
  margin: 0 0 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.loop-art::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
}
.loop-sketch { position: absolute; inset: 18% 14%; }
/* Phones: shorter sketches, so the four tiles don't read as four tall boxes. */
@media (max-width: 39.99rem) { .loop-art { aspect-ratio: 2 / 1; } }

/* Research: three bars, the tallest gold. */
.la-research { display: flex; align-items: flex-end; gap: 9%; }
.la-research i { flex: 1; border-radius: 4px 4px 0 0; background: var(--sand); transform-origin: bottom; }
.la-research i:nth-child(1) { height: 45%; }
.la-research i:nth-child(2) { height: 68%; }
.la-research i:nth-child(3) { height: 100%; background: var(--gold); }
/* Draft: lines of a script, the first one highlighted. */
.la-draft { display: flex; flex-direction: column; justify-content: center; gap: 13%; }
.la-draft i { display: block; height: 8%; border-radius: 3px; background: var(--sand); }
.la-draft i:nth-child(1) { width: 88%; background: var(--butter); transform-origin: left; }
.la-draft i:nth-child(2) { width: 100%; }
.la-draft i:nth-child(3) { width: 72%; }
.la-draft i:nth-child(4) { width: 84%; }
/* Edit: a chat bubble and a slide whose words get shorter. */
.la-edit i { position: absolute; display: block; border-radius: 4px; }
.la-edit .la-bubble { top: 0; right: 0; width: 46%; height: 18%; border-radius: 9px 9px 3px; background: var(--espresso); }
.la-edit .la-slide { left: 0; bottom: 0; width: 64%; height: 66%; border: 1px solid var(--line); background: var(--white); }
.la-edit .la-long, .la-edit .la-short { left: 8%; height: 9%; background: var(--sand); }
.la-edit .la-long { bottom: 38%; width: 52%; }
.la-edit .la-long + .la-long { bottom: 22%; width: 44%; }
.la-edit .la-short { bottom: 28%; width: 30%; height: 16%; background: var(--gold); opacity: 0; }
/* Schedule: a week, one day picked. */
.la-schedule { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7%; align-content: center; }
.la-schedule i { aspect-ratio: 1; border-radius: 3px; background: var(--sand); }
.la-schedule i.la-day { background: var(--gold); transform: scale(0.4); opacity: 0; }

/* 16 s: a 4 s turn per tile, in reading order. */
.loop-art::after, .la-research i, .la-draft i:nth-child(1), .la-edit .la-long, .la-edit .la-short,
.la-schedule i.la-day {
  animation-duration: 16s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-fill-mode: both;
}
.loop-art::after { animation-name: loop-bar; }
.la-research i { animation-name: loop-grow; }
.la-draft i:nth-child(1) { animation-name: loop-wipe; }
.la-edit .la-long { animation-name: loop-out; }
.la-edit .la-short { animation-name: loop-in; }
.la-schedule i.la-day { animation-name: loop-pick; }
.loop-tile:nth-child(2) .loop-art::after, .loop-tile:nth-child(2) .la-draft i:nth-child(1) {
  animation-delay: -12s;
}
.loop-tile:nth-child(3) .loop-art::after, .loop-tile:nth-child(3) .la-edit i { animation-delay: -8s; }
.loop-tile:nth-child(4) .loop-art::after, .loop-tile:nth-child(4) .la-schedule i { animation-delay: -4s; }

@keyframes loop-bar {
  0% { opacity: 1; transform: scaleX(0); }
  22%, 24% { opacity: 1; transform: scaleX(1); }
  25.5% { opacity: 0; transform: scaleX(1); }
  26%, 100% { opacity: 0; transform: scaleX(0); }
}
@keyframes loop-grow {
  0%, 2% { transform: scaleY(0.55); }
  14%, 92% { transform: none; }
  100% { transform: scaleY(0.55); }
}
@keyframes loop-wipe {
  0%, 3% { transform: scaleX(0.15); }
  14%, 92% { transform: none; }
  100% { transform: scaleX(0.15); }
}
@keyframes loop-out {
  0%, 8% { opacity: 1; }
  12%, 92% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes loop-in {
  0%, 10% { opacity: 0; }
  14%, 92% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes loop-pick {
  0%, 6% { opacity: 0; transform: scale(0.4); }
  12%, 92% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: scale(0.4); }
}

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

@media (prefers-reduced-motion: reduce) {
  .hd *, .hd *::before, .hd *::after,
  .loop-art, .loop-art *, .loop-art::after { animation: none !important; }
  .hd-scene { opacity: 0; transform: none; }
  .hd-scene.hd-s3, .hd-steps .hd-s3 { opacity: 1; }
  .hd-steps .hd-s3::after { transform: scaleX(1); }
  .hd-ask, .hd-new { opacity: 1; transform: none; }
  .hd-reply { opacity: 1; transform: none; }
  .hd-old { opacity: 0; }
  .la-edit .la-long { opacity: 0; }
  .la-edit .la-short, .la-schedule i.la-day { opacity: 1; transform: none; }
}
