/* The close: a red panel over the knight photograph, its right edge cut on the
   site's 13deg slant, carrying the early-access application
   (js/early-access.js), where every Try for free on the site lands. The photograph sits at the band's right edge at full
   height, starting where the slant's foot leaves it. */
.close {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  overflow: hidden;
  min-height: clamp(34rem, 37vw, 46rem);
  padding: clamp(4rem, 6vw, 7rem) var(--gutter);
  background: var(--char);
  color: var(--white);
}

/* Skewed from the top, so the top edge holds at 42.5% across and the foot
   leans back by the band's height times tan(13deg). */
.close::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -30%;
  z-index: -1;
  width: 72.5%;
  background: var(--red-deep);
  transform: skewX(-13deg);
  transform-origin: top;
}

.close__photo {
  position: absolute;
  top: 0;
  right: 0;
  z-index: -2;
  width: 70%;
  height: 100%;
  object-fit: cover;
  object-position: 100% 50%;
}

.close__panel {
  width: min(100%, 30rem);
}

.close .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

/* The hero's size: the page opens and closes on the same scale. */
.close__title {
  font-size: calc(var(--text-h2) * 1.2);
  line-height: 1;
  white-space: nowrap;
}

.close__lede {
  margin-top: clamp(1rem, 1.4vw, 1.5rem);
  font-family: var(--serif);
  font-size: clamp(1.25rem, 1.35vw, 1.5rem);
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.92);
}

.close :focus-visible {
  outline-color: var(--white);
}

.signup {
  display: grid;
  gap: 0.75rem;
  max-width: 26rem;
  margin-top: clamp(1.5rem, 2vw, 2rem);
}

.signup[hidden] {
  display: none;
}

.signup__trap {
  display: none;
}

.signup__field {
  display: grid;
  gap: 0.5rem;
}

.signup__label {
  font-family: var(--serif);
  font-size: 1.0625rem;
}

.signup__field input {
  width: 100%;
  height: 3.25rem;
  padding: 0 1.1rem;
  border: 0;
  border-radius: 2px;
  background: var(--paper);
  font: 400 1.0625rem/1 var(--serif);
  color: var(--ink);
}

.signup__field input::placeholder {
  color: var(--ink-mute);
}

.signup .btn--light {
  isolation: isolate;
  overflow: hidden;
  justify-content: space-between;
  height: 3.25rem;
  font-size: 1.0625rem;
  color: var(--red);
  transition:
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

/* On hover a charcoal panel sweeps in from the left, its leading edge a red
   seam on the site's 13deg slant. At rest and at the end of the sweep the seam
   sits outside the button, so only the motion shows it. */
.signup .btn--light::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: -1rem;
  width: calc(100% + 2rem);
  background: var(--char);
  box-shadow: 2px 0 0 var(--red);
  transform: translateX(-102%) skewX(-13deg);
  transition: transform 0.5s var(--ease);
}

/* Each word rolls over as the panel passes it: the red word lifts out of its
   slot and a paper copy rises in behind, one word after the next. */
.signup .roll {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

.signup .roll > span {
  position: relative;
  display: block;
  color: var(--red);
  transition: transform 0.38s var(--ease);
}

.signup .roll > span::after {
  content: attr(data-word);
  position: absolute;
  top: 100%;
  left: 0;
  color: var(--paper);
}

/* Staggered only as far as the panel's own pace, so no red word waits on the charcoal. */
.signup .roll:nth-child(2) > span {
  transition-delay: 0.03s;
}

.signup .roll:nth-child(3) > span {
  transition-delay: 0.06s;
}

/* The arrow runs out past the edge and a paper one slides in behind the
   panel. js/magnet.js leans it a few px towards the pointer (--mx, --my). */
.signup .btn__arrow {
  position: relative;
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  transform: translate3d(calc(var(--mx, 0) * 1px), calc(var(--my, 0) * 1px), 0);
  transition: transform 0.3s var(--ease);
}

.signup .btn__arrow svg {
  position: absolute;
  inset: 0;
  transition:
    transform 0.45s var(--ease),
    opacity 0.3s var(--ease);
}

.signup .btn__arrow svg + svg {
  color: var(--paper);
  opacity: 0;
  transform: translateX(-2.4rem);
}

.signup .btn--light:hover {
  background: var(--paper);
  transform: translateY(-1px);
  box-shadow: 0 1.2rem 1.9rem -1rem rgba(40, 4, 6, 0.85);
}

.signup .btn--light:hover::before {
  transform: translateX(0) skewX(-13deg);
}

.signup .btn--light:hover .roll > span {
  transform: translateY(-100%);
}

/* Far enough to clear the button's 1.6rem edge whole. */
.signup .btn--light:hover .btn__arrow svg {
  transform: translateX(3.2rem);
}

/* The paper arrow follows the panel in, so the bay never shows empty. */
.signup .btn--light:hover .btn__arrow svg + svg {
  opacity: 1;
  transform: none;
  transition:
    transform 0.45s var(--ease) 0.12s,
    opacity 0.2s var(--ease) 0.12s;
}

.signup .btn--light:active {
  transform: none;
  box-shadow: 0 0.6rem 1.2rem -0.8rem rgba(40, 4, 6, 0.85);
}

/* At rest the status line is the panel's small caps note; once the form
   speaks it turns to sentence text. */
.signup__status {
  max-width: 17rem;
  margin-top: 1.1rem;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.7;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}

.signup__status[data-state] {
  max-width: 26rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  letter-spacing: 0;
  text-transform: none;
}

.signup__status[data-state='warn'] {
  color: #ffdca6;
}

.signup__status[data-state='error'] {
  font-weight: 600;
  color: var(--white);
}

/* Sent: the lede and form give way to the confirmation slip
   (css/confirm.css), under the headline. */
.signup-done {
  max-width: 30rem;
  margin-top: clamp(1.5rem, 2vw, 2rem);
}

/* ── Stacked: the whole form on unbroken red, then the photograph under a
   shallow diagonal seam that echoes the desktop slant ── */
@media (max-width: 960px) {
  .close {
    display: block;
    min-height: 0;
    padding: 0;
    background: var(--red-deep);
  }

  .close::before {
    display: none;
  }

  .close__panel {
    width: auto;
    padding: var(--section-y) var(--gutter) clamp(2.75rem, 8vw, 4rem);
  }

  .close__title {
    white-space: normal;
  }

  .signup {
    max-width: 30rem;
  }

  .signup__status {
    font-size: 0.75rem;
  }

  /* Both the car and the knight held in a squarer frame. */
  .close__photo {
    position: static;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-position: 45% 50%;
    clip-path: polygon(0 clamp(1.75rem, 8vw, 3rem), 100% 0, 100% 100%, 0 100%);
  }
}

/* Phones: a compact red scene, the form inside one screen, the photograph a
   shorter closing panel under it. */
@media (max-width: 767px) {
  .close__panel {
    padding: 3rem var(--gutter) 2.5rem;
  }

  .signup {
    margin-top: 1.5rem;
  }

  .close__photo {
    height: 16.25rem;
    aspect-ratio: auto;
  }
}
