/* The Agent Card pre-order page (/agent-card): a night hero with the card and its two prices, what the
   card does, the three-view render in a dark band, and the pre-order form (js/pages/agent-card.js). */

/* ── always-dark bands ─────────────────────────
   Both pictures are one render of the card on its own navy studio field (#050b14 at its edges, up to
   #13294e where its light falls), and that field cannot be cut out. A band that carries a picture
   takes the field as its own, so the picture has no visible edge there, and re-declares the semantic
   tokens the band uses with the night palette, so text and the button read the same in either page
   theme. */

.acd-night {
  --bg: #050b14;
  --acd-light: #13294e;
  --ink: #e7eef0;
  --ink-2: #b8c9cf;
  --ink-3: #8aa1a9;
  --focus: #6cc6c8;
  --btn: #e7eef0;
  --btn-ink: #07161f;
  --btn-hover: #ffffff;
  color-scheme: dark;
  background: var(--bg);
  color: var(--ink);
}

/* ── hero ──────────────────────────────────── */

.acd-hero__inner {
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: center;
  padding-top: calc(var(--header-h) + 48px);
}

.acd-hero__aside {
  position: relative;
  justify-self: center;
  align-self: center;
}

/* The render's light, carried on past the picture, so the picture's faded edge has the same field to
   fade into. Placed and stepped as in the render: it falls from above, left of the front view. */
.acd-hero__aside::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 21%;
  top: 12%;
  width: 240%;
  height: 124%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    closest-side,
    var(--acd-light) 0%,
    var(--acd-light) 25%,
    color-mix(in srgb, var(--acd-light) 66%, transparent) 55%,
    color-mix(in srgb, var(--acd-light) 34%, transparent) 80%,
    transparent 100%
  );
  pointer-events: none;
}

/* The picture's outer band is its fade to nothing, so it may run past the column's top and bottom. */
.acd-hero__card {
  display: block;
  width: min(100%, 440px);
  height: auto;
  margin-block: -44px;
}

/* ── the two prices ────────────────────────── */

.acd-price {
  display: flex;
  align-items: center;
  gap: 14px;
}

.acd-price__amount {
  font-size: clamp(3.25rem, 5.2vw, 4.5rem);
  line-height: 0.9;
  font-weight: 400;
  font-stretch: var(--wdth-display);
  letter-spacing: -0.045em;
  color: var(--ink);
}

.acd-price__meta {
  display: grid;
  gap: 2px;
  font-size: 0.9375rem;
  line-height: 1.4;
}

.acd-price__label {
  font-weight: 620;
  color: var(--ink);
}

.acd-price__was {
  color: var(--ink-3);
}

.acd-facts {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: 1.5;
  color: var(--ink-2);
}

.acd-facts li {
  position: relative;
  padding-left: 18px;
}

.acd-facts li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
}

/* ── what the card does ────────────────────── */

.acd-what__grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: var(--s-6) var(--gutter);
  align-items: start;
}

.acd-what__title {
  position: sticky;
  top: calc(var(--header-h) + 32px);
}

.acd-does {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.acd-do {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 8px var(--gutter);
  align-items: baseline;
  padding-block: clamp(20px, 2.4vw, 30px);
  border-bottom: 1px solid var(--line);
}

.acd-do__text,
.acd-trial {
  font-size: var(--fs-body-l);
  line-height: 1.6;
  text-wrap: pretty;
}

.acd-do__text {
  max-width: 56ch;
  color: var(--ink-2);
}

/* Said at the size of the three lines above it: what a confirmation does today is not small print. */
.acd-trial {
  margin-top: clamp(20px, 2.4vw, 30px);
  padding: 18px 22px;
  border-radius: var(--r-control);
  background: var(--surface-2);
  color: var(--ink);
}

/* ── three views ───────────────────────────── */

.acd-views {
  margin: 0 var(--tank-inset);
  border-radius: var(--r-tank);
  overflow: clip;
}

.acd-views__figure {
  display: grid;
  justify-items: center;
  margin: 0;
}

/* Always the band's full width: the render's light reaches its top edge and its floor runs to both
   sides, so any edge of the picture inside the band would show. A very wide screen crops its height. */
.acd-views__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 88svh;
  object-fit: cover;
  object-position: 50% 42%;
}

/* The render ends in an empty dark floor: the caption sits on it. */
.acd-views__media {
  position: relative;
  width: 100%;
}

/* Over the picture, cropped as the picture is. It shows only while it plays. It starts in the dark and
   its lamp flickers on within half a second, so it comes in quickly ("lights down"): a slow fade would
   lay the lit screen over the picture. At its end it fades out slowly to the picture it ended on, which
   is the sharper of the two. */
.acd-views__clip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.acd-views__clip[data-mo-state='playing'] {
  opacity: 1;
  transition-duration: 0.12s;
}

