@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/fraunces-latin-var-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Newsreader';
  src: url('/assets/fonts/newsreader-latin-var-normal.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --linen: #f6f1ec;
  --linen-soft: #fbf8f5;
  --ink: #2a160c;
  --ink-soft: #57463a;
  --muted: #8a776a;
  --terracotta: #b35d46;
  --terracotta-soft: #f1e0d8;
  --line: #e3d7cc;
  --shadow: 0 1px 2px rgba(42, 22, 12, .05), 0 12px 28px rgba(42, 22, 12, .06);
  --ease: cubic-bezier(.22, .61, .36, 1);
  --dur: .44s;
  --topbar: calc(env(safe-area-inset-top, 0px) + 58px);
  --bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--linen);
}

body {
  font-family: 'Newsreader', Georgia, serif;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; cursor: pointer; }
p { margin: 0; }
h1, h2 { margin: 0; font-weight: 400; }

/* ---------- estrutura ---------- */
.app { position: fixed; inset: 0; overflow: hidden; }

.track {
  position: absolute;
  inset: 0;
  display: flex;
  transition: transform var(--dur) var(--ease);
  will-change: transform;
}

.slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: calc(var(--topbar) + 8px) 22px calc(var(--bottom) + 74px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.slide::-webkit-scrollbar { display: none; }
.slide:not(.is-active) { pointer-events: none; }

/* entrada suave do conteúdo do slide */
.slide > * { opacity: 0; transform: translateY(9px); }
.slide.is-active > * {
  opacity: 1;
  transform: none;
  transition: opacity .45s ease, transform .5s var(--ease);
}
.slide.is-active > *:nth-child(2) { transition-delay: .06s; }
.slide.is-active > *:nth-child(3) { transition-delay: .11s; }
.slide.is-active > *:nth-child(4) { transition-delay: .16s; }

/* ---------- barra superior ---------- */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 18px 10px;
  background: linear-gradient(var(--linen) 62%, rgba(246, 241, 236, 0));
}
.topbar[hidden] { display: none; }

.back {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  opacity: .38;
  transition: opacity .2s ease, background .2s ease, transform .2s var(--ease);
}
.back:hover { opacity: .8; }
.back:active { transform: scale(.92); }
.back:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 2px; opacity: 1; }
.back[hidden] { visibility: hidden; display: grid; }

.progress {
  height: 2px;
  border-radius: 2px;
  background: rgba(42, 22, 12, .1);
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--terracotta);
  border-radius: 2px;
  transition: width var(--dur) var(--ease);
}

.counter {
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: right;
}

/* ---------- tipografia ---------- */
.eyebrow {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 10px;
}

.display {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(30px, 8.6vw, 40px);
  line-height: 1.02;
  letter-spacing: -.015em;
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
}

.lede {
  font-size: 16.5px;
  line-height: 1.52;
  color: var(--ink-soft);
  margin-top: 14px;
}
.lede--sm { font-size: 15.5px; color: var(--muted); margin-top: 10px; }

/* ---------- abertura ---------- */
.slide--intro {
  padding-top: calc(var(--topbar) - 26px);
  justify-content: space-between;
}
.logo { width: min(62vw, 232px); height: auto; margin-bottom: 18px; }
.intro-top { flex: 0 0 auto; }
.intro-bottom { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; margin-top: 18px; }

.intro-photo {
  margin: 0;
  flex: 0 0 auto;
  height: clamp(168px, 34vh, 330px);
  border-radius: 16px;
  overflow: hidden;
  background: var(--terracotta-soft);
}
.intro-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
}

.cta {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 17px 22px;
  background: var(--ink);
  color: var(--linen);
  font-size: 16.5px;
  letter-spacing: .01em;
  box-shadow: var(--shadow);
  transition: transform .18s var(--ease), opacity .2s ease, background .2s ease;
}
.cta:hover { background: #3a2013; }
.cta:active { transform: scale(.985); }
.cta:disabled { opacity: .45; cursor: default; }
.cta:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 3px; }

.micro {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

/* ---------- perguntas ---------- */
.q-head { flex: 0 0 auto; margin-bottom: 22px; }
.q-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(24px, 7vw, 31px);
  line-height: 1.12;
  letter-spacing: -.01em;
}
.q-help { font-size: 14.5px; color: var(--muted); margin-top: 9px; }

.q-body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
.q-body--top { justify-content: center; }

.options { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }

