/* CareWise · seção Camadas. Classes com prefixo cam-. Desktop é a base; o celular sobrescreve em ≤860px. */
.cam {
  position: relative; z-index: 5; height: 320vh;
  background:
    radial-gradient(50% 42% at 72% 56%, rgba(79,70,229,.2), transparent 70%),
    var(--indigo-noite, #120F33);
  color: #fff;
}
.cam-palco {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 500px) minmax(0, 1fr); align-items: center; gap: 4vw;
  padding: 96px clamp(20px, 6vw, 96px) 40px;
}

/* ---------- Texto e lista de camadas ---------- */
.cam-sobre { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #A5B4FC; }
.cam h2 {
  margin: 14px 0 18px; font-weight: 400; letter-spacing: -0.035em; line-height: 1.06;
  font-size: clamp(32px, min(3.8vw, 6vh), 58px);
}
.cam-intro { font-size: 16.5px; line-height: 1.6; color: rgba(255,255,255,.66); max-width: 460px; }

.cam-lista { margin-top: clamp(18px, 3.4vh, 34px); border-bottom: 1px solid rgba(255,255,255,.08); }
.cam-item {
  display: grid; grid-template-columns: 40px 1fr; align-items: start;
  padding: clamp(8px, 1.3vh, 12px) 0; border-top: 1px solid rgba(255,255,255,.08);
}
.cam-num { font-size: 12px; font-weight: 800; letter-spacing: .1em; color: rgba(255,255,255,.3); padding-top: 4px; transition: color .4s; }
.cam-item h3 {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 17px; font-weight: 700; letter-spacing: -0.02em; color: rgba(255,255,255,.4); transition: color .4s;
}
.cam-item.aceso h3 { color: rgba(255,255,255,.78); }
.cam-item.aceso .cam-num { color: rgba(165,180,252,.7); }
.cam-item.ativo h3 { color: #fff; }
.cam-item.ativo .cam-num { color: #C7D2FE; }
.cam-medico.ativo .cam-num { color: var(--coral, #FB7185); }
.cam-medico.ativo h3 { color: var(--coral, #FB7185); }
.cam-selo {
  font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 3px 9px; border-radius: 999px;
  color: var(--coral, #FB7185); border: 1px solid rgba(251,113,133,.45);
}
.cam-desc { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .55s cubic-bezier(.2,.8,.2,1), opacity .45s; }
.cam-desc > p { overflow: hidden; min-height: 0; font-size: 15px; line-height: 1.55; color: rgba(255,255,255,.66); }
.cam-item.ativo .cam-desc { grid-template-rows: 1fr; opacity: 1; }
.cam-item.ativo .cam-desc > p { padding-top: 6px; }

/* ---------- Cena 3D ---------- */
.cam-cena {
  position: relative; height: min(80vh, 700px);
  perspective: 1900px; perspective-origin: 50% 20%;
}
.cam-chao {
  position: absolute; left: 50%; bottom: 4%; width: 90%; height: 26%; transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(79,70,229,.45), transparent 70%);
  filter: blur(10px); opacity: .7;
}
.cam-pilha {
  --lado: min(27vw, 64vh, 380px);
  --rx: 58deg; --rz: -42deg; --centro: 0px;
  position: absolute; left: 50%; top: 56%;
  width: var(--lado); height: var(--lado); margin: calc(var(--lado) / -2) 0 0 calc(var(--lado) / -2);
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateZ(var(--rz)) translateZ(var(--centro));
}
.cam-placa {
  position: absolute; inset: 0; border-radius: 26px; transform-style: preserve-3d;
  transform: translateZ(var(--z, 0px));
  border: 1px dashed rgba(165,180,252,.28);
  background: rgba(79,70,229,.03);
  transition: background .6s, border-color .6s, box-shadow .6s;
}
/* Espessura da placa: uma cópia escura logo abaixo */
.cam-placa::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  transform: translateZ(-7px); background: #0B0924; opacity: 0; transition: opacity .6s;
}
.cam-face {
  position: absolute; inset: 0; border-radius: inherit; padding: 9% 9%;
  display: flex; flex-direction: column; gap: 6%;
  opacity: .07; transition: opacity .6s;
}
.cam-face b { font-size: clamp(13px, calc(var(--lado) * .052), 19px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; max-width: 82%; }
.cam-icone {
  width: 20%; aspect-ratio: 1; border-radius: 26%;
  background: rgba(255,255,255,.12) var(--cam-icone) center / 52% no-repeat;
}
.cam-ui { margin-top: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.cam-ui i { grid-column: 1 / -1; height: 7px; border-radius: 99px; background: rgba(255,255,255,.22); transform-origin: left; transform: scaleX(.15); transition: transform .9s cubic-bezier(.2,.8,.2,1); }
.cam-ui i:nth-child(2) { width: 78%; }
.cam-ui i:nth-child(3) { width: 56%; }
.cam-ui em { height: calc(var(--lado) * .14); border-radius: 10px; background: rgba(255,255,255,.1); margin-top: 6px; transform: scaleY(.3); transform-origin: bottom; transition: transform .9s cubic-bezier(.2,.8,.2,1); }

/* Camadas já acesas, embaixo da ativa */
.cam-placa.abaixo {
  border: 1px solid rgba(165,180,252,.32);
  background: linear-gradient(135deg, #3A33B8, #23205E);
  box-shadow: 0 0 40px rgba(79,70,229,.25);
}
.cam-placa.abaixo::before, .cam-placa.ativa::before { opacity: 1; }
.cam-placa.abaixo .cam-face { opacity: .55; }
/* Camada ativa */
.cam-placa.ativa {
  border: 1px solid rgba(199,210,254,.75);
  background: linear-gradient(135deg, #6A62F5 0%, #4F46E5 45%, #2E2A8C 100%);
  box-shadow: 0 0 0 1px rgba(199,210,254,.2), 0 0 60px rgba(99,102,241,.4);
}
.cam-placa.ativa .cam-face { opacity: 1; }
.cam-placa.abaixo .cam-ui i, .cam-placa.ativa .cam-ui i { transform: scaleX(1); }
.cam-placa.abaixo .cam-ui em, .cam-placa.ativa .cam-ui em { transform: scaleY(1); }
.cam-placa.ativa .cam-ui em:nth-of-type(1) { background: rgba(224,231,255,.7); }
/* Módulo médico, no topo, em coral */
.cam-placa-medico { border-color: rgba(251,113,133,.4); }
.cam-placa-medico.ativa, .cam-placa-medico.abaixo {
  border-color: rgba(255,228,230,.8);
  background: linear-gradient(135deg, #FDA4AF 0%, #FB7185 50%, #E11D48 100%);
  box-shadow: 0 0 0 1px rgba(255,228,230,.3), 0 0 60px rgba(251,113,133,.4);
  color: var(--indigo-escuro, #1E1B4B);
}
.cam-placa-medico .cam-icone { background-color: rgba(30,27,75,.14); }
.cam-placa-medico.ativa .cam-ui i, .cam-placa-medico.ativa .cam-ui em { background: rgba(30,27,75,.2); }
.cam-placa-medico.ativa .cam-ui em:nth-of-type(1) { background: var(--indigo-escuro, #1E1B4B); }

.cam-contador {
  position: absolute; right: 4%; top: 6%; display: flex; align-items: baseline; gap: 6px;
  font-weight: 800; letter-spacing: -0.02em; color: rgba(255,255,255,.35); font-size: 14px;
}
.cam-contador b { font-size: 40px; color: #fff; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }

.cam-legenda { display: none; }

/* Ícones das placas (traço branco; o do médico em índigo escuro) */
[data-cam-icone="ficha"]      { --cam-icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='3'/%3E%3Ccircle cx='9' cy='11' r='2.5'/%3E%3Cpath d='M5.5 17c.6-1.8 2-2.7 3.5-2.7s2.9.9 3.5 2.7M15 10h3M15 14h3'/%3E%3C/svg%3E"); }
[data-cam-icone="agenda"]     { --cam-icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18'/%3E%3C/svg%3E"); }
[data-cam-icone="treino"]     { --cam-icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 7v10M18 7v10M3 10v4M21 10v4M6 12h12'/%3E%3C/svg%3E"); }
[data-cam-icone="avaliacao"]  { --cam-icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 20V10M10 20V4M16 20v-7M22 20H2'/%3E%3C/svg%3E"); }
[data-cam-icone="financeiro"] { --cam-icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Crect x='2' y='6' width='20' height='13' rx='2'/%3E%3Ccircle cx='12' cy='12.5' r='2.5'/%3E%3C/svg%3E"); }
[data-cam-icone="app"]        { --cam-icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Crect x='6' y='2' width='12' height='20' rx='3'/%3E%3Cpath d='M10 18h4'/%3E%3C/svg%3E"); }
[data-cam-icone="medico"]     { --cam-icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231E1B4B' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='5'/%3E%3Cpath d='M12 8v8M8 12h8'/%3E%3C/svg%3E"); }

/* ---------- Celular (≤860px): pilha no meio, a camada ativa embaixo ---------- */
@media (max-width: 860px) {
  .cam { height: 285vh; }
  .cam-palco {
    grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto;
    align-items: stretch; gap: 0; padding: 78px 20px 26px;
  }
  .cam h2 { font-size: clamp(28px, 8vw, 38px); margin: 10px 0 0; }
  .cam-intro { display: none; }
  /* A lista fica só para leitor de tela; quem vê lê a legenda */
  .cam-lista {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .cam-cena { height: auto; min-height: 0; perspective: 1300px; }
  .cam-pilha { --lado: min(60vw, 30svh, 250px); top: 54%; }
  .cam-placa { border-radius: 18px; }
  .cam-ui { gap: 4px; }
  .cam-ui i { height: 5px; }
  .cam-contador { top: 2%; right: 0; }
  .cam-contador b { font-size: 28px; }
  .cam-legenda { display: block; min-height: 156px; text-align: left; }
  .cam-legenda.trocou { animation: cam-surgir .5s ease; }
  .cam-legenda h3 { margin: 6px 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; }
  .cam-legenda.medico h3 { color: var(--coral, #FB7185); }
  .cam-legenda p { font-size: 15px; line-height: 1.5; color: rgba(255,255,255,.7); }
  .cam-legenda .cam-num { padding: 0; color: #C7D2FE; }
  .cam-legenda.medico .cam-num { color: var(--coral, #FB7185); }
}
@keyframes cam-surgir { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Movimento reduzido: pilha aberta e toda acesa, sem rolagem presa ---------- */
.cam.cam-estatico { height: auto; }
.cam.cam-estatico .cam-palco { position: relative; height: auto; min-height: 100vh; }
.cam.cam-estatico .cam-desc { grid-template-rows: 1fr; opacity: 1; }
.cam.cam-estatico .cam-desc > p { padding-top: 6px; }
.cam.cam-estatico .cam-item h3 { color: #fff; }
.cam.cam-estatico .cam-medico h3 { color: var(--coral, #FB7185); }
.cam.cam-estatico .cam-contador { display: none; }
.cam.cam-estatico .cam-placa, .cam.cam-estatico .cam-face, .cam.cam-estatico .cam-desc,
.cam.cam-estatico .cam-ui i, .cam.cam-estatico .cam-ui em { transition: none; }
@media (max-width: 860px) {
  .cam.cam-estatico .cam-palco { grid-template-rows: auto; padding-top: 72px; }
  .cam.cam-estatico .cam-cena { height: 56vh; order: 2; }
  .cam.cam-estatico .cam-lista { position: static; width: auto; height: auto; overflow: visible; clip: auto; clip-path: none; white-space: normal; order: 3; }
  .cam.cam-estatico .cam-legenda { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cam-legenda.trocou { animation: none; }
}
