/* Athos Koiné — entrada e criação de conta.
   Usa as variáveis de site.css e responde ao contrato de tema: o escuro vale
   por preferência do sistema quando não há escolha manual, e vale também quando
   o botão de tema grava data-theme="dark". */

.auth-page {
  --auth-danger: #9e3b2f;
  --auth-danger-ink: #7d2f26;
  --auth-danger-tint: rgba(158, 59, 47, 0.08);
  --auth-ring: rgba(176, 141, 62, 0.28);
  --auth-shadow: 0 1px 2px rgba(15, 36, 30, 0.06), 0 18px 44px -30px rgba(15, 36, 30, 0.45);
  --auth-field-bg: var(--paper-2);
  --auth-strength-weak: #9e3b2f;
  --auth-strength-medium: #b08d3e;
  --auth-strength-strong: #2c5a49;
  --auth-glide: var(--card);
  --auth-glide-edge: transparent;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-page {
    --auth-danger: #f0a08c;
    --auth-danger-ink: #f5bdae;
    --auth-danger-tint: rgba(240, 160, 140, 0.1);
    --auth-ring: rgba(214, 176, 97, 0.32);
    --auth-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 22px 50px -30px rgba(0, 0, 0, 0.8);
    --auth-strength-weak: #d97a63;
    --auth-strength-medium: #d6b061;
    --auth-strength-strong: #9dc7b4;
    --auth-glide: #26342c;
    --auth-glide-edge: rgba(236, 231, 216, 0.16);
  }
}

:root[data-theme="dark"] .auth-page {
  --auth-danger: #f0a08c;
  --auth-danger-ink: #f5bdae;
  --auth-danger-tint: rgba(240, 160, 140, 0.1);
  --auth-ring: rgba(214, 176, 97, 0.32);
  --auth-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 22px 50px -30px rgba(0, 0, 0, 0.8);
  --auth-strength-weak: #d97a63;
  --auth-strength-medium: #d6b061;
  --auth-strength-strong: #9dc7b4;
  --auth-glide: #26342c;
  --auth-glide-edge: rgba(236, 231, 216, 0.16);
}

/* Estrutura --------------------------------------------------------------- */

/* As autoras vencem a folha do navegador, então um display explícito (grid,
   flex) anula o atributo hidden. Sem esta regra o campo Nome e a fileira de
   provedores continuariam visíveis quando deveriam estar ocultos. */
.auth-page [hidden] {
  display: none !important;
}

.auth-page .site-header {
  position: static;
}

/* O botão de tema injetado pelo theme.js não deve encolher nem quebrar. */
.auth-page .header-inner {
  gap: 18px;
}

.auth-page :where(.theme-toggle) {
  flex-shrink: 0;
}

/* Auto-margem na marca, e não no CTA: assim o que vem depois dela (o botão de
   tema e o CTA, nesta ordem) se agrupa à direita — com ou sem o botão de tema. */
.auth-page .brand-lockup {
  margin-right: auto;
}

.auth-page .header-cta {
  min-height: 44px;
}

.auth-main {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(28px, 6vw, 60px) 20px clamp(48px, 8vw, 96px);
}

.auth-card {
  width: min(100%, 470px);
  margin-inline: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: clamp(24px, 5vw, 38px);
  box-shadow: var(--auth-shadow);
  animation: auth-rise 320ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes auth-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth-eyebrow {
  margin: 0 0 4px;
  font-family: var(--greek);
  font-size: 18px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-ink);
}

.auth-card h1 {
  margin: 0 0 10px;
  font-size: clamp(24px, 4vw, 30px);
  line-height: 1.15;
}

.auth-lead {
  margin: 0 0 24px;
  font-size: 15px;
  color: var(--soft);
}

/* Abas -------------------------------------------------------------------- */

.auth-tabs {
  position: relative;
  display: flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 22px;
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.auth-tab-glide {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 7px);
  border-radius: 999px;
  background: var(--auth-glide);
  box-shadow: inset 0 0 0 1px var(--auth-glide-edge), 0 1px 2px rgba(15, 36, 30, 0.14),
    0 8px 18px -14px rgba(15, 36, 30, 0.5);
  transform: translateX(0);
  transition: transform 260ms cubic-bezier(0.2, 0.8, 0.25, 1);
}

