@layer sections {
  /* Modal do formulário de depoimento (<dialog> nativo) */
  html:has(.modal[open]) {
    overflow: hidden;
  }

  .modal {
    width: min(100% - 1.5rem, 40rem);
    max-width: none;
    max-height: calc(100dvh - 1.5rem);
    margin: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-white);
    overflow: visible;
  }

  .modal::backdrop {
    background: rgb(2 25 73 / 0.72);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }

  .modal[open] {
    animation: modal-in var(--dur-base) var(--ease-out) both;
  }

  .modal[open]::backdrop {
    animation: modal-fade var(--dur-base) var(--ease-out) both;
  }

  @keyframes modal-in {
    from {
      opacity: 0;
      transform: translateY(1.25rem) scale(0.98);
    }

    to {
      opacity: 1;
      transform: none;
    }
  }

  @keyframes modal-fade {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }

  .modal__panel {
    position: relative;
    max-height: calc(100dvh - 1.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    border: 1.5px solid var(--color-yellow);
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-blue-800), var(--color-blue-700) 55%, var(--color-blue-600));
    box-shadow: 0 1.5rem 3rem -1rem rgb(2 25 73 / 0.7);
  }

  .modal__panel::-webkit-scrollbar {
    display: none;
  }

  .modal__body {
    padding: 2.25rem 1.25rem 1.5rem;
  }

  .modal__body--done {
    display: grid;
    justify-items: center;
    gap: 1rem;
    padding-block: 3rem;
    text-align: center;
  }

  /* O display:grid acima vencia o atributo hidden: a mensagem aparecia o tempo todo */
  .modal__body[hidden] {
    display: none;
  }

  .modal__title {
    padding-right: 2.5rem;
    font-size: clamp(1.5rem, 6vw, 2.25rem);
    font-weight: var(--fw-black);
    line-height: 1.1;
    text-transform: uppercase;
  }

  .modal__lead {
    margin-top: 0.5rem;
    font-size: 1rem;
    font-weight: var(--fw-bold);
    line-height: 1.3;
    opacity: 0.9;
  }

  .modal__req {
    color: var(--color-yellow);
  }

  /* Fica fora do painel rolável: o X não some quando o formulário rola */
  .modal__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-pill);
    transition: background-color var(--dur-fast) var(--ease-out), rotate var(--dur-base) var(--ease-out);
  }

  .modal__close::before,
  .modal__close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.2rem;
    height: 2px;
    margin: -1px 0 0 -0.6rem;
    border-radius: 2px;
    background: var(--color-white);
  }

  .modal__close::before {
    rotate: 45deg;
  }

  .modal__close::after {
    rotate: -45deg;
  }

  .modal__close:hover {
    background: rgb(255 255 255 / 0.15);
    rotate: 90deg;
  }

  .modal__close:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
  }

  /* Formulário em etapas (conte-sua-historia/): o visual dele vem de conte-sua-historia.css, bloco ".modal .csh" */
  .modal__panel {
    padding: 3.5rem 1.25rem 1.75rem;
  }

  @media (min-width: 640px) {
    .modal__panel {
      padding: 3.5rem 2.5rem 2.25rem;
    }
  }

  /* A página está com zoom 0.75 no desktop (base.css): compensa a altura em dvh */
  @media (min-width: 1024px) {
    .modal,
    .modal__panel {
      max-height: calc((100dvh - 1.5rem) / 0.75);
    }
  }


  /* ===== Modal de transmissões (js/modules/live.js) ===== */
  .modal--live {
    width: min(100% - 1.5rem, 56rem);
  }

  .live-modal__kicker {
    margin-bottom: 0.35rem;
    color: var(--color-yellow);
    font-size: 0.9rem;
    font-weight: var(--fw-extrabold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .live-player {
    margin-top: 1.25rem;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 1rem;
    background: #000;
  }

  .live-player[hidden] {
    display: none;
  }

  .live-player:not([hidden]) {
    animation: live-player-open 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  @keyframes live-player-open {
    from {
      opacity: 0;
      transform: translateY(-0.75rem) scale(0.96);
      clip-path: inset(0 0 100% 0 round 1rem);
    }
    to {
      opacity: 1;
      transform: none;
      clip-path: inset(0 0 0 0 round 1rem);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .live-player:not([hidden]) {
      animation: none;
    }
  }

  .live-player iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
  }

  .live-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }

  .live-list[hidden] {
    display: none;
  }

  .live-list__item {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgb(255 255 255 / 0.14);
    border-radius: var(--radius-sm);
    background: rgb(2 25 73 / 0.45);
  }

  .live-list__when {
    display: grid;
    justify-items: center;
    width: 4.75rem;
    padding: 0.45rem 0.5rem;
    border-radius: 0.75rem;
    background: var(--color-yellow);
    color: var(--color-navy);
    line-height: 1.1;
    text-align: center;
  }

  .live-list__date {
    font-size: 1.05rem;
    font-weight: var(--fw-black);
    text-transform: uppercase;
  }

  .live-list__time {
    font-size: 0.85rem;
    font-weight: var(--fw-extrabold);
  }

  .live-list__name {
    font-size: 1rem;
    font-weight: var(--fw-extrabold);
    line-height: 1.25;
  }

  .live-list__place {
    margin-top: 0.2rem;
    font-size: 0.85rem;
    font-weight: var(--fw-bold);
    line-height: 1.3;
    opacity: 0.75;
  }

  /* Mobile: Assistir + compartilhar ocupam a linha inteira embaixo */
  .live-list__actions {
    position: relative;
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    gap: 0.5rem;
  }

  .live-list__cta {
    flex: 1;
    min-width: 0;
    min-height: 2.5rem;
    font-size: 1rem;
  }

  .live-share {
    position: relative;
    display: flex;
    justify-content: center;
    margin-top: 0.75rem;
  }

  .live-share[hidden] {
    display: none;
  }

  /* Minimalista: pílula só com contorno, igual ao ícone anterior; amarela no hover */
  .live-share__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding: 0 1.25rem;
    border: 2px solid rgb(255 255 255 / 0.5);
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font-size: 0.95rem;
    font-weight: var(--fw-extrabold);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  }

  .live-share__button:hover,
  .live-share__button:focus-visible {
    border-color: var(--color-yellow);
    background: var(--color-yellow);
    color: var(--color-navy);
  }

  .live-share__button svg {
    flex: none;
    width: 1.1rem;
    height: 1.1rem;
  }

  .live-list__share-status {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.35rem);
    transform: translateX(-50%);
    padding: 0.25rem 0.6rem;
    border-radius: 0.5rem;
    background: var(--color-yellow);
    color: var(--color-navy);
    font-size: 0.8rem;
    font-weight: var(--fw-extrabold);
    white-space: nowrap;
    pointer-events: none;
  }

  .live-list__share-status:empty {
    display: none;
  }

  .live-list__cta--soon {
    --tag-bg: transparent;
    --tag-border: rgb(255 255 255 / 0.35);
    color: rgb(255 255 255 / 0.7);
    cursor: default;
  }

  .live-list__cta--soon:hover,
  .live-list__cta--soon:active {
    transform: none;
    filter: none;
  }

  .live-list__empty {
    margin-top: 1.5rem;
    padding: 1.25rem;
    border: 1px dashed rgb(255 255 255 / 0.3);
    border-radius: var(--radius-sm);
    font-weight: var(--fw-bold);
    text-align: center;
    opacity: 0.85;
  }

  @media (min-width: 640px) {
    .live-list__item {
      grid-template-columns: auto 1fr auto;
    }

    .live-list__actions {
      grid-column: auto;
    }

    .live-list__cta {
      flex: none;
      min-width: 8.5rem;
    }
  }

  /* Desktop: .tag-button ganha largura/fonte em --px (buttons.css); no modal mantém o tamanho compacto */
  @media (min-width: 1024px) {
    .live-list__cta {
      width: auto;
      min-height: 2.5rem;
      font-size: 1rem;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .modal[open],
    .modal[open]::backdrop {
      animation: none;
    }

    .modal__close:hover {
      rotate: none;
    }
  }
}
