/* PredSaúde — base compartilhada por todas as páginas (tokens, header, rodapé, WhatsApp, reveal).
   Mobile first. Breakpoints: 640px (tablet), 900px (desktop), 1100px (menu completo). */

:root {
  --ink: #0b2350;
  --ink-2: #102d63;
  --royal: #003fc1;
  --royal-hover: #0034a1;
  --sky: #0090ff;
  --mist: #eef3fa;
  --line: #d9e2ef;
  --vital: #16b892;
  --text: #22324f;
  --muted: #5a6b85;
  --white: #ffffff;
  --whatsapp: #25d366;

  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Red Hat Text", system-ui, sans-serif;

  --header-h: 64px;
  --gutter: 20px;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 1px 2px rgb(11 35 80 / 6%), 0 12px 32px -12px rgb(11 35 80 / 18%);
}

@media (min-width: 900px) {
  :root {
    --header-h: 76px;
    --gutter: 32px;
  }
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.menu-open {
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

figure {
  margin: 0;
}

a {
  color: var(--royal);
  text-underline-offset: 3px;
}

button {
  font: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-s);
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.975rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn svg {
  width: 20px;
  height: 20px;
}

.btn--lg {
  min-height: 52px;
  padding: 14px 26px;
  font-size: 1.025rem;
}

.btn--block {
  width: 100%;
}

.btn--primary {
  background: var(--royal);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--royal-hover);
}

.btn--light {
  border-color: rgb(255 255 255 / 45%);
  color: var(--white);
}

.btn--light:hover {
  border-color: var(--white);
  background: rgb(255 255 255 / 8%);
}

.btn--white {
  background: var(--white);
  color: var(--royal);
}

.btn--white:hover {
  background: var(--mist);
}

.btn--ghost {
  border-color: currentColor;
  color: inherit;
}

.btn--whatsapp {
  background: var(--whatsapp);
  color: #083b1f;
}

.btn--whatsapp:hover {
  background: #1fbe5b;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--royal);
  background: var(--royal);
  color: var(--white);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  color: var(--white);
  transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}

.site-header.is-solid,
.site-header.is-open {
  background: rgb(255 255 255 / 94%);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--line);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
}

/* backdrop-filter would become the containing block of the fixed menu sheet */
.site-header.is-open {
  background: var(--white);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.site-header__bar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--header-h);
}

.brand {
  position: relative;
  display: block;
  width: 132px;
  margin-right: auto;
}

.brand__logo {
  width: 100%;
  transition: opacity 0.3s;
}

.brand__logo--color {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.is-solid .brand__logo--color,
.is-open .brand__logo--color {
  opacity: 1;
}

.is-solid .brand__logo--white,
.is-open .brand__logo--white {
  opacity: 0;
}

.site-header__client {
  display: none;
}

.menu-toggle {
  display: grid;
  align-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0 11px;
  border: 0;
  background: transparent;
  color: inherit;
}

.menu-toggle__bar {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.3s var(--ease), opacity 0.2s;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu: full-height sheet under the bar */
.site-nav {
  position: fixed;
  inset: var(--header-h) 0 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 16px var(--gutter) calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background: var(--white);
  color: var(--ink);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s, transform 0.3s var(--ease), visibility 0s 0.3s;
}

.site-header.is-open .site-nav {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity 0.25s, transform 0.3s var(--ease);
}

.site-nav__list a {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
}

@media (max-width: 1099px) {
  .site-nav__list a[aria-current="page"] {
    color: var(--royal);
  }
}

.site-nav__mobile-extra {
  display: grid;
  gap: 12px;
}

.site-nav__contact {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.9;
}

.site-nav__contact a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}

@media (min-width: 1100px) {
  .brand {
    flex: none;
    width: 150px;
    margin-right: 0;
  }

  .menu-toggle,
  .site-nav__mobile-extra {
    display: none;
  }

  .site-nav {
    position: static;
    flex-direction: row;
    margin-inline: auto;
    padding: 0;
    overflow: visible;
    background: none;
    color: inherit;
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: none;
  }

  .site-nav__list {
    display: flex;
    gap: 4px;
  }

  .site-nav__list a {
    position: relative;
    padding: 8px 12px;
    border: 0;
    color: inherit;
    font-family: var(--font-body);
    font-size: 0.975rem;
    font-weight: 500;
  }

  .site-nav__list a::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 2px;
    height: 2px;
    border-radius: 2px;
    background: var(--sky);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s var(--ease);
  }

  .site-nav__list a:hover::after,
  .site-nav__list a[aria-current]::after {
    transform: scaleX(1);
  }

  .site-header__client {
    display: inline-flex;
    min-height: 40px;
    padding: 8px 18px;
    font-size: 0.925rem;
  }
}

/* Tighter menu until there is room for every link at full spacing */
@media (min-width: 1100px) and (max-width: 1279px) {
  .site-nav__list {
    gap: 0;
  }

  .site-nav__list a {
    padding-inline: 9px;
    font-size: 0.925rem;
  }

  .site-nav__list a::after {
    left: 9px;
    right: 9px;
  }

  .site-header__client {
    padding-inline: 14px;
  }
}

/* Scroll progress: the same sky line as the hero pulse */
.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  pointer-events: none;
}