.auth-tabs.is-signup .auth-tab-glide {
  transform: translateX(calc(100% + 6px));
}

.auth-tabs.is-single .auth-tab-glide {
  width: calc(100% - 8px);
  transform: none;
}

.auth-tab {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--soft);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 180ms ease;
}

.auth-tab.is-active {
  color: var(--ink);
}

.auth-tabs.is-single .auth-tab {
  cursor: default;
}

/* Campos ------------------------------------------------------------------ */

.auth-panel.is-switching form {
  animation: auth-panel-in 220ms ease-out;
}

@keyframes auth-panel-in {
  from {
    opacity: 0.35;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.field .opt {
  font-weight: 400;
  color: var(--faint);
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--auth-field-bg);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input::placeholder {
  color: var(--faint);
  opacity: 1;
}

.field input:hover:not(:focus) {
  border-color: var(--green-soft);
}

.field input:focus {
  border-color: var(--gold);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--auth-ring);
  /* Mantém o anel de foco do site: o dourado do campo tem contraste baixo
     contra o papel, e quem navega por teclado merece o mesmo indicador forte
     das outras páginas. */
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.auth-field.is-error input {
  border-color: var(--auth-danger);
  background: var(--auth-danger-tint);
}

.auth-field.is-error input:focus {
  border-color: var(--auth-danger);
  box-shadow: 0 0 0 3px var(--auth-danger-tint);
}

.auth-field.is-error label {
  color: var(--auth-danger-ink);
}

.auth-field-error {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--auth-danger-ink);
}

.auth-field-error:empty {
  display: none;
}

.hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--faint);
}

/* Senha ------------------------------------------------------------------- */

.password-wrap {
  position: relative;
  display: flex;
}

.password-wrap input {
  padding-right: 116px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 104px;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--gold-ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.password-toggle:hover {
  background: rgba(176, 141, 62, 0.12);
}

.auth-eye {
  flex-shrink: 0;
}

.auth-eye-closed {
  display: none;
}

.password-toggle.is-visible .auth-eye-open {
  display: none;
}

.password-toggle.is-visible .auth-eye-closed {
  display: block;
}

/* Medidor de força -------------------------------------------------------- */

.auth-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.auth-strength-track {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}

.auth-strength-seg {
  width: 26px;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 200ms ease;
}

.auth-strength-text {
  margin: 0;
  font-size: 12.5px;
  color: var(--faint);
}

.auth-strength[data-level="1"] .auth-strength-seg:nth-child(-n + 1) {
  background: var(--auth-strength-weak);
}

.auth-strength[data-level="2"] .auth-strength-seg:nth-child(-n + 2) {
  background: var(--auth-strength-medium);
}

.auth-strength[data-level="3"] .auth-strength-seg:nth-child(-n + 3),
.auth-strength[data-level="4"] .auth-strength-seg:nth-child(-n + 4) {
  background: var(--auth-strength-strong);
}

.auth-strength[data-level="3"] .auth-strength-text,
.auth-strength[data-level="4"] .auth-strength-text {
  color: var(--soft);
}

/* Botões ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 13px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease,
    box-shadow 160ms ease;
}

.btn.wide {
  width: 100%;
}

.btn.primary {
  background: var(--green);
  color: #f8f2e4;
  box-shadow: 0 14px 28px -20px rgba(15, 36, 30, 0.85);
}

.btn.primary:hover:not([disabled]) {
  background: var(--green-soft);
  transform: translateY(-1px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary {
    color: var(--green-deep);
  }
}

:root[data-theme="dark"] .btn.primary {
  color: var(--green-deep);
}

.btn.primary.is-loading {
  opacity: 0.78;
  cursor: progress;
  transform: none;
}

.auth-btn-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  opacity: 0.85;
  animation: auth-spin 700ms linear infinite;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.btn.is-loading .auth-btn-spinner {
  display: block;
}

/* Foco visível ------------------------------------------------------------- */

/* Os campos já respondem ao foco com borda dourada + anel de 3px, que é o
   indicador nesta altura; um outline por cima daria anel duplo. */
.auth-tabs button:focus-visible,
.password-toggle:focus-visible,
.btn:focus-visible,
.auth-foot a:focus-visible,
.auth-footer a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Estado geral ------------------------------------------------------------ */

.auth-status {
  min-height: 22px;
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--soft);
}

