/* ==========================================================================
   Página de cada obra (obras/<NN>-<slug>/index.html)
   Usa os tokens e componentes de estilo.css.
   Celular: foto em cima, informações embaixo.
   Desktop (≥ 900 px): foto fixa à esquerda, informações rolam à direita.
   ========================================================================== */

/* menu sempre com fundo nestas páginas */
.pagina-obra .topo {
  background: rgba(20, 19, 17, 0.92);
  border-bottom-color: var(--linha);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.obra-pagina {
  padding-top: calc(var(--altura-topo) + env(safe-area-inset-top));
}

/* ---------- Foto ---------- */
.obra-foto {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem var(--margem) 0.5rem;
  background: #0f0e0c;
}

.obra-foto__moldura {
  position: relative;
  margin: 0;
  line-height: 0; /* sem overflow: hidden, para a lupa não ser cortada nas bordas */
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
}
.obra-foto__borrao {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(16px);
  clip-path: inset(0); /* o borrão não vaza para fora da foto */
}
/* a moldura já nasce do tamanho certo (proporção --r = largura/altura),
   então nada pula quando a foto termina de carregar (CLS = 0) */
.obra-foto__moldura {
  width: min(100%, calc(72vh * var(--r, 1.5)));
  width: min(100%, calc(72svh * var(--r, 1.5)));
}
.obra-foto__img {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--r, 1.5);
  transition: opacity 0.7s ease;
}
.js .obra-foto__img { opacity: 0; }
.js .obra-foto__img.carregada { opacity: 1; }

.obra-foto__dica {
  display: none;
  margin-top: 0.9rem;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--texto-suave);
}

.obra-foto__setas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 0.75rem;
}
.obra-foto__posicao {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--texto-suave);
  font-variant-numeric: tabular-nums;
}
.seta {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--linha);
  border-radius: 50%;
  color: var(--texto);
  transition: border-color 0.3s ease, color 0.3s ease, background-color 0.3s ease;
}
@media (hover: hover) {
  .seta:hover { border-color: var(--dourado); color: var(--dourado); background: rgba(201, 164, 106, 0.08); }
}

/* ---------- Lupa (só com mouse) ---------- */
.lupa {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 200px;
  height: 200px;
  margin: -100px 0 0 -100px;
  border-radius: 50%;
  border: 1px solid rgba(201, 164, 106, 0.85);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), inset 0 0 0 4px rgba(20, 19, 17, 0.35);
  background-color: var(--fundo-2);
  background-repeat: no-repeat;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.25s ease, transform 0.35s var(--ease);
}
.lupa.lupa--ativa { opacity: 1; transform: scale(1); }
.com-lupa .obra-foto__moldura { cursor: none; }

@media (hover: hover) and (pointer: fine) {
  .obra-foto__dica { display: block; }
}

/* ---------- Informações ---------- */
.obra-info {
  padding: 2.25rem var(--margem) clamp(4rem, 10vw, 6rem);
  max-width: 40rem;
  margin-inline: auto;
}

.obra-info__voltar {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--texto-suave);
  transition: color 0.3s ease;
}
.obra-info__voltar:hover { color: var(--dourado); }

.obra-info__cabeca { margin-top: 2.25rem; }
.obra-info__titulo {
  margin-top: 0.8rem;
  font-family: var(--fonte-titulo);
  font-weight: 400;
  font-size: clamp(2.2rem, 8vw, 3.4rem);
  line-height: 1.08;
}
.obra-info__local {
  margin-top: 0.7rem;
  font-size: 0.95rem;
  color: var(--texto-suave);
}

.obra-info__descricao {
  margin-top: 1.75rem;
  font-family: var(--fonte-titulo);
  font-size: clamp(1.15rem, 3vw, 1.3rem);
  line-height: 1.6;
}

