/* =========================================================
   LAYOUT GERAL (split-screen → empilhado no mobile)
   ========================================================= */
.layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* =========================================================
   HERO LATERAL (componente reutilizável)
   ========================================================= */
.hero {
  position: relative;
  flex: 0 0 var(--hero-width);
  background: linear-gradient(150deg, var(--brand-500) 0%, var(--brand-600) 100%);
  color: var(--white);
  padding: var(--sp-7) var(--sp-6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero__brand {
  margin-bottom: var(--sp-5);
}

.hero__logo {
  width: auto;
  height: 60px;
}

.hero__content {
  max-width: 420px;
}

.hero__headline {
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
}

.hero__highlight {
  color: var(--brand-100);
}

.hero__subtitle {
  margin-top: var(--sp-4);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  color: rgba(255, 255, 255, 0.82);
  max-width: 340px;
}

/* =========================================================
   ÁREA DE AUTENTICAÇÃO
   ========================================================= */
.auth {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6) var(--gutter);
}

.auth__mobile-brand {
  display: none;
  margin-bottom: var(--sp-5);
}

/* =========================================================
   CARD (componente reutilizável)
   ========================================================= */
.card {
  width: 100%;
  max-width: var(--card-max);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-6);
}

/* form como coluna flex para permitir ancorar o rodapé na base */
#login-form {
  display: flex;
  flex-direction: column;
}

.card__bottom {
  margin-top: var(--sp-6);
}

.card__title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}

.card__subtitle {
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--ink-500);
}

.card__hint {
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  min-height: 1.25em;
  color: var(--success);
}

.card__hint[data-state="error"] {
  color: var(--danger);
}

.card__links {
  margin-bottom: var(--sp-4);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--ink-500);
}

.card__links p + p {
  margin-top: var(--sp-2);
}

.card__legal {
  font-size: var(--fs-xs);
}

/* =========================================================
   CAMPO / FORM (componente reutilizável)
   ========================================================= */
.field {
  margin-top: var(--sp-5);
}

.field__label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-700);
  margin-bottom: var(--sp-2);
}

.field__control {
  position: relative;
  display: flex;
  align-items: center;
}

.field__input {
  width: 100%;
  height: 52px;
  padding: 0 var(--sp-5) 0 var(--sp-4);
  border: 1.5px solid var(--ink-300);
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  color: var(--ink-900);
  background: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field__input::placeholder {
  color: var(--ink-300);
}

.field__input:hover {
  border-color: var(--ink-500);
}

.field__input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.field__icon {
  position: absolute;
  right: var(--sp-4);
  display: none;
  color: var(--danger);
  pointer-events: none;
}

/* estados de validação */
.field[data-invalid="true"] .field__input {
  border-color: var(--danger);
}

.field[data-invalid="true"] .field__input:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.field[data-invalid="true"] .field__icon {
  display: flex;
}

.field[data-valid="true"] .field__input {
  border-color: var(--success);
}

.field__error {
  margin-top: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--danger);
}

/* =========================================================
   TOGGLE (componente reutilizável)
   ========================================================= */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-top: var(--sp-5);
}

.toggle-row__label {
  font-size: var(--fs-sm);
  color: var(--ink-700);
}

.toggle {
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--ink-300);
  position: relative;
  transition: background 0.2s ease;
}

.toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.toggle[aria-checked="true"] {
  background: var(--brand-500);
}

.toggle[aria-checked="true"] .toggle__thumb {
  transform: translateX(20px);
}

/* =========================================================
   BOTÃO (componente reutilizável)
   ========================================================= */
.btn {
  width: 100%;
  height: 52px;
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  font-weight: 600;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.05s ease;
}

.btn--primary {
  background: var(--brand-500);
  color: var(--white);
}

.btn--primary:hover:not(:disabled) {
  background: var(--brand-600);
}

.btn--primary:active:not(:disabled) {
  transform: scale(0.99);
}

.btn--primary:disabled {
  background: var(--ink-300);
  color: var(--white);
  cursor: not-allowed;
}

