/* Refinamientos de reflow, interacción y accesibilidad. */

main {
  overflow: visible;
}

:where(
  .site-header__inner > *,
  .opening > *,
  .route-opening > *,
  .section-heading > *,
  .story-entry > *,
  .editorial-band > *,
  .edition-intro > *,
  .edition-entry > *,
  .process-step > *,
  .image-spread > *,
  .image-spread__notes > *,
  .gift-finder__form > *,
  .piece-opening > *,
  .piece-facts > *,
  .brand-section__grid > *,
  .brand-signatures > *,
  .brand-rule > *,
  .type-specimen > *,
  .palette-ledger > *,
  .brand-application > *,
  .campaign-entry > *,
  .campaign-visuals > *,
  .campaign-message > *,
  .closing-band__inner > *,
  .site-footer__grid > *,
  .site-footer__end > *
) {
  min-width: 0;
}

:where(h1, h2, h3, p, li, dt, dd, figcaption, label) {
  overflow-wrap: break-word;
  word-break: normal;
}

:where(.text-action, .action-primary, .action-secondary, .brand-name__line) {
  overflow-wrap: anywhere;
}

.site-footer a,
.campaign-visuals figcaption a {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

:where(a, button, select):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

main#contenido[tabindex="-1"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.menu-button,
.gift-finder__submit,
.piece-gallery__controls button {
  min-width: 44px;
  min-height: 44px;
}

.gift-field select[aria-invalid="true"] {
  border: 2px solid var(--berry-dark);
}

.gift-result[data-state="error"],
.gift-result[data-state="success"] {
  padding-inline: 18px;
  border-left: 3px solid var(--berry-dark);
}

.gift-result[data-state="error"] {
  background: var(--paper-deep);
}

.gift-result[data-state="success"] {
  border-left-color: var(--blue);
}

.piece-gallery,
.piece-gallery__stage {
  min-width: 0;
  overflow: visible;
}

.piece-gallery__stage img {
  width: min(100%, 630px);
  height: auto;
  max-height: none;
  object-fit: contain;
  transform: none;
}

@media (max-width: 860px) {
  .site-footer__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-footer__intro {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .site-header__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .brand-name {
    max-width: 100%;
    min-width: 0;
  }

  .brand-name__line {
    max-width: 100%;
    white-space: normal;
  }

  .menu-button {
    width: auto;
    min-width: 48px;
    padding: 10px 12px;
    white-space: nowrap;
  }

  .page-piece .piece-gallery__stage {
    height: auto;
    aspect-ratio: 1 / 1;
    overflow: visible;
  }

  .page-piece .piece-gallery__stage img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    transform: none;
  }
}

@media (min-width: 761px) and (max-width: 900px) {
  .page-collection .catalog-opening {
    grid-template-columns: minmax(0, 0.84fr) minmax(0, 1.16fr);
  }
}

@media (max-width: 760px) {

  .section-heading,
  .edition-intro,
  .closing-band__inner,
  .brand-section__grid,
  .editorial-band,
  .brand-application,
  .campaign-entry,
  .gift-finder__form {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-collection .catalog-opening {
    grid-template-columns: minmax(0, 1fr);
  }

  .story-entry,
  .process-step {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .edition-entry {
    grid-template-columns: 42px minmax(110px, 0.55fr) minmax(0, 1fr);
  }

  .edition-entry__details,
  .campaign-message div,
  .type-specimen {
    grid-template-columns: minmax(0, 1fr);
  }

  .piece-facts div {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  }

  .brand-rule {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .piece-gallery__stage img {
    width: min(100%, 520px);
  }
}

@media (max-width: 390px) {
  .edition-entry {
    grid-template-columns: 32px 128px minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }
}

@media (forced-colors: active) {
  .gift-field select[aria-invalid="true"],
  .gift-result[data-state="error"],
  .gift-result[data-state="success"],
  .piece-gallery__controls button[aria-pressed="true"] {
    border-color: currentColor;
  }
}