/* The caption's negative margin lays it over the picture's floor. The media box is positioned (for the
   clip), so the caption needs a layer of its own to stay on top of it: it carries the "this is a render"
   line. */
.acd-views__cap {
  position: relative;
  z-index: 1;
  max-width: 72ch;
  margin-top: clamp(-56px, -3.2vw, -12px);
  padding: 0 var(--margin) clamp(28px, 3.6vw, 48px);
  font-size: 0.9375rem;
  line-height: 1.5;
  text-align: center;
  text-wrap: balance;
  color: var(--ink-2);
}

/* ── pre-order ─────────────────────────────── */

.acd-order__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 88px);
  align-items: start;
}

.acd-order__intro {
  position: sticky;
  top: calc(var(--header-h) + 40px);
  display: grid;
  gap: 20px;
}

.acd-form {
  position: relative;
  display: grid;
  gap: 22px;
  padding: clamp(20px, 3vw, 40px);
  border-radius: var(--r-panel);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line-soft) inset;
}

.acd-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.acd-form__wide {
  grid-column: 1 / -1;
}

/* 16px and no less: below it iOS zooms the page in when a field takes focus. */
.acd-form .input,
.acd-form .textarea,
.acd-step__val {
  font-size: max(16px, 1rem);
}

.acd-form__note-input {
  min-height: 96px;
}

.acd-form__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.acd-form .field__error {
  display: flex;
  align-items: center;
  gap: 6px;
}

.acd-form .field__error::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* quantity: a fewer and a more button around the number, each a full 44px to tap */
.acd-step {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: var(--r-control);
  background: var(--surface-2);
}

.acd-step__btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--ink);
  transition: background-color var(--t-fast);
}

.acd-step__btn:hover {
  background: color-mix(in oklab, var(--ink) 9%, transparent);
}

.acd-step__btn:active {
  transform: scale(0.94);
}

.acd-step__btn[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}

.acd-step__val {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 660;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.acd-step__val::-webkit-outer-spin-button,
.acd-step__val::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.acd-step__val:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
  border-radius: 10px;
}

.field.is-invalid .acd-step {
  box-shadow: 0 0 0 1px var(--bad) inset;
}

.acd-form__status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: var(--r-control);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.acd-form__status:focus {
  outline: none;
}

.acd-form__status .icon {
  margin-top: 2px;
}

.acd-form__status--ok {
  background: var(--ok-soft);
  color: color-mix(in oklab, var(--ok) 72%, var(--ink));
}

.acd-form__status--bad {
  background: var(--bad-soft);
  color: color-mix(in oklab, var(--bad) 80%, var(--ink));
}

.acd-form__status strong {
  font-weight: 700;
  color: var(--ink);
}

/* The pre-order number is read out and copied whole: its dash is no place for a line break. */
.acd-form__ref {
  white-space: nowrap;
}

.acd-form__foot {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.acd-form__notice {
  max-width: 64ch;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--ink-3);
}

/* The one link in the small print still gets a 44px target; the margins give the room back. */
.acd-form__notice .link {
  display: inline-block;
  padding-block: 12px;
  margin-block: -12px;
}

.acd-form.is-sent .acd-form__grid {
  opacity: 0.55;
}

.acd-form [data-acd-submit][aria-disabled="true"] {
  opacity: 1;
}

.acd-form.is-sent [data-acd-submit] {
  background: var(--ok);
  color: var(--ink-inverse);
}

/* ── narrower screens ──────────────────────── */

@media (max-width: 900px) {
  /* one column: the card first, then the words */
  .acd-hero__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding-top: calc(var(--header-h) + 8px);
  }

  .acd-hero__aside {
    order: -1;
    justify-self: center;
  }

  .acd-hero__card {
    width: min(62vw, 250px);
    margin-block: 0 -30px;
  }

  .acd-what__grid,
  .acd-order__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .acd-what__title,
  .acd-order__intro {
    position: static;
  }

  /* the button a few lines below already says the price */
  .acd-order__intro .acd-price {
    display: none;
  }
}

@media (max-width: 640px) {
  /* A phone's first screen should reach the button: a smaller card and tighter copy. */
  .acd-hero__card {
    width: min(48vw, 184px);
    margin-block: 0 -20px;
  }

  .acd-hero .page-hero__copy {
    gap: 12px;
  }

  .acd-hero .page-hero__lede {
    font-size: 1rem;
  }

  .acd-hero .page-hero__actions .btn {
    width: 100%;
  }

  .acd-do {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Crop some of the empty field left and right of the three views, so the cards are bigger. */
  .acd-views__img {
    aspect-ratio: 3 / 2;
    object-fit: cover;
  }

  .acd-form__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .acd-form__foot .btn {
    width: 100%;
  }
}
