:root {
  --cream: #fdf2dd;
  --white: #fefbf3;
  --ink: #403c46;
  --ink-muted: #72697c;
  --purple: #5c3781;
  --purple-deep: #492f62;
  --red: #ff4848;
  --yellow: #ffd94c;
}

* { box-sizing: border-box; }

html, body { min-width: 320px; min-height: 100%; margin: 0; }

body {
  color: var(--ink);
  font-family: "Pacaembu", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
img, object { image-rendering: auto; }

.campaign {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: var(--cream);
}

.campaign::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

.home-screen { position: relative; z-index: 1; min-height: 100vh; padding: 80px; }

.home-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: calc(100vh - 160px);
  max-width: 720px;
  margin: 0 auto;
}

.home-top { display: flex; flex-direction: column; align-items: center; width: 100%; gap: 32px; }
.number-marquee, .mobile-banner, .mobile-campaign-logo { display: none; }
.campaign-seal { display: block; width: min(395px, 100%); height: auto; }

.brand-card {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: min(100%, 542px);
  height: 168px;
  padding: 0 32px;
  gap: 40px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--white);
}

.brand-card__logo-wrap { display: flex; flex: 0 0 auto; align-items: center; padding: 32px 0; }
.brand-card__logo { display: block; width: 223px; height: 104px; object-fit: contain; }
.brand-card__portrait { position: relative; flex: 0 0 auto; width: 215px; height: 165.089px; overflow: hidden; }
.brand-card__portrait img { position: absolute; top: -80.38%; left: -27.92%; display: block; width: 160.3%; height: 263.59%; max-width: none; }

.home-intro { display: flex; align-items: center; justify-content: center; width: 100%; text-align: center; }
.home-intro__copy { display: flex; flex-direction: column; width: 100%; gap: 16px; }
.home-intro h1, .home-intro p, .home-footer p, .flow-title h2, .flow-title p, .format-flow h2 { margin: 0; }
.home-intro h1 { font-size: 40px; font-weight: 200; line-height: 56px; }
.home-intro h1 strong { font-weight: 700; }
.home-intro p { font-size: 20px; font-weight: 200; line-height: 28px; }
.home-intro p strong, .flow-title h2, .format-flow h2, .format-option strong { font-weight: 700; }

.home-footer { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; gap: 24px; }
.home-footer p { font-size: 24px; font-weight: 200; line-height: 32px; text-align: center; }
.social-links { display: flex; align-items: center; gap: 16px; height: 24.151px; }
.social-link { display: block; height: 24.151px; overflow: hidden; color: var(--purple); transition: filter 180ms ease, transform 180ms ease; }
.social-link--instagram { width: 22.541px; }
.social-link--x { width: 25.456px; }
.social-link--facebook { width: 12.368px; }
.social-link--tiktok { width: 21.82px; }
.social-link__sprite, .social-link__sprite img { display: block; width: 130.184px; height: 24.151px; max-width: none; }
.social-link--x .social-link__sprite { transform: translateX(-38.541px); }
.social-link--facebook .social-link__sprite { transform: translateX(-79.997px); }
.social-link--tiktok .social-link__sprite { transform: translateX(-108.364px); }
.social-link:hover { filter: brightness(0.84); transform: translateY(-2px) scale(1.08); }
.social-link:focus-visible { outline: 3px solid var(--red); outline-offset: 4px; border-radius: 2px; }

.flow-overlay {
  position: fixed;
  z-index: 5;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  background: rgba(253, 242, 221, 0.8);
  backdrop-filter: blur(28px);
}

.flow-overlay[hidden] { display: none; }
.flow-shell { width: 100%; max-width: 720px; margin: 0 auto; }
.format-flow, .candidate-flow, .download-flow { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 720px; gap: 32px; }
.format-flow h2, .flow-title h2 { color: var(--ink); font-size: 32px; font-weight: 700; line-height: normal; text-align: center; }
.flow-title { display: flex; flex-direction: column; align-items: center; width: 100%; gap: 24px; text-align: center; }
.flow-title p { color: var(--ink); font-size: 18px; font-weight: 200; line-height: 22px; text-align: center; }

.format-options { display: flex; flex-direction: column; align-items: center; width: 100%; gap: 16px; }
.format-option { display: flex; align-items: center; justify-content: center; width: fit-content; max-width: 100%; gap: 24px; padding: 24px; cursor: pointer; border: 2px solid var(--white); border-radius: 12px; background: rgba(254, 251, 243, 0.32); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.32); color: var(--ink); text-align: left; transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
.format-option.is-selected { border: 6px solid rgba(92, 55, 129, 0.48); background: var(--white); box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.32); }
.format-option:hover { background: var(--white); }
.format-option.is-selected:hover { background: var(--cream); }
.format-option__copy { display: flex; flex: 0 1 auto; flex-direction: column; align-items: flex-start; justify-content: center; max-width: 420px; gap: 8px; }
.format-option strong { color: var(--purple); font-size: 24px; line-height: normal; }
.format-option__copy > span { font-size: 18px; font-weight: 200; line-height: 22px; }

.format-placeholder { display: block; flex: 0 0 auto; overflow: hidden; border: 0.8px solid var(--purple); border-radius: 4px; background: var(--purple); }
.format-placeholder img { display: block; width: 100%; height: 100%; object-fit: cover; }
.format-placeholder--rectangular { width: 100px; height: 125px; }
.format-placeholder--vertical { width: 100px; height: 178px; }

