/* Visual compartilhado dos projetos (index.html e trabalhos.html). */

/* ---------- blocos com imagem ---------- */
.work-grid {
  grid-auto-flow: dense;
}

.demo-tile {
  cursor: pointer;
}

.work-tile.demo-tile:hover {
  transform: none;
}

.tile-thumb,
.tile-shade {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.tile-thumb {
  background-size: cover;
  background-repeat: no-repeat;
}

/* bloco vertical (1 coluna × 3 linhas, perto de 9:16) para vídeos verticais */
.work-grid .work-tile.vertical {
  grid-column: span 1;
  grid-row: span 3;
}

.tile-thumb-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-shade {
  background: linear-gradient(to top, rgba(10, 8, 6, 0.9) 0%, rgba(10, 8, 6, 0.55) 30%, transparent 60%);
}

.work-tile.demo-tile::before {
  z-index: 2;
}

.work-tile.demo-tile .soon-badge {
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.work-tile.demo-tile .work-tile-number,
.work-tile.demo-tile:hover .work-tile-number {
  background: none;
  color: rgba(0, 0, 0, 0.28);
  opacity: 1;
}

.work-tile.demo-tile .cat {
  color: rgba(255, 255, 255, 0.75);
}

.work-tile.demo-tile h3 {
  color: #fff;
  transition: color .2s ease;
}

.work-tile.demo-tile:hover h3,
.work-tile.demo-tile:focus-visible h3 {
  color: var(--tile-accent, var(--coral-soft));
}

/* ---------- modal de demo ---------- */
.demo-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
  padding: 20px;
}

.demo-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.demo-modal-content {
  position: relative;
  width: 100%;
  max-width: 1000px;
  height: 80vh;
  background: var(--bg);
  border: 1px solid var(--border-mid);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
  animation: modalSlideIn .4s var(--ease-out-expo) both;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.demo-modal-header {
  position: relative;
  z-index: 6;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.demo-modal-heading {
  flex: 1;
  min-width: 0;
}

.demo-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.demo-modal-desc {
  margin-top: 4px;
  max-width: 640px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-dim);
}

.demo-modal-close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 246, 230, 0.06);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease);
  color: var(--ink-dim);
  font-size: 24px;
  line-height: 1;
}

.demo-modal-close:hover {
  background: rgba(255, 246, 230, 0.12);
  border-color: var(--border-mid);
  color: var(--ink);
}

.demo-modal-menu {
  flex-shrink: 0;
  display: flex;
  gap: 2px;
  max-width: 100%;
  padding: 5px;
  border-radius: 100px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    0 10px 30px rgba(0, 0, 0, 0.35);
}

.demo-menu-item {
  padding: 7px 13px;
  border-radius: 100px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.78);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: background .2s var(--ease), color .2s var(--ease);
}

.demo-menu-item:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}

.demo-menu-item.active {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.demo-modal-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.demo-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg-soft);
  overscroll-behavior: contain;
}

.demo-images {
  padding-bottom: 80px;
}

.demo-image {
  width: 100%;
  height: auto;
  display: block;
}

.demo-modal-controls {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.demo-links {
  position: absolute;
  right: 22px;
  bottom: 6px;
  display: flex;
  gap: 8px;
}

.demo-btn-full {
  pointer-events: auto;
  padding: 12px 18px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    0 10px 30px rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background .2s var(--ease);
}

.demo-btn-full:hover {
  background: rgba(0, 0, 0, 0.62);
}

.demo-modal [hidden] {
  display: none !important;
}

/* projetos de arte (livro etc.): imagens centralizadas e menores, fundo preto */
.demo-modal.narrow .demo-modal-body {
  background: #000;
}

.demo-modal.narrow .demo-images {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px 16px 96px;
}

.demo-modal.narrow .demo-image {
  max-width: 360px;
}

.demo-modal.narrow .demo-images:has(.demo-row) > .demo-image {
  max-width: 900px;
}

.demo-modal.narrow .demo-images > .demo-image.demo-logo {
  max-width: 520px;
  margin: 8px 0 4px;
}

.demo-modal.narrow .demo-images > .demo-image.demo-wide {
  max-width: 900px;
}

.demo-modal.narrow .demo-images > .demo-image.demo-mid {
  max-width: 640px;
}

.demo-video-file {
  display: block;
  width: 100%;
  max-width: 360px;
  border-radius: 12px;
  background: #000;
}

/* peça impressa em 3D (cardápios, convites) */
.demo-3d {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 0 8px;
  perspective: 1600px;
}

/* o maior possível sem a folha passar da altura do modal */
.card3d {
  position: relative;
  width: min(460px, 78vw, calc((80vh - 230px) * var(--proporcao, 0.707)));
  transform-style: preserve-3d;
  cursor: grab;
  touch-action: none;
  user-select: none;
  outline: none;
}

.card3d:active {
  cursor: grabbing;
}

.card3d:focus-visible {
  outline: 2px solid var(--coral-soft);
  outline-offset: 8px;
}

.card3d-face,
.card3d-edge {
  position: absolute;
  inset: 0;
  border-radius: 3px;
}

.card3d-edge {
  background: var(--borda, #2a0b09);
}

.card3d-face {
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card3d-face.front {
  transform: translateZ(1.5px);
}

.card3d-face.back {
  transform: rotateY(180deg) translateZ(1.5px);
}

.card3d-face img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
}

/* reflexo de luz que corre pela folha conforme ela gira */
.card3d-face::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.16) 50%, transparent 65%);
  background-size: 260% 100%;
  background-position: var(--brilho-x, 50%) 0;
  mix-blend-mode: screen;
}

