/* Vitrine pública. */

:root {
  color-scheme: light dark;
  --bg: #fff;
  --ink: #111;
  --on-ink: #fff;
  --muted: #5f5f5f;
  --surface: #f1f1f1;
  --surface-strong: #e6e6e6;
  --surface-hover: #dcdcdc;
  --line: #e4e4e4;
  --bar: #111;
  --backdrop: rgb(0 0 0 / .5);
  --photo-filter: none;
  --sold-opacity: .45;
  --radius: 12px;
  --radius-small: 8px;
  --gutter: 16px;
  --locked-gap: 0px;
  --page: 1280px;
  --chrome-top: 48px;
  --bar-height: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --ink: #f2f2f2;
    --on-ink: #111;
    --muted: #a8a8a8;
    --surface: #222;
    --surface-strong: #333;
    --surface-hover: #404040;
    --line: #2e2e2e;
    --bar: #2a2a2a;
    --backdrop: rgb(0 0 0 / .7);
    /* O piso claro das fotos brilharia demais em volta. */
    --photo-filter: brightness(.9);
    /* Peça quase preta esmaecida sumiria no fundo escuro. */
    --sold-opacity: .6;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
/* Trava o fundo sem a página pular: a barra de rolagem some, e site.js mede a largura
   dela, que vira folga no corpo e dentro da barra de seleção, fixa. A barra continua até
   a borda da tela, para não sobrar um degrau claro ao lado dela. */
html:has(dialog[open]) {
  --locked-gap: var(--scrollbar-gap, 0px);
  overflow: hidden;
}

body {
  margin: 0;
  padding-right: var(--locked-gap);
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1, h2, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
img, svg { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.icon { stroke-linecap: round; stroke-linejoin: round; }

/* Sem JS, nenhum controle morto: site.js marca o <html> com .js ao rodar. */
html:not(.js) [data-select] { display: none; }

/* ---------- cabeçalho ---------- */

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name count" "tagline tagline";
  align-items: baseline;
  column-gap: 12px;
  max-width: var(--page);
  margin-inline: auto;
  padding: 8px var(--gutter) 0;
}

.site-name {
  grid-area: name;
  font-size: 20px;
  font-weight: 600;
  line-height: 24px;
}
.site-name a { text-decoration: none; }

.site-count {
  grid-area: count;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.site-tagline {
  grid-area: tagline;
  display: flex;
  flex-wrap: wrap;
  column-gap: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}
.site-tagline li:not(:last-child)::after { content: " \00b7"; }

/* Barra curta das páginas que não são a lista. */
.site-header--compact {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-areas: none;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 5;
  height: var(--chrome-top);
  column-gap: 0;
  padding: 0 4px;
  background: var(--bg);
}
.site-header--compact .site-name {
  grid-area: auto;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- filtros ---------- */

.filters {
  position: sticky;
  top: 0;
  z-index: 5;
  overflow-x: auto;
  background: var(--bg);
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

.filters__list {
  display: flex;
  gap: 6px;
  width: max-content;
  min-width: 100%;
  padding-inline: var(--gutter);
}

/* O alvo tem 44 px; a pílula desenhada dentro dele, 34. As medidas deixam o começo da
   próxima pílula à vista a 390 px, para ficar claro que a fila continua. */
.filters__item {
  display: flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  white-space: nowrap;
}
.filters__label {
  padding: 0 10px;
  background: var(--surface);
  border-radius: 999px;
  font-size: 14px;
  line-height: 34px;
}
.filters__item[aria-current] .filters__label { background: var(--ink); color: var(--on-ink); }
.filters__item:focus-visible { outline: none; }
.filters__item:focus-visible .filters__label { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- grade ---------- */

/* Cada card ocupa duas linhas da grade (foto e legenda). Com subgrid, os vizinhos dividem
   as duas: fotos e preços de uma fileira ficam alinhados, e a altura da foto é a do
   maior recorte da fileira. Quem não tem subgrid fica com cada card na própria altura. */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 8px;
  max-width: var(--page);
  margin-inline: auto;
  padding: 2px var(--gutter) 16px;
}

.grid__item,
.card,
.card__link {
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  min-width: 0;
}

.card { position: relative; }

.card__link { text-decoration: none; }
.card__link:focus-visible { border-radius: var(--radius); }

/* A altura vem do ::before, não de aspect-ratio, para a foto poder crescer até a do
   vizinho mais alto. O recorte tira só o alto da foto: a peça fica embaixo. */
.card__media {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius);
}
.card__media::before {
  content: "";
  display: block;
  padding-top: calc(100% * 4 / 3);
}
.card__media--portrait::before { padding-top: 125%; }
.card__media--square::before { padding-top: 100%; }

.card__photo,
.card__placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.card__photo {
  object-fit: cover;
  object-position: 50% 100%;
  filter: var(--photo-filter);
}

.card__body {
  display: flex;
  flex-direction: column;
  padding: 8px 0 18px;
}

.card__title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
}

.card__sub {
  margin-top: 1px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}
.card__size { white-space: nowrap; }
.card__brand:not(:only-child)::after { content: " \00b7"; }

/* Logo abaixo do texto: legenda sem subtítulo não deixa vão. */
.card__price {
  padding-top: 3px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 20px;
}

.card__select {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
}
.card__select:focus-visible { outline-offset: -2px; }

/* Em cima da foto, em qualquer tema: as cores não mudam com ele. */
.card__select-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: #fff;
  border-radius: 50%;
  color: #111;
}
.card__select-mark .icon { grid-area: 1 / 1; width: 16px; height: 16px; }
.card__select-mark .icon:last-child { display: none; }
.card__select[aria-pressed="true"] .card__select-mark {
  background: #111;
  box-shadow: 0 0 0 2px #fff;
  color: #fff;
}
.card__select[aria-pressed="true"] .icon:first-child { display: none; }
.card__select[aria-pressed="true"] .icon:last-child { display: block; }

/* Selecionada: visível de longe, inclusive em peça escura. A moldura fica dentro da foto,
   para não encostar na vizinha nem sair da margem da legenda. */
.card:has(.card__select[aria-pressed="true"]) .card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px var(--ink);
  pointer-events: none;
}

.card--sold .card__photo {
  filter: grayscale(1);
  opacity: var(--sold-opacity);
}
.card--sold .card__title,
.card--sold .card__price { color: var(--muted); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--ink);
  border-radius: 999px;
  color: var(--on-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
}
/* Sobre a foto, igual nos dois temas; o contorno separa o selo de uma peça preta. */
.card__media .badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: #111;
  box-shadow: 0 0 0 1px rgb(255 255 255 / .55);
  color: #fff;
}

