/* ==========================================================================
   Pasta de portfólio 3D — folder.css
   Escopo: tudo vive sob .pf (prefixo "pf-"), sem tocar em estilos globais.
   Valores numéricos de layout/estado são definidos por folder.js.
   ========================================================================== */

.pf {
  /* ---- Tokens (podem ser sobrescritos por data-attributes / opções) ---- */
  --pf-color: var(--pf-cream, #F3E9CE);
  --pf-paper: #FFFFFF;
  --pf-text: #474747;
  --pf-line: #E3E3E3;
  --pf-block: #E9E9E9;
  --pf-speed: 1;
  --pf-frost: .25;
  --pf-focus: #9CC2FF;
  --pf-sha: .5;                       /* opacidade da sombra no chão */
  --pf-ps1: rgba(0, 0, 0, .22);       /* sombra curta das folhas */
  --pf-ps2: rgba(0, 0, 0, .30);       /* sombra longa das folhas */

  --pf-dur: calc(900ms / var(--pf-speed));
  --pf-pdur: calc(var(--pf-dur) * .95);
  --pf-pe: cubic-bezier(.34, 1.56, .64, 1);   /* easing das folhas (JS ajusta) */
  --pf-fe: cubic-bezier(.34, 1.56, .64, 1);   /* easing da capa (JS ajusta) */

  --pf-back-hi: color-mix(in srgb, var(--pf-color) 80%, #4a3d1a);
  --pf-back: color-mix(in srgb, var(--pf-color) 86%, #4a3d1a);
  --pf-logo-size: 100px;
  --pf-front-hi: color-mix(in srgb, var(--pf-color) 68%, #fff);

  position: relative;
  display: block;
  width: 100%;
  height: var(--pf-h, 460px);
  font-family: inherit;
  color: var(--pf-text);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.pf--ready { transition: height var(--pf-dur) cubic-bezier(.65, 0, .3, 1); }

.pf[data-theme="light"] {
  --pf-focus: #2457D6;
  --pf-sha: .22;
  --pf-ps1: rgba(70, 55, 20, .14);
  --pf-ps2: rgba(70, 55, 20, .22);
}

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

/* ---- Camada de escala (a composição é desenhada em px "de projeto") ---- */
.pf-scaler {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: 50% 50%;
}

/* ---- Palco com perspectiva ---- */
.pf-stage {
  position: absolute;
  inset: 0;
  perspective: 1600px;
  perspective-origin: 50% 42%;
}

.pf-tilt {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg));
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}

/* ---- 1. Sombra projetada ---- */
.pf-shadow {
  position: absolute;
  height: 46px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, var(--pf-sha)) 0%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
  transform: translateZ(-2px);
  transition:
    left var(--pf-dur) cubic-bezier(.65, 0, .3, 1),
    top var(--pf-dur) cubic-bezier(.65, 0, .3, 1),
    width var(--pf-dur) cubic-bezier(.65, 0, .3, 1),
    opacity var(--pf-dur) ease;
}

/* ---- Pasta ---- */
.pf-folder {
  position: absolute;
  width: 300px;
  height: 220px;
  transform-style: preserve-3d;
  transition: top var(--pf-dur) cubic-bezier(.65, 0, .3, 1);
}

.pf--pre .pf-folder { transform: translate3d(0, 46px, -160px) rotateX(16deg); }
.pf--intro .pf-folder { animation: pf-intro 1.15s cubic-bezier(.2, .8, .2, 1) both; }

@keyframes pf-intro {
  from { transform: translate3d(0, 46px, -160px) rotateX(16deg); }
  to   { transform: none; }
}

/* ---- 2. Estrutura traseira + 3. Aba (um unico desenho vetorial: sem emendas) ---- */
.pf-back {
  position: absolute;
  inset: 0;
}
.pf-back-svg {
  position: absolute;
  left: 0;
  top: -27px;
  width: 300px;
  height: 247px;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 20px 18px rgba(0, 0, 0, .30));
}

.pf-tab {
  position: absolute;
  top: -27px;
  left: 148px;
  width: 112px;
  height: 27px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 1px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .015em;
  line-height: 1;
  color: #2E2814;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .38);
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
.pf-tab span { transition: opacity .35s ease; }
.pf:not([data-state="closed"]) .pf-tab span { opacity: 0; }

/* ---- 4. Documentos ---- */
.pf-paper {
  position: absolute;
  left: 50%;
  top: 0;
  width: 300px;
  height: 390px;
  margin-left: -150px;
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: var(--pf-paper);
  color: var(--pf-text);
  text-align: left;
  cursor: pointer;
  outline: none;
  transform-origin: 50% 50%;
  transform:
    translate3d(var(--x, 0px), calc(var(--y, 0px) + var(--hy, 0px)), var(--z, 0px))
    rotate(calc(var(--r, 0deg) + var(--hr, 0deg)))
    scale(calc(var(--s, .5) * var(--hs, 1)));
  box-shadow: 0 2px 4px var(--pf-ps1), 0 16px 36px var(--pf-ps2);
  /* transição curta (hover, peek). A longa só vale em .pf--moving */
  transition: transform .4s cubic-bezier(.2, .7, .2, 1), box-shadow .4s ease;
}

.pf--moving .pf-paper {
  transition:
    transform var(--pf-pdur) var(--pf-pe) var(--pd, 0ms),
    box-shadow .6s ease var(--pd, 0ms);
}

/* escurece levemente as folhas que ficam atrás da selecionada */
.pf-paper::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s ease;
}
.pf-paper.is-behind::after { opacity: .1; }

/* hover sutil (somente com a pasta aberta) */
.pf[data-state="open"] .pf-paper:hover,
.pf[data-state="open"] .pf-paper:focus-visible {
  --hy: -16px;
  --hs: 1.04;
  box-shadow: 0 3px 6px var(--pf-ps1), 0 26px 50px var(--pf-ps2);
}

.pf-paper:focus-visible { outline: 5px solid var(--pf-focus); outline-offset: 8px; }

.pf-paper.is-selected {
  cursor: zoom-out;
  box-shadow: 0 4px 8px var(--pf-ps1), 0 40px 80px rgba(0, 0, 0, .5);
}

/* conteúdo da folha */
.pf-title {
  display: block;
  margin: 0 0 16px;
  font-size: 28px;
  line-height: 1.12;
  font-weight: 650;
  letter-spacing: -.02em;
  color: var(--pf-text);
}

/* a pagina pode definir --pf-display (fonte de titulo) e --pf-ink (cor do texto) */
.pf-title { color: var(--pf-ink, var(--pf-text)); }
.pf[data-display] .pf-title {
  font-family: var(--pf-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: .01em;
  text-transform: uppercase;
}
/* muitas folhas: o titulo quebra em linhas curtas para caber na parte visivel de cada folha */
.pf[data-many] .pf-title { font-size: 24px; max-width: 124px; transition: max-width .3s ease; }
.pf[data-many][data-stair] .pf-title { max-width: none; }
.pf[data-many] .pf-paper.is-selected .pf-title { max-width: none; font-size: 28px; }
.pf-paper.is-table.is-selected .pf-title { padding-right: 38px; }

.pf-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }

.pf-lines { display: grid; gap: 10px; margin: 0 0 18px; }
.pf-lines i {
  display: block;
  height: 11px;
  border-radius: 6px;
  background: var(--pf-line);
}
.pf-lines i:nth-child(1) { width: 100%; }
.pf-lines i:nth-child(2) { width: 88%; }
.pf-lines i:nth-child(3) { width: 94%; }

.pf-art {
  flex: none;
  height: 96px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--pf-block);
  overflow: hidden;
}
.pf-art svg { display: block; width: 100%; height: 100%; }

