/* ═══════════════════════════════════════════
   Geometric Soul — Anamnese  ·  Design System
   ═══════════════════════════════════════════ */

:root {
  --bg: #0F1624;
  --surface: #141E2E;
  --surface-hi: #1A2540;
  --primary: #F5F0E8;
  --muted: #8A95A8;
  --muted-dim: #4A5568;
  --accent: #C9A84C;
  --accent-dim: rgba(201, 168, 76, 0.12);
  --accent-border: rgba(201, 168, 76, 0.25);
  --error: #E05A5A;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
  --radius: 14px;
  --t: 220ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ─────────────────────────── */

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

/* Garante que o atributo 'hidden' sempre funcione, mesmo quando CSS define display:flex */
[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* hard block horizontal scroll */
  max-width: 100%;
}

body {
  background: var(--bg);
  color: var(--primary);
  font-family: var(--font-body);
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  width: 100%;
  max-width: 100vw;
}

/* Textura sutil */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Layout Container ─────────────────────── */

.form-container {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0 auto;
  /* bottom padding accounts for the fixed actions bar (~80px) */
  padding: 1.5rem 1.25rem 90px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ── Typography Helpers ───────────────────── */

.label-mono {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.title-display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 8vw, 2.4rem);
  line-height: 1.15;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.subtitle-italic {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.6;
}

.separator {
  width: 48px;
  height: 1.5px;
  background: var(--accent);
  border: none;
  margin: 1.25rem 0;
}

/* ═══════════════════════════════════════════
   Tela 0 — Boas-vindas
   ═══════════════════════════════════════════ */

.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100svh;
  padding: 2rem 1.25rem;
  position: relative;
  overflow: hidden;
  gap: 0;
  /* controlled by children margins */
}

.welcome-bg-svg {
  position: absolute;
  width: 420px;
  height: 420px;
  opacity: 0.05;
  pointer-events: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.welcome-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.welcome-content .label-mono {
  margin-bottom: 0.75rem;
}

/* —— Logo wrapper: clips PNG whitespace instead of using negative margins —— */
.welcome-logo-wrap {
  /* Visible area = the actual logo graphic (roughly 60% of the PNG box) */
  width: min(440px, 90vw);
  height: min(270px, 58vw);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 25px;
  margin-bottom: -6%;
}

.welcome-logo {
  /* Let the image be larger than wrapper so whitespace gets clipped */
  width: 140%;
  height: 140%;
  object-fit: contain;
  flex-shrink: 0;
}

.welcome-content .separator {
  margin: 1.25rem auto;
}

.welcome-content .subtitle-italic {
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
  max-width: 420px;
}

/* ═══════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0.85rem 2rem;
  transition: all var(--t) var(--ease);
  outline: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: #d4b35c;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(201, 168, 76, 0.3);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-ghost:hover {
  color: var(--primary);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

/* Shake */
@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-6px);
  }

  40% {
    transform: translateX(6px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

.btn--shake {
  animation: shake 0.4s ease;
}

/* ═══════════════════════════════════════════
   Header Fixo
   ═══════════════════════════════════════════ */

.header-logo {
  height: 250px;
  width: 250px;
  display: block;
  margin: -70px auto;
  overflow: visible;
  object-fit: contain;
}

.form-header {
  position: sticky;
  top: 0;
  z-index: 110;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(15, 22, 36, 0.88);
  /* let the -70px margins on the logo keep the header compact */
  padding: calc(0.25rem + env(safe-area-inset-top, 0px)) 1rem 0.25rem;
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.header-brand {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.header-protocol {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--muted-dim);
}

/* Step Dots */
.step-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 0.6rem;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-dim);
  transition: all var(--t) var(--ease);
  flex-shrink: 0;
}

.step-dot.completed {
  background: var(--accent);
}

.step-dot.active {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.25);
}

.step-line {
  width: 18px;
  height: 1px;
  background: var(--muted-dim);
  transition: background var(--t) var(--ease);
}

.step-line.completed {
  background: var(--accent);
}

/* Progress Bar */
.progress-bar {
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 1px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 400ms var(--ease);
}

.progress-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: var(--muted-dim);
  text-align: center;
}

/* ═══════════════════════════════════════════
   Floating Labels — Bottom Line
   ═══════════════════════════════════════════ */

.field-wrap {
  position: relative;
  margin-bottom: 1.75rem;
}