.obra-info__acoes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}
.botao-whats {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 52px;
  padding: 0.9rem 1.6rem;
  background: var(--dourado);
  color: var(--fundo);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s var(--ease);
}
.botao-secundario {
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0.9rem 1.4rem;
  border: 1px solid var(--linha);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: border-color 0.3s ease, color 0.3s ease;
}
@media (hover: hover) {
  .botao-whats:hover { background: #d8b67e; box-shadow: 0 10px 30px rgba(201, 164, 106, 0.3); transform: translateY(-1px); }
  .botao-secundario:hover { border-color: var(--dourado); color: var(--dourado); }
}
@media (max-width: 479px) {
  .botao-whats, .botao-secundario { flex: 1 1 100%; justify-content: center; }
}

.obra-info__nota {
  margin-top: 0.9rem;
  font-size: 0.82rem;
  color: var(--texto-suave);
}

/* blocos */
.obra-bloco {
  margin-top: clamp(3rem, 8vw, 4.5rem);
  padding-top: 1.75rem;
  border-top: 1px solid var(--linha);
}
.obra-bloco__titulo {
  font-family: var(--fonte-titulo);
  font-weight: 400;
  font-size: 1.45rem;
  margin-bottom: 1.25rem;
}

/* ficha */
.ficha { display: grid; gap: 0; }
.ficha > div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--linha);
}
.ficha dt {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--texto-suave);
  padding-top: 0.2rem;
}
.ficha dd { margin: 0; font-size: 0.95rem; }
.ficha a { color: var(--dourado); border-bottom: 1px solid rgba(201, 164, 106, 0.4); }

/* tamanhos */
.tamanhos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.8rem, 1fr));
  gap: 0.6rem;
}
.tamanhos li {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 0.9rem;
  border: 1px solid var(--linha);
}
.tamanhos__medida {
  font-family: var(--fonte-titulo);
  font-size: clamp(1.05rem, 3.6vw, 1.3rem);
  white-space: nowrap;
}
.tamanhos__nome {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dourado);
}

.escala { margin: 1.5rem 0 0; }
.escala__svg { width: 100%; height: auto; max-height: 260px; }
.escala__chao { stroke: var(--linha); stroke-width: 1; vector-effect: non-scaling-stroke; }
.escala__pessoa { fill: rgba(233, 228, 218, 0.28); }
.escala__obra {
  fill: rgba(201, 164, 106, 0.1);
  stroke: var(--dourado);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.escala__rotulo { fill: var(--texto-suave); font-family: var(--fonte-texto); }
.escala figcaption {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--texto-suave);
}

/* como funciona */
.passos { list-style: none; padding: 0; display: grid; gap: 1.4rem; }
.passos li { display: grid; grid-template-columns: 2.5rem 1fr; gap: 0.75rem; }
.passos li > span {
  font-family: var(--fonte-titulo);
  font-size: 1.1rem;
  color: var(--dourado);
}
.passos strong { font-weight: 500; }
.passos p { margin-top: 0.2rem; font-size: 0.9rem; color: var(--texto-suave); }

/* mais da série */
.mais {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem 0.9rem;
  align-items: start;
}
.mais a { display: grid; gap: 0.25rem; }
.mais__foto {
  display: block;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  margin-bottom: 0.45rem;
}
.mais__foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}
.mais__num { font-size: 0.64rem; letter-spacing: 0.18em; color: var(--dourado); }
.mais__titulo { font-family: var(--fonte-titulo); font-size: 0.98rem; line-height: 1.3; }
@media (hover: hover) {
  .mais a:hover img { transform: scale(1.05); }
}
.obra-info__serie {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dourado);
}

/* anterior / próxima */
.vizinhas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: clamp(3rem, 8vw, 4.5rem);
}
.vizinha {
  display: grid;
  gap: 0.35rem;
  padding: 1.1rem 1rem;
  border: 1px solid var(--linha);
  transition: border-color 0.3s ease;
}
.vizinha--prox { text-align: right; }
.vizinha__dir { font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dourado); }
.vizinha__titulo { font-family: var(--fonte-titulo); font-size: 0.98rem; line-height: 1.3; }
@media (hover: hover) {
  .vizinha:hover { border-color: var(--dourado); }
}
.vizinhas__dica {
  display: none;
  margin-top: 0.9rem;
  font-size: 0.75rem;
  color: var(--texto-suave);
  text-align: center;
}
@media (hover: hover) and (pointer: fine) { .vizinhas__dica { display: block; } }