.scroll-progress span {
  display: block;
  height: 100%;
  background: var(--sky);
  box-shadow: 0 0 8px rgb(0 144 255 / 60%);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---------- Sections ---------- */

.section {
  padding-block: 72px;
}

@media (min-width: 900px) {
  .section {
    padding-block: 112px;
  }
}

.section-head {
  max-width: 44rem;
  margin-bottom: 40px;
}

.section-head--row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  max-width: none;
}

.section-head--row > div:first-child {
  max-width: 44rem;
}

.section-title {
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section-lead {
  margin-top: 14px;
  color: var(--muted);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  max-width: 42rem;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 56px 0 calc(96px + env(safe-area-inset-bottom));
  background: var(--ink);
  color: rgb(255 255 255 / 72%);
  font-size: 0.95rem;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--white);
  text-decoration: underline;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px 24px;
}

.site-footer__brand,
.site-footer__brand + .site-footer__col {
  grid-column: 1 / -1;
}

.site-footer__brand img {
  width: 160px;
}

.site-footer__brand p {
  max-width: 22rem;
  margin: 16px 0 20px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 500;
}

.social-link svg {
  width: 22px;
  height: 22px;
}

.site-footer__col h2 {
  margin-bottom: 12px;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
}

.site-footer__col li a {
  display: inline-block;
  padding: 5px 0;
}

.site-footer__legal {
  display: grid;
  gap: 12px;
  width: calc(min(100%, 1200px) - 2 * var(--gutter));
  margin: 48px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgb(255 255 255 / 12%);
  font-size: 0.85rem;
  color: rgb(255 255 255 / 55%);
}

@media (min-width: 640px) {
  .site-footer__brand + .site-footer__col {
    grid-column: auto;
  }
}

@media (min-width: 900px) {
  .site-footer {
    padding-top: 72px;
    padding-bottom: 40px;
  }

  .site-footer__grid {
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 40px;
  }

  .site-footer__brand {
    grid-column: auto;
  }

  .site-footer__legal {
    grid-template-columns: 1fr auto;
    align-items: end;
  }
}

/* ---------- WhatsApp floating button ---------- */

.whatsapp-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 0;
  height: 58px;
  min-width: 58px;
  padding: 0 15px;
  border-radius: 999px;
  background: var(--whatsapp);
  color: var(--white);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 24px -6px rgb(10 80 40 / 45%), 0 2px 6px rgb(0 0 0 / 12%);
  transition: transform 0.3s var(--ease), box-shadow 0.3s, gap 0.3s var(--ease), padding 0.3s var(--ease);
}

.whatsapp-fab svg {
  flex: none;
  width: 28px;
  height: 28px;
}

.whatsapp-fab::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid var(--whatsapp);
  animation: ping 2.4s 1.5s var(--ease) 3;
  opacity: 0;
  pointer-events: none;
}

.whatsapp-fab__label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.35s var(--ease);
}

.whatsapp-fab:hover,
.whatsapp-fab:focus-visible {
  gap: 10px;
  padding-right: 20px;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -6px rgb(10 80 40 / 55%), 0 2px 6px rgb(0 0 0 / 12%);
}

.whatsapp-fab:hover .whatsapp-fab__label,
.whatsapp-fab:focus-visible .whatsapp-fab__label {
  max-width: 140px;
}

.js .whatsapp-fab {
  animation: fab-in 0.6s 1.2s var(--ease) both;
}

/* Hide the FAB while the mobile menu is open (the menu has its own WhatsApp button) */
body.menu-open .whatsapp-fab {
  opacity: 0;
  pointer-events: none;
}

/* ---------- Scroll reveal ---------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--d, 0ms);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Keyframes ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes fade-in {
  to {
    opacity: 1;
  }
}

@keyframes ping {
  0% {
    opacity: 0.9;
    transform: scale(1);
  }
  80%,
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

@keyframes fab-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
}

/* ---------- Image lightbox (native <dialog>, rendered in the top layer) ---------- */

body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 72px 16px 20px;
  border: 0;
  background: transparent;
}

.lightbox[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.lightbox::backdrop {
  background: rgb(11 35 80 / 88%);
}

.lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.lightbox__scroll {
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
  padding: 16px;
  border-radius: var(--radius-m);
  background: var(--white);
  box-shadow: 0 24px 64px -16px rgb(0 0 0 / 45%);
  -webkit-overflow-scrolling: touch;
}

.lightbox__img {
  max-width: min(1600px, calc(100vw - 64px));
  max-height: calc(100dvh - 180px);
  width: auto;
  height: auto;
}

.lightbox__caption {
  color: rgb(255 255 255 / 86%);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

/* Dense images (infographics, maps): click toggles a zoomed, pannable view */
.lightbox--wide .lightbox__img {
  cursor: zoom-in;
}

.lightbox--wide.is-zoomed .lightbox__img {
  width: 2400px;
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

/* On phones the diagram stays legible and pans inside the card */
@media (max-width: 639px) {
  .lightbox__scroll {
    width: 100%;
  }

  .lightbox__img {
    width: 900px;
    max-width: none;
    max-height: none;
  }

  .lightbox--wide .lightbox__img {
    width: 1600px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .lightbox[open] {
    animation: lightbox-in 0.25s var(--ease);
  }

  .lightbox[open]::backdrop {
    animation: lightbox-fade 0.25s ease;
  }
}

@keyframes lightbox-in {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}

@keyframes lightbox-fade {
  from {
    opacity: 0;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  .js [data-reveal],
  .js [data-reveal] > * {
    opacity: 1;
    transform: none;
    clip-path: none;
  }

  .whatsapp-fab::before {
    display: none;
  }
}
