/* The landing page. Layout follows the editorial grid in base.css: a rubric column, then the story. */

/* ---- hero ------------------------------------------------------------------------------------ */

.hero {
  padding-top: clamp(2rem, 1rem + 3.5vw, 4.5rem);
  padding-bottom: var(--section);
}

.hero + .section {
  border-top: var(--border);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  column-gap: clamp(2rem, 6vw, 7rem);
  align-items: start;
}

.hero h1 {
  max-width: 11.5ch;
}

.hero__lede {
  margin-top: var(--space-5);
}

.hero__form {
  margin-top: var(--space-6);
  max-width: 34rem;
}

.hero__fine {
  margin-top: var(--space-4);
  max-width: 32rem;
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.hero__demo {
  justify-self: end;
  width: min(100%, 360px);
  margin: 0;
}

.hero__demo-head,
.hero__demo-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.hero__demo-head {
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-3);
  border-bottom: 2px solid var(--ink);
  font-weight: 650;
}

.hero__demo-foot {
  min-height: var(--tap);
  margin-top: var(--space-2);
  color: var(--ink-2);
}

@media (max-width: 900px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero__demo {
    justify-self: start;
    width: min(78%, 300px);
    margin-top: var(--space-8);
  }
}

/* ---- the clip (shared by the hero demo and the anatomy figure) ------------------------------- */

.clip {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: var(--radius-3);
  background: #0c0c0b;
  color: #fff;
  container-type: inline-size;
  isolation: isolate;
}

.clip .scene {
  width: 100%;
  height: 100%;
}

/* The renderer's backdrop: the same footage, zoomed to fill, darkened and desaturated. */
.clip__backdrop {
  position: absolute;
  inset: -4%;
  filter: blur(5px) brightness(0.48) saturate(0.45) contrast(0.8);
}

.clip__picture {
  position: absolute;
  left: 0;
  right: 0;
  top: 34.17%;
  height: 31.67%;
  overflow: hidden;
}

/* Speaker focus: 1.35x, framed on whoever is talking (render.py centres the speaker, clamped to the
   picture, which for a two-shot means pinning the zoom to their side). No transition: it is a cut. */
.clip__cam {
  width: 100%;
  height: 100%;
  transform: scale(1.35);
  transform-origin: 0% 55%;
}

.clip--focus-b .clip__cam {
  transform-origin: 100% 55%;
}

.clip__progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: max(3px, 0.93cqw);
}