.field-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.1rem 0 0.4rem;
  color: var(--primary);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--t) var(--ease);
}

.field-input:focus {
  border-bottom-color: var(--accent);
}

.field-label {
  position: absolute;
  top: 1.1rem;
  left: 0;
  color: var(--muted);
  font-size: 0.9rem;
  pointer-events: none;
  transition: all var(--t) var(--ease);
}

.field-input:focus~.field-label,
.field-input:not(:placeholder-shown)~.field-label {
  top: 0;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Golden line grows from center */
.field-wrap::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--t) var(--ease), left var(--t) var(--ease);
}

.field-wrap:focus-within::after {
  width: 100%;
  left: 0;
}

/* Error */
.field-wrap.field--error .field-input {
  border-bottom-color: var(--error);
}

.field-wrap.field--error .field-label {
  color: var(--error);
}

.field-wrap.field--error::after {
  background: var(--error);
  width: 100%;
  left: 0;
}

/* ═══════════════════════════════════════════
   Selection Cards — Checkbox
   ═══════════════════════════════════════════ */

.sel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (max-width: 500px) {
  .sel-grid {
    grid-template-columns: 1fr;
  }
}

.sel-card {
  background: var(--surface);
  border: 1.5px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: all var(--t) var(--ease);
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.sel-card:hover {
  background: var(--surface-hi);
  border-color: rgba(201, 168, 76, 0.45);
  transform: translateY(-2px);
}

.sel-card.selected {
  background: var(--accent-dim);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-border);
}

.sel-card .card-icon {
  width: 24px;
  height: 24px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.5;
  margin-bottom: 0.4rem;
  transition: stroke var(--t);
}

.sel-card.selected .card-icon {
  stroke: var(--accent);
}

.sel-card .card-label {
  font-size: 0.88rem;
  color: var(--primary);
}

/* "Outro" input inside card */
.outro-input {
  display: none;
  width: 100%;
  margin-top: 0.6rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.35rem 0;
  color: var(--primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--t) var(--ease);
}

.outro-input:focus {
  border-bottom-color: var(--accent);
}

.outro-input::placeholder {
  color: var(--muted-dim);
  font-style: italic;
}

/* ═══════════════════════════════════════════
   Platonic Solid Cards — Radio
   ═══════════════════════════════════════════ */

.plat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.plat-grid .plat-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  max-width: 260px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 480px) {
  .plat-grid {
    grid-template-columns: 1fr;
  }

  .plat-grid .plat-card:last-child:nth-child(odd) {
    max-width: 100%;
  }
}

.plat-card {
  background: var(--surface);
  border: 1.5px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 1.75rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--t) var(--ease);
  user-select: none;
}

.plat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(201, 168, 76, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.plat-card.selected {
  border: 2px solid var(--accent);
  background: linear-gradient(135deg, var(--surface-hi), var(--accent-dim));
  box-shadow: 0 0 0 1px rgba(201, 168, 76, 0.3), 0 8px 40px rgba(201, 168, 76, 0.15);
}

.solid-svg {
  width: 68px;
  height: 68px;
  margin: 0 auto 1rem;
  display: block;
  color: var(--accent);
  animation: breathe 6s ease-in-out infinite;
}

.plat-card:hover .solid-svg,
.plat-card.selected .solid-svg {
  filter: drop-shadow(0 0 10px rgba(201, 168, 76, 0.5));
  animation: none;
}

@keyframes breathe {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }

  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

.solid-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: #FFFFFF;
  margin-bottom: 0.2rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.solid-elem {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.solid-desc {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.9rem;
  color: rgba(245, 240, 232, 0.82);
}

/* ═══════════════════════════════════════════
   Textarea — Immersive
   ═══════════════════════════════════════════ */

.textarea-wrap {
  position: relative;
  margin-top: 0.5rem;
}

.textarea-field {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 0;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.8;
  resize: none;
  outline: none;
  min-height: 100px;
  transition: border-color var(--t) var(--ease);
}

.textarea-field:focus {
  border-bottom-color: rgba(201, 168, 76, 0.4);
}

.textarea-field::placeholder {
  color: var(--muted);
  font-style: italic;
  opacity: 0.6;
}

.char-count {
  position: absolute;
  bottom: -1.2rem;
  right: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted-dim);
}

/* ═══════════════════════════════════════════
   Actions Bar
   ═══════════════════════════════════════════ */

.actions-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(15, 22, 36, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.75rem 1.25rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.actions-bar .btn-ghost {
  padding: 0.7rem 1.2rem;
}

.actions-bar .btn-primary {
  padding: 0.7rem 1.8rem;
}

/* ═══════════════════════════════════════════
   Tela 8 — Completion
   ═══════════════════════════════════════════ */

.completion-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100svh;
  padding: 2rem 1.25rem;
  overflow: hidden;
}

.success-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 2rem;
}

