/* =========================================================
   Ministério da Imaginação — Landing Page
   Digibela · codificado a partir do Figma (frame DESKTOP-V4)
   ========================================================= */

:root {
  --blue-900: #002b77;
  --blue-700: #0050dd;
  --blue-ink: #012f80;
  --border-blue: #005cff;
  --paper: #fafafa;
  --ink: #26282a;
  --yellow: #fddd3f;
  --accent: #fed106;

  --font-display: "McLaren", "Comic Sans MS", system-ui, sans-serif;
  --font-text: "Red Hat Display", system-ui, -apple-system, sans-serif;

  --container: 1600px;
  --gutter: clamp(20px, 5vw, 110px);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-text);
  color: var(--paper);
  background: linear-gradient(180deg, var(--blue-700) 0%, var(--blue-900) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

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

a { color: inherit; }

h1, h2, p, ul { margin: 0; }

ul { list-style: none; padding: 0; }

button { font: inherit; cursor: pointer; }

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

/* ---------- Background ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    url("../assets/bckg-stars.webp") center center no-repeat,
    linear-gradient(180deg, var(--blue-700) 0%, var(--blue-900) 100%);
  background-size: 110%;
  background-blend-mode: lighten;
}

/* large soft cloud drifting from the top-left (Figma: clouds_top_l) */
.bg__clouds {
  position: absolute;
  top: 0;
  left: 0;
  width: min(1600px, 92vw);
  height: auto;
  pointer-events: none;
}

.bg__star {
  position: absolute;
  width: 40px;
  height: auto;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.25));
}

/* moved into .hero__right — positioned against the form column */
.bg__star--yellow {
  z-index: 2;
  width: clamp(46px, 4.4vw, 78px);
  top: 50px;
  right: 40px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.25));
}

.bg__star--a { width: 46px; top: 30%;  left: 3%; }
.bg__star--b { width: 26px; top: 17%;  left: 42%; }
.bg__star--c { width: 22px; top: 46%;  right: 4%; opacity: 0.85; }
.bg__star--d { width: 20px; top: 74%;  right: 8%; opacity: 0.8; }
.bg__star--e { width: 18px; top: 9%;   left: 8%; opacity: 0.75; }

/* ---------- Hero shell ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  padding: 0;
  overflow: hidden;
}

.hero__inner {
  position: relative;
  z-index: 2;
  height: 100vh;
  max-width: 1530px;
  margin: 0 auto;
  padding: 42px var(--gutter) 0;
  display: grid;
  gap: clamp(40px, 6vw, 80px);
}

/* ---------- Left column ---------- */
.hero__left {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.6vw, 30px);
  max-width: 640px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 4px;
}

.brand__logo {
  width: clamp(190px, 20vw, 261px);
  height: auto;
}

.brand__tag {
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 5px 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  color: #fff;
}

.hero__copy { position: relative; z-index: 1; }

.hero__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.25rem, 4.6vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--paper);
}

.hero__brush {
  width: min(100%, 460px);
  height: auto;
  margin: 10px 0 14px;
}

.hero__subtitle {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.125rem, 1.7vw, 1.75rem);
  line-height: 1.25;
  color: var(--paper);
  max-width: 600px;
}

/* ---------- Benefits ---------- */
.benefits {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.benefit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 8px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-blue);
  border-radius: 32px 16px 32px 16px;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--paper);
  backdrop-filter: blur(2px);
}

.benefit__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: none;
}

.benefit__icon img { width: 24px; height: auto; }

/* ---------- Right column ---------- */
.hero__right {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(24px, 4vw, 40px);
  justify-self: center;
  width: 100%;
  max-width: 560px;
}

/* checkerboard frame + yellow card as one exported shape (Figma: full-bckg-form) */
.form-frame {
  position: relative;
  width: 100%;
  padding: clamp(100px, 5vw, 44px) clamp(60px, 5vw, 46px) clamp(56px, 7vw, 84px);
  background: url("../assets/full-bckg-form.svg") center / 100% 100% no-repeat;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.28));
}

.lead-form {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 2.6vw, 30px);
}

.lead-form__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 3vw, 2.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--blue-ink);
  margin-bottom: clamp(8px, 1.8vw, 16px);
}

/* ---------- Fields ---------- */
.field { position: relative; }

