@layer components {
  /* ============================================
     Member Profile
     ============================================ */

  .member-profile__header {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 1rem;
    row-gap: 0.5rem;
  }

  .member-profile__name {
    grid-column: 1;
    grid-row: 1;
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    margin: 0;
  }

  .member-profile__badge {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    font-size: var(--text-xl);
  }

  .member-profile__info {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
  }

  .member-profile__actions {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    gap: 0.5rem;
    justify-self: end;
    align-self: end;
  }

  .member-profile__role {
    font-size: var(--text-md);
    font-weight: var(--weight-bold);
    color: var(--color-primary);
  }

  .member-profile__since {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
  }

  .member-profile__skills {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  /* ── Shared skill pill (used on profile + volunteer form) ── */

  .skill-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5ch;
  }

  .skill-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5ch;
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    padding: 0.25rem 0.75rem;
    border-radius: .5rem;
    background-color: color-mix(in oklch, var(--color-primary), transparent 90%);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
  }

  /* Toggleable variant: a <label> wraps a hidden checkbox.
     Unchecked state is muted; checked falls back to the base style above. */
  label.skill-pill {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }

  label.skill-pill:has(input:not(:checked)) {
    background-color: transparent;
    border-color: var(--color-border);
    color: var(--color-text-muted);
  }

  label.skill-pill:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
  }

  label.skill-pill:focus-within {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }

  label.skill-pill input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  /* ── Account page sections ──
     Every card on the account page shares one column layout so the
     Volunteer, Newsletter and Privacy sections line up identically. */

  .account-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* Spacing is owned by the flex `gap`; zero the title margin so it doesn't
     stack on top of it (headings carry margin-block-end: 1ch from base). */
  .account-section > h2 {
    margin-block-end: 0;
  }

  .account-section > p {
    margin: 0;
  }

  /* Definition list of read-only account details. */
  .account-summary {
    align-self: stretch;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1.5rem;
    margin: 0;
  }

  .account-summary dt {
    font-weight: var(--weight-medium);
    color: var(--color-text-muted);
  }

  .account-summary dd {
    margin: 0;
  }

  /* ── Volunteer section ── */

  .volunteer-card__status {
    display: inline-flex;
    align-items: center;
    gap: 0.5ch;
    color: var(--color-primary);
    font-weight: var(--weight-bold);
    font-size: var(--text-md);
  }

  .volunteer-card__sublabel {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 0.5rem;
  }

  .volunteer-card__skills {
    width: 100%;
  }

  /* ── Account deletion ── */

  /* Its own card, given a subtle red identity so the destructive action
     reads as a danger zone without nesting a box inside another card. */
  .card--danger {
    border-color: color-mix(in oklch, var(--color-negative), transparent 50%);
    background-color: color-mix(in oklch, var(--color-negative), transparent 96%);
  }

  /* Mobile-first: body then action stacked. From 34rem up: body left, action
     right, on one row. */
  .account-danger__row {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  /* Action block: full-width button with the hint below it. */
  .account-danger__action {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .account-danger__action .btn--hold {
    width: 100%;
  }

  /* width:0 + min-width:100% makes the hint fill (and wrap to) the button's
     width without ever widening the column past the button. */
  .account-danger__hint {
    width: 0;
    min-width: 100%;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-align: center;
  }

  @media (min-width: 34rem) {
    .account-danger__row {
      flex-direction: row;
      align-items: flex-start;
      justify-content: space-between;
      gap: 1.5rem;
    }

    /* Action shrinks to its button; button + hint right-aligned. */
    .account-danger__action {
      flex-shrink: 0;
      align-items: flex-end;
    }

    .account-danger__action .btn--hold {
      width: auto;
    }
  }

  /* Press-and-hold button: a fill sweeps left→right while held.
     Driven by hold_to_confirm_controller via inline transform/transition. */
  .btn--hold {
    position: relative;
    overflow: hidden;
    /* Block long-press text selection / callout on touch devices. */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
  }

  .btn--hold__fill {
    position: absolute;
    inset: 0;
    transform: scaleX(0);
    transform-origin: left center;
    background-color: rgba(0, 0, 0, 0.28);
    pointer-events: none;
  }

  .btn--hold__label {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5ch;
  }

  /* ── Activity feed ── */

  .member-activity {
    display: grid;
    gap: 1rem;
  }

  .member-activity a {
    text-decoration: none;
    color: inherit;
  }

  .member-activity__empty {
    color: var(--color-text-muted);
  }

  /* ── Member link (no underline on show pages) ── */

  .member-link {
    color: inherit;
    text-decoration: none;
  }
}