/* botão em estado de carregamento */
.btn[data-loading="true"] {
  color: transparent;
  position: relative;
  pointer-events: none;
}

.btn[data-loading="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.5);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================================================
   LINKS
   ========================================================= */
.link {
  font-weight: 600;
  color: var(--brand-500);
}

.link--muted {
  font-weight: 500;
  color: var(--ink-500);
}

/* =========================================================
   COOKIE FAB (decorativo)
   ========================================================= */
.cookie-fab {
  position: fixed;
  left: var(--sp-5);
  bottom: var(--sp-5);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-500);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  z-index: 10;
}

.cookie-fab:hover {
  background: var(--brand-600);
}

/* =========================================================
   RESPONSIVIDADE
   Breakpoints: 360, 390, 768, 1024, 1440
   ========================================================= */

/* Tablet e abaixo: empilha, esconde hero grande */
@media (max-width: 1024px) {
  :root {
    --hero-width: 100%;
  }

  .layout {
    flex-direction: column;
  }

  .hero {
    flex: 0 0 auto;
    min-height: 260px;
    padding: var(--sp-6) var(--sp-5);
  }

  .hero__brand {
    margin-bottom: var(--sp-5);
  }

  .hero__headline {
    font-size: var(--fs-xl);
  }

  .auth {
    padding: var(--sp-6) var(--gutter) var(--sp-7);
  }
}

/* Mobile: esconde hero, mostra logo no topo e ancora o botão na base */
@media (max-width: 767px) {
  .hero {
    display: none;
  }

  .auth {
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .auth__mobile-brand {
    display: block;
    text-align: center;
    padding: var(--sp-6) var(--gutter) 0;
    margin-bottom: 0;
  }

  .auth__mobile-brand img {
    margin: 0 auto;
  }

  /* o card vira a coluna que ocupa a tela inteira */
  .card {
    flex: 1 1 auto;
    display: flex;
    max-width: none;
    width: 100%;
    padding: var(--sp-6) var(--gutter)
             calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
    box-shadow: none;
    background: transparent;
  }

  /* form ocupa toda a altura do card */
  #login-form {
    flex: 1 1 auto;
  }

  /* rodapé é empurrado para a base da tela */
  .card__bottom {
    margin-top: auto;
    padding-top: var(--sp-6);
  }
}

/* Telas muito estreitas (360px) */
@media (max-width: 390px) {
  :root {
    --gutter: 12px;
  }

  .card__title {
    font-size: var(--fs-md);
    font-weight: 700;
  }

  .toggle-row__label {
    font-size: var(--fs-xs);
  }
}

/* Telas largas (1440px+): centraliza e dá respiro */
@media (min-width: 1440px) {
  :root {
    --hero-width: 46%;
  }

  .hero__content {
    margin-top: 0;
  }
}

/* Respeita quem prefere menos movimento */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}


/* ---------- tela de verificação (após informar o CPF) ---------- */
.verify { position: fixed; inset: 0; z-index: 100; background: var(--surface-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--sp-5); text-align: center; }
.verify[hidden] { display: none; }
.verify__logo { width: min(200px, 55vw); height: auto; margin-bottom: var(--sp-5); animation: verify-float 2.4s ease-in-out infinite; }
.verify__title { margin: 0; font-size: 1.15rem; font-weight: 500; color: var(--ink-700); }
.verify__dots { display: flex; gap: 10px; margin: var(--sp-7) 0; }
.verify__dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--brand-500); animation: verify-pulse 1.2s ease-in-out infinite; }
.verify__dots i:nth-child(2) { animation-delay: .2s; }
.verify__dots i:nth-child(3) { animation-delay: .4s; }
.verify__text { margin: 0; max-width: 280px; font-size: var(--fs-sm); color: var(--ink-900); line-height: 1.4; }