/* ---------- Desktop: foto fixa à esquerda ---------- */
@media (min-width: 900px) {
  .obra-pagina {
    display: grid;
    grid-template-columns: minmax(0, 58fr) minmax(0, 42fr);
    align-items: start;
    padding-top: 0;
  }

  .obra-foto {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    padding: calc(var(--altura-topo) + 2rem) clamp(1.5rem, 4vw, 4rem) 1.5rem;
  }
  .obra-foto__moldura {
    width: min(100%, calc((100vh - var(--altura-topo) - 9rem) * var(--r, 1.5)));
    width: min(100%, calc((100svh - var(--altura-topo) - 9rem) * var(--r, 1.5)));
  }

  .obra-info {
    max-width: 36rem;
    margin: 0;
    padding: calc(var(--altura-topo) + 3rem) clamp(2rem, 4vw, 4.5rem) 6rem;
  }

  .mais { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   Ver na parede (simulação aproximada)
   A parede tem 4,20 m × 2,80 m (unidade dos SVGs em img/ambientes/ = 1 cm).
   A obra é posicionada em % dessa parede por js/obra.js.
   ========================================================================== */
.botao-parede { gap: 0.6rem; }
.botao-parede[hidden] { display: none; }

.parede-dialogo {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--fundo);
  color: var(--texto);
  overscroll-behavior: contain;
}
.parede-dialogo::backdrop { background: rgba(10, 9, 8, 0.82); }
.parede-dialogo[open] { animation: parede-entra 0.45s var(--ease) both; }
@keyframes parede-entra { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.parede-dialogo__caixa {
  display: grid;
  gap: 1.1rem;
  padding: calc(1rem + env(safe-area-inset-top)) var(--margem) calc(1.5rem + env(safe-area-inset-bottom));
}

.parede-dialogo__topo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.parede-dialogo__titulo {
  margin-top: 0.35rem;
  font-family: var(--fonte-titulo);
  font-weight: 400;
  font-size: clamp(1.25rem, 4.5vw, 1.7rem);
  line-height: 1.2;
}
.parede-dialogo__fechar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -4px -8px 0 0;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}
.parede-dialogo__fechar:hover { background: rgba(233, 228, 218, 0.08); }

/* ---- a parede ---- */
.parede {
  position: relative;
  width: 100%;
  aspect-ratio: 420 / 280;
  overflow: hidden;
  background: #2a2926;
  container-type: inline-size;
}
.parede__fundo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.4s ease;
}
.parede__obra {
  position: absolute;
  /* left, top, width, height em % — definidos em obra.js */
  box-sizing: border-box;
  padding: 0.45cqw;               /* moldura fina de ~1,9 cm */
  background: #161513;
  box-shadow: 0 1.2cqw 2.6cqw rgba(0, 0, 0, 0.32), 0 0.3cqw 0.6cqw rgba(0, 0, 0, 0.25);
  transition: left 0.6s var(--ease), top 0.6s var(--ease), width 0.6s var(--ease), height 0.6s var(--ease);
}
.parede__obra img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.parede__sofa {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.parede__medida {
  position: absolute;
  left: 50%;
  bottom: 3%;
  transform: translateX(-50%);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(20, 19, 17, 0.72);
  color: var(--texto);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* ---- controles ---- */
.parede-dialogo__controles { display: grid; gap: 0.9rem; }
.parede-escolha { display: grid; gap: 0.5rem; min-width: 0; }
.parede-escolha__lista {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  margin-inline: calc(var(--margem) * -1);
  padding-inline: var(--margem);
}
.parede-escolha__lista::-webkit-scrollbar { display: none; }
.amostra {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c1) 50%, var(--c2) 50%);
  box-shadow: inset 0 0 0 1px rgba(233, 228, 218, 0.25);
}

.parede-dialogo__aviso {
  padding: 0.8rem 1rem;
  border-left: 2px solid var(--dourado);
  background: rgba(201, 164, 106, 0.07);
  font-size: 0.82rem;
  line-height: 1.55;
  color: rgba(233, 228, 218, 0.82);
}
.parede-dialogo__aviso strong { color: var(--texto); font-weight: 500; }

.parede-dialogo__acoes { display: flex; flex-wrap: wrap; gap: 0.75rem; }

@media (max-width: 479px) {
  .parede-dialogo__acoes > * { flex: 1 1 100%; justify-content: center; }
}

/* desktop: caixa centralizada, parede grande com controles ao lado */
@media (min-width: 900px) {
  .parede-dialogo {
    width: min(1180px, 94vw);
    height: auto;
    max-height: 94vh;
    margin: auto;
    border: 1px solid var(--linha);
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6);
  }
  .parede-dialogo__caixa {
    grid-template-columns: minmax(0, 1fr) 19rem;
    grid-template-areas:
      "topo topo"
      "parede controles"
      "parede aviso"
      "parede acoes";
    grid-template-rows: auto auto 1fr auto;
    column-gap: 2rem;
    padding: 1.75rem 2rem 2rem;
  }
  .parede-dialogo__topo { grid-area: topo; }
  .parede { grid-area: parede; align-self: start; }
  .parede-dialogo__controles { grid-area: controles; }
  .parede-dialogo__aviso { grid-area: aviso; align-self: start; }
  .parede-dialogo__acoes { grid-area: acoes; flex-direction: column; }
  .parede-dialogo__acoes > * { justify-content: center; }
  .parede-escolha__lista { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; }
}