.pf-intro {
  position: relative;
  height: 53px;
  margin: 0 0 18px;
  transition: height .45s cubic-bezier(.2, .7, .2, 1);
}
.pf-intro .pf-lines { margin: 0; transition: opacity .3s ease; }

.pf-desc {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: block;
  font-size: 15.5px;
  line-height: 1.5;
  color: #5A5A5A;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s ease, transform .4s ease;
}

.pf-paper.is-selected .pf-intro { height: var(--dh, 116px); }
.pf-paper.is-selected .pf-intro .pf-lines { opacity: 0; }
.pf-paper.is-selected .pf-desc {
  opacity: 1;
  transform: none;
  transition-delay: .28s;
}

/* ---- folha-tabela (servicos clicaveis) ---- */
.pf-table {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.pf-paper.is-selected .pf-table {
  opacity: 1;
  visibility: visible;
  transition: opacity .35s ease .28s, visibility 0s;
}
.pf-paper.is-table.is-selected .pf-intro,
.pf-paper.is-table.is-selected .pf-art {
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility 0s linear .2s;
}
.pf-table-hd {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--pf-ink, #171310);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(23, 19, 16, .5);
}
.pf-rows {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 19, 16, .3) transparent;
  margin-right: -8px;
  padding-right: 8px;
}
.pf-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 11px 4px;
  border: 0;
  border-bottom: 1px dashed rgba(23, 19, 16, .22);
  background: none;
  font: inherit;
  font-size: 14px;
  line-height: 1.3;
  color: var(--pf-ink, #171310);
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, padding .15s ease;
}
.pf-row:hover,
.pf-row:focus-visible {
  background: rgba(228, 168, 37, .18);
  padding-left: 10px;
  outline: none;
}
.pf-row:focus-visible { box-shadow: inset 3px 0 0 var(--pf-focus, #E4A825); }
.pf-row-name { font-weight: 600; }
.pf-row-price { flex: none; font-family: var(--pf-display, inherit); font-size: 15px; color: var(--pf-rust, #9A2E1B); white-space: nowrap; }

.pf-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: none;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(23, 19, 16, .08);
  color: var(--pf-ink, #171310);
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.pf-close svg { width: 13px; height: 13px; display: block; }
.pf-close:hover { background: var(--pf-gold, #E4A825); }
.pf-close:focus-visible { outline: 2px solid var(--pf-focus, #9CC2FF); outline-offset: 2px; }
.pf-paper.is-selected .pf-close { display: grid; }

/* ---- 5. Capa frontal articulada ---- */
.pf-front {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 160px;
  border-radius: 20px 20px 18px 18px;
  background: linear-gradient(170deg, var(--pf-front-hi), var(--pf-color) 72%);
  transform-origin: 50% 100%;
  transform: translate3d(0, var(--ffy, 0px), 14px) rotateX(var(--ffr, 0deg));
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, .55),
    0 14px 30px rgba(0, 0, 0, .28);
  overflow: hidden;
  transition: transform .45s cubic-bezier(.2, .7, .2, 1);
}

.pf--moving .pf-front {
  transition: transform var(--pf-dur) var(--pf-fe) var(--fd, 0ms);
}

/* brilho acetinado (frost) */
.pf-front::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, calc(var(--pf-frost) * 1.6)) 0%, rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
}
/* sombreamento quando a capa tomba para frente */
.pf-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(58, 44, 12, .30), rgba(58, 44, 12, .12));
  opacity: var(--pf-shade, 0);
  pointer-events: none;
  transition: opacity var(--pf-dur) ease var(--fd, 0ms);
}

/* ---- Botão semântico que abre/fecha a pasta ---- */
.pf-hit {
  position: absolute;
  z-index: 5;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
  cursor: pointer;
  outline: none;
}
.pf-hit:focus-visible { outline: 3px solid var(--pf-focus); outline-offset: 6px; }

/* logo no centro da capa (somente com a pasta fechada) */
.pf-hit-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  height: var(--pf-logo-size);
  width: auto;
  max-width: 70%;
  object-fit: contain;
  transform: translate(-50%, -50%);
  pointer-events: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 2px 3px rgba(60, 45, 10, .22));
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.pf[data-state="closed"] .pf-hit-logo {
  opacity: 1;
  visibility: visible;
  transition: opacity .4s ease .5s, visibility 0s;
}

/* ---- 6. Destaque (folha selecionada usa z-depth maior, definido em JS) ---- */

.pf-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Movimento reduzido ---- */
@media (prefers-reduced-motion: reduce) {
  .pf { --pf-dur: 1ms; }
  .pf *, .pf *::before, .pf *::after {
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
    animation: none !important;
  }
}