.option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--linen-soft);
  font-size: 16px;
  line-height: 1.32;
  color: var(--ink);
  transition: border-color .2s ease, background .25s ease, transform .16s var(--ease);
}
.option:active { transform: scale(.99); }
.option:hover { border-color: #d3c2b3; }
.option:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 2px; }

.option .dot {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  border: 1.5px solid #c9b8a9;
  border-radius: 50%;
  transition: border-color .2s ease, background .2s ease;
}
.option.is-selected {
  border-color: var(--terracotta);
  background: var(--terracotta-soft);
}
.option.is-selected .dot {
  border-color: var(--terracotta);
  background: var(--terracotta);
  box-shadow: inset 0 0 0 3px var(--terracotta-soft);
}
.option--long { font-size: 15.2px; }

/* ---------- campos de texto ---------- */
.field { display: block; }
.field input {
  width: 100%;
  padding: 16px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-family: 'Newsreader', Georgia, serif;
  font-size: 18px;
  color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input::placeholder { color: #b6a496; }
.field input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(179, 93, 70, .14);
}
.field input[aria-invalid='true'] { border-color: var(--terracotta); }

.field-error {
  min-height: 20px;
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--terracotta);
}

.q-actions { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }

.skip {
  align-self: center;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  padding: 6px 4px;
}
.skip:hover { color: var(--ink-soft); }

.submit-error {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--terracotta-soft);
  border: 1px solid var(--terracotta);
  font-size: 14.5px;
  color: var(--ink);
}
.submit-error[hidden] { display: none; }

/* ---------- conclusão ---------- */
.slide--final { justify-content: flex-start; }
.slide--final:focus { outline: none; }
.final-inner { display: flex; flex-direction: column; gap: 14px; }
.final-photo {
  border-radius: 16px;
  overflow: hidden;
  margin: 4px 0 2px;
  height: clamp(190px, 34vh, 330px);
}
.final-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 32%; }
.final-text { font-size: 16.5px; line-height: 1.55; color: var(--ink-soft); }
.final-text--soft { color: var(--muted); font-size: 15.5px; }
.assinatura {
  margin-top: 6px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink);
}
.assinatura span { color: var(--terracotta); }

/* ---------- figura de canto ---------- */
.mascote {
  position: absolute;
  right: 14px;
  bottom: calc(var(--bottom) + 8px);
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s var(--ease);
}
.mascote[hidden] { display: none; }
.mascote img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 18%;
  border: 2px solid var(--linen);
  box-shadow: 0 2px 10px rgba(42, 22, 12, .16);
  animation: bob 4.5s ease-in-out infinite;
}
.bubble {
  max-width: 168px;
  padding: 6px 11px;
  border-radius: 12px 12px 3px 12px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-soft);
  box-shadow: 0 2px 8px rgba(42, 22, 12, .05);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .3s ease, transform .3s var(--ease);
}
.bubble.is-on { opacity: 1; transform: none; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1.2deg); }
  50% { transform: translateY(-4px) rotate(1.2deg); }
}

/* ---------- telas baixas ---------- */
@media (max-height: 700px) {
  :root { --topbar: calc(env(safe-area-inset-top, 0px) + 52px); --bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }
  .logo { width: min(46vw, 168px); margin-bottom: 10px; }
  .display { font-size: clamp(25px, 7.2vw, 32px); }
  .q-title { font-size: clamp(21px, 6.4vw, 27px); }
  .lede { font-size: 15px; margin-top: 10px; }
  .lede--sm { font-size: 14px; }
  .option { padding: 12px 14px; font-size: 15px; }
  .intro-photo { height: clamp(120px, 24vh, 220px); }
  .final-photo { height: clamp(140px, 24vh, 230px); }
  .cta { padding: 15px 20px; }
  .slide--intro { padding-top: calc(var(--topbar) - 22px); }
  .intro-bottom { gap: 10px; }
  .micro { font-size: 12.5px; }
  .mascote img { width: 44px; height: 44px; }
}

/* ---------- desktop: coluna centrada, sem esticar o layout mobile ---------- */
@media (min-width: 620px) {
  body { background: #efe7e0; }
  .app {
    left: 50%;
    right: auto;
    width: 464px;
    transform: translateX(-50%);
    background: var(--linen);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    box-shadow: 0 0 70px rgba(42, 22, 12, .07);
  }
  .slide { padding-left: 30px; padding-right: 30px; }
  .display { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .track { transition: none; }
}
