@layer components {
  /* The order page: the checkout while unpaid, then the file and the expert's status. */
  /* A message, not a verdict: the warm neutral, as on the landing. */
  .order-alert {
    background: var(--color-warm);
    border-radius: 10px;
    font: var(--text-small);
    padding: 12px 14px;
  }

  /* The checkout in PhotoAiD's order (founder's pick, 17 Nov 2026, design-explorations/checkout A).
   * On a phone one column: the photo and its price, the form, the totals, the promises, and the
   * total pinned to the bottom of the screen. On a desktop the form on the left, the order on the right. */
  .checkout {
    display: flex;
    flex-direction: column;
    gap: 20px;

    @media (max-width: 899px) {
      .checkout__main,
      .checkout__aside,
      .order-summary {
        display: contents;
      }

      .order-summary__item { order: 0; }
      .checkout__heading { order: 1; }
      .checkout__payment { order: 2; }
      .order-summary__totals { order: 3; }
      .order-summary__promise { order: 4; }
      .checkout__bar { order: 5; }
    }

    @media (min-width: 900px) {
      align-items: start;
      column-gap: 72px;
      display: grid;
      grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    }
  }

  .checkout__main,
  .checkout__aside {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-inline-size: 0;
  }

  .checkout__heading {
    @media (max-width: 760px) { text-align: center; }
  }

  .checkout__payment {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .checkout__bar {
    @media (min-width: 761px) {
      &.flow__bar { display: none; }
    }
  }

  .checkout__total {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;

    > span:first-child {
      display: flex;
      flex-direction: column;
    }

    b { font: 600 21px/26px var(--font-display); }

    small {
      color: var(--color-muted);
      font: var(--text-caption);
    }
  }

  .checkout__sum {
    font: 500 22px/26px var(--font-mono);
  }

  /* Paddle's inline frame goes in here; Paddle names its target by this class. */
  .paddle-checkout__frame {
    min-block-size: 450px;
  }

  /* When Paddle's script doesn't load: not a verdict, so the warm neutral. */
  .checkout__unavailable {
    background: var(--color-warm);
    border-radius: 10px;
    font: var(--text-small);
    padding: 12px 14px;
  }

  .flow-card.checkout__test {
    border: 1.5px dashed var(--color-muted);
  }

  .checkout__test-label {
    color: var(--color-muted);
    font: 500 12px/16px var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .checkout__field {
    display: flex;
    flex-direction: column;
    gap: 6px;

    label {
      font-size: 15px;
      font-weight: 600;
      line-height: 22px;
    }
  }

  .checkout__input {
    background: var(--color-surface);
    border: 1px solid var(--color-muted);
    border-radius: 10px;
    font-size: 17px;
    min-block-size: 52px;
    padding: 0 14px;

    &:focus-visible {
      border-color: var(--color-ink);
    }
  }

  /* On a desktop one card: the photo and its price on the warm band, the totals under them. */
  .order-summary {
    background: var(--color-surface);
    border: 1px solid var(--color-hairline);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .order-summary__item {
    align-items: center;
    background: var(--color-warm);
    border-radius: 14px;
    display: grid;
    gap: 12px;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    padding: 12px 14px;

    @media (min-width: 900px) {
      border-radius: 0;
      gap: 16px;
      grid-template-columns: 96px minmax(0, 1fr) auto;
      padding: 16px 20px;
    }
  }

  .order-summary__photo,
  .order-summary__picture {
    border: 1px solid var(--color-hairline);
    border-radius: 6px;
    inline-size: 100%;
    object-fit: cover;
  }

  .order-summary__photo {
    aspect-ratio: 1;
    block-size: auto;
  }

  .order-summary__picture {
    aspect-ratio: 3 / 2;
  }

  .order-summary__price {
    font: 500 17px/22px var(--font-mono);
  }

  .order-summary__totals {
    display: flex;
    flex-direction: column;
    gap: 6px;

    @media (max-width: 899px) {
      background: var(--color-surface);
      border: 1px solid var(--color-hairline);
      border-radius: 14px;
      padding: 14px 16px 6px;
    }

    @media (min-width: 900px) {
      padding: 14px 20px 8px;
    }
  }

  .order-summary__heading {
    font: 600 17px/24px var(--font-text);
  }

  .flow-card.order-summary__promise {
    padding: 16px;

    @media (min-width: 900px) { padding: 18px 20px; }
  }

  .order-summary__name {
    display: flex;
    flex-direction: column;
  }

  .order-summary__title {
    font-size: 17px;
    font-weight: 600;
    line-height: 22px;
  }

  .order-summary__document {
    color: var(--color-muted);
    font: 500 12px/16px var(--font-mono);
  }

  .order-summary__ticks {
    --icon-size: 22px;

    display: flex;
    flex-direction: column;
    gap: 8px;

    li {
      display: grid;
      font: var(--text-small);
      gap: 10px;
      grid-template-columns: 22px minmax(0, 1fr);
    }

    .icon {
      background-color: var(--color-ink);
    }
  }

  .order-summary__lines {
    display: flex;
    flex-direction: column;
    margin: 0;
  }

  .order-summary__line {
    align-items: center;
    border-block-start: 1px solid var(--color-hairline);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 10px 0;

    &:first-child { border-block-start: 0; }

    dt {
      display: flex;
      flex-direction: column;
      font-size: 16px;
      font-weight: 600;
      line-height: 22px;
    }

    small {
      color: var(--color-muted);
      font: var(--text-caption);
    }

    dd {
      font: 500 15px/22px var(--font-mono);
      margin: 0;
    }
  }

  .order-summary__line--total {
    border-block-start-color: var(--color-ink);

    dt { font: 600 21px/26px var(--font-display); }
    dd { font-size: 22px; }
  }

  /* Where the order stands: with the expert, or verified. */
  .order-status {
    align-items: start;
    background: var(--color-surface);
    border: 1px solid var(--color-ink);
    border-radius: 12px;
    display: grid;
    gap: 12px;
    grid-template-columns: 14px minmax(0, 1fr);
    padding: 14px 16px;
  }

  .order-status__dot {
    block-size: 14px;
    border: 2px dashed var(--color-ink);
    border-radius: 50%;
    inline-size: 14px;
    margin-block-start: 5px;
  }

  .order-status__title {
    font-size: 17px;
    font-weight: 600;
    line-height: 24px;
  }


  /* The paid order, the file first (founder's pick, 17 Nov 2026, design-explorations/order-paid C).
   * On a phone: the title, the file with its button, the status, then the folds. On a desktop
   * the photo has its own column and the rest sits beside it. */
  .paid {
    display: flex;
    flex-direction: column;
    gap: 20px;

    @media (max-width: 899px) {
      .paid__heading { order: 1; }
      .order-file { order: 2; }
      .paid__status { order: 3; }
      .paid__copy { order: 4; font: var(--text-small); }
      .paid__folds { order: 5; }
    }

    @media (min-width: 900px) {
      align-items: start;
      column-gap: 72px;
      display: grid;
      grid-template-areas: "photo heading" "photo copy" "photo name" "photo actions" "photo status" "photo folds";
      grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
      grid-template-rows: auto auto auto auto auto 1fr;
      row-gap: 18px;

      .order-file { display: contents; }
      .paid__heading { grid-area: heading; }
      .paid__copy { grid-area: copy; margin-block-start: -12px; }
      .paid__status { grid-area: status; }
      .paid__folds { grid-area: folds; }
    }
  }

  /* The file: centred in its card on a phone, its photo in a card of its own on a desktop. */
  .flow-card.order-file {
    align-items: center;
    padding: 16px;
    text-align: center;
  }

  .order-file__photo {
    background: var(--color-placeholder);
    border: 1px solid var(--color-hairline);
    border-radius: 12px;
    inline-size: 220px;
    overflow: hidden;
    position: relative;

    @media (min-width: 900px) {
      background: var(--color-surface);
      border-radius: 14px;
      grid-area: photo;
      inline-size: 100%;
      padding: 20px;
    }
  }

  .order-file__image {
    aspect-ratio: 1;
    block-size: auto;
    display: block;
    inline-size: 100%;

    @media (min-width: 900px) {
      border: 1px solid var(--color-hairline);
      border-radius: 10px;
    }
  }

  /* While the edges are filled: the frame over hatching where they will be drawn. */
  .order-file__photo--preparing .order-file__image {
    background: repeating-linear-gradient(-45deg, var(--color-placeholder) 0 6px, var(--color-surface) 6px 12px);
  }

  .order-file__tag {
    background: var(--color-ink);
    border-radius: 4px;
    color: var(--color-on-ink);
    font: 500 11px/16px var(--font-mono);
    inset-block-end: 10px;
    inset-inline-start: 10px;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    position: absolute;
    text-transform: uppercase;

    @media (min-width: 900px) {
      inset-block-end: 30px;
      inset-inline-start: 30px;
    }
  }

  .order-file__chip {
    inset-block-end: 10px;
    inset-inline-start: 10px;
    position: absolute;

    @media (min-width: 900px) {
      inset-block-end: 30px;
      inset-inline-start: 30px;
    }
  }

  .order-file__text {
    display: flex;
    flex-direction: column;
    gap: 2px;

    @media (min-width: 900px) {
      grid-area: name;
      text-align: start;
    }
  }

  .order-file__name {
    font-size: 17px;
    font-weight: 600;
    line-height: 22px;

    @media (min-width: 900px) { font-size: 19px; line-height: 26px; }
  }

  .order-file__meta {
    color: var(--color-muted);
    font: 500 13px/18px var(--font-mono);
  }

  .order-file__actions {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 10px;

    .flow__button { inline-size: 100%; }

    @media (min-width: 900px) {
      align-items: flex-start;
      grid-area: actions;
      text-align: start;

      .flow__button { inline-size: auto; }
    }
  }

  .order-file__gone {
    font: var(--text-small);

    @media (min-width: 900px) { grid-area: actions; text-align: start; }
  }

  /* What happens next and the order summary, each behind one line. */
  .paid__folds {
    display: flex;
    flex-direction: column;
    inline-size: 100%;
  }

  .order-fold {
    border-block: 1px solid var(--color-hairline);

    & + & { border-block-start: 0; }
  }

  .order-fold__summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    font-size: 16px;
    font-weight: 600;
    gap: 12px;
    justify-content: space-between;
    line-height: 22px;
    list-style: none;
    padding: 14px 0;

    &::-webkit-details-marker { display: none; }
  }

  .order-fold__show,
  .order-fold__hide {
    color: var(--color-muted);
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .order-fold__hide,
  .order-fold[open] .order-fold__show {
    display: none;
  }

  .order-fold[open] .order-fold__hide {
    display: inline;
  }

  .order-fold__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-block-end: 14px;
  }

  .order-next {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-block-end: 14px;

    li {
      display: grid;
      font-size: 16px;
      gap: 10px;
      grid-template-columns: 26px minmax(0, 1fr);
      line-height: 24px;
    }
  }

  .order-next__number {
    color: var(--color-muted);
    font: 500 13px/24px var(--font-mono);
  }

  /* After the expert's result (founder's pick, 17 Nov 2026, design-explorations/order-follow-up B).
   * A retake: the photo the expert looked at, the reason and its tip before the button; on a
   * desktop the photo has its own column. A refund or a closing: one column. */
  .follow-up {
    display: flex;
    flex-direction: column;
    gap: 20px;

    &:not(.follow-up--ended) {
      @media (min-width: 900px) {
        align-items: start;
        column-gap: 64px;
        display: grid;
        grid-template-areas: "photo heading" "photo facts" "photo sentence" "photo actions" "photo tips" "photo terms";
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        grid-template-rows: auto auto auto auto auto 1fr;

        .follow-up__look { display: contents; }
      }
    }
  }

  .follow-up--ended {
    max-inline-size: 640px;
  }

  .follow-up__heading {
    @media (min-width: 900px) { grid-area: heading; }
  }

  .follow-up__title {
    font: var(--text-title);
  }

  /* On a phone one card: the photo beside its facts, the reason under them. */
  .follow-up__look {
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-hairline);
    border-radius: 14px;
    display: grid;
    gap: 12px 14px;
    grid-template-columns: 112px minmax(0, 1fr);
    padding: 14px;
  }

  .follow-up__photo {
    display: contents;

    figcaption {
      grid-column: 1 / -1;
      grid-row: 3;
    }

    @media (min-width: 900px) {
      display: flex;
      flex-direction: column;
      gap: 10px;
      grid-area: photo;
      margin: 0;
    }
  }

  .follow-up__image {
    aspect-ratio: 1;
    block-size: auto;
    border: 1px solid var(--color-hairline);
    border-radius: 8px;
    grid-column: 1;
    grid-row: 1;
    inline-size: 100%;
    object-fit: cover;

    @media (min-width: 900px) { border-radius: 14px; }
  }

  .follow-up__facts {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 6px;
    grid-column: 2;
    grid-row: 1;

    .follow-up__look:not(:has(.follow-up__photo)) & {
      grid-column: 1 / -1;
    }

    @media (min-width: 900px) {
      align-items: center;
      flex-direction: row;
      flex-wrap: wrap;
      gap: 8px 18px;
      grid-area: facts;
    }
  }

  .follow-up__fact {
    color: var(--color-muted);
    font: 500 13px/18px var(--font-mono);
  }

  .follow-up__sentence {
    font-size: 17px;
    font-weight: 600;
    grid-column: 1 / -1;
    grid-row: 2;
    line-height: 25px;

    @media (min-width: 900px) {
      font: var(--text-lead);
      grid-area: sentence;
    }
  }

  .follow-up__actions {
    @media (min-width: 900px) { grid-area: actions; }
  }

  .follow-up__tips {
    @media (min-width: 900px) { grid-area: tips; }
  }

  .follow-up__terms {
    @media (min-width: 900px) { grid-area: terms; }
  }

  /* Where the refund is: done, now, next. */
  .flow-card.refund-track {
    gap: 14px;
    padding: 16px;
  }

  .refund-track__step {
    display: grid;
    gap: 2px 12px;
    grid-template-columns: 20px minmax(0, 1fr);

    &::before {
      background: var(--color-ink);
      block-size: 20px;
      content: "";
      grid-row: 1 / span 2;
      inline-size: 20px;
      margin-block-start: 2px;
      mask: url("/assets/icons/tick-688080a7.svg") center / contain no-repeat;
    }

    b {
      font-size: 16px;
      font-weight: 600;
      line-height: 24px;
    }

    span {
      color: var(--color-muted);
      font: var(--text-caption);
    }
  }

  .refund-track__step--done b { color: var(--color-ink); }

  .refund-track__step--now::before {
    mask-image: url("/assets/icons/verdict-wait-76a268a2.svg");
  }

  .refund-track__step--next {
    &::before {
      background: var(--color-on-ink-muted);
      mask-image: url("/assets/icons/verdict-wait-76a268a2.svg");
    }

    b { color: var(--color-muted); }
  }

  .refund-track__step .refund-track__date {
    font: 500 13px/18px var(--font-mono);
  }
}
