/* Capitolo: apre un gruppo di sezioni (titolo, descrizione, link alle sezioni che seguono) e lo chiude
   (.chapter.close: descrizione per chi vende e azioni). Banner: foto con velo scuro e invito finale. */

@layer components {
  .chapter {
    display: grid;
    gap: 18px;
    padding: clamp(32px, 5vw, 72px);
    border-radius: var(--r-lg);
    background: var(--ink);
    color: var(--on-ink);

    & h2 { font-size: var(--step-head); max-width: 22ch; }
    & > p { max-width: 58ch; color: var(--on-ink-soft); }

    & .links { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
    & .links a {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      height: 42px;
      padding: 0 18px;
      border-radius: var(--r-pill);
      background: color-mix(in srgb, var(--on-ink) 10%, transparent);
      color: var(--on-ink);
      font-size: var(--step-small);
      font-weight: 500;
      text-decoration: none;
      transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
    }
    & .links a:hover { background: var(--on-ink); color: var(--ink); transform: translateY(-2px); }
    & .links .icon { width: 16px; height: 16px; }

    /* chiusura: fondo chiaro, testo a sinistra e azioni a destra */
    &.close {
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: end;
      column-gap: clamp(24px, 4vw, 64px);
      background: var(--accent-soft);
      color: var(--ink);

      & > p { color: var(--ink); }
      & h2, & > p { grid-column: 1; }
      & .actions { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; gap: 10px; }
    }
  }
  @media (max-width: 1080px) {
    .chapter.close { grid-template-columns: minmax(0, 1fr); }
    .chapter.close .actions { grid-column: 1; grid-row: auto; }
  }

  .banner {
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    min-height: 420px;
    overflow: hidden;
    border-radius: var(--r-lg);
    color: var(--on-ink);
    text-align: center;

    & > img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
    &::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--scrim); }
    & .text { display: grid; justify-items: center; gap: 18px; max-width: 44rem; padding: 48px 24px; }
    & h2 { font-size: var(--step-head); }
  }
}