.field__label {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.field__input {
  width: 100%;
  height: clamp(54px, 4vw, 60px);
  padding: 0 20px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: var(--paper);
  font-family: var(--font-text);
  font-size: 16px;
  color: var(--ink);
}

.field__input::placeholder { color: var(--ink); opacity: 1; }

.field__input {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field__input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(254, 209, 6, 0.35);
}

.field__input[aria-invalid="true"] {
  border-color: #c0392b;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.2);
}

/* ---------- Checkboxes ---------- */
.lead-form__checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 2px 0 6px;
}

.check {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  font-family: var(--font-text);
  font-size: 12px;
  line-height: 1.3;
  color: var(--ink);
  cursor: pointer;
}

.check input {
  position: absolute;
  opacity: 0;
  width: 18px;
  height: 18px;
  margin: 0;
}

.check__box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--blue-ink);
  border-radius: 4px;
  background: #fff;
  display: grid;
  place-items: center;
}

.check__box::after {
  content: "";
  width: 10px;
  height: 6px;
  border: 2px solid var(--blue-700);
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translateY(-1px) scale(0);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.check input:checked + .check__box::after { transform: rotate(-45deg) translateY(-1px) scale(1); }

/* "pop" com flashzinho ao marcar */
.check input:checked + .check__box { animation: check-pop 0.32s ease; }

.check input:focus-visible + .check__box {
  outline: 3px solid var(--blue-700);
  outline-offset: 2px;
}

.check__text a { text-decoration: underline; }

/* ---------- CTA ---------- */
.btn-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: clamp(10px, 2.4vw, 24px);
  padding: clamp(20px, 3vw, 26px) 24px;
  border: 0;
  border-radius: 8px;
  background: var(--blue-700);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: clamp(15px, 1.15vw, 18px);
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-cta img { width: 14px; height: auto; }

.btn-cta:hover {
  background: #0246bd;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 43, 119, 0.35);
}

.btn-cta:active { transform: translateY(0); }

.btn-cta[disabled] { opacity: 0.6; cursor: progress; transform: none; }

/* ---------- Form status / secure line ---------- */
.lead-form__status {
  margin: 2px 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

.lead-form__status.is-error { background: #fdecea; color: #a5281b; }
.lead-form__status.is-success { background: #e7f6ec; color: #1e7a3d; }

.lead-form__secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink);
}

.lead-form__secure img { width: 16px; height: 16px; }

/* ---------- Footer (under the form) ---------- */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
}

.site-footer__badges { width: min(340px, 90%); height: auto; }

.site-footer__links {
  display: flex;
  gap: clamp(28px, 5vw, 64px);
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.19);
  width: 100%;
  justify-content: center;
}

.site-footer__links a,
.site-footer__link-btn {
  font-family: var(--font-text);
  font-size: 12px;
  color: #fff;
  text-decoration: none;
}

.site-footer__link-btn {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  line-height: inherit;
}

.site-footer__links a:hover,
.site-footer__link-btn:hover { text-decoration: underline; }

/* ---------- Modal ("Quem Somos") ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 12, 40, 0.62);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal__dialog {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--paper);
  border-radius: 24px;
  padding: clamp(28px, 5vw, 44px);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.modal.is-open .modal__backdrop { opacity: 1; }
.modal.is-open .modal__dialog { opacity: 1; transform: none; }

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--blue-700);
  color: var(--accent);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.modal__close svg { width: 20px; height: 20px; }
.modal__close:hover { background: #0246bd; transform: rotate(90deg); }

.modal__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2rem);
  letter-spacing: -0.03em;
  color: var(--blue-ink);
  margin: 4px 40px 14px 0;
}

.modal__body {
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}

.modal__body > * + * { margin-top: 12px; }

.modal__body h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.15rem;
  color: var(--blue-ink);
  margin-top: 20px;
}

.modal__body ul {
  list-style: disc;
  padding-left: 1.25em;
}

.modal__body li + li { margin-top: 4px; }

body.modal-open { overflow: hidden; }

/* ---------- Decorative illustrations ---------- */
.hero__book,
.hero__rabbit {
  pointer-events: none;
  user-select: none;
}

/* mobile: book sits between the benefits and the form, tucked behind its top */
.hero__book {
  display: block;
  position: relative;
  z-index: 0;
  width: min(640px, 116%);
  margin: 24px auto -32px;
}

.hero__rabbit {
  display: none;
  position: absolute;
  z-index: 3;
  width: 96px;
}

