/* Containers: white rounded surfaces on the canvas. No borders; inside a card, fills go back to ink at 8%. */
@layer components {
  .card {
    --fill: var(--color-ink-8);
    --fill-hover: var(--color-ink-12);

    display: grid;
    gap: var(--space-4);
    align-content: start;
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
  }

  .card__title { font-size: var(--text-2xl); letter-spacing: var(--tracking-heading); line-height: var(--leading-snug); }

  /* A card holding a form is as wide as the form, not the page. */
  .card:has(> .form) { max-width: calc(var(--form-width) + 2 * var(--space-6)); }

  .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: var(--space-4); }

  /* The plan chooser: one Monthly or Yearly toggle for every card, which hides the other interval's prices. */
  .plans { display: grid; gap: var(--space-6); justify-items: center; }
  /* Each option as wide as its words, so "Yearly · 2 months free" stays on one line on a phone. */
  .plans .segmented { grid-auto-columns: auto; }
  .plans .cards { width: 100%; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
  .plans:has([value="month"]:checked) .plans__year,
  .plans:has([value="year"]:checked) .plans__month { display: none; }

  /* A plan card: name and price, what it includes, then its one action pinned to the bottom so the cards line up. */
  .plan { display: flex; flex-direction: column; }
  .plan__action { margin-top: auto; }

  /* A list of what's included, each with a tick. */
  .checks { display: grid; gap: var(--space-2); }
  .checks li { position: relative; padding-inline-start: var(--space-6); }
  .checks li::before { content: "✓"; position: absolute; inset-inline-start: 0; font-weight: var(--weight-bold); }

  /* An event's summary as a lead over its description, and the policy as a fact under them. */
  .about-card { gap: var(--space-5); }
  .about-card__lead { max-width: 40rem; font-size: var(--text-xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-snug); line-height: var(--leading-snug); text-wrap: pretty; }
  .about-card .prose { display: grid; gap: var(--space-3); }

  /* A big number and what it counts */
  .stat { display: grid; gap: var(--space-1); }
  .stat__value { font-size: var(--text-3xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-heading); line-height: 1; font-variant-numeric: tabular-nums; }

  .empty {
    display: grid;
    gap: var(--space-4);
    justify-items: center;
    padding: var(--space-12) var(--space-6);
    text-align: center;
  }

  /* A message inside the page, about the thing next to it: butter for a condition, mint or coral for a result. */
  .callout {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    background: var(--color-butter);
    font-weight: var(--weight-bold);
  }

  .callout--notice { background: var(--color-notice); }
  .callout--alert { background: var(--color-alert); }
  /* A notice: the loud message about the whole account, such as a lapsed plan. White, with a coral-to-sky gradient edge
     (the one exception to "no borders"), mixed by hue so its middle never turns grey, and a coral glow, never a grey shadow. */
  .notice {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4) var(--space-8);
    align-items: center;
    min-height: 9rem;
    padding: var(--space-6) var(--space-8);
    border: 4px solid transparent;
    border-radius: var(--radius-lg);
    background:
      linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
      linear-gradient(in oklch 120deg, var(--color-coral), var(--color-sky)) border-box;
    box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--color-coral) 70%, transparent);
  }

  .notice__text { display: grid; flex: 1 1 24rem; gap: var(--space-1); font-size: var(--text-lg); }
  .notice__action { flex: none; }
}

/* Colour swatches on the design system page */
@layer components {
  .swatch {
    display: grid;
    align-content: end;
    width: 7rem;
    height: 5rem;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--band);
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
  }

  .swatch--ink { background: var(--color-ink); color: var(--color-on-button); }
  .swatch--button { background: var(--color-button); color: var(--color-on-button); }

  /* A person as a name badge: a white card whose pastel top, with their name, waves into the body. */
  .badge { border-radius: var(--radius-lg); background: var(--color-surface); overflow: hidden; }
  .badge__top { display: grid; gap: var(--space-1); padding: var(--space-6) var(--space-6) var(--space-2); }
  .badge .wave { height: var(--space-6); margin-top: -1px; background: var(--band); fill: var(--color-surface); }
  .badge__body { padding: var(--space-2) var(--space-6) var(--space-6); }
  .badge__name { margin-bottom: var(--space-2); font-size: var(--text-3xl); letter-spacing: var(--tracking-display); line-height: var(--leading-tight); }
  .badge__work { font-weight: var(--weight-bold); }

  /* On a phone the badge reaches the screen's edges, as the bands do. */
  @media (max-width: 767px) {
    .badge { margin-inline: calc(-1 * var(--gutter)); border-radius: 0; }
  }
}