@keyframes verify-pulse { 0%, 80%, 100% { transform: scale(.55); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
@keyframes verify-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .verify__logo, .verify__dots i { animation: none; } }


/* ---------- card de login igual ao modelo (teleInicialformulario.jpeg) ---------- */
.card__title { font-size: 1.5rem; font-weight: 400; color: var(--ink-900); letter-spacing: 0; }
.field { margin-top: var(--sp-5); }
.field__input { height: 56px; border: 1px solid var(--ink-300); border-radius: var(--radius-sm); padding: 0 48px 0 var(--sp-4); }
.field__input::placeholder { color: var(--ink-500); }
.field[data-invalid="true"] .field__input { border-color: #d6375a; }
.field[data-invalid="true"] .field__input:focus { box-shadow: 0 0 0 3px rgba(214, 55, 90, 0.15); }
.field__icon { color: #d6375a; }
.field__error { margin-top: 6px; font-weight: 700; color: #d6375a; }
.toggle-row { margin-top: var(--sp-5); padding-right: var(--sp-3); }
.toggle-row__label { font-size: var(--fs-md); color: var(--ink-700); }
.card__links { margin-bottom: var(--sp-4); }
.card__links p + p { margin-top: var(--sp-3); }
.card__legal { font-size: 0.8125rem; }
.card__legal .link--muted { font-weight: 700; color: var(--ink-500); }
.btn { height: 48px; border-radius: var(--radius-sm); font-weight: 700; }
.btn--primary:disabled { background: #cfd0d6; color: #8a8d99; }
.card__hint:empty { display: none; }

/* desktop/tablet: card mais alto, com o rodapé (links + botão) ancorado na base */
@media (min-width: 768px) {
  .card { display: flex; min-height: 590px; border-radius: 28px; box-shadow: 0 12px 40px rgba(26, 26, 46, 0.10); padding: 44px var(--sp-4) 40px; }
  #login-form { flex: 1 1 auto; }
  .card__bottom { margin-top: auto; padding-top: var(--sp-6); }
}


/* ---------- hero: frases em marca-texto (grifo pintando) ---------- */
.typer { margin-top: var(--sp-4); }
.typer__fixed { font-size: clamp(1.9rem, 2.6vw, 2.4rem); font-weight: 700; line-height: 1.2; color: var(--white); letter-spacing: -0.02em; }
.typer__line { margin-top: var(--sp-4); font-size: clamp(2.1rem, 3.2vw, 2.9rem); font-weight: 700; line-height: 1.42; letter-spacing: -0.02em; min-height: 2.9em; }
.typer__mark { display: block; }
/* contêiner usado só para medir onde as linhas quebram */
.typer__mark--medir { color: transparent; }

/* cada linha vira um grifo próprio, revelado por um corte que anda da esquerda p/ direita */
.hl { display: table; background: var(--white); color: var(--brand-500); padding: 2px 10px; border-radius: 4px; white-space: nowrap; clip-path: inset(0 100% 0 0 round 4px); transition-property: clip-path; transition-timing-function: cubic-bezier(.76, 0, .20, 1); will-change: clip-path; }
.hl + .hl { margin-top: 8px; }
.hl.on { clip-path: inset(0 0 0 0 round 4px); }   /* pintado por inteiro */
.hl.on.off { clip-path: inset(0 100% 0 0 round 4px); } /* apagado da direita p/ esquerda */

@media (max-width: 1024px) {
  .typer { margin-top: var(--sp-5); }
  .typer__fixed { font-size: 1.5rem; }
  .typer__line { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hl { transition: none; }
}


/* ---------- pessoa sobre a divisão hero/formulário (telas largas) ---------- */
.hero-person { display: none; }
@media (min-width: 1314px) {
  .layout { position: relative; }
  /* o formulário fica acima da imagem onde houver sobreposição */
  .auth { position: relative; z-index: 2; }
  .hero-person {
    display: block;
    position: absolute;
    left: var(--hero-width);           /* divisão entre painel e formulário */
    bottom: 0;
    transform: translateX(-50%);        /* centraliza na divisão */
    height: min(80vh, 570px); /* ~465x570 como na referência */
    width: auto;
    z-index: 1;
    pointer-events: none;
  }
}