/* =========================================================
   Desktop layout
   ========================================================= */
@media (min-width: 1024px) {
  .hero { display: flex; align-items: center; }

  .hero__inner {
    /* static aqui para o .hero__book absoluto se ancorar no .hero (viewport) */
    position: static;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(440px, 520px);
    align-items: flex-start;
    gap: clamp(32px, 4vw, 76px);
  }

  .hero__left,
  .hero__right { z-index: 2; }

  .hero__left {
    max-width: 720px;
    padding-top: 24px;
    padding-bottom: clamp(48px, 6vw, 96px);
  }

  .benefits { flex-wrap: nowrap; }

  /* desktop: book glued to the bottom-left corner of the viewport */
  .hero__book {
    position: absolute;
    z-index: 1;
    left: 0;
    bottom: 0;
    width: clamp(440px, 60vw, 1020px);
    margin-left: -140px;
  }

  .hero__right {
    align-self: stretch;
    justify-content: center;
    padding-bottom: clamp(90px, 12vh, 150px);
  }

  /* badges + institutional links pinned to the bottom of the column */
  .site-footer {
    position: absolute;
    inset: auto 0 clamp(16px, 3vh, 30px) 0;
    width: 100%;
  }

  .hero__rabbit {
    display: block;
    right: -30px;
    bottom: 8px;
  }
}

@media (min-width: 1440px) {
  .hero__book { margin-left: 0; }
}

@media (min-width: 1720px) {
  .hero__left { max-width: 780px; }
}

/* =========================================================
   Mobile tweaks
   ========================================================= */