/* placa de mesa em "A": cada aba abre 18° a partir da dobra de cima */
.demo-3d-placa {
  padding-top: 72px;
  perspective: 1400px;
}

.demo-3d-placa .card3d-dica {
  margin-top: 96px;
}

.placa3d {
  --w: min(480px, 80vw);
  --h: calc(var(--w) / var(--proporcao));
  position: relative;
  width: var(--w);
  height: calc(var(--h) * 0.951);
  transform-style: preserve-3d;
  cursor: grab;
  touch-action: none;
  user-select: none;
  outline: none;
}

.placa3d:active {
  cursor: grabbing;
}

.placa3d:focus-visible {
  outline: 2px solid var(--coral-soft);
  outline-offset: 12px;
}

.placa3d-aba {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--h);
  transform-origin: top center;
  transform-style: preserve-3d;
}

.aba-frente {
  transform: rotateX(18deg);
}

.aba-verso {
  transform: rotateX(-18deg);
}

.placa3d-aba .card3d-face,
.placa3d-dentro {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.placa3d-dentro {
  background: var(--interno);
}

.aba-frente .fora,
.aba-verso .placa3d-dentro {
  transform: translateZ(0.6px);
}

.aba-frente .placa3d-dentro,
.aba-verso .fora {
  transform: rotateY(180deg) translateZ(0.6px);
}

/* sombra no tampo da mesa, deitada no plano do chão */
.placa3d-chao {
  --d: calc(var(--h) * 0.309 * 5);
  position: absolute;
  left: -40%;
  width: 180%;
  top: calc(100% - var(--d) / 2);
  height: var(--d);
  transform: rotateX(90deg);
  /* sombra da placa sobre uma luz de mesa, para aparecer no fundo preto */
  background:
    radial-gradient(ellipse 34% 30% at center, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.5) 60%, transparent 100%),
    radial-gradient(ellipse at center, rgba(255, 236, 214, 0.12) 0%, rgba(255, 236, 214, 0.04) 45%, transparent 70%);
  pointer-events: none;
}

.card3d-sombra {
  width: min(400px, 68vw);
  height: 22px;
  margin-top: 28px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.7), transparent 70%);
  filter: blur(6px);
}

.card3d-dica {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.demo-video {
  display: block;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 12px;
  background: #000;
}

.demo-row {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 900px;
}

.demo-modal.narrow .demo-row .demo-image {
  flex: 1;
  min-width: 0;
  max-width: none;
}

.demo-row.has-embed {
  align-items: flex-start;
  max-width: 580px;
}

.demo-modal .demo-row.has-embed .demo-image {
  flex: 0 0 40%;
}

.demo-embed {
  flex: 1;
  min-width: 0;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.demo-embed iframe {
  width: 100%;
  max-width: 260px;
  height: 360px;
  border: 1px solid var(--border-mid);
  border-radius: 14px;
  background: #fff;
}

.demo-embed a {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--coral-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 600px) {
  .demo-modal {
    padding: 10px;
  }

  .demo-modal-content {
    height: 88vh;
  }

  .demo-modal-header {
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
  }

  .demo-modal-menu {
    order: 3;
    flex-basis: 100%;
    flex-shrink: 1;
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 18px;
  }

  .demo-modal-controls {
    flex-direction: column;
    gap: 8px;
    left: 10px;
    right: 10px;
    bottom: 12px;
  }

  .demo-links {
    position: static;
    flex-wrap: wrap;
    justify-content: center;
  }

  .demo-images,
  .demo-modal.narrow .demo-images {
    padding-bottom: 110px;
  }

  .demo-menu-item,
  .demo-btn-full {
    padding: 6px 10px;
    font-size: 11px;
  }

  .demo-row.has-embed {
    flex-direction: column;
    align-items: stretch;
  }

  .demo-modal .demo-row.has-embed .demo-image {
    flex: none;
    width: 100%;
  }

  .demo-embed iframe {
    height: 400px;
  }
}