.success-circle {
  stroke-dasharray: 226;
  stroke-dashoffset: 226;
  animation: draw 700ms ease forwards;
}

.success-check {
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: draw 400ms ease 600ms forwards;
}

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

.completion-protocol {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.completion-date {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--muted-dim);
  margin-bottom: 2rem;
}

.completion-invite {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--primary);
  opacity: 0.9;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.completion-socials {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--t) var(--ease);
  cursor: pointer;
}

.social-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.social-btn[aria-label="WhatsApp"] {
  background: rgba(37, 211, 102, 0.12);
  color: #25d366;
  border: 1px solid rgba(37, 211, 102, 0.3);
}

.social-btn[aria-label="WhatsApp"]:hover {
  background: rgba(37, 211, 102, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.2);
}

.social-btn[aria-label="Instagram"] {
  background: rgba(225, 48, 108, 0.1);
  color: #e1306c;
  border: 1px solid rgba(225, 48, 108, 0.25);
}

.social-btn[aria-label="Instagram"]:hover {
  background: rgba(225, 48, 108, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(225, 48, 108, 0.2);
}

/* Logo no rodapé da tela de encerramento */
.completion-logo {
  width: 180px;
  height: 180px;
  object-fit: contain;
  display: block;
  margin: -40px auto 0;
  opacity: 0.85;
}

/* Garante que os botões de navegação nunca apareçam na tela de obrigado */
[data-step="8"]:not([hidden])~.actions-bar {
  display: none !important;
}

/* Garante que os botões nunca apareçam na tela inicial (boas-vindas) */
[data-step="0"]:not([hidden])~.actions-bar {
  display: none !important;
}

/* ═══════════════════════════════════════════
   Submit Error
   ═══════════════════════════════════════════ */

.submit-error {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--error);
  text-align: center;
  margin-top: 0.75rem;
}

/* ═══════════════════════════════════════════
   Step Section Spacing
   ═══════════════════════════════════════════ */

.step-section {
  padding: 1.5rem 0 1rem;
}

.step-section .label-mono {
  margin-bottom: 0.5rem;
}

.step-section .title-display {
  margin-bottom: 0.75rem;
}

.step-section .subtitle-italic {
  margin-bottom: 1.25rem;
}

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */

@media (max-width: 640px) {
  .form-container {
    padding: 1rem 1rem 90px;
  }

  .welcome-content .title-display {
    font-size: clamp(2rem, 9vw, 2.4rem);
  }

  .title-display {
    font-size: clamp(1.5rem, 7vw, 1.8rem);
  }

  .welcome-bg-svg {
    width: min(260px, 70vw);
    height: min(260px, 70vw);
  }

  .form-header {
    /* No negative margins — prevents horizontal bleed */
    padding: calc(0.25rem + env(safe-area-inset-top, 0px)) 1rem 0.25rem;
    overflow: hidden;
  }

  .plat-card {
    padding: 1rem 0.75rem;
  }

  .solid-svg {
    width: 48px;
    height: 48px;
  }

  .solid-name {
    font-size: 1.15rem;
  }

  .solid-desc {
    font-size: 0.8rem;
  }

  .step-section {
    padding: 1rem 0 0.5rem;
  }
}

@media (max-width: 360px) {
  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
  }

  .actions-bar {
    padding: 0.75rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .sel-card {
    padding: 0.75rem;
  }
}

@media (max-height: 667px) {

  /* iPhone SE height and below */
  .welcome-screen,
  .completion-screen {
    min-height: 100svh;
    max-height: 100svh;
    overflow: hidden;
    padding: 1.5rem 1.25rem;
  }

  .welcome-bg-svg {
    width: 180px;
    height: 180px;
  }

  .welcome-content .subtitle-italic {
    margin-bottom: 1.5rem;
  }

  .step-section {
    padding-top: 0.5rem;
  }
}

/* ═══════════════════════════════════════════
   Scrollbar
   ═══════════════════════════════════════════ */

::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--muted-dim);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}