/* Efeitos globais (maestro): grão de filme, barra de progresso, cursor, Raio-X. */

/* ---------- grão de filme ---------- */
.grao {
  position: fixed; inset: -160px; z-index: 1100; pointer-events: none;
  opacity: .085;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 2 -.5 0 0 0 2 -.5 0 0 0 2 -.5 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}
/* o grão só "ferve" em tela grande com mouse (GPU folgada); no celular fica parado */
@media (hover: hover) and (pointer: fine) and (min-width: 1024px) {
  .grao { will-change: transform; animation: grao 1s steps(5) infinite; }
}
@keyframes grao {
  0% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(-90px, 60px, 0); }
  40% { transform: translate3d(70px, -110px, 0); }
  60% { transform: translate3d(-40px, 120px, 0); }
  80% { transform: translate3d(110px, 30px, 0); }
  100% { transform: translate3d(-120px, -60px, 0); }
}
@media (prefers-reduced-motion: reduce) { .grao { animation: none; } }

/* ---------- barra de progresso da rolagem ---------- */
.progresso {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 61;
  background: linear-gradient(90deg, var(--girassol), var(--sol));
  transform-origin: 0 50%; transform: scaleX(0);
  box-shadow: 0 0 12px rgba(242, 179, 33, .7);
  pointer-events: none;
}

/* ---------- cursor próprio (só mouse fino) ---------- */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 1200; pointer-events: none;
  width: 0; height: 0; opacity: 0; transition: opacity .3s;
}
.cursor--visivel { opacity: 1; }
.cursor__bola {
  position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--girassol);
  background: rgba(242, 179, 33, .08);
  transition: transform .45s var(--ease-sai), background .3s, border-color .3s;
}
.cursor__texto {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%) scale(.6);
  font: 700 .72rem/1 var(--fonte-texto); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  color: var(--tinta); opacity: 0; transition: opacity .25s, transform .45s var(--ease-sai);
}
.cursor[data-estado="link"] .cursor__bola { transform: scale(2.6); background: rgba(242, 179, 33, .16); border-color: rgba(242, 179, 33, .7); }
.cursor[data-estado="rotulo"] .cursor__bola { transform: scale(5.4); background: var(--girassol); border-color: var(--girassol); }
.cursor[data-estado="rotulo"] .cursor__texto { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.cursor[data-estado="escondido"] { opacity: 0; }
.cursor--aperta .cursor__bola { transform: scale(.7); }
.cursor--aperta[data-estado="link"] .cursor__bola { transform: scale(2.1); }
.cursor--aperta[data-estado="rotulo"] .cursor__bola { transform: scale(4.6); }

/* ---------- Raio-X ---------- */
.raiox-botao {
  position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 710;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 12px; border: 0; border-radius: 999px;
  background: rgba(20, 12, 7, .78); color: var(--creme);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 246, 232, .14);
  font-size: .82rem; font-weight: 700; letter-spacing: .02em;
  transition: background .3s, color .3s, opacity .4s, transform .5s var(--ease-sai), visibility 0s;
}
/* durante a abertura o botão fica guardado (não briga com o título nem com os botões do vídeo).
   A tecla X funciona sempre; com o Raio-X ligado ele aparece. */
body.na-abertura .raiox-botao:not([aria-pressed="true"]) {
  opacity: 0; visibility: hidden; transform: translateY(20px); pointer-events: none;
  transition: background .3s, color .3s, opacity .4s, transform .5s var(--ease-sai), visibility 0s linear .5s;
}
.raiox-botao kbd {
  font: 700 .7rem/1 var(--fonte-texto); padding: 4px 6px; border-radius: 6px;
  background: rgba(255, 246, 232, .12); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .4);
}
.raiox-botao__icone {
  position: relative; width: 16px; height: 16px; border-radius: 4px;
  border: 1.5px dashed currentColor;
}
.raiox-botao__icone::after {
  content: ""; position: absolute; left: -3px; right: -3px; top: 50%; height: 1.5px; background: #5ee0ff;
  box-shadow: 0 0 6px #5ee0ff; animation: raiox-varre 2.4s ease-in-out infinite;
}
@keyframes raiox-varre { 0%, 100% { transform: translateY(-7px); } 50% { transform: translateY(7px); } }
.raiox-botao:hover { background: rgba(20, 12, 7, .92); }
.raiox-botao::after {
  content: "Aperte X e veja como este site foi feito"; position: absolute; left: 0; bottom: calc(100% + 10px);
  width: max-content; max-width: 70vw; padding: 8px 12px; border-radius: 10px;
  background: #5ee0ff; color: #04202a; font-size: .78rem; font-weight: 700; line-height: 1.25;
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .5);
  opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity .4s, transform .5s var(--ease-sai);
}
.raiox-botao--dica::after { opacity: 1; transform: none; }
/* computador: um círculo de 44 px só com o ícone (não cobre o texto nas margens de 47 a 72 px);
   o rótulo "Raio-X · X" abre no hover, no foco e com o Raio-X ligado */