.auth-status.is-error {
  color: var(--auth-danger-ink);
}

.auth-status.is-ok {
  color: var(--green);
  font-weight: 600;
}

/* Provedores -------------------------------------------------------------- */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
  color: var(--faint);
  font-size: 12.5px;
  text-transform: lowercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-providers {
  display: grid;
  gap: 10px;
}

.auth-providers:empty {
  display: none;
}

.btn.provider {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn.provider:hover:not([disabled]) {
  border-color: var(--gold);
  background: rgba(176, 141, 62, 0.08);
  transform: translateY(-1px);
}

.btn.provider[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.provider-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-weight: 700;
}

.provider-slot {
  display: flex;
  justify-content: center;
  min-height: 44px;
  max-width: 100%;
}

/* O botão do Google é um iframe de largura fixa: nunca pode alargar o cartão. */
.provider-slot iframe {
  max-width: 100%;
}

.auth-note {
  margin: 14px 0 0;
  padding: 11px 14px 11px 16px;
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  background: rgba(176, 141, 62, 0.1);
  font-size: 13px;
  line-height: 1.5;
  color: var(--soft);
}

/* Rodapé do cartão -------------------------------------------------------- */

.auth-foot {
  margin: 22px 0 0;
  font-size: 13.5px;
  color: var(--soft);
}

.auth-foot.small {
  font-size: 12.5px;
  color: var(--faint);
}

/* Link dentro da frase: o alvo cresce com padding, sem caixa própria, que é o
   jeito de não brigar com a altura da linha. */
.auth-foot a {
  color: var(--green);
  font-weight: 600;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  padding-block: 6px;
}

.small {
  font-size: 12.5px;
}

.muted {
  color: var(--soft);
}

/* Rodapé da página -------------------------------------------------------- */

.auth-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 40px;
}

.auth-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
  font-size: 13.5px;
}

.auth-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  justify-content: center;
  padding-inline: 12px;
  color: var(--soft);
  text-decoration: none;
  transition: color 160ms ease;
}

.auth-footer a:hover {
  color: var(--green);
  text-decoration: underline;
  text-decoration-color: var(--gold);
}

.auth-footer-copy {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--faint);
}

/* Estreito ---------------------------------------------------------------- */

/* Na faixa mais estreita a marca e o botão do cabeçalho não cabem juntos: o
   subtítulo sai de cena para o CTA continuar inteiro e tocável. Com o botão de
   tema injetado pelo theme.js podem ser três itens; aí a linha quebra e o
   grupo de ações desce inteiro, em vez de alargar a página. */
@media (max-width: 420px) {
  .auth-page .header-inner {
    gap: 12px;
    flex-wrap: wrap;
    row-gap: 8px;
    padding-block: 10px;
  }

  .auth-page .brand-tag {
    display: none;
  }
}

@media (max-width: 400px) {
  .auth-tab {
    font-size: 13.5px;
    padding-inline: 8px;
  }

  .password-wrap input {
    padding-right: 62px;
  }

  .password-toggle {
    min-width: 52px;
    padding-inline: 8px;
  }

  .password-toggle #password-toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .auth-strength {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* Movimento reduzido ------------------------------------------------------ */

/* site.css já zera durações com !important; aqui entra só o que é da página:
   as animações próprias e o deslocamento no hover, que a regra genérica não
   alcança porque os seletores deste arquivo são mais específicos. */
@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .auth-panel.is-switching form {
    animation: none;
  }

  .auth-page .btn.primary:hover:not([disabled]),
  .auth-page .btn.provider:hover:not([disabled]) {
    transform: none;
  }
}
