/* ==========================================================================
   e-Laborando — Modal imersivo compartilhado
   Usado pelo Portfólio (portfolio/) e pelas prévias dos aplicativos (página inicial).
   ========================================================================== */
html.pf-lock, html.pf-lock body { overflow: hidden; }

.pf-modal {
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: clamp(0px, 2.4vw, 32px); border: 0;
  background: transparent; color: var(--text);
  overscroll-behavior: contain;
}
.pf-modal::backdrop { background: rgba(19,22,41,.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.pf-modal[open] { display: flex; }
.pf-m-panel {
  position: relative; display: flex; flex-direction: column;
  width: 100%; max-width: 1280px; height: 100%; margin: 0 auto;
  background: var(--white); border-radius: 22px; overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.5);
  animation: pfModalIn .35s var(--ease) both;
}
@keyframes pfModalIn { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }

.pf-m-bar {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 14px 24px; border-bottom: 1px solid var(--line); background: var(--white);
}
.pf-m-id { min-width: 0; }
.pf-m-cat { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--orange-text, #C24100); }
.pf-m-title { font-size: clamp(1.05rem, 2vw, 1.35rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; overflow-wrap: anywhere; }
.pf-m-title:focus { outline: none; }
.pf-m-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.pf-m-id { margin-right: 16px; }
.pf-m-visit[hidden] { display: none; }
.pf-m-nav { display: flex; align-items: center; gap: 4px; }
.pf-m-nav[hidden] { display: none; }
.pf-m-count { min-width: 44px; text-align: center; font-size: .8rem; font-weight: 600; color: var(--text-soft); font-variant-numeric: tabular-nums; }

.pf-icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 50%; border: 1px solid var(--line); background: var(--white); color: var(--navy); cursor: pointer;
  transition: background-color .2s, border-color .2s, transform .2s var(--ease);
}
.pf-icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pf-icon-btn:hover { border-color: var(--navy); }
.pf-icon-btn:active { transform: scale(.94); }
.pf-m-close { background: var(--navy); border-color: var(--navy); color: var(--white); }
.pf-m-close:hover { background: var(--navy-2); }

.pf-m-tabs { flex: none; display: flex; gap: 4px; padding: 10px 24px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.pf-m-tabs[hidden] { display: none; }
.pf-tab {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: 99px; border: 0;
  background: transparent; color: var(--text-soft); font: inherit; font-size: .85rem; font-weight: 500; cursor: pointer;
}
.pf-tab:hover { color: var(--navy); background: var(--surface); }
.pf-tab.is-active { background: var(--navy); color: var(--white); }

.pf-m-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; background: var(--surface); }
.pf-m-body:focus { outline: none; }
.pf-m-desc { max-width: 1080px; margin: 0 auto; padding: clamp(16px, 3vw, 32px) clamp(12px, 4vw, 48px) 0; color: var(--text-soft); font-weight: 300; }
.pf-m-desc + .pf-m-content { padding-top: 16px; }
.pf-m-desc[hidden] { display: none; }
.pf-m-content { max-width: 1080px; margin: 0 auto; padding: clamp(16px, 3vw, 40px) clamp(12px, 4vw, 48px) clamp(32px, 5vw, 64px); }

/* Imagens — apresentação editorial */
.pf-m-content.modo-imagens { display: grid; gap: clamp(14px, 2.4vw, 28px); }
.pf-m-section {
  font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint);
  display: flex; align-items: center; gap: 12px; padding-top: 12px;
}
.pf-m-section::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.pf-m-fig { margin: 0; }
.pf-m-img {
  position: relative;
  display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in;
  border-radius: 14px; overflow: hidden; background: var(--white);
  min-height: 160px; box-shadow: var(--shadow-sm);
}
.pf-m-fig.is-loaded .pf-m-img { min-height: 0; }
/* Camada transparente sobre a imagem: o clique abre a ampliação normalmente, mas o
   botão direito / toque prolongado atinge o botão, não o arquivo de imagem.
   Não altera a aparência (sem cor, sem filtro). */
.pf-m-img::after { content: ""; position: absolute; inset: 0; }
.pf-m-img img { display: block; width: 100%; height: auto; opacity: 0; transition: opacity .45s var(--ease); }
.pf-m-fig.is-loaded .pf-m-img img { opacity: 1; }
.pf-m-fig.is-missing .pf-m-img { cursor: default; background: repeating-linear-gradient(45deg, var(--white) 0 12px, #EEF0F5 12px 24px); }
.pf-m-fig figcaption { padding: 10px 4px 0; font-size: .85rem; color: var(--text-soft); }
.pf-m-mobile { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(14px, 3vw, 32px); }
.pf-m-fig.is-mobile { width: min(100%, 340px); }
.pf-m-fig.is-mobile .pf-m-img { border-radius: 24px; }

/* Selo do projeto (ex.: "Projeto demonstrativo — conteúdo fictício") */
.pf-m-selo { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: .75rem; font-weight: 500; color: var(--text-soft); }
.pf-m-selo::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); flex: none; }

/* Índice de seções e textos editoriais */
.pf-m-indice {
  position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: calc(-1 * clamp(16px, 3vw, 40px)) calc(-1 * clamp(12px, 4vw, 48px)) 0; padding: 12px clamp(12px, 4vw, 48px);
  background: rgba(246,247,250,.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.pf-m-indice::-webkit-scrollbar { display: none; }
.pf-m-desc:not([hidden]) + .pf-m-content .pf-m-indice { margin-top: -16px; }
.pf-m-indice-btn {
  flex: none; min-height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--white);
  color: var(--text-soft); font: inherit; font-size: .78rem; font-weight: 500; cursor: pointer; transition: border-color .2s, color .2s;
}
.pf-m-indice-btn:hover { border-color: var(--navy); color: var(--navy); }
.pf-m-sec { padding-top: clamp(16px, 3vw, 40px); }
.pf-m-sec.tem-texto { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); gap: 10px clamp(20px, 4vw, 56px); align-items: baseline; padding-bottom: 6px; }
.pf-m-sec .pf-m-section { padding-top: 0; scroll-margin-top: 72px; }
.pf-m-sec .pf-m-section:focus { outline: none; }
.pf-m-sec.tem-texto .pf-m-section { font-size: clamp(1.25rem, 2.2vw, 1.7rem); font-weight: 700; letter-spacing: -0.035em; text-transform: none; color: var(--navy); }
.pf-m-sec.tem-texto .pf-m-section::after { display: none; }
.pf-m-section-txt { color: var(--text-soft); font-weight: 300; font-size: clamp(.95rem, 1.3vw, 1.05rem); line-height: 1.65; max-width: 60ch; }
.pf-modal[data-cat="identidade-visual"] .pf-m-content.modo-imagens { gap: clamp(16px, 2.6vw, 32px); }
.pf-modal[data-cat="identidade-visual"] .pf-m-img { border-radius: 18px; box-shadow: 0 1px 2px rgba(19,22,41,.05), 0 24px 48px -28px rgba(19,22,41,.35); }

/* Navegação entre imagens na ampliação */
.pf-zoom-nav { position: absolute; top: 50%; z-index: 1; transform: translateY(-50%); background: var(--white); }
.pf-zoom-prev { left: 14px; }
.pf-zoom-next { right: 14px; }
.pf-zoom-count { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); z-index: 1; color: var(--white); font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Navegação interativa */
.pf-device-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.pf-devices { display: inline-flex; gap: 4px; padding: 4px; border-radius: 99px; background: var(--white); border: 1px solid var(--line); }
.pf-dev { min-height: 36px; padding: 0 14px; border-radius: 99px; border: 0; background: transparent; font: inherit; font-size: .8rem; font-weight: 500; color: var(--text-soft); cursor: pointer; }
.pf-dev.is-active { background: var(--navy); color: var(--white); }
.pf-newtab { font-size: .85rem; font-weight: 600; color: var(--navy); text-underline-offset: 3px; }
.pf-stage { display: flex; justify-content: center; }
.pf-frame-wrap {
  position: relative; width: 100%; max-width: 100%; height: min(72vh, 900px);
  border-radius: 14px; overflow: hidden; background: var(--white); border: 1px solid var(--line);
  box-shadow: var(--shadow); transition: max-width .4s var(--ease);
}
.pf-frame-wrap iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--white); }
.pf-frame-wrap.is-loading::after {
  content: "Carregando demonstração…"; position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--white); color: var(--text-soft); font-size: .875rem;
}
.pf-m-note { margin-top: 14px; font-size: .85rem; color: var(--text-soft); }
.pf-frame-note { margin: 0 0 14px; }
.pf-link-btn { margin-top: 6px; padding: 8px 0; border: 0; background: none; font: inherit; font-size: .875rem; font-weight: 600; color: var(--navy); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* PDF */
.pf-pdf { display: block; width: 100%; height: min(78vh, 1000px); border-radius: 14px; border: 1px solid var(--line); background: var(--white); }

/* Ampliação */
.pf-zoom { position: fixed; inset: 0; z-index: 2; background: rgba(19,22,41,.94); }
.pf-zoom[hidden] { display: none; }
.pf-zoom-scroll { position: absolute; inset: 0; overflow: auto; display: grid; place-items: start center; padding: 64px 16px 32px; overscroll-behavior: contain; cursor: zoom-out; }
.pf-zoom-scroll img { display: block; max-width: none; width: auto; height: auto; max-height: none; border-radius: 6px; cursor: zoom-out; }
/* imagens menores que a tela ficam centralizadas; maiores rolam */
@media (max-width: 900px) { .pf-zoom-scroll img { max-width: 200%; } }
.pf-zoom-close { position: absolute; top: 14px; right: 14px; z-index: 1; background: var(--white); }

/* ---------- Celular: apresentação em tela cheia ---------- */
@media (max-width: 720px) {
  .pf-m-sec.tem-texto { grid-template-columns: 1fr; }
  .pf-zoom-nav { top: auto; bottom: 18px; transform: none; }
  .pf-modal { padding: 0; }
  .pf-m-panel { border-radius: 0; }
  /* topo compacto: título + fechar */
  .pf-m-bar { padding: 12px 66px 12px 16px; min-height: 64px; }
  .pf-m-close { position: absolute; top: 10px; right: 10px; z-index: 3; }
  /* navegação e "Visitar site" numa barra inferior, ao alcance do polegar */
  .pf-m-actions {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    justify-content: space-between; gap: 10px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  }
  .pf-m-nav { margin-left: auto; }
  .pf-m-body { padding-bottom: 76px; }
  .pf-m-panel.sem-acoes .pf-m-actions { display: none; }
  .pf-m-panel.sem-acoes .pf-m-body { padding-bottom: 0; }
  .pf-m-tabs { padding: 8px 12px; }
}


/* ---------- Prévias dos aplicativos (variação do mesmo modal) ---------- */
.ap-viewer { display: grid; gap: 16px; }
.ap-stage {
  position: relative; display: grid; place-items: center;
  min-height: min(58vh, 640px); padding: 12px;
  background: var(--white); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  touch-action: pan-y;
}
.ap-stage img { display: block; max-width: 100%; max-height: min(calc(100dvh - 430px), 680px); min-height: 160px; width: auto; height: auto; border-radius: 10px; opacity: 0; transition: opacity .35s var(--ease); }
.ap-stage.is-loaded img { opacity: 1; }
.ap-stage::before { content: "Carregando…"; position: absolute; color: var(--text-soft); font-size: .85rem; }
.ap-stage.is-loaded::before { display: none; }
.ap-stage.is-missing::before { content: "Imagem indisponível"; display: block; }
.ap-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; box-shadow: var(--shadow-sm); }
.ap-arrow.prev { left: 12px; }
.ap-arrow.next { right: 12px; }
.ap-arrow[hidden] { display: none; }
.ap-legenda { text-align: center; }
.ap-legenda b { display: block; font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.ap-legenda span { display: block; font-size: .875rem; color: var(--text-soft); margin-top: 2px; }
.ap-dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.ap-dot { width: 44px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.ap-dot::before { content: ""; width: 22px; height: 5px; border-radius: 3px; background: var(--line-strong); transition: background-color .2s, width .25s var(--ease); }
.ap-dot[aria-current="true"]::before { width: 32px; background: var(--orange); }
.ap-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ap-logo { width: 40px; height: 40px; flex: none; border-radius: 21%; object-fit: contain; }
.ap-desc { max-width: 760px; margin: 0 auto; text-align: center; color: var(--text-soft); font-weight: 300; }
@media (max-width: 720px) {
  .ap-stage { min-height: 52vh; padding: 8px; }
  .ap-arrow.prev { left: 6px; } .ap-arrow.next { right: 6px; }
}