.clip__bar {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.clip__bar--early {
  width: 14%;
}

.clip__bar--mid {
  width: 58%;
}

.clip__hook {
  position: absolute;
  top: 18.54%;
  left: 13%;
  right: 13%;
  text-align: center;
  font-size: 6.2cqw;
  font-weight: 800;
  font-stretch: 90%;
  line-height: 1.3;
  text-transform: uppercase;
  transition: opacity var(--dur-3) linear;
}

.clip__hook span {
  background: var(--accent);
  color: #111;
  padding: 0.16em 0.3em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.clip__hook[data-hidden="true"] {
  opacity: 0;
}

.clip__credit {
  position: absolute;
  top: 67.6%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  text-align: center;
  font-size: 3.7cqw;
  font-weight: 700;
  font-stretch: 100%;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 0 0.3cqw #000, 0 0 0.3cqw #000;
}

.clip__caption {
  position: absolute;
  top: 74.7%;
  left: 4%;
  right: 4%;
  transform: translateY(-50%);
  font-size: 7.6cqw;
}

/* A reaction GIF slot, drawn as a placeholder: the real ones are chosen per clip. */
.clip__meme {
  position: absolute;
  top: 43.5%;
  right: 2.8%;
  width: 27.8%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: repeating-linear-gradient(135deg, #2a2a27 0 5px, #34342f 5px 10px);
  color: #e6e6dd;
  font-family: var(--font-mono);
  font-size: 3.1cqw;
  line-height: 1.2;
  text-align: center;
}

/* Caption type: the renderer's style. Uppercase, heavy, white with a black outline, current word yellow. */
.caption-type {
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-stretch: 88%;
  line-height: 1.12;
  text-transform: uppercase;
  color: #fff;
  -webkit-text-stroke: 0.14em #000;
  paint-order: stroke fill;
  text-shadow: 0 0.04em 0 rgba(0, 0, 0, 0.55);
}

.caption-type span {
  display: inline-block;
}

/* The renderer grows the current word to 112%; the margin keeps it off its neighbours. */
.caption-type .is-active {
  color: var(--accent);
  transform: scale(1.12);
  margin-inline: 0.22em;
}

.caption-type:lang(hi) {
  font-family: var(--font-deva);
  text-transform: none;
  line-height: 1.35;
}

/* ---- the source strip ------------------------------------------------------------------------ */

.source {
  margin-top: clamp(3rem, 2rem + 4vw, 5.5rem);
  padding-top: var(--space-4);
  border-top: 2px solid var(--ink);
}

.source__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
}

.source__file {
  font-size: var(--text-md);
}

.source__label {
  font-weight: 700;
  margin-right: var(--space-2);
}

.source__facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: 0;
}

.source__facts div {
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
}

.source__facts dt {
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.source__facts dd {
  margin: 0;
}

.source__facts strong {
  background: var(--accent);
  padding: 0.1em 0.3em;
  font-weight: 500;
}

.source__scale {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  color: var(--ink-3);
}

.source__track {
  position: relative;
  height: 72px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-2);
  background: var(--surface);
}

.source__wave {
  width: 100%;
  height: 100%;
}

.source__seg {
  fill: var(--accent);
}

.source__bars rect {
  fill: var(--ink);
  opacity: 0.78;
}

.source__pin {
  position: absolute;
  top: -13px;
  left: calc((var(--x, 0) + var(--w, 0) / 2) * 1%);
  transform: translateX(-50%);
  display: none;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 21px;
  text-align: center;
}

.source__pin[data-placed] {
  display: block;
}

/* The wedge that opens clip 1's sliver of the timeline into its sentences. */
.zoom {
  height: 56px;
  background: var(--accent-wash);
  clip-path: polygon(var(--x1, 0%) 0, var(--x2, 100%) 0, 100% 100%, 0 100%);
  visibility: hidden;
}

.zoom[data-placed] {
  visibility: visible;
}

.sentences {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding-top: var(--space-6);
}

.sentence {
  flex: 1 1 0;
  min-width: 0;
  padding: var(--space-3) var(--space-3) var(--space-4);
  border-top: 2px solid var(--ink);
  background: var(--surface);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.sentence + .sentence {
  border-left: 1px solid var(--rule);
}

.sentence.is-out {
  flex-grow: 0.75;
  background: transparent;
  border-top-color: var(--rule-strong);
  color: var(--ink-3);
}

.sentence__meta {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  color: var(--ink-3);
}

.sentence .w {
  transition: background-color var(--dur-1) linear, color var(--dur-1) linear;
}

.sentences[data-playing] .sentence.is-in .w {
  color: var(--ink-3);
}

.sentences[data-playing] .sentence.is-in .w.is-said {
  color: var(--ink);
}

.sentence .w.is-active {
  background: var(--accent);
  color: var(--ink) !important;
  box-shadow: 0 0 0 2px var(--accent);
}

/* Cut marks: where the clip starts and stops. They can only sit between sentences. */
.sentence__cut {
  position: relative;
  flex: none;
  width: 3px;
  margin: calc(-1 * var(--space-5)) var(--space-2) 0;
  background: var(--ink);
}

.sentence__cut span {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translate(-50%, -100%);
  padding: 2px 6px;
  border: 1.5px solid var(--ink);
  background: var(--accent);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}

.source__foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4) var(--space-7);
  align-items: start;
  margin-top: var(--space-5);
}

.sentences__note {
  max-width: 40rem;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.source__clips {
  display: grid;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.source__clips li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

@media (max-width: 900px) {
  .sentences {
    flex-direction: column;
    padding-top: 0;
  }

  .sentence + .sentence {
    border-left: 0;
  }

  .sentence.is-out {
    border-top-width: 1px;
  }

  .sentence__cut {
    width: auto;
    height: 3px;
    margin: var(--space-5) 0 var(--space-3);
  }

  .sentence__cut span {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
  }

  .zoom {
    height: 32px;
  }

  .source__foot {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- how it works ---------------------------------------------------------------------------- */

.steps {
  margin-top: var(--space-7);
  counter-reset: step;
}

.step {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 5fr) minmax(0, 6fr);
  gap: var(--space-2) var(--space-6);
  padding-block: var(--space-5);
  border-top: var(--border);
}

.step:last-child {
  border-bottom: var(--border);
}

.step__n {
  font-size: var(--text-sm);
  color: var(--ink-3);
  padding-top: 0.35em;
}

.step__title {
  font-size: var(--text-xl);
  font-weight: 720;
  font-stretch: var(--stretch-heading);
  line-height: 1.15;
}

.step__body {
  color: var(--ink-2);
  max-width: 34rem;
}

.step__body > * + * {
  margin-top: var(--space-3);
}

.step__detail {
  font-size: var(--text-sm);
  color: var(--ink-3);
}

@media (max-width: 760px) {
  .step {
    grid-template-columns: 2.75rem minmax(0, 1fr);
  }

  .step__body {
    grid-column: 2;
  }
}

/* ---- anatomy --------------------------------------------------------------------------------- */

.anatomy .lede {
  margin-top: var(--space-4);
}

.anatomy__body {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: var(--space-7) clamp(2rem, 5vw, 5rem);
  margin-top: var(--space-7);
  align-items: start;
}

.anatomy__figure {
  margin: 0;
  position: sticky;
  top: calc(var(--header-h) + var(--space-5));
}

.pin {
  position: absolute;
  left: 3%;
  z-index: 2;
  width: 7.5cqw;
  height: 7.5cqw;
  min-width: 22px;
  min-height: 22px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 2px solid #111;
  border-radius: 50%;
  background: var(--accent);
  color: #111;
  font-family: var(--font-mono);
  font-size: max(11px, 3.6cqw);
  font-weight: 500;
  line-height: 1;
}

.pin--bar {
  top: 4.5%;
}

.pin--hook {
  top: 21%;
}

.pin--picture {
  top: 37.5%;
}

.pin--meme {
  top: 49.5%;
  left: auto;
  right: 32.5%;
}

.pin--credit {
  top: 67.6%;
}

.pin--caption {
  top: 79.5%;
}

.legend {
  display: grid;
  gap: 0;
}

.legend li {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: var(--space-4);
  padding-block: var(--space-4);
  border-top: var(--border);
}

.legend li:first-child {
  border-top: 0;
  padding-top: 0;
}

.legend p {
  margin-top: var(--space-1);
  color: var(--ink-2);
  max-width: 36rem;
}

.legend__n {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
}

.legend__plain .legend__n {
  background: transparent;
  border-color: var(--rule-strong);
}

.meta-card {
  margin-top: var(--space-6);
  border: 1px solid var(--ink);
  border-radius: var(--radius-3);
  background: var(--surface);
}

.meta-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--border);
}

.meta-card__fields {
  margin: 0;
}

.meta-card__fields div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-bottom: var(--border);
  font-size: var(--text-sm);
}

