@layer components {
  /* The check page (checks/new): the photo, step 2, then the check running and its result, step 3, each the
   * landing course's approved design on the flow's two sides (.flow-page, flow.css). */

  /* ---- Step 2: the photo ----
   * "Add your photo", the approved design (../landing/pages/add-photo/design.html, 27 Nov 2026), on the
   * flow's two sides (.flow-page--add, flow.css). Under the headline, on a computer: the place to drop a
   * photo with the one main button, then the code that opens this step on a phone. On a touch screen (a
   * coarse pointer, not the width) one button takes their place: under the headline where the two sides
   * stand next to each other, pinned to the bottom of the screen in one column. On the sand side, the
   * example photo with the three tips marked on it. */

  /* The chosen document, at the right end of the logo row: its picture, its name as on step 1, and the way
   * back. It is one link; on a retake, and on step 3, the document can't change, so it is neither a link nor
   * says Change. */
  .add-chosen {
    align-items: center;
    background: var(--color-ground);
    block-size: 32px;
    border: 1px solid var(--color-hairline);
    border-radius: var(--rounded-md);
    color: var(--color-ink);
    display: inline-flex;
    font: 600 13.5px/1.2 var(--font-sans);
    gap: 8px;
    margin-block-end: -5px;
    min-inline-size: 0;
    padding: 0 11px 0 7px;
    position: relative;
    text-decoration: none;

    /* The area to tap is 44px tall. */
    &:is(a)::after {
      content: "";
      inset: -7px 0;
      position: absolute;
    }

    &:is(a):hover {
      border-color: var(--color-ink);
      color: var(--color-ink);
      text-decoration: none;

      .add-chosen__change { color: var(--color-ink); }
    }

    @media (max-width: 600px) {
      font-size: 13px;
    }

    /* Step 2's, with "Change" beside the name; step 3's keeps its room. */
    @media (max-width: 379px) {
      .flow-page--add & {
        gap: 6px;
        padding: 0 8px 0 6px;
      }
    }
  }

  .add-chosen__picture {
    block-size: auto;
    border-radius: 2px;
    flex: none;
    inline-size: auto;
    max-block-size: 20px;
    max-inline-size: 27px;
    outline: 1px solid color-mix(in srgb, var(--color-ink) 14%, transparent);
    outline-offset: -1px;
  }

  /* A document whose picture is a stand-in shows the drawing of its kind, as its row on step 1 does. */
  .add-chosen__drawing {
    block-size: 20px;
    color: var(--color-ink);
    display: block;
    flex: none;
    inline-size: 15px;

    * { vector-effect: non-scaling-stroke; }
  }

  .add-chosen__name {
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .add-chosen__change {
    border-inline-start: 1px solid var(--color-hairline);
    color: var(--color-muted);
    flex: none;
    font-weight: 500;
    padding-inline-start: 9px;
    text-decoration: underline;
    text-underline-offset: 3px;

    @media (max-width: 379px) {
      padding-inline-start: 7px;
    }
  }

  /* Under the headline, one box for the expert's retake (orders/_retake_notice) and one for a problem with
   * the check itself, not a verdict on the photo: flat sand with a hairline. The red stays on the verdict. */
  .add-notice {
    background: var(--color-surface);
    border: 1px solid var(--color-hairline);
    border-radius: var(--rounded-lg);
    color: var(--color-ink);
    font: 400 15px/1.5 var(--font-sans);
    margin-block-start: 16px;
    padding: 14px 16px;

    p + p { margin-block-start: 6px; }

    /* "Retake needed", the brand's failed verdict (.chip--fail) as the design draws it there. */
    .chip {
      block-size: 26px;
      gap: 5px;
      line-height: 1;
      margin-block-end: 8px;
      padding-block: 0;

      &::before {
        block-size: 14px;
        inline-size: 14px;
      }
    }

    .btn {
      --btn-background: var(--color-ground);

      margin-block-start: 12px;
    }
  }

  /* The drop area: sand, a dashed line that reads on warm white, 16px corners. With a photo held over it
   * (checker_controller.js), pale mint and a solid charcoal line. */
  .add-drop {
    background: var(--color-surface);
    border: 1.5px dashed color-mix(in srgb, var(--color-ink) 36%, transparent);
    border-radius: var(--rounded-lg);
    display: grid;
    justify-items: center;
    margin-block-start: 22px;
    padding: clamp(28px, 5vh, 48px) 24px clamp(22px, 4.2vh, 40px);
    text-align: center;

    @media (min-width: 1024px) and (max-height: 780px) {
      margin-block-start: 18px;
      padding-block: 22px 18px;
    }

    @media (pointer: coarse) {
      display: none;
    }
  }

  .add-drop--over {
    background: var(--color-accent-soft);
    border-color: var(--color-ink);
    border-style: solid;
  }

  .add-drop__icon {
    --icon-size: 22px;

    background: var(--color-ground);
    block-size: 46px;
    border: 1px solid var(--color-hairline);
    border-radius: var(--rounded-full);
    display: grid;
    inline-size: 46px;
    place-items: center;
  }

  .add-drop__title {
    font: var(--text-h3);
    letter-spacing: -0.01em;
    margin-block-start: 14px;
  }

  .add-drop__button {
    margin-block-start: 14px;
  }

  .add-drop__note {
    color: var(--color-muted);
    font: 400 13px/1.4 var(--font-sans);
    margin-block-start: 12px;
  }

  /* The code for the phone: a row as step 1's rows are, the code in the place of the picture. */
  .add-qr {
    align-items: center;
    background: var(--color-ground);
    border: 1px solid var(--color-hairline);
    border-radius: var(--rounded-lg);
    display: flex;
    gap: 16px;
    margin-block-start: 12px;
    padding: 11px 16px 11px 11px;

    @media (max-width: 600px) {
      align-items: flex-start;
    }

    @media (pointer: coarse) {
      display: none;
    }
  }

  .add-qr__code {
    background: white;
    block-size: 78px;
    border: 1px solid var(--color-hairline);
    border-radius: 8px;
    color: var(--color-ink);
    display: block;
    flex: none;
    inline-size: 78px;
    padding: 3px;

    @media (min-width: 1024px) and (max-height: 780px) {
      block-size: 68px;
      inline-size: 68px;
    }
  }

  .add-qr__title {
    font: 600 16px/1.3 var(--font-sans);
    letter-spacing: -0.01em;
  }

  .add-qr__line {
    color: var(--color-muted);
    font: 400 14px/1.45 var(--font-sans);
    margin-block-start: 2px;
    text-wrap: pretty;
  }

  /* The touch screen's one button: under the headline where the two sides stand next to each other (a
   * tablet on its side), and in one column (a phone) pinned to the bottom of the screen with a hairline
   * above it. It is the page's only way to add a photo there, so it is shown by the pointer, not the width. */
  .add-bar {
    display: none;
    inline-size: 100%;
    margin-inline: auto;
    max-inline-size: calc(var(--flow-column) + 2 * var(--flow-gutter));
    padding-block: 0 32px;
    padding-inline: var(--flow-gutter);

    .btn {
      --icon-size: 20px;

      gap: 8px;
    }

    @media (pointer: coarse) {
      display: block;
    }

    @media (max-width: 1023px) {
      background: var(--color-ground);
      border-block-start: 1px solid var(--color-hairline);
      inset-block-end: 0;
      margin-block-start: auto;
      max-inline-size: none;
      order: 5;
      padding-block: 12px calc(12px + env(safe-area-inset-bottom, 0px));
      position: sticky;
      z-index: 6;

      .btn {
        display: flex;
        inline-size: 100%;
        margin-inline: auto;
        max-inline-size: var(--flow-column);
      }
    }
  }

  /* The example: her photo as taken, a photo that passes, with the three tips marked on it, and the tips
   * under it with the same numbers. A raised card on the sand side, a flat sand card in one column, where it
   * floats over nothing. With the mouse on a tip its mark stands out, and the other way round
   * (tip_marks_controller.js). */
  .add-example {
    --add-photo-width: 204px;

    background: var(--color-ground);
    border: 1px solid var(--color-hairline);
    border-radius: var(--rounded-xl);
    box-shadow: var(--shadow-raised);
    inline-size: 100%;
    max-inline-size: 404px;
    padding: 20px 24px 12px;

    /* A low window (a small laptop): a smaller photo, so the card and its sentence still fit. */
    @media (min-width: 1024px) and (max-height: 780px) {
      --add-photo-width: 174px;

      padding-block: 16px 8px;
    }

    @media (min-width: 1024px) and (max-height: 660px) {
      --add-photo-width: 138px;
    }

    @media (max-width: 1023px) {
      background: var(--color-surface);
      border-radius: var(--rounded-lg);
      box-shadow: none;
      max-inline-size: none;
    }

    @media (max-width: 600px) {
      --add-photo-width: 176px;

      padding-inline: 18px;
    }
  }

  .add-example__title {
    align-items: center;
    display: flex;
    font: 700 17px/1.3 var(--font-sans);
    letter-spacing: -0.01em;
    min-block-size: 28px;
    text-wrap: wrap;
  }

  /* Mark 1 stands in the space above her hair, on a thin rule that measures it; mark 2 is on her cheek,
   * where the light falls, and mark 3 beside her eye, where glasses would be. The tag is on the photo's
   * lower corner, clear of the marks. */
  .add-example__photo {
    aspect-ratio: 3 / 4;
    inline-size: var(--add-photo-width);
    margin: 12px auto 0;
    position: relative;
  }

  .add-example__selfie {
    block-size: 100%;
    border-radius: var(--rounded-md);
    inline-size: 100%;
    object-fit: cover;
    outline: 1px solid color-mix(in srgb, var(--color-ink) 12%, transparent);
    outline-offset: -1px;
  }

  .add-example__tag {
    background: var(--color-accent-soft);
    border-radius: var(--rounded-full);
    color: var(--color-ink);
    font: 500 12px/1.4 var(--font-sans);
    inset-block-end: 8px;
    inset-inline-start: 8px;
    letter-spacing: 0.02em;
    padding: 2px 9px;
    position: absolute;
    z-index: 1;
  }

  .add-example__gap {
    block-size: 15%;
    border-block: 1.5px solid var(--color-ground);
    inline-size: 9px;
    inset-block-start: 2.2%;
    inset-inline-start: 50%;
    margin-inline-start: -4.5px;
    opacity: 0.9;
    position: absolute;

    &::before {
      border-inline-start: 1.5px solid var(--color-ground);
      content: "";
      inset-block: 0;
      inset-inline-start: 3.75px;
      position: absolute;
    }
  }

  /* A tip's number, the app's: a pale mint circle with a charcoal number. Charcoal while its tip or its
   * mark is under the mouse. */
  .add-example__number {
    background: var(--color-accent-soft);
    block-size: 22px;
    border-radius: var(--rounded-full);
    color: var(--color-ink);
    display: grid;
    flex: none;
    font: 700 12px/1 var(--font-sans);
    font-variant-numeric: tabular-nums;
    inline-size: 22px;
    place-items: center;
  }

  .add-example__number--on {
    background: var(--color-ink);
    color: var(--color-ground);
  }

  /* On the photo the number has a warm white ring, so it reads on her, and stands out a little larger. */
  .add-example__pin {
    box-shadow: 0 0 0 2px var(--color-ground);
    cursor: default;
    inset-block-start: var(--y);
    inset-inline-start: var(--x);
    margin: -11px 0 0 -11px;
    position: absolute;

    &.add-example__number--on { transform: scale(1.18); }
  }

  .add-example__tips {
    margin-block-start: 14px;
  }

  .add-example__tip {
    border-block-start: 1px solid var(--color-hairline);
    color: var(--color-muted);
    cursor: default;
    display: grid;
    font: 400 14px/1.45 var(--font-sans);
    gap: 11px;
    grid-template-columns: 22px minmax(0, 1fr);
    padding-block: 10px;

    b {
      color: var(--color-ink);
      font-weight: 600;
    }

    > :last-child { text-wrap: pretty; }

    @media (min-width: 1024px) and (max-height: 780px) {
      font-size: 13.5px;
      padding-block: 8px;
    }
  }

  /* Movement, only with motion allowed: the lines and the numbers change in 150ms; on a full load, once the
   * card is in (.flow-page's load effect), the three marks land on the photo one after the other, done in
   * 1.5 seconds. Transitions, not animations: the photo state hidden and shown again (a retake) doesn't
   * replay them. */
  @media screen and (prefers-reduced-motion: no-preference) {
    .add-chosen {
      transition: border-color 150ms ease;
    }

    .add-drop {
      transition: background-color 150ms ease, border-color 150ms ease;

      &[data-revealed] {
        transition:
          opacity 500ms cubic-bezier(0.2, 0.7, 0.2, 1) var(--reveal-delay, 0ms),
          translate 500ms cubic-bezier(0.2, 0.7, 0.2, 1) var(--reveal-delay, 0ms),
          background-color 150ms ease,
          border-color 150ms ease;
      }
    }

    .add-example__number {
      transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
    }

    .add-example__pin {
      transition:
        opacity 420ms cubic-bezier(0.22, 1, 0.36, 1) var(--add-at, 600ms),
        scale 420ms cubic-bezier(0.22, 1, 0.36, 1) var(--add-at, 600ms),
        background-color 150ms ease,
        color 150ms ease,
        transform 150ms ease;
    }

    .add-example__gap {
      transition: opacity 420ms cubic-bezier(0.22, 1, 0.36, 1) 600ms;
    }

    .js-motion .add-example:not([data-revealed]) {
      .add-example__pin {
        opacity: 0;
        scale: 0.6;
      }

      .add-example__gap {
        opacity: 0;
      }
    }
  }

  /* A photo added on the US passport's page comes with #photo (checks/_handover): this step stays out of sight
   * from the first paint until the checker has taken the photo and shows the check running, or found none and
   * shows this step as it is, or for 5 s at most if the checker's script never runs. */
  .check-handover .flow-page--add {
    visibility: hidden;
  }

  /* ---- Step 3: the check running and its result ----
   * The approved design (../landing/pages/check-result/design.html, 27 Nov 2026), on the flow's two sides
   * (.flow-page--check, flow.css), one page whose parts change with the state (checks/_check). Left: the
   * headline, then the stages of the check, or the result's sentence, its six checks and its one main
   * button. Right: the card "Your photo", which holds the applicant's own photo. After PhotoAiD's screens:
   * the sweeping line beside the list of stages, a check as a bold name with its verdict on the right, and
   * "Retake photo" as a link under the one button. */

  /* The stages, one under the other. Done: the brand's tick. Now: charcoal with its number, a ring turning
   * around it, the title in charcoal and its detail under it; the stage waiting for the checker's files
   * looks the same, with the download in its detail's place. To come: a hairline circle and grey words. */
  .check-stages {
    margin-block: 26px 32px;

    @media (min-width: 1024px) and (max-height: 780px) {
      margin-block-start: 20px;
    }

    @media (max-width: 1023px) {
      margin-block-start: 22px;
    }
  }

  .check-stages__item {
    column-gap: 18px;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    min-block-size: 66px;
    padding-block-end: 16px;
    position: relative;

    /* The line down to the next stage, charcoal under a stage done. */
    &:not(:last-child)::before {
      border-inline-start: 1.5px solid var(--color-hairline);
      content: "";
      inset-block: 40px 8px;
      inset-inline-start: 15.25px;
      position: absolute;
    }

    &[data-state="done"]:not(:last-child)::before {
      border-color: color-mix(in srgb, var(--color-ink) 45%, transparent);
    }

    &:last-child {
      min-block-size: 32px;
      padding-block-end: 0;
    }

    @media (min-width: 1024px) and (max-height: 780px) {
      min-block-size: 56px;
      padding-block-end: 12px;
    }

    @media (max-width: 1023px) {
      min-block-size: 54px;
      padding-block-end: 10px;
    }
  }

  .check-stages__dot {
    --icon-size: 20px;

    block-size: 32px;
    border: 1.5px solid var(--color-hairline);
    border-radius: var(--rounded-full);
    display: grid;
    font: 700 13.5px/1 var(--font-sans);
    inline-size: 32px;
    place-items: center;
    position: relative;

    .icon,
    .check-stages__number {
      display: none;
    }

    [data-state="done"] > & {
      background: var(--color-accent-soft);
      border-color: transparent;

      .icon { display: inline-block; }
    }

    :is([data-state="now"], [data-state="waiting"]) > & {
      background: var(--color-ink);
      border-color: var(--color-ink);
      color: var(--color-ground);

      .check-stages__number { display: inline; }

      /* The ring around it, which turns while the check runs. */
      &::before {
        border: 1.5px solid var(--color-hairline);
        border-block-start-color: var(--color-ink);
        border-radius: var(--rounded-full);
        content: "";
        inset: -6px;
        position: absolute;
      }
    }
  }

  .check-stages__text {
    align-self: start;
    padding-block-start: 4px;
  }

  .check-stages__title {
    color: var(--color-muted);
    display: block;
    font: 400 17px/1.4 var(--font-sans);

    :is([data-state="now"], [data-state="waiting"]) & {
      color: var(--color-ink);
      font-weight: 600;
    }

    @media (max-width: 1023px) {
      font-size: 16px;
    }
  }

  .check-stages__detail,
  .check-stages__download {
    color: var(--color-muted);
    font: 400 14px/1.4 var(--font-sans);
    font-variant-numeric: tabular-nums;
    margin-block-start: 1px;
  }

  .check-stages__detail {
    display: none;

    [data-state="now"] & { display: block; }
  }

  .check-stages__download {
    display: block;
  }

  /* What has arrived of the checker's files: a thin line that fills with it. */
  .check-stages__meter {
    background: var(--color-hairline);
    block-size: 4px;
    border-radius: var(--rounded-full);
    display: block;
    inline-size: 180px;
    margin-block-start: 8px;
    max-inline-size: 100%;
    overflow: hidden;

    &::before {
      background: var(--color-ink);
      block-size: 100%;
      border-radius: inherit;
      content: "";
      display: block;
      inline-size: calc(var(--arrived, 0) * 100%);
    }
  }

  /* The result's sentence under the headline. When the photo fails it is the reason and what to do, in charcoal. */
  .check-lede {
    color: var(--color-muted);
    font: 400 17px/1.5 var(--font-sans);
    margin-block-start: 12px;
    max-inline-size: 34em;
    text-wrap: pretty;

    @media (min-width: 1024px) and (max-height: 780px) {
      font-size: 16px;
      margin-block-start: 8px;
    }

    @media (max-width: 600px) {
      font-size: 16px;
    }
  }

  .check-lede--reason {
    color: var(--color-ink);
  }

  /* The six checks between hairlines: the name in bold, under it the wording the checker returned (the
   * measurement next to the document's range), and the verdict on the right, drawn as the brand draws one. */
  .check-rows {
    margin-block-start: 18px;

    @media (min-width: 1024px) and (max-height: 780px) {
      margin-block-start: 12px;
    }

    /* In one column, with the link after it, the link's own room follows. */
    @media (max-width: 1023px) {
      margin-block: 12px 28px;

      &:has(~ .check-retake-row:not([hidden])) { margin-block-end: 0; }
    }
  }

  .check-row {
    align-items: center;
    border-block-start: 1px solid var(--color-hairline);
    column-gap: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding-block: 9px;

    &:last-child { border-block-end: 1px solid var(--color-hairline); }

    .chip {
      block-size: 26px;
      line-height: 1;
      padding-block: 0;

      &::before {
        block-size: 14px;
        inline-size: 14px;
      }
    }

    @media (min-width: 1024px) and (max-height: 780px) {
      padding-block: 6px;
    }

    @media (max-width: 1023px) {
      &:first-child { border-block-start: 0; }
    }

    @media (max-width: 379px) {
      column-gap: 10px;
    }
  }

  .check-row__name {
    display: block;
    font: 600 16px/1.3 var(--font-sans);
    letter-spacing: -0.01em;

    @media (min-width: 1024px) and (max-height: 780px) {
      font-size: 15px;
    }
  }

  .check-row__value {
    color: var(--color-muted);
    display: block;
    font: 400 13.5px/1.4 var(--font-sans);
    font-variant-numeric: tabular-nums;
    margin-block-start: 1px;
  }

  /* The one main button, as wide as the column, and under it "Retake photo" as a link (when the photo
   * passes). In one column the button is pinned to the bottom of the screen, flat with a hairline above it,
   * and the link stands after the six checks (.check-retake-row). */
  .check-actions {
    inline-size: 100%;
    margin-inline: auto;
    max-inline-size: calc(var(--flow-column) + 2 * var(--flow-gutter));
    padding: 20px var(--flow-gutter) 32px;
    text-align: center;

    .btn {
      --icon-size: 20px;

      display: flex;
      gap: 8px;
      inline-size: 100%;
    }

    @media (min-width: 1024px) and (max-height: 780px) {
      padding-block: 14px 18px;
    }

    @media (max-width: 1023px) {
      background: var(--color-ground);
      border-block-start: 1px solid var(--color-hairline);
      inset-block-end: 0;
      margin-block-start: auto;
      max-inline-size: none;
      order: 5;
      padding-block: 12px calc(12px + env(safe-area-inset-bottom, 0px));
      position: sticky;
      z-index: 6;

      .btn {
        margin-inline: auto;
        max-inline-size: var(--flow-column);
      }

      .check-retake { display: none; }
    }
  }

  /* "Retake photo" as a tertiary action: an underlined link with the circular arrow before it, which
   * shows what it does. */
  .check-retake {
    --icon-size: 17px;

    align-items: center;
    background: none;
    border: 0;
    color: var(--color-ink);
    cursor: pointer;
    display: inline-flex;
    font: 600 15px/1.4 var(--font-sans);
    gap: 7px;
    margin-block-start: 14px;
    padding: 0;
    position: relative;
    text-decoration: underline;
    text-underline-offset: 4px;

    /* The area to tap. */
    &::after {
      content: "";
      inset: -12px -8px;
      position: absolute;
    }

    &:hover { text-decoration-thickness: 2px; }

    @media (min-width: 1024px) and (max-height: 780px) {
      margin-block-start: 10px;
    }
  }

  /* The link's place in one column, after the six checks. */
  .check-retake-row {
    display: none;
    text-align: center;

    @media (max-width: 1023px) {
      display: block;
      margin-block: 18px 30px;

      .check-retake { margin-block-start: 0; }
    }
  }

  /* The card: a raised card on the sand side, a flat sand card in one column, where it floats over nothing.
   * Its photo stands in the document's shape, fitted into --check-w by --check-h, with room above it for the
   * rule of its width and at its sides for the rules of its height and the head's. */
  .check-card {
    --check-w: 216px;
    --check-h: 216px;

    background: var(--color-ground);
    border: 1px solid var(--color-hairline);
    border-radius: var(--rounded-xl);
    box-shadow: var(--shadow-raised);
    inline-size: 100%;
    max-inline-size: 404px;
    padding: 20px 24px 12px;

    /* A low window (a small laptop): a smaller photo. */
    @media (min-width: 1024px) and (max-height: 780px) {
      --check-w: 190px;
      --check-h: 190px;

      padding-block: 16px 8px;
    }

    @media (min-width: 1024px) and (max-height: 660px) {
      --check-w: 160px;
      --check-h: 160px;
    }

    @media (max-width: 1023px) {
      background: var(--color-surface);
      border-radius: var(--rounded-lg);
      box-shadow: none;
      max-inline-size: none;
    }

    @media (max-width: 600px) {
      --check-w: 196px;
      --check-h: 196px;

      padding-inline: 18px;
    }

    @media (max-width: 379px) {
      --check-w: 176px;
      --check-h: 176px;

      padding-inline: 14px;
    }
  }

  .check-card__head {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-block-size: 28px;
  }

  .check-card__title {
    font: 700 17px/1.3 var(--font-sans);
    letter-spacing: -0.01em;
  }

  .check-card__tag {
    background: var(--color-accent-soft);
    border-radius: var(--rounded-full);
    color: var(--color-ink);
    flex: none;
    font: var(--text-label);
    letter-spacing: 0.02em;
    padding: 3px 12px;
  }

  .check-card__stage {
    display: flex;
    justify-content: center;
    margin-block-start: 8px;
    padding: 30px 30px 0;
  }

  .check-card__frame {
    aspect-ratio: var(--shape, 1);
    block-size: min(var(--check-h), var(--check-w) / (var(--shape, 1)));
    flex: none;
    position: relative;
  }

  /* The photo's own box, which clips what lies on it: the photo as taken, the preview over it, the light of
   * the sweeping line and the mark of what failed. */
  .check-card__photo {
    background: var(--color-surface);
    border-radius: 8px;
    inset: 0;
    outline: 1px solid color-mix(in srgb, var(--color-ink) 12%, transparent);
    outline-offset: -1px;
    overflow: hidden;
    position: absolute;
  }

  .check-card__taken,
  .check-card__preview {
    block-size: 100%;
    inline-size: 100%;
    inset: 0;
    position: absolute;
  }

  .check-card__taken {
    object-fit: cover;
  }

  .check-card__canvas {
    block-size: 100%;
    display: block;
    inline-size: 100%;
  }

  .check-card__caption {
    border-block-start: 1px solid var(--color-hairline);
    color: var(--color-muted);
    font: 400 12.5px/1.45 var(--font-sans);
    margin-block-start: 16px;
    min-block-size: calc(11px + 2 * 1.45em);
    padding-block-start: 10px;
    text-wrap: pretty;

    /* While the check runs nothing stands under the photo: the line keeps its room, not its hairline. */
    &:not(:has(> :not([hidden]))) { border-color: transparent; }
  }

  /* While the check runs: a mint dashed line sweeps down and up over the photo, reaching past its sides,
   * with a soft mint light around it on the photo. */
  .check-scan {
    inset: 0;
    pointer-events: none;
    position: absolute;
  }

  .check-scan__move {
    inset: 0;
    position: absolute;
    transform: translateY(46%);
  }

  .check-scan__line {
    border-block-start: 2px dashed var(--color-accent);
    inset-block-start: -1px;
    inset-inline: -12px;
    position: absolute;

    &::before,
    &::after {
      block-size: 10px;
      border-inline-start: 2px solid var(--color-accent);
      content: "";
      inset-block-start: -6px;
      position: absolute;
    }

    &::before { inset-inline-start: 0; }
    &::after { inset-inline-end: 0; }
  }

  .check-scan__light {
    background: linear-gradient(transparent, color-mix(in srgb, var(--color-accent) 42%, transparent), transparent);
    block-size: 28%;
    inset-block-start: -14%;
    inset-inline: 0;
    position: absolute;
  }

  /* When it passes: the file's size on two rules, the head's height on a third between two dashed guides at
   * the crown and the chin (--crown and --chin, shares of the photo's height, from the checker), and the band
   * the checker draws on the preview. The rules are step 1's. */
  .check-measure {
    inset: 0;
    pointer-events: none;
    position: absolute;
  }

  .check-measure__rule {
    position: absolute;

    &::before,
    &::after {
      border: 0 solid var(--color-ink);
      content: "";
      position: absolute;
    }
  }

  .check-measure__rule--width {
    block-size: 11px;
    inset-block-start: -20px;
    inset-inline: 0;

    &::before {
      border-block-start-width: 1px;
      inset-block-start: 5px;
      inset-inline: 0;
    }

    &::after {
      border-inline-width: 1px;
      inset: 0;
    }
  }

  .check-measure__rule--height,
  .check-measure__rule--head {
    inline-size: 11px;

    &::before {
      border-inline-start-width: 1px;
      inset-block: 0;
      inset-inline-start: 5px;
    }

    &::after {
      border-block-width: 1px;
      inset: 0;
    }
  }

  .check-measure__rule--height {
    inset-block: 0;
    inset-inline-end: -20px;

    .check-measure__label { transform: translate(-50%, -50%) rotate(90deg); }
  }

  /* The head's rule, from the crown to the chin, its label turned to read upward. */
  .check-measure__rule--head {
    inset-block: calc(var(--crown, 0.1) * 100%) calc((1 - var(--chin, 0.7)) * 100%);
    inset-inline-start: -20px;

    .check-measure__label { transform: translate(-50%, -50%) rotate(-90deg); }
  }

  .check-measure__label {
    background: var(--color-accent-soft);
    border-radius: var(--rounded-full);
    color: var(--color-ink);
    font: 600 11.5px/1.5 var(--font-sans);
    inset-block-start: 50%;
    inset-inline-start: 50%;
    padding: 1px 8px;
    position: absolute;
    transform: translate(-50%, -50%);
    white-space: nowrap;
  }

  .check-measure__guide {
    border-block-start: 1px dashed color-mix(in srgb, var(--color-ink) 42%, transparent);
    inset-inline: 0;
    position: absolute;
  }

  .check-measure__guide--crown { inset-block-start: calc(var(--crown, 0.1) * 100%); }
  .check-measure__guide--chin { inset-block-start: calc(var(--chin, 0.7) * 100%); }

  /* When it fails: a red bar on the photo as taken (on its top edge when that edge cut the head, along the
   * head that can't be framed otherwise, placed by the checker), and a tag that names the failure. The only
   * red on the page, with "Failed". */
  .check-flag {
    inset: 0;
    pointer-events: none;
    position: absolute;
  }

  .check-flag__bar {
    background: var(--color-fail);
    position: absolute;

    &[data-edge="top"] {
      block-size: 4px;
      inset-block-start: calc(var(--top, 0) * 100%);
      inset-inline: 0;
    }

    &[data-edge="head"] {
      inline-size: 4px;
      inset-block: calc(var(--top, 0) * 100%) calc((1 - var(--bottom, 1)) * 100%);
      inset-inline-end: calc(var(--right, 0) * 100%);
    }
  }

  .check-flag__tag {
    align-items: center;
    background: var(--color-ground);
    border-radius: var(--rounded-full);
    box-shadow: inset 0 0 0 1px currentColor;
    color: var(--color-fail);
    display: inline-flex;
    font: 700 10.5px/1.2 var(--font-sans);
    gap: 4px;
    inset-block-start: 12px;
    inset-inline-end: 8px;
    letter-spacing: 0.02em;
    max-inline-size: calc(100% - 16px);
    min-block-size: 22px;
    padding: 3px 9px 3px 6px;
    position: absolute;

    &::before {
      background-color: currentColor;
      block-size: 12px;
      content: "";
      flex: none;
      inline-size: 12px;
      mask: url("/assets/icons/verdict-fail-0a4711b3.svg") center / contain no-repeat;
    }

    &:empty { display: none; }
  }

  /* Movement, only with motion allowed. While the check runs the ring of the stage now running turns and
   * the line sweeps over the photo. When the result comes, the preview fades in over the photo as taken
   * (checker_controller.js keeps that photo under it until then), the marks follow, the left side comes in
   * and the verdicts land one after the other: animations, so each run once whenever a result is shown.
   * With reduced motion the ring and the line stand still and the result is simply there. */
  @media screen and (prefers-reduced-motion: no-preference) {
    .check-stages__dot::before {
      animation: check-spin 0.9s linear infinite;
    }

    .check-scan__move {
      animation: check-scan 1.7s ease-in-out infinite alternate;
    }

    .check-card__preview {
      animation: check-fade 600ms ease both;
    }

    .check-measure,
    .check-flag {
      animation: check-fade 350ms ease 350ms both;
    }

    .check-enter {
      animation: check-enter 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
    }

    .check-row .chip {
      animation: check-chip 380ms cubic-bezier(0.22, 1, 0.36, 1) calc(120ms + var(--i, 0) * 70ms) both;
    }

    .check-retake {
      transition: text-decoration-thickness 150ms ease;
    }
  }

  @keyframes check-spin {
    to { transform: rotate(360deg); }
  }

  @keyframes check-scan {
    from { transform: translateY(2%); }
    to { transform: translateY(98%); }
  }

  @keyframes check-fade {
    from { opacity: 0; }
  }

  @keyframes check-enter {
    from { opacity: 0; translate: 0 10px; }
  }

  @keyframes check-chip {
    from { opacity: 0; transform: scale(0.85); }
  }
}