@media (max-width: 1023px) {
  .hero__inner {
    height: auto;
    min-height: 0;
    /* minmax(0, …) evita o "blowout" do grid causado pelo texto do título */
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0;
    padding-top: 32px;
  }

  .hero__left { max-width: 560px; margin: 0 auto; }
  .hero__right { margin-top: 10px; margin-bottom: 32px; }

  .hero__title { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .hero__subtitle { font-size: clamp(1rem, 4.4vw, 1.375rem); }

  .brand { align-items: center; }
  .hero__copy { text-align: center; }
  .hero__brush { margin-inline: auto; }
  .benefits {
    justify-content: center;
    align-items: stretch;
  }

  .benefit {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    max-width: 25%;
    padding: 12px 10px;
  }

  /* padding lateral/topo do form era fixo em ~100px — grande demais no mobile */
  /* padding lateral/topo era fixo em ~100px no desktop — grande demais no mobile.
     O SVG agora tem preserveAspectRatio="none", então preenche a caixa sem letterbox. */
  .form-frame {
    padding: clamp(44px, 12vw, 68px) clamp(34px, 9vw, 50px) clamp(44px, 11vw, 60px);
  }

  .bg__star--b { top: 8%; left: 6%; }
  .bg__star--yellow { display: none; }
}

@media (max-width: 620px) {
  .bg__star--a,
  .bg__star--b { display: none; }
}

@media (max-width: 480px) {
  .benefit { font-size: 11px; }
  .benefit__icon { width: 38px; height: 38px; }
  .benefit__icon img { width: 20px; }
}

/* =========================================================
   Animações de entrada (ao carregar a página, uma única vez)
   Só transform/opacity/clip-path. Desligadas em prefers-reduced-motion.
   ========================================================= */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

@keyframes rise-in-book {
  from { opacity: 0; transform: translateY(60px); }
  to   { opacity: 1; transform: none; }
}

@keyframes form-in {
  from { opacity: 0; transform: translateX(40px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

@keyframes brush-paint {
  from { opacity: 1; clip-path: inset(0 100% 0 0); }
  to   { opacity: 1; clip-path: inset(0 0 0 0); }
}

@keyframes pop-in {
  0%   { opacity: 0; transform: scale(0.4); }
  70%  { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes sky-wake {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* livro/hipopótamo boiando na nuvem (loop) */
@keyframes float-book {
  0%   { transform: translateY(0); }
  25%  { transform: translateY(-6px); }
  50%  { transform: translateY(0); }
  75%  { transform: translateY(6px); }
  100% { transform: translateY(0); }
}

/* céu "acordando": camada escura por cima do fundo que se dissolve */
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #001034;
  pointer-events: none;
  animation: sky-wake 0.7s ease-out 0.05s both;
}

.brand,
.hero__title,
.hero__subtitle,
.benefit,
.form-frame,
.hero__book,
.site-footer {
  animation: rise-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand           { animation-delay: 0.08s; }
.hero__title     { animation-delay: 0.16s; }
.hero__subtitle  { animation-delay: 0.34s; }
/* benefícios entram por último, logo depois do resto */
.benefit         { animation-delay: 1s; }
.benefit:nth-child(2) { animation-delay: 1.1s; }
.benefit:nth-child(3) { animation-delay: 1.2s; }

.hero__brush {
  animation: brush-paint 0.55s ease-out 0.26s both;
}

.form-frame {
  animation: form-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.hero__book {
  animation:
    rise-in-book 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.5s both,
    float-book 4s ease-in-out 1.3s infinite;
}

.bg__star--yellow {
  animation:
    pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.55s both,
    star-idle 5s ease-in-out 1.2s infinite;
}

.site-footer {
  animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.62s both;
}

/* =========================================================
   Ambiente em loop (tópico 2)
   ========================================================= */

/* estrelinhas piscando fora de sincronia */
@keyframes twinkle {
  0%, 100% { opacity: 0.45; transform: scale(0.94); }
  50%      { opacity: 1;    transform: scale(1.05); }
}
.bg__star--a { animation: twinkle 3.6s ease-in-out 0.2s infinite; }
.bg__star--b { animation: twinkle 4.4s ease-in-out 1.1s infinite; }
.bg__star--c { animation: twinkle 3.1s ease-in-out 0.6s infinite; }
.bg__star--d { animation: twinkle 5s   ease-in-out 2s   infinite; }
.bg__star--e { animation: twinkle 4s   ease-in-out 1.6s infinite; }

/* estrela amarela: pulso lento + leve balanço */
@keyframes star-idle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50%      { transform: rotate(6deg) scale(1.06); }
}

/* estrela cadente cruzando o céu a cada ~18s */
.bg::before {
  content: "";
  position: absolute;
  top: 10%;
  left: 0;
  width: 90px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 251, 230, 0), #fffbe6);
  opacity: 0;
  pointer-events: none;
  animation: shooting-star 18s ease-in 6s infinite;
}
@keyframes shooting-star {
  0%  { opacity: 0; transform: translate(-12vw, 0) rotate(20deg) scaleX(0.3); }
  1%  { opacity: 1; }
  8%  { opacity: 1; transform: translate(72vw, 26vh) rotate(20deg) scaleX(1); }
  10% { opacity: 0; transform: translate(88vw, 32vh) rotate(20deg) scaleX(1); }
  100% { opacity: 0; transform: translate(88vw, 32vh) rotate(20deg) scaleX(1); }
}

/* =========================================================
   Micro-interações — CTA / campos / checkbox / status (tópico 3)
   ========================================================= */

/* CTA "respirando": anel de sombra pulsando; pausa em hover/foco/disabled */
.btn-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  animation: cta-breathe 2.6s ease-in-out 2s infinite;
}
@keyframes cta-breathe {
  0%   { box-shadow: 0 0 0 0 rgba(0, 80, 221, 0.45); }
  70%  { box-shadow: 0 0 0 11px rgba(0, 80, 221, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 80, 221, 0); }
}
.btn-cta:hover::after,
.btn-cta:focus-visible::after,
.btn-cta[disabled]::after { animation: none; }

/* ícone de download quicando enquanto o botão está em hover/foco */
@keyframes icon-bob {
  0%, 100% { transform: translateY(0); }
  45%      { transform: translateY(3px); }
}
.btn-cta:hover img,
.btn-cta:focus-visible img { animation: icon-bob 0.85s ease-in-out infinite; }

/* campo inválido: tranco curto (classe .shake re-adicionada pelo JS) */
@keyframes field-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}
.field__input.shake { animation: field-shake 0.3s ease; }

/* checkbox: flashzinho ao marcar */
@keyframes check-pop {
  0%   { background: #fff; }
  45%  { background: #d7e4ff; }
  100% { background: #fff; }
}

/* mensagem de status descendo ao aparecer */
@keyframes status-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lead-form__status { animation: status-in 0.24s ease; }

/* estrela amarela girando na confirmação (classe .spin pelo JS) */
@keyframes star-spin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}
.bg__star--yellow.spin { animation: star-spin 0.7s cubic-bezier(0.22, 1, 0.36, 1); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
  }
}