.empty { padding: 48px var(--gutter); color: var(--muted); text-align: center; }

/* ---------- botões ---------- */

.button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 6px 8px;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  text-decoration: none;
}
.button--primary {
  background: var(--ink);
  color: var(--on-ink);
}
.button--quiet {
  background: var(--surface-strong);
}
.button--quiet.is-selected {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--surface-hover);
}
.button__sub {
  font-size: 12px;
  font-weight: 400;
  line-height: 14px;
}

.icon-button {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
}

/* ---------- detalhe ---------- */

.detail__media { position: relative; }

.gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }

.gallery__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
/* Sem JS não há contagem: a próxima foto aparecendo na borda é o que diz para deslizar. */
html:not(.js) .gallery__slide:not(:only-child) { flex-basis: 88%; }

.gallery__link {
  position: relative;
  display: block;
  background: var(--surface);
  cursor: zoom-in;
}
.gallery__link:focus-visible { outline-offset: -2px; }

.gallery__photo {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: contain; /* uma foto deitada aparece inteira */
  filter: var(--photo-filter);
}

.gallery__zoom {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: #fff;
  border-radius: 50%;
  color: #111;
}
.gallery__zoom .icon { width: 18px; height: 18px; }

.gallery__count {
  position: absolute;
  bottom: 12px;
  left: 12px;
  padding: 0 10px;
  background: rgb(0 0 0 / .65);
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 26px;
  pointer-events: none;
}
html:not(.js) .gallery__count { display: none; }

/* As setas são do desktop: no celular se desliza com o dedo. */
.gallery__nav { display: none; }

.detail__info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px var(--gutter) 0;
}

