/*
 * Camada responsiva do site Unilabor.
 * Mantem os componentes dentro da largura util e corrige composicoes mobile
 * sem alterar os breakpoints de desktop.
 */

@media (max-width: 47.99rem) {
  body.biograph-theme :where(main, section, article, .shell, .ubx-shell) {
    min-width: 0;
  }

  body.biograph-theme :where(img, video, iframe) {
    max-width: 100%;
  }

  body.biograph-theme :where(.shell, .ubx-shell) > * {
    min-width: 0;
  }

  /* Localizador de unidades */
  body.biograph-theme .page-section--unidades_mapa .unit-finder__heading {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 0.875rem;
    margin-bottom: 1.5rem;
    text-align: center;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-finder__heading > div {
    display: grid;
    min-width: 0;
    justify-items: center;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-finder__heading h2 {
    max-width: 15ch;
    font-size: clamp(2rem, 10vw, 2.75rem);
    line-height: 1.04;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-finder__heading > p {
    max-width: 32rem;
    font-size: 0.9375rem;
    line-height: 1.55;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-stage {
    min-width: 0;
  }

  /* O link continua acessivel pelo teclado, mas nao invade o titulo. */
  body.biograph-theme .page-section--unidades_mapa .unit-stage__skip:not(:focus):not(:focus-visible) {
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    transform: none;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-stage__skip:focus,
  body.biograph-theme .page-section--unidades_mapa .unit-stage__skip:focus-visible {
    width: auto;
    height: auto;
    margin: 0;
    padding: 0.75rem 1rem;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    transform: none;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-panel__head {
    min-width: 0;
    padding: 1rem;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-search,
  body.biograph-theme .page-section--unidades_mapa .unit-search input {
    min-width: 0;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-inline: 0;
    padding-inline: 0;
    overflow: visible;
    gap: 0.5rem;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-filters button {
    min-height: 2.5rem;
    padding-inline: 0.875rem;
    white-space: normal;
  }

  body.biograph-theme .page-section--unidades_mapa .units-map {
    width: 100%;
    min-width: 0;
    min-height: 25rem;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-map-controls {
    top: 0.5rem;
    right: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  body.biograph-theme .page-section--unidades_mapa .unit-map-card {
    right: 0.75rem;
    bottom: 0.75rem;
    left: 0.75rem;
    width: auto;
    max-width: none;
  }

  body.biograph-theme .page-section--unidades_mapa :where(.unit-panel__list, .unit-item, .unit-item__summary, .unit-item__details) {
    min-width: 0;
  }

  /* Paginas editoriais e contato: impede a coluna pelo tamanho intrinseco. */
  body.biograph-theme .ubx-editorial {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  body.biograph-theme :where(.ubx-editorial__content, .ubx-editorial__media, .ubx-directory, .ubx-directory__toolbar, .ubx-directory__list, .ubx-directory-card, .ubx-directory-card__body, .contact-team-photo) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  body.biograph-theme :where(.ubx-directory-card__title, .ubx-directory-card__copy, .ubx-directory-card__facts) {
    overflow-wrap: anywhere;
  }

  body.biograph-theme .ubx-directory-card__actions > * {
    max-width: 100%;
  }

  /* Filtros do blog: todas as categorias permanecem visiveis sem corte. */
  body.biograph-theme.page-blog .blog-filters {
    flex-wrap: wrap;
    justify-content: center;
    margin-inline: 0;
    padding-inline: 0;
    overflow: visible;
  }

  body.biograph-theme.page-blog .blog-filters button {
    min-height: 2.5rem;
    padding-inline: 0.875rem;
  }

  /* Controles e formularios respeitam a largura disponivel. */
  body.biograph-theme :where(input, select, textarea, button) {
    max-width: 100%;
  }

  body.biograph-theme :where(.ubx-actions, .ubx-page-intro__actions, .ubx-editorial__actions, .ubx-callout__actions) {
    min-width: 0;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-beacon__label {
    width: max-content;
    max-width: min(10rem, calc(100vw - 4rem));
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 22rem) {
  body.biograph-theme.page-home .page-section--hero .hero__trust-copy {
    width: 100%;
    max-width: calc(100vw - 2rem);
    text-align: center;
  }

  body.biograph-theme.page-home .page-section--hero .hero__trust-copy > span {
    white-space: normal;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-panel__head {
    padding-inline: 0.75rem;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-filters button {
    flex: 1 1 calc(50% - 0.25rem);
    padding-inline: 0.625rem;
  }

  body.biograph-theme .page-section--unidades_mapa .unit-filters button:last-child {
    flex-basis: 100%;
  }
}