.candidate-flow { gap: 32px; }
.candidate-input-group { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.digit-slots { display: flex; gap: 8px; }
.candidate-digit-input { display: block; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 6px; background: var(--white); color: var(--red); font-size: 32px; font-weight: 700; line-height: 56px; text-align: center; caret-color: var(--red); outline: none; }
.candidate-digit-input::placeholder { color: var(--red); opacity: 1; }
.candidate-input-group.is-editing .candidate-digit-input::placeholder { color: transparent; }
.candidate-digit-input:focus-visible { box-shadow: 0 0 0 4px #ffc9c9; }
.candidate-help { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.candidate-information { display: flex; flex-direction: column; align-items: center; width: 100%; gap: 4px; text-align: center; }
.candidate-information p { margin: 0; }
#candidate-name { font-size: 18px; font-weight: 200; line-height: 22px; }
#candidate-party { width: 248px; height: 22px; color: var(--ink-muted); font-size: 16px; font-weight: 200; line-height: 20px; }

.colinha-preview { display: block; height: auto; overflow: hidden; border-radius: 6px; background: var(--purple); box-shadow: 0 10px 30px rgba(73, 47, 98, 0.2); }
.colinha-preview--rectangular { width: min(480px, calc(100vw - 96px), calc((100svh - 340px) * 0.8)); }
.colinha-preview--vertical { width: min(270px, calc(100vw - 96px), calc((100svh - 340px) * 0.5625)); }

.download-actions { display: flex; align-items: center; justify-content: center; gap: 16px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes enter { from { opacity: 0; translate: 0 16px; } to { opacity: 1; translate: 0 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes number-marquee { to { transform: translateX(-50%); } }
.home-top > *, .home-footer { animation: enter 460ms cubic-bezier(0.22, 0.8, 0.32, 1) both; }
.home-top > .brand-card { animation-name: fade; }
.home-intro { animation-delay: 80ms; }
.home-action { animation-delay: 160ms; }
.home-footer { animation-delay: 240ms; }
.flow-overlay:not([hidden]) .format-flow > *, .flow-overlay:not([hidden]) .candidate-flow > *, .flow-overlay:not([hidden]) .download-flow > * { animation: enter 360ms cubic-bezier(0.22, 0.8, 0.32, 1) both; }
.flow-overlay:not([hidden]) .format-flow > :nth-child(2), .flow-overlay:not([hidden]) .candidate-flow > :nth-child(2), .flow-overlay:not([hidden]) .download-flow > :nth-child(2) { animation-delay: 70ms; }
.flow-overlay:not([hidden]) .format-flow > :nth-child(3), .flow-overlay:not([hidden]) .candidate-flow > :nth-child(3), .flow-overlay:not([hidden]) .download-flow > :nth-child(3) { animation-delay: 140ms; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; } }

@media (max-width: 1336px) {
  .home-screen { padding: 40px; }
  .home-container { min-height: calc(100vh - 80px); }
  .home-top { gap: 24px; }
  .home-intro h1 { font-size: 32px; line-height: 1.3; }
}

@media (max-width: 800px) {
  .campaign { overflow: visible; }
  .home-screen { min-height: auto; padding: 24px; }
  .home-container { justify-content: flex-start; min-height: 0; gap: 48px; }
  .home-top { gap: 32px; }
  .campaign-seal, .brand-card { display: none !important; }
  .number-marquee { display: block; width: 100%; overflow: hidden; }
  .number-marquee__track { display: flex; width: max-content; animation: number-marquee 28s linear infinite; will-change: transform; }
  .number-marquee__group { display: flex; flex: 0 0 auto; gap: 12px; padding-right: 12px; }
  .number-marquee img { display: block; width: clamp(52px, 18vw, 70px); height: auto; }
  .mobile-banner { display: block; width: min(100%, 317px); height: auto; }
  .mobile-campaign-logo { display: block; width: min(223px, 100%); height: auto; }
  .home-intro h1 { font-size: clamp(30px, 7vw, 32px); line-height: 1.12; }
  .home-intro p, .pill-button, .secondary-button { font-size: clamp(18px, 4.5vw, 20px); line-height: 1.4; }
  .home-footer p { font-size: 18px; line-height: 1.28; }
  .flow-overlay { align-items: flex-start; padding: 32px 20px 48px; }
  .flow-shell, .format-flow, .candidate-flow, .download-flow { max-width: 520px; }
  .download-actions { flex-direction: column; width: 100%; }
}

@media (max-width: 440px) {
  .home-screen { padding: 20px; }
  .home-top { gap: 32px; }
  .flow-overlay { padding: 32px 16px; }
  .format-flow, .candidate-flow, .download-flow { gap: 28px; }
  .format-flow h2, .flow-title h2 { font-size: 28px; line-height: 34px; }
  .format-option { gap: 16px; padding: 20px; }
  .format-option__copy > span, .flow-title p { font-size: 17px; line-height: 21px; }
  .format-placeholder--rectangular { width: 82px; height: 103px; }
  .format-placeholder--vertical { width: 82px; height: 146px; }
  .colinha-preview--rectangular { width: min(480px, calc(100vw - 80px), calc((100svh - 320px) * 0.8)); }
  .colinha-preview--vertical { width: min(270px, calc(100vw - 80px), calc((100svh - 320px) * 0.5625)); }
}