.detail__title {
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
}

.detail__head .badge { margin-top: 6px; }

.detail__price {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  line-height: 24px;
}

.detail__head .badge { margin-top: 6px; }

.measurements__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 24px;
}

.rows__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 0;
  line-height: 20px;
}
.rows__row dt { color: var(--muted); }
.rows__row dd {
  overflow-wrap: anywhere;
  text-align: right;
}
.rows--strong dd {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.rows--facts {
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.measurements__note {
  padding-top: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.detail__notes { max-width: 62ch; }


/* No celular, as duas ações ficam à mão enquanto se confere a peça. */
.detail__cta {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  gap: 8px;
  margin-top: auto;
  margin-inline: calc(var(--gutter) * -1);
  padding: 8px var(--gutter) calc(8px + var(--safe-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.detail__cta .button { flex: 1 1 0; min-width: 0; }

/* Na página direta com a barra de seleção à vista, só uma barra fica fixa. */
.app:has(#selection-bar:not([hidden])) .site-main > .detail .detail__cta { position: static; }

.unavailable {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 32px var(--gutter);
}
.unavailable__title {
  font-size: 20px;
  font-weight: 600;
  line-height: 26px;
}
.unavailable .button { width: auto; padding-inline: 24px; }

/* ---------- dialog da peça ---------- */

dialog {
  padding: 0;
  background: var(--bg);
  border: 0;
  color: var(--ink);
}
dialog::backdrop { background: var(--backdrop); }

.detail-dialog {
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.detail-dialog[open] { animation: fade .15s ease-out; }

@keyframes fade {
  from { opacity: 0; }
}
@keyframes rise {
  from { opacity: 0; translate: 0 16px; }
}

.detail-dialog__bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  height: var(--chrome-top);
  padding: 0 4px;
  background: var(--bg);
}
.detail-dialog__name {
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-dialog__close .icon:last-child { display: none; }

[data-detail-content]:empty {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--surface);
}

/* ---------- barra de seleção ---------- */

.selection-bar {
  --bar-inset: var(--gutter);
  position: fixed;
  inset: auto 0 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: calc(var(--bar-height) + var(--safe-bottom));
  padding: 8px calc(var(--bar-inset) + var(--locked-gap)) calc(8px + var(--safe-bottom)) var(--bar-inset);
  background: var(--bar);
  color: #fff;
}

.selection-bar__summary {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 44px;
  padding: 0 4px 0 0;
  background: none;
  border: 0;
  border-radius: var(--radius-small);
  color: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
}
.selection-bar__summary .icon { flex: none; width: 18px; height: 18px; }

.selection-bar__send {
  display: flex;
  flex: none;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  background: #fff;
  border-radius: var(--radius);
  color: #111;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
[data-selection-send][aria-busy="true"] { opacity: .7; }
.selection-bar :focus-visible { outline-color: #fff; }

.app:has(#selection-bar:not([hidden])) .site-main { padding-bottom: calc(var(--bar-height) + var(--safe-bottom)); }

.toast {
  position: fixed;
  right: var(--gutter);
  bottom: calc(var(--gutter) + var(--safe-bottom));
  left: var(--gutter);
  z-index: 11;
  max-width: 460px;
  padding: 12px 14px;
  background: var(--ink);
  border-radius: var(--radius);
  color: var(--on-ink);
}
.app:has(#selection-bar:not([hidden])) .toast { bottom: calc(var(--bar-height) + var(--safe-bottom) + 8px); }

/* ---------- revisão da seleção ---------- */

.selection-panel {
  width: 100%;
  max-width: 100%;
  max-height: 85dvh;
  margin: auto 0 0;
  border-radius: var(--radius) var(--radius) 0 0;
}
.selection-panel[open] {
  display: flex;
  flex-direction: column;
  animation: rise .15s ease-out;
}

.selection-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 6px var(--gutter);
}
.selection-panel__head h2 {
  font-size: 17px;
  font-weight: 600;
}

.selection-panel__notice {
  margin: 0 var(--gutter) 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-small);
}

.selection-panel__list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.selection-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  /* O botão Remover tem 12 px de folga em volta do texto: o texto fica na margem. */
  padding: 10px calc(var(--gutter) - 12px) 10px var(--gutter);
  border-bottom: 1px solid var(--line);
}
.selection-item__photo {
  width: 48px;
  height: 64px;
  background: var(--surface);
  border-radius: var(--radius-small);
  filter: var(--photo-filter);
  object-fit: cover;
}
.selection-item__name { font-size: 14px; font-weight: 600; line-height: 18px; }
.selection-item__size { color: var(--muted); font-size: 13px; line-height: 18px; }
.selection-item__price {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 20px;
}
.selection-item__remove {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  background: none;
  border: 0;
  border-radius: var(--radius-small);
  color: var(--muted);
  font-size: 14px;
}

.selection-panel__foot {
  display: grid;
  gap: 10px;
  padding: 12px var(--gutter) calc(16px + var(--safe-bottom));
}
.selection-panel__summary { font-weight: 600; }

/* ---------- só com mouse: no toque, o hover fica preso depois do toque ---------- */

@media (hover: hover) {
  .filters__item:not([aria-current]):hover .filters__label,
  .button--quiet:hover,
  .selection-item__remove:hover,
  .icon-button:hover { background: var(--surface-hover); }
  .button--primary:hover { opacity: .85; }
  .selection-bar__send:hover { background: #e6e6e6; }
  .card__select:hover .card__select-mark { background: #e6e6e6; }
  .card__select[aria-pressed="true"]:hover .card__select-mark { background: #333; }
  .card__link:hover .card__title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
}

/* ---------- PhotoSwipe ---------- */

.pswp {
  --pswp-bg: #000;
  --pswp-placeholder-bg: #1a1a1a;
}

/* ---------- celular ---------- */

@media (max-width: 899px) {
  /* A peça ocupa a tela toda, e o botão de ação fica no pé mesmo com pouca ficha. */
  .detail {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - var(--chrome-top));
  }
  .detail__info { flex: 1; }
  /* Em tela baixa, a foto cede para o título e o preço caberem acima dos botões. */
  .gallery__photo { max-height: max(300px, calc(100dvh - 212px)); }
}

/* ---------- telas muito estreitas ---------- */

@media (max-width: 359px) {
  :root { --gutter: 12px; }
  .selection-bar__summary,
  .selection-bar__send { font-size: 14px; }
  .selection-bar__send { padding-inline: 10px; }
  /* "14 peças · R$ 1.400" precisa do espaço da seta. */
  .selection-bar__summary .icon { display: none; }
  .detail__cta .button { font-size: 14px; padding-inline: 4px; }
}

/* ---------- telas maiores ---------- */

/* Tablet em pé: a foto não toma a tela, e as medidas chegam à primeira vista. Em volta
   dela fica o fundo da página, para ler como foto centrada, não como tarja. */
@media (min-width: 640px) and (max-width: 899px) {
  .gallery__link { background: var(--bg); }
  .gallery__photo { max-height: 60dvh; }
  /* A foto 3:4 tem 45dvh de largura: contagem e zoom ficam nos cantos dela. */
  .detail__info { width: 100%; max-width: 560px; margin-inline: auto; }
  .gallery__count { left: max(12px, calc(50% - 22.5dvh + 12px)); }
  .gallery__zoom { right: max(12px, calc(50% - 22.5dvh + 12px)); }
  [data-detail-content]:empty { max-height: 60dvh; }
}

@media (min-width: 640px) {
  :root { --gutter: 24px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 12px; }
  .card__body { padding-bottom: 24px; }
  .filters__label { padding-inline: 14px; }
  .filters__list { gap: 8px; }
  .selection-panel {
    width: min(480px, calc(100vw - 48px));
    margin: auto;
    border-radius: var(--radius);
  }
}

@media (min-width: 900px) {
  :root { --gutter: 32px; }

  .site-header:not(.site-header--compact) {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "name tagline count";
    column-gap: 16px;
    padding-block: 20px 8px;
  }

  .site-header--compact {
    height: 56px;
    padding-inline: calc(var(--gutter) - 10px);
  }

  .filters__list {
    width: auto;
    min-width: 0;
    max-width: var(--page);
    margin-inline: auto;
  }

  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 16px;
    padding-top: 8px;
  }
  .card__body { padding-bottom: 28px; }
  .card__title { font-size: 15px; line-height: 20px; }
  .card__sub { font-size: 14px; line-height: 20px; }
  .card__price { font-size: 15px; }

  .selection-bar {
    /* O 100% é a tela sem a barra de rolagem, como na grade; com um dialog aberto a barra
       some, e a folga desconta a diferença. */
    --bar-inset: max(var(--gutter), calc((100% - var(--locked-gap) - var(--page)) / 2 + var(--gutter)));
  }
  .selection-bar__summary { flex: none; }
  .selection-bar__send { margin-left: auto; padding-inline: 20px; }

  /* Sem JS não há setas: as fotos aparecem abertas, a capa maior. */
  html:not(.js) .gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
    align-content: start;
  }
  html:not(.js) .gallery__slide:first-child { grid-column: 1 / -1; }

  .gallery__zoom { opacity: 0; }
  .gallery__link:hover .gallery__zoom,
  .gallery__link:focus-visible .gallery__zoom { opacity: 1; }

  .js .gallery__nav:not(:disabled) {
    position: absolute;
    top: 50%;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    padding: 0;
    background: #fff;
    border: 0;
    border-radius: 50%;
    color: #111;
  }
  .gallery__nav--previous { left: 12px; }
  .gallery__nav--next { right: 12px; }
  .js .gallery__nav:not(:disabled):hover { background: #e6e6e6; }

  /* A coluna da foto cabe na altura da tela, para a foto aparecer inteira. */
  .detail {
    --photo-column: calc(var(--detail-height) * .75);
    display: grid;
    grid-template-columns: minmax(0, min(58%, var(--photo-column))) minmax(340px, 1fr);
    align-items: start;
  }

  .detail__info { padding: 28px 32px; gap: 16px; }
  .detail__title { font-size: 22px; line-height: 28px; }
  .detail__price { font-size: 20px; line-height: 28px; }

  .detail__cta {
    position: static;
    margin-inline: 0;
    margin-top: 4px;
    padding: 0;
    background: none;
    border-top: 0;
  }

  .site-main > .detail {
    --detail-height: calc(100dvh - 88px);
    grid-template-columns: minmax(0, min(58%, var(--photo-column))) 488px;
    justify-content: center;
    max-width: var(--page);
    margin-inline: auto;
    padding: 0 var(--gutter) 32px;
  }
  .site-main > .detail .gallery__link { overflow: hidden; border-radius: var(--radius); }
  /* 488 px com a folga dos lados dão os mesmos 424 px de texto do dialog. */
  .site-main > .detail .detail__info {
    position: sticky;
    top: 0;
    max-width: 488px;
    padding-block: 0;
  }
  .app:has(#selection-bar:not([hidden])) .site-main > .detail { --detail-height: calc(100dvh - 148px); }

  .unavailable { max-width: var(--page); margin-inline: auto; }

  .detail-dialog {
    --detail-height: min(calc(100dvh - 64px), 800px);
    width: min(1040px, calc(100vw - 64px));
    /* Em tela estreita a foto ocupa 58% da largura: o dialog não passa da altura dela. */
    height: min(var(--detail-height), calc(min(1040px, 100vw - 64px) * .58 / .75));
    margin: auto;
    overflow: hidden;
    border-radius: var(--radius);
  }

  /* O botão de fechar flutua no canto da coluna de texto. */
  .detail-dialog__bar {
    position: absolute;
    inset: 8px 8px auto auto;
    display: block;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
  }
  .detail-dialog__name,
  .detail-dialog__close .icon:first-child { display: none; }
  .detail-dialog__close .icon:last-child { display: block; }

  .detail-dialog [data-detail-content] { height: 100%; }
  .detail-dialog [data-detail-content]:empty { aspect-ratio: auto; }
  .detail-dialog .detail { height: 100%; }
  .detail-dialog .detail__media { height: 100%; background: var(--surface); }
  .detail-dialog .detail__info {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .detail-dialog .detail__head { padding-right: 32px; }
}

@media (min-width: 1600px) {
  :root { --page: 1520px; }
  .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 2200px) {
  :root { --page: 1880px; }
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
