/* The last screen before the footer, and the second most seen part of
   the page. Same indigo band as the hero, same weight, so the page
   closes where it opened. Two columns above 62rem, one below. */

@layer components {
  .demo {
    background: var(--color-deep);
    color: var(--color-on-deep);
    background-image: radial-gradient(
      100% 120% at 12% 100%,
      color-mix(in oklch, var(--color-berry) 38%, transparent) 0%,
      transparent 60%
    );
  }

  .demo__inner {
    display: grid;
    gap: var(--space-xl);
    align-items: start;
  }

  .demo__intro .label {
    color: var(--color-muted-on-deep);
  }

  .demo__title {
    margin-block-start: var(--space-xs);
    font-size: var(--step-4);
    font-weight: 700;
  }

  .demo__intro p {
    margin-block-start: var(--space-m);
    color: var(--color-muted-on-deep);
  }

  .demo__sent {
    padding: var(--space-m);
    border: 1px solid var(--color-line-on-deep);
    border-radius: var(--radius-lg);
    background: var(--color-wash-on-deep);
  }

  .demo__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-s);
  }

  /* align-content: end keeps the inputs on one line across a row even
     when one label wraps to two. */
  .field {
    display: grid;
    align-content: end;
    gap: var(--space-3xs);
    max-inline-size: none;
  }

  .field--wide {
    grid-column: 1 / -1;
  }

  /* A submit button the width of the whole form reads as a banner,
     not as a control. */
  .demo__fields .button {
    justify-self: start;
    margin-block-start: var(--space-2xs);
  }

  .field__label {
    font-family: var(--font-display);
    font-size: var(--step--1);
    font-weight: 600;
    font-stretch: var(--width-label);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--color-muted-on-deep);
  }

  .field__input {
    inline-size: 100%;
    padding: var(--space-xs) var(--space-s);
    border: 1px solid var(--color-line-on-deep);
    border-radius: var(--radius);
    background: var(--color-wash-on-deep);
    color: var(--color-on-deep);
    font-family: inherit;
    font-size: var(--step-0);
    transition: border-color var(--motion), background-color var(--motion);
  }

  .field__input::placeholder {
    color: color-mix(in oklch, var(--color-muted-on-deep) 70%, transparent);
  }

  .field__input:hover,
  .field__input:focus-visible {
    border-color: var(--color-on-deep);
  }

  /* The native select popup is painted by the operating system, so
     its options need a readable ground of their own. */
  .field__input option {
    background: var(--color-deep);
    color: var(--color-on-deep);
  }

  .field__error {
    font-size: var(--step--1);
    color: var(--color-on-accent);
    background: var(--color-accent);
    border-radius: var(--radius);
    padding: var(--space-3xs) var(--space-2xs);
    justify-self: start;
  }

  @media (min-width: 62rem) {
    .demo__inner {
      grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
      gap: var(--space-2xl);
    }

    .demo__intro {
      position: sticky;
      inset-block-start: 6rem;
    }
  }
}
