/* Layout e comportamento. Cores, fontes e imagens de marca ficam em tema.css. */

:root {
  --altura-barra-look: clamp(112px, 34.5vw, 150px);
  --faixa-bordo: 44px; /* faixa bordô abaixo da borda rasgada do papel, na primeira tela */
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cor-fundo);
  color: var(--cor-sobre-fundo);
  font-family: var(--fonte-texto);
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }

/* Anel duplo: aparece tanto sobre o bordô quanto sobre o papel. */
:focus-visible { outline: 3px solid var(--cor-papel); box-shadow: 0 0 0 6px var(--cor-bordo); }

.so-leitor {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Botões de texto (janela de salvar) ---------- */

.botao {
  min-height: 46px;
  padding: 0 22px;
  border: 1.5px solid var(--cor-destaque);
  border-radius: var(--raio-botao);
  background: transparent;
  color: var(--cor-destaque);
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
}
.botao--principal { background: var(--cor-destaque); color: var(--cor-destaque-texto); }
.botao--texto { border-color: transparent; color: var(--cor-texto-suave); }
.botao:active { transform: scale(.97); }
.botao:disabled { opacity: .55; cursor: progress; }

/* ---------- Botões em forma de coração (desenhados pela autora) ---------- */

.botao-coracao { padding: 0; border: 0; background: none; line-height: 0; }
.botao-coracao img { display: block; width: 100%; height: auto; pointer-events: none; user-select: none; }
.botao-coracao:active { transform: scale(.93); }
.botao-coracao:disabled { opacity: .6; cursor: progress; }

/* ---------- Tela inicial ---------- */

.abertura {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 10svh, 90px);
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.abertura__logo {
  width: min(58vw, 340px);
  height: auto;
  max-height: 28svh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* A imagem inteira (coração + texto) pulsa junto e é o botão. */
.pulsa {
  width: min(42vw, 240px);
  padding: 0;
  border: 0;
  background: none;
  line-height: 0;
  animation: pulsar 2.4s ease-in-out infinite;
}
.pulsa img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 40svh;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.pulsa:active { animation: none; transform: scale(.95); }

@keyframes pulsar {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ---------- Provador: croqui sobre o papel ---------- */

.vitrine {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  background: var(--cor-fundo) var(--img-papel-fundo) top center / 100% calc(100% - var(--faixa-bordo)) no-repeat;
}

.vitrine__titulo {
  position: absolute;
  top: max(2.4%, env(safe-area-inset-top));
  left: 5%;
  z-index: 2;
  width: 72%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

/* A área ocupa o espaço que sobrar; o croqui cresce até caber nela, sem distorcer. */
.palco-area {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  container-type: size;
  padding: 11svh 0 var(--faixa-bordo);
}

.palco {
  position: relative;
  height: 100%;
  max-width: 100%;
  aspect-ratio: var(--proporcao, .6);
}
@supports (width: 1cqw) {
  .palco {
    height: auto;
    max-width: none;
    width: min(100cqw, calc(100cqh * var(--proporcao, .6)));
  }
}

.palco img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.palco .camada { transition: opacity .16s ease; }
.palco .camada.entrando { opacity: 0; }

/* Os corações ficam nos cantos, sobre a borda rasgada, como no modelo. */
.acoes {
  position: absolute;
  inset: auto 4% calc(var(--faixa-bordo) - 4px) 4%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}
.acoes .botao-coracao { pointer-events: auto; }
.botao-coracao--refazer { width: clamp(64px, 18vw, 100px); }
.botao-coracao--salvar { width: clamp(96px, 28vw, 150px); }

.dica-rolar {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  background: none;
  color: var(--cor-sobre-fundo);
  font-family: var(--fonte-titulo);
  font-size: 1.3rem;
  white-space: nowrap;
}
.dica-rolar span { display: inline-block; font-family: var(--fonte-texto); animation: saltinho 1.6s ease-in-out infinite; }
@keyframes saltinho { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* ---------- Provador: guarda-roupa ---------- */

.guarda-roupa {
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 18px 16px calc(56px + env(safe-area-inset-bottom));
  scroll-margin-top: calc(var(--altura-barra-look) + env(safe-area-inset-top));
}

.categoria__titulo {
  margin: 0 0 14px 6px;
  color: var(--cor-sobre-fundo);
  font-family: var(--fonte-titulo);
  font-size: clamp(2.4rem, 12vw, 3.4rem);
  font-weight: 400;
  line-height: 1.05;
}

.grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.peca {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 8px;
  border: 0;
  border-radius: var(--raio-peca);
  background: var(--cor-superficie);
}
.peca img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.peca:active { transform: scale(.96); }
.peca[aria-pressed="true"] { box-shadow: 0 0 0 4px var(--cor-papel); }
.peca[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cor-bordo) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3.2L15 6.8' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}

@media (min-width: 560px) and (max-width: 899px) {
  .grade { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Barra do look (celular, quando o croqui sai da tela) ---------- */

.barra-look {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(var(--altura-barra-look) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 16px;
  transform: translateY(-110%);
  transition: transform .22s ease;
}
.barra-look.visivel { transform: none; }

/* O papel rasgado vai num pseudo-elemento para a sombra acompanhar a borda irregular. */
.barra-look::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--img-papel-topo) center bottom / 100% 100% no-repeat;
  filter: drop-shadow(0 4px 5px rgb(0 0 0 / .28));
}

.barra-look__mini {
  height: calc(var(--altura-barra-look) - 34px);
  padding: 0;
  border: 0;
  background: none;
}
.palco--mini { display: block; width: auto; max-width: none; height: 100%; aspect-ratio: var(--proporcao, .6); }

.barra-look__acoes { display: flex; align-items: center; gap: 10px; }
.botao-coracao--pequeno { width: 58px; }
.botao-coracao--pequeno.botao-coracao--maior { width: 76px; }

/* ---------- Janela de salvar ---------- */

.modal {
  width: min(92vw, 420px);
  max-height: 94vh;
  max-height: 94dvh;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--cor-papel);
  color: var(--cor-texto);
}
.modal::backdrop { background: rgb(40 0 15 / .6); }
.modal__corpo {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: inherit;
  padding: 18px;
  overflow: auto;
}
.modal__titulo {
  margin: 0;
  color: var(--cor-destaque);
  font-family: var(--fonte-titulo);
  font-size: 2.2rem;
  font-weight: 400;
  line-height: 1.1;
  text-align: center;
}
.modal__imagem {
  width: 100%;
  max-height: 58vh;
  max-height: 58dvh;
  object-fit: contain;
  border: 1px solid var(--cor-linha);
  border-radius: 12px;
  background: #fff;
}
.modal__dica { margin: 0; color: var(--cor-texto-suave); font-size: .85rem; text-align: center; }

/* ---------- Avisos ---------- */

.aviso {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: 88vw;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--cor-papel);
  color: var(--cor-bordo);
  box-shadow: 0 6px 18px rgb(0 0 0 / .28);
  font-size: .92rem;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity .2s ease, transform .2s ease;
}
.aviso.visivel { opacity: 1; transform: translate(-50%, 0); }

.faixa-teste {
  position: fixed;
  left: 8px;
  bottom: 8px;
  z-index: 50;
  padding: 3px 10px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 11px;
  opacity: .8;
  pointer-events: none;
}

.sem-js, .erro { padding: 24px; text-align: center; }

/* ---------- Computador: croqui fixo de um lado, guarda-roupa do outro ---------- */

@media (min-width: 900px) {
  .provador {
    display: grid;
    grid-template-columns: minmax(420px, 44%) 1fr;
    align-items: start;
  }
  .vitrine {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
  }
  .dica-rolar { display: none; }
  .barra-look { display: none; }
  .guarda-roupa { max-width: 60rem; padding: 48px 48px 72px; gap: 40px; }
  .grade { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
}