.meta-card__fields div:last-child {
  border-bottom: 0;
}

.meta-card__fields dt {
  color: var(--ink-3);
}

.meta-card__fields dd {
  margin: 0;
}

@media (max-width: 760px) {
  .anatomy__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .anatomy__figure {
    position: static;
    width: min(78%, 300px);
  }

  .meta-card__fields div {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1);
  }
}

/* ---- languages ------------------------------------------------------------------------------- */

.lang {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.1fr);
  gap: var(--space-6);
  margin-top: var(--space-7);
  align-items: start;
}

.spec {
  margin: 0;
}

.spec__screen {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  padding: var(--space-4);
  border-radius: var(--radius-3);
  background: var(--night);
  overflow: hidden;
}

.spec__caption {
  font-size: clamp(1.5rem, 1rem + 1.6vw, 2.25rem);
}

.spec figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  margin-top: var(--space-3);
  font-size: var(--text-sm);
}

.lang__text {
  color: var(--ink-2);
}

.lang__text > * + * {
  margin-top: var(--space-4);
}

@media (max-width: 1100px) {
  .lang {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lang__text {
    grid-column: 1 / -1;
    max-width: var(--measure);
  }
}

@media (max-width: 520px) {
  .lang {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- pricing --------------------------------------------------------------------------------- */

.pricing .lede {
  margin-top: var(--space-4);
}

.pricing__free {
  margin-top: var(--space-5);
  max-width: 44rem;
  color: var(--ink-2);
}

.pricing__more {
  margin-top: var(--space-5);
  font-weight: 650;
}

/* ---- API (the one dark band) ----------------------------------------------------------------- */

.api {
  background: var(--night);
  color: var(--night-text);
}

.section.api,
.section.api + .section {
  border-top: 0;
}

.api .rubric {
  border-top-color: var(--accent);
}

.api__story {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-7) clamp(2rem, 4vw, 4rem);
  align-items: start;
}

.api__text > * + * {
  margin-top: var(--space-4);
}

.api__text p {
  color: #d6d6cd;
  max-width: 34rem;
}

.api__text .api__note {
  color: var(--night-muted);
  font-size: var(--text-sm);
}

.api .code {
  border: 1px solid var(--night-rule);
  background: #0b0b0a;
}

.api__flow {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-size: var(--text-xs);
  color: var(--night-muted);
}

.api__flow.mono span {
  padding: 3px 8px;
  border: 1px solid var(--night-rule);
  border-radius: var(--radius-1);
}

.api__flow:not(.mono) {
  font-size: var(--text-sm);
  color: #d6d6cd;
}

@media (max-width: 1000px) {
  .api__story {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .api .code {
    font-size: var(--text-xs);
  }
}

/* ---- FAQ and join ---------------------------------------------------------------------------- */

.faq {
  margin-top: var(--space-6);
  max-width: 52rem;
}

.join .grid {
  row-gap: var(--space-6);
}

.join__copy {
  grid-column: 1 / span 6;
}

.join__copy h2 {
  font-size: var(--text-3xl);
  font-stretch: var(--stretch-display);
  font-weight: 800;
  line-height: var(--leading-tight);
}

.join__copy .lede {
  margin-top: var(--space-5);
}

.join__copy .small {
  margin-top: var(--space-4);
}

.join__form {
  grid-column: 8 / -1;
  padding: var(--space-6);
  border: 1px solid var(--ink);
  border-radius: var(--radius-3);
  background: var(--surface);
}

@media (max-width: 900px) {
  .join__copy,
  .join__form {
    grid-column: 1 / -1;
  }

  .join__form {
    padding: var(--space-5);
  }
}
