/* The example business: the lime "Try the assistant" button in the hero form and the stage it opens (public/js/example.js).
   Page tokens only (base.css, site.css). Loaded after home.css (and before motion.css, which stays last), so its equal-weight rules win. */

/* ---------- the button ---------- */
/* First in the form, then the field with an ink "Show me", then its line (on a laptop too: with the line above the field the English
   field ran 12 px under the ads banner at 1366x657). Only the hero's form: the closing form and the 404 page's keep their order. */
.hero--live .try {
  grid-template-areas: "example" "box" "lead" "msg";
}
.try-example {
  grid-area: example;
  justify-self: start;
  margin-bottom: 4px;
}
/* Under 1180 px (landing wave 2, M2): the lime button, the divider, the field, the offer slot, the note's row. Wave 1's line under the button is
   not shown here (the divider carries its message); from 1180 px the form is as before. The button's 4 px margin was for that line: the divider
   sits 8 px under the button instead. */
@media (max-width: 1179px) {
  .hero--live .try {
    grid-template-areas: "example" "or" "box" "offer" "msg";
  }
  .hero--live:not(.is-demo) .try-lead {
    display: none;
  }
  .hero--live .try-example {
    margin-bottom: 0;
  }
  /* A live run: the divider and the offer fold away with the button and the lead line, and the form is wave 1's four-row one again (an
     empty "or" or "offer" row would still add a grid gap). "Try another" removes is-demo and brings them all back. */
  .hero.is-demo .w2-or,
  .hero.is-demo .w2-offer {
    display: none;
  }
  .hero.is-demo .try {
    grid-template-areas: "example" "box" "lead" "msg";
  }
}
.try-example .ph {
  font-size: 20px;
}
@media (max-width: 599px) {
  .try-example {
    justify-self: stretch;
  }
}
/* Lime marks the one next action: while the example button is there, the field's button is the plain ink one. So is the own card's
   button while the phone card above it is lime: the lead on the phone is the moment, and a second lime under it split it (18 Nov shots). */
.try:has(.try-example) .try-go,
.phone.connected:not([hidden]) ~ .example-own .try-go {
  --b-bg: var(--btn);
  --b-fg: var(--btn-ink);
  --b-edge: var(--btn);
  --b-shadow: inset 0 1px 0 rgb(255 255 255 / 0.2), 0 1px 1px rgb(17 17 16 / 0.14), 0 8px 16px -10px rgb(17 17 16 / 0.45);
  --b-rim: inset 0 0 0 1px rgb(255 255 255 / 0.5), 0 0 0 3px color-mix(in oklab, var(--btn) 30%, transparent);
}
/* A normal read folds the hero away; the button goes with the line above the field. */
.hero.is-demo .try-example {
  display: none;
}
/* A refused example says so in the field's own warning line (the demo's [data-demo-error] is its own, cleared as the visitor types). */
.try:has([data-example-refused]:not(:empty)) .try-note {
  opacity: 0;
}

/* The invalid-address error ends with a link to the example. It is a plain sibling after the error line, not a .try-error (it always has
   words, so it must not hide the note), out of sight and out of the tab order until the error has text. It has no grid area, so it
   takes the form's implicit row below the four named ones and adds no space while it is hidden. */
.try-errlink {
  display: none;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.try-error[data-demo-error]:not(:empty) + .try-errlink {
  display: block;
}
.try-errlink:focus-visible {
  outline-color: currentColor; /* the page's ring is ink, unseen on the laptop's night hero; the link's colour reads on both */
}
/* From 1180 px the hero is the scene's band and its words follow the sky (home.css, --night 0 by day to 1 at night): the link does too,
   and the red turns to the app's dark-theme red at night (#f28b82, base.css), 7:1 on the dark band where the page's red was 2.4:1. The
   refused line is a .try-error too. Phones keep the ink link and the page's red. */
@media (min-width: 1180px) {
  .hero--live .try-errlink {
    color: color-mix(in oklab, var(--ink) calc(100% - var(--night, 0) * 100%), var(--on-dark));
  }
  .hero--live .try-error {
    color: color-mix(in oklab, var(--danger) calc(100% - var(--night, 0) * 100%), #f28b82);
  }
}

/* ---------- the stage: the invented site blurred behind the chat, then the phone card ---------- */
.stage[data-example] .learned,
.stage[data-example] .stage-cta,
.stage[data-example] .ready,
.stage[data-example] .loader {
  display: none;
}
.stage[data-example]:focus {
  outline: none; /* the stage takes the focus when it opens (public/js/example.js), it is not a control */
}
.stage[data-example] {
  padding-top: 12px;
  scroll-margin-top: 0; /* not every section's 24 px (home.css): the top bar does not stay, so the example opens at the screen's top */
}
/* The hero the top bar follows is hidden while the example has the page, not folded away (is-demo): the top bar and the Black Friday
   line take the day's colours, as while the demo has the page (home.css: a chalk bar, an ink line), not the night sky over the chalk. */
@media (min-width: 1180px) {
  body:has(.stage[data-example]:not([hidden])) :is(.top, .bf-bar) {
    --night: 0;
    --sky: var(--bg);
  }
}

/* The white card after the lead: the field and the lime button that start the normal read on the visitor's own site. It has the phone
   card's look (home.css .phone: white on the chalk page, no edge of its own), so the field's pill is the one edge in it. */
.example-own {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* with the form's: the field gives way (its own width widened a 320 px phone's page to 355 px) */
  gap: 8px;
  padding: 18px;
  border-radius: 18px;
  background: var(--surface);
}
.example-own[hidden] {
  display: none;
}
.example-own h3 {
  font-family: var(--font);
  font-size: 17px;
  letter-spacing: 0;
}
.example-own > p {
  font-size: 15px;
  color: var(--ink-2);
}
.example-own-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 4px; /* 12 px under the words, as the phone card's button */
}
/* The hero's field and button, flush with the card's words. The box's grid area ("box", home.css) is the hero form's: in this grid it
   opened an implicit column that pushed the box right (18 Nov shots: on a laptop the field started half way across). */
.example-own .try-box {
  grid-area: auto;
}
.example-own .try-box:focus-within {
  box-shadow: inset 0 1px 0 #fff, var(--shadow), 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); /* the ring's gap is the white card */
}
/* On a phone the field and the button stack, each full width: the box around both goes (in the card it was a second edge, indented),
   and the field is the hero's white pill on its own. */
@media (max-width: 760px) {
  .example-own .try-box,
  .example-own .try-box:focus-within {
    gap: 8px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .example-own .try-field {
    padding: 0 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 #fff, var(--shadow);
    transition: box-shadow 0.16s var(--ease);
  }
  .example-own .try-field:has(input[aria-invalid="true"]) {
    border-color: var(--danger);
  }
  .example-own .try-field:focus-within {
    border-color: var(--ink);
    box-shadow: inset 0 1px 0 #fff, var(--shadow), 0 0 0 2px var(--surface), 0 0 0 4px var(--ink);
  }
}
.example-own-error {
  font-size: 14px;
  color: var(--danger);
  font-weight: 500;
}
.example-own-error:empty {
  display: none;
}
