/* Mobile audit overrides.
   Scoped, additive, and intentionally separate from the approved desktop stylesheet. */

/* Sala de Leitura: explicit gallery class replaces the fragile inline-style selector. */
.sala-sequence-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 820px) {
  .sala-sequence-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (max-width: 430px) {
  .sala-sequence-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  /* Sintaxe: keep the grammatical analysis readable on narrow phones. */
  .parse {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .parse > div {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--rule);
  }

  .parse dt { margin: 0; }

  .parse dd {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

/* Homepage mobile hero refinement */
@media (max-width: 820px) {
  /* The carousel stage follows the tallest selected work (936 × 1024).
     Every slide occupies this same field; landscape works are centered
     without cropping, so the index below no longer shifts vertically. */
  .home-page .hero-figure--work,
  .home-page #hero-figure {
    width: 100%;
    height: auto !important;
    aspect-ratio: 936 / 1024 !important;
    overflow: hidden;
    background: var(--white);
    transition: none !important;
  }

  .home-page #hero-figure .hero-slide {
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
  }

  .home-page #hero-figure .hero-slide picture.hero-picture {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .home-page #hero-figure .hero-slide img {
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain !important;
  }

  /* On mobile the hero is purely visual. The catalogue below carries
     title, medium and date information. */
  .home-page .hero-caption {
    display: none;
  }

  .home-page .hero-dots {
    margin-top: 10px;
  }

  /* The editorial callout remains present, but no longer competes
     typographically with the work title and cover. */
  .home-anatomia blockquote {
    font-size: 22px;
    line-height: 1.42;
    max-width: 28ch;
    margin-bottom: 34px;
  }
}

@media (max-width: 430px) {
  .home-anatomia blockquote {
    font-size: 20px;
    line-height: 1.45;
  }
}

/* Homepage mobile hero correction v2 */
@media (max-width: 820px) {
  .home-page .hero-stage {
    position: relative;
  }

  .home-page .hero-figure--work,
  .home-page #hero-figure {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 936 / 1024 !important;
    overflow: hidden !important;
    background: var(--white) !important;
  }

  /* Override the later shared-media rule that changes hero slides to
     position:static and lets each asset determine the stage height. */
  .home-page #hero-figure .hero-slide {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  .home-page #hero-figure .hero-slide.on {
    display: flex !important;
  }

  .home-page #hero-figure .hero-slide picture.hero-picture {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .home-page #hero-figure .hero-slide img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
  }

  .home-page .hero-arrow {
    top: 50% !important;
    transform: translateY(-50%) !important;
  }
}

/* Homepage mobile index and caption consistency */
@media (max-width: 820px) {
  /* Keep the editorial category title in the same visual system as the
     other index groups. */
  .home-page #index .index-group[data-cat="editorial"] .group-label {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.01em;
  }

  /* One caption system across the homepage: mono, muted, left aligned,
     with title/detail stacked consistently on small screens. */
  .home-page .project-caption,
  .home-page .materia-archive-caption,
  .home-page .home-media-caption {
    display: block;
    margin-top: 8px;
    margin-bottom: 24px;
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.45;
    letter-spacing: .04em;
    color: var(--muted);
    text-align: left;
    text-transform: lowercase;
  }

  .home-page .project-caption > *,
  .home-page .materia-archive-caption > *,
  .home-page .home-media-caption > * {
    display: block;
    text-align: left !important;
  }

  .home-page .home-media-caption {
    max-width: 34ch;
  }

  .home-page .painting-exhibition figcaption.project-caption,
  .home-page .sala-document-constellation figcaption.project-caption {
    margin-top: 8px;
    margin-bottom: 20px;
  }
}

/* Hero caption removed across all viewport sizes */
.home-page .hero-caption {
  display: none !important;
}


/* Shared lightbox + gated editorial access */
a[data-lightbox] {
  display: block;
  cursor: zoom-in;
}

body.lightbox-open {
  overflow: hidden;
}

.site-lightbox[hidden] {
  display: none;
}

.site-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(255, 255, 255, .96);
}

.site-lightbox img {
  display: block;
  max-width: min(96vw, 1800px);
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.site-lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 2;
  border: 0;
  background: transparent;
  font: 28px/1 var(--font-sans);
  cursor: pointer;
}

.anatomia-gate {
  min-height: 68vh;
}

.anatomia-gate-form {
  width: min(360px, 100%);
  margin-top: 48px;
  display: grid;
  gap: 10px;
}

.anatomia-gate-form label,
.anatomia-gate-error {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.anatomia-gate-form input {
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--black);
  border-radius: 0;
  background: transparent;
  font: inherit;
  outline: none;
}

.anatomia-gate-form button {
  justify-self: start;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.home-feature-link--under-title {
  margin-top: 8px;
  margin-bottom: 28px;
}