@media (min-width: 701px) {
  .raiox-botao {
    height: 44px; min-width: 44px; padding: 0 13px; gap: 0; justify-content: center;
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(94, 224, 255, .4);
  }
  .raiox-botao > span:not(.raiox-botao__icone), .raiox-botao kbd {
    max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap; margin-left: 0;
    transition: max-width .5s var(--ease-sai), opacity .3s, margin-left .5s var(--ease-sai);
  }
  .raiox-botao:hover > span:not(.raiox-botao__icone), .raiox-botao:hover kbd,
  .raiox-botao:focus-visible > span:not(.raiox-botao__icone), .raiox-botao:focus-visible kbd,
  .raiox-botao[aria-pressed="true"] > span:not(.raiox-botao__icone), .raiox-botao[aria-pressed="true"] kbd {
    max-width: 90px; opacity: 1; margin-left: 8px;
  }
  .raiox-botao kbd { padding-inline: 0; }
  .raiox-botao:hover kbd, .raiox-botao:focus-visible kbd, .raiox-botao[aria-pressed="true"] kbd { padding-inline: 6px; }
}
/* telas de 701 a 1199 px: a margem da página (5vw) é menor; o círculo encolhe e encosta no canto */
@media (min-width: 701px) and (max-width: 1199px) {
  .raiox-botao { height: 36px; min-width: 36px; padding: 0 10px; left: max(6px, env(safe-area-inset-left)); bottom: max(8px, env(safe-area-inset-bottom)); }
}
/* tela de toque (celular, tablet): não tem tecla X */
@media (hover: none) {
  .raiox-botao::after { content: "Toque e veja como este site foi feito"; }
  .raiox-botao kbd { display: none; }
}
.raiox-botao[aria-pressed="true"] { background: #5ee0ff; color: #04202a; }
.raiox-botao[aria-pressed="true"] kbd { background: rgba(4, 32, 42, .15); }

html.raiox [data-raiox-item] { outline: 2px dashed #5ee0ff !important; outline-offset: 4px; }
html.raiox section[data-raiox] { box-shadow: inset 0 0 0 2px rgba(94, 224, 255, .35); }

.raiox-camada { position: fixed; inset: 0; z-index: 700; pointer-events: none; overflow: hidden; }
.raiox-secao, .raiox-item { position: absolute; left: 0; top: 0; will-change: transform; }
.raiox-secao {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  max-width: min(760px, calc(100vw - 36px));
  padding: 8px; border-radius: 14px;
  background: rgba(4, 22, 30, .86); color: #dff8ff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(94, 224, 255, .45);
  font: 600 .76rem/1.2 var(--fonte-texto);
}
.raiox-secao b { padding: 4px 8px; border-radius: 8px; background: #5ee0ff; color: #04202a; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; }
.raiox-secao span { padding: 4px 9px; border-radius: 999px; background: rgba(94, 224, 255, .14); box-shadow: inset 0 0 0 1px rgba(94, 224, 255, .3); }
.raiox-item {
  max-width: 260px; padding: 3px 8px; border-radius: 6px;
  background: #5ee0ff; color: #04202a; font: 700 .68rem/1.25 var(--fonte-texto);
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .5);
}
@media (max-width: 700px) {
  .raiox-secao { max-width: calc(100vw - 20px); padding: 6px; gap: 4px; font-size: .75rem; }
  .raiox-secao b { font-size: .72rem; }
  .raiox-secao span { padding: 3px 7px; }
  .raiox-item { max-width: 220px; font-size: .72rem; }
}

.raiox-painel {
  position: fixed; z-index: 720; top: 12px; right: 12px; bottom: 12px;
  width: min(400px, calc(100vw - 24px));
  display: flex; flex-direction: column;
  border-radius: 20px; overflow: hidden;
  background: rgba(4, 18, 24, .94); color: #e3f8ff;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(94, 224, 255, .35);
  font-size: .9rem; line-height: 1.45;
}
.raiox-painel__topo { display: flex; align-items: flex-start; gap: 8px; padding: 18px 16px 14px 20px; border-bottom: 1px solid rgba(94, 224, 255, .2); }
.raiox-painel__alca { flex: 1; display: grid; gap: 4px; text-align: left; background: none; border: 0; padding: 0; color: inherit; cursor: default; }
.raiox-painel__olho { font-size: .7rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #5ee0ff; }
.raiox-painel__alca strong { font-family: var(--fonte-titulo); font-weight: 600; font-size: 1.5rem; line-height: 1.05; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 72; }
.raiox-painel__alca em { font-style: normal; font-size: .8rem; opacity: .7; }
.raiox-painel__fechar { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 0; background: rgba(94, 224, 255, .14); color: inherit; font-size: 1.3rem; line-height: 1; }
.raiox-painel__fechar:hover { background: rgba(94, 224, 255, .28); }
.raiox-painel__corpo { overflow-y: auto; padding: 16px 20px 22px; overscroll-behavior: contain; }
.raiox-painel__texto { padding: 12px 14px; border-radius: 12px; background: rgba(94, 224, 255, .1); box-shadow: inset 3px 0 0 #5ee0ff; margin-bottom: 16px; }
.raiox-painel__lista { list-style: none; counter-reset: tec; margin: 0; padding: 0; display: grid; gap: 2px; }
.raiox-painel__lista li { counter-increment: tec; display: grid; grid-template-columns: 28px 1fr; gap: 2px 8px; padding: 9px 0; border-bottom: 1px solid rgba(94, 224, 255, .1); }
.raiox-painel__lista li::before { content: counter(tec, decimal-leading-zero); grid-row: span 2; font-size: .72rem; font-weight: 700; color: #5ee0ff; padding-top: 2px; }
.raiox-painel__tec { font-weight: 600; }
.raiox-painel__lista li { transition: background .4s, box-shadow .4s; border-radius: 10px; }
.raiox-painel__lista li.is-atual { background: rgba(94, 224, 255, .1); box-shadow: inset 3px 0 0 #5ee0ff; padding-left: 8px; }
.raiox-painel__onde { display: flex; flex-wrap: wrap; gap: 4px; }
.raiox-painel__chip { font: 600 .7rem/1 var(--fonte-texto); padding: 5px 8px; border-radius: 999px; border: 0; background: rgba(94, 224, 255, .16); color: #bdf1ff; }
button.raiox-painel__chip:hover { background: #5ee0ff; color: #04202a; }
.raiox-painel__chip--pagina { background: rgba(255, 246, 232, .1); color: #e3f8ff; }
.raiox-painel__dica { margin: 16px 0 0; font-size: .8rem; opacity: .75; }
.raiox-painel__dica kbd { font: 700 .72rem/1 var(--fonte-texto); padding: 3px 6px; border-radius: 5px; background: rgba(94, 224, 255, .2); }
@media (max-width: 700px) {
  .raiox-painel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 64vh; border-radius: 18px; }
  .raiox-painel__alca { cursor: pointer; }
  .raiox-painel__alca strong { font-size: 1.2rem; }
  .raiox-painel--recolhido .raiox-painel__corpo { display: none; }
  .raiox-painel--recolhido .raiox-painel__topo { border-bottom: 0; padding: 12px 12px 12px 16px; }
  .raiox-painel__alca::after { content: "toque para abrir a lista"; font-size: .72rem; color: #5ee0ff; }
  .raiox-painel__alca[aria-expanded="true"]::after { content: "toque para recolher"; }
  html.raiox .raiox-botao { display: none; }
}
