/* Abertura animada: notebook desenhado em CSS e capturas originais preservadas. */
body { isolation: isolate; background-color: #f5f6f8; }
#ambient-particles { position: fixed; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
main, .site-footer { position: relative; z-index: 1; }
.hero { background: transparent; }
.hero h1 { font-weight: 700; letter-spacing: -.045em; }
.hero::after { opacity: .65; }
.hero-grid { opacity: .2; }
/* Superfícies abertas deixam o fluxo de informações aparecer nas áreas vazias.
   Cartões, formulário e painel institucional mantêm seus fundos opacos. */
.section-muted, .routine-strip, .site-footer { background-color: rgb(255 255 255 / 36%); }
[data-theme="dark"] body { background-color: #14151a; }
[data-theme="dark"] .section-muted, [data-theme="dark"] .routine-strip, [data-theme="dark"] .site-footer { background-color: rgb(30 30 37 / 40%); }

.hero-visual-animated { min-height: 540px; padding: 16px 0 0; }
.device-scene { position: relative; width: 100%; max-width: 580px; aspect-ratio: 1.14; margin: 10px auto 0; perspective: 1500px; }
.device-parallax { position: absolute; inset: 0; transform: perspective(1500px) rotateX(var(--pointer-y, 0deg)) rotateY(var(--pointer-x, 0deg)); transform-style: preserve-3d; transition: transform .35s ease-out; }
.hero-device-motion { position: absolute; inset: 0; transform-style: preserve-3d; }
.device-stage { position: relative; width: 100%; height: 100%; padding: 0; border: 0; background: none; transform: rotateY(-5deg) rotateX(2deg); transform-style: preserve-3d; }
.device-stage::after { position: absolute; z-index: -1; right: 4%; bottom: 1%; left: 5%; height: 8%; border-radius: 50%; background: radial-gradient(ellipse, rgb(30 24 29 / 14%), transparent 72%); filter: blur(10px); content: ''; pointer-events: none; }
.laptop-display { position: absolute; z-index: 1; top: 47%; left: 12%; width: 79%; height: 45%; padding: 7px 6px 10px; border: 3px solid #93969f; border-radius: 11px 11px 4px 4px; background: linear-gradient(140deg, #2d2e35, #14151a 60%); box-shadow: 0 10px 18px rgb(29 24 29 / 10%), inset 0 0 0 1px rgb(255 255 255 / 12%); }
.laptop-display::before { position: absolute; z-index: 2; top: 2px; left: calc(50% - 1.5px); width: 3px; height: 3px; border-radius: 50%; background: #888d99; box-shadow: 0 0 0 1px #22232b; content: ''; }
.laptop-bezel { display: block; width: 100%; height: 100%; overflow: hidden; border: 1px solid #08090e; border-radius: 3px; background: #fff; }
.device-screen { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.laptop-base { position: absolute; z-index: 5; top: 91%; left: 4%; width: 94%; height: 4.5%; border: 1px solid #b4b7bf; border-radius: 1px 1px 9px 9px; background: linear-gradient(180deg, #e3e5ea, #c7cbd3 51%, #f0f1f4 56%, #a2a6af 90%, #727781); clip-path: polygon(8% 0, 91% 0, 100% 69%, 98.5% 100%, 1.5% 100%, 0 69%); }
.laptop-base::before { position: absolute; left: 21%; top: 7%; width: 59%; height: 30%; border: 1px solid rgb(36 37 44 / 20%); border-radius: 2px; background-image: repeating-linear-gradient(90deg, transparent 0 6px, #5b5e67 6px 7px), repeating-linear-gradient(0deg, #4f525b 0 2px, #c5c8ce 2px 3px); content: ''; opacity: .45; }
.laptop-base::after { position: absolute; left: 43%; top: 46%; width: 17%; height: 28%; border: 1px solid rgb(60 61 70 / 15%); border-radius: 2px; background: rgb(239 240 244 / 22%); content: ''; }

/* As três telas são botões independentes; o cabeçalho de cada uma fica exposto. */
.floating-screen { position: absolute; display: flex; flex-direction: column; min-width: 0; min-height: 44px; padding: 0; overflow: hidden; border: 1px solid #e0e1e7; border-radius: 12px; color: #363435; background: #fff; box-shadow: 0 12px 25px rgb(33 26 31 / 11%), 0 1px 3px rgb(33 26 31 / 4%); text-align: left; cursor: zoom-in; transform-origin: center bottom; backface-visibility: hidden; transition: border-color .2s, box-shadow .2s; }
.floating-screen:hover, .floating-screen:focus-visible { border-color: #ca0018; box-shadow: 0 14px 29px rgb(78 26 38 / 14%), 0 0 0 1px rgb(202 0 24 / 9%); }
.floating-screen:focus-visible { z-index: 8; outline: 3px solid var(--brand); outline-offset: 4px; }
.floating-toolbar { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; min-height: 34px; padding: 7px 11px; border-bottom: 1px solid #e5e6ed; background: linear-gradient(#fff, #f7f8fb); color: #4c4850; font-size: .875rem; font-weight: 600; line-height: 1.35; }
.floating-toolbar .screen-dot { display: block; flex-shrink: 0; width: 6px; height: 6px; border-radius: 2px; background: #ca0018; }
.floating-toolbar > span:not(.screen-dot) { flex: 1; min-width: 0; }
.floating-toolbar > .icon { flex-shrink: 0; width: 16px; height: 16px; }
.floating-screen > img { display: block; flex: 1 1 0; width: 100%; height: 0; min-height: 0; object-fit: cover; object-position: top; }
.screen-terceirizados { z-index: 2; top: 0; left: 0; width: 54%; height: 37%; --screen-transform: translate3d(0, 0, 25px) rotateZ(-3deg) rotateY(-4deg); --screen-float: -2px; transform: var(--screen-transform); }
.screen-protocolos { z-index: 3; top: 4%; right: 0; width: 52%; height: 34%; --screen-transform: translate3d(0, 0, 40px) rotateZ(2deg) rotateY(-3deg); --screen-float: -3px; transform: var(--screen-transform); }
.screen-emendas { z-index: 4; top: 34%; left: 12%; width: 73%; height: 39%; --screen-transform: translate3d(0, 0, 65px) rotateZ(-1deg) rotateY(-2deg); --screen-float: -2px; transform: var(--screen-transform); box-shadow: 0 16px 31px rgb(33 26 31 / 14%), 0 1px 4px rgb(33 26 31 / 4%); }
.screen-emendas .floating-toolbar { border-bottom-color: #efd5da; color: #95001e; background: #fff8f9; }
.hero-visual-caption { max-width: 500px; margin: 9px auto 0; color: var(--text); font-size: .875rem; line-height: 1.55; text-align: center; }
.hero-visual-caption p { font-size: inherit; }
.hero-visual-caption > strong { display: block; color: var(--ink); font-family: 'Manrope', Arial, sans-serif; font-size: .875rem; font-weight: 600; line-height: 1.5; }
.hero-visual-caption > span { display: block; margin-top: 4px; }
.motion-controls { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 9px; }
.motion-toggle { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px; padding: 9px 13px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: transparent; font-size: .875rem; font-weight: 500; line-height: 1.4; transition: color .2s, border-color .2s, background .2s; }
.motion-toggle .icon { width: 17px; height: 17px; }
.motion-toggle:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.motion-toggle .motion-play-icon, .motion-toggle .play-icon { display: none; }
.motion-toggle[data-state="paused"] .motion-pause-icon, .motion-toggle[data-state="paused"] .pause-icon { display: none; }
.motion-toggle[data-state="paused"] .motion-play-icon, .motion-toggle[data-state="paused"] .play-icon { display: block; }

/* O estado inicial é estático. O JS habilita movimento apenas quando permitido. */
html.motion-intro:not(.motion-started) .floating-screen { opacity: 0; }
html.motion-running .floating-screen, html.motion-running .hero-device-motion { will-change: transform; }
html.motion-running.motion-started .hero-device-motion, html.motion-paused.motion-started .hero-device-motion { animation: device-float 8s ease-in-out infinite; }
html.motion-running.motion-started .floating-screen, html.motion-paused.motion-started .floating-screen { animation: screen-emerge 1.05s cubic-bezier(.16, 1, .3, 1) both, screen-float 7.5s ease-in-out 1.05s infinite; }
html.motion-running.motion-started .screen-terceirizados, html.motion-paused.motion-started .screen-terceirizados { animation-delay: 0s, 1.05s; }
html.motion-running.motion-started .screen-protocolos, html.motion-paused.motion-started .screen-protocolos { animation-delay: .12s, 1.17s; }
html.motion-running.motion-started .screen-emendas, html.motion-paused.motion-started .screen-emendas { animation-delay: .24s, 1.29s; }
html.motion-paused.motion-started .hero-device-motion, html.motion-paused.motion-started .floating-screen { animation-play-state: paused; }
html.motion-paused .device-parallax { transform: perspective(1500px) rotateX(0deg) rotateY(0deg); }
html.motion-running .device-scene:hover .hero-device-motion, html.motion-running .device-scene:focus-within .hero-device-motion { animation-play-state: paused; }
html.motion-running .device-scene:hover .floating-screen, html.motion-running .device-scene:focus-within .floating-screen { animation-play-state: running, paused; }
.device-scene.is-offscreen .floating-screen, .device-scene.is-offscreen .hero-device-motion { animation-play-state: paused !important; }
[data-theme="dark"] .device-stage::after { background: radial-gradient(ellipse, rgb(0 0 0 / 34%), transparent 70%); }
[data-theme="dark"] .floating-screen { border-color: #77717d; box-shadow: 0 15px 35px rgb(0 0 0 / 32%); }
[data-theme="dark"] .floating-screen:hover, [data-theme="dark"] .floating-screen:focus-visible { border-color: #ff6c7c; box-shadow: 0 15px 35px rgb(0 0 0 / 34%), 0 0 0 2px rgb(255 108 124 / 20%); }

@keyframes screen-emerge {
  from { opacity: 0; transform: translate3d(0, 85px, -30px) scale(.76) rotateX(6deg); }
  to { opacity: 1; transform: var(--screen-transform); }
}
@keyframes screen-float {
  0%, 100% { transform: var(--screen-transform) translateY(0); }
  50% { transform: var(--screen-transform) translateY(var(--screen-float)); }
}
@keyframes device-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@media (min-width: 1500px) {
  .hero-visual-animated { min-height: 600px; }
}
@media (max-width: 1119px) {
  .hero-visual-animated { min-height: 490px; }
  .device-stage { transform: rotateY(-4deg) rotateX(2deg); }
}
@media (max-width: 900px) {
  .hero-visual-animated { max-width: 640px; min-height: 0; padding: 0; }
  .device-scene { max-width: 620px; aspect-ratio: 1.23; }
  .device-stage { transform: rotateY(-3deg) rotateX(1deg); }
  .hero-visual-caption { margin-top: 12px; }
}
@media (max-width: 599px) {
  .hero-visual-animated { padding-top: 10px; }
  .device-scene { width: 100%; aspect-ratio: 1.04; }
  .device-stage { transform: rotateY(-1deg); }
  .device-parallax { transform: none; }
  .laptop-display { left: 10%; width: 82%; padding: 5px 4px 8px; border-width: 2px; border-radius: 8px 8px 3px 3px; }
  .laptop-base { left: 2%; width: 96%; height: 4.5%; }
  .floating-screen { min-height: 128px; border-radius: 7px; }
  .floating-toolbar { min-width: 0; min-height: 36px; gap: 5px; padding: 6px 8px; overflow: hidden; font-size: .875rem; white-space: nowrap; line-height: 1.25; }
  .floating-toolbar > span:not(.screen-dot) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .floating-toolbar .screen-dot { width: 4px; height: 4px; }
  .floating-toolbar > .icon { display: none; }
  .screen-terceirizados { top: 0; left: 0; width: 56%; height: 37%; --screen-transform: translate3d(0, 0, 12px) rotateZ(-2deg); --screen-float: -2px; }
  .screen-protocolos { top: 4%; right: 0; width: 54%; height: 35%; --screen-transform: translate3d(0, 0, 20px) rotateZ(1.5deg); --screen-float: -3px; }
  .screen-emendas { top: 36%; left: 9%; width: 78%; height: 38%; --screen-transform: translate3d(0, 0, 30px) rotateZ(-.5deg); --screen-float: -2px; }
  .hero-visual-caption { margin-top: 13px; font-size: .875rem; }
  .motion-controls { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .device-parallax { transform: none !important; transition: none; }
  .hero-device-motion, .floating-screen { animation: none !important; }
  .floating-screen { opacity: 1 !important; transform: var(--screen-transform); }
  .motion-controls { display: none; }
}
@media print {
  body { background-color: #fff; }
  #ambient-particles, .motion-controls { display: none !important; }
  .hero-device-motion, .floating-screen { animation: none !important; }
  .device-parallax { transform: none; }
  .floating-screen { opacity: 1; transform: var(--screen-transform); }
}
