/* Paleta dessaturada e quente, a mesma da cidade: salvia, creme, terracota. */
:root {
  --cream: #f4ede0;
  --cream-2: #ebe1cd;
  --paper: #fbf7ee;
  --line: #dccfb6;
  --sage: #8fa58a;
  --sage-d: #566d54;
  --sage-l: #dde5d3;
  --terra: #ad5638;
  --terra-d: #8f452c;
  --terra-l: #efd3c5;
  --ink: #38372f;
  --muted: #6b675a;
  --radius: 18px;
  --shadow: 0 1px 0 #fff8 inset, 0 10px 30px -14px #5a4a2e55;
  font-family: ui-rounded, "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--cream);
  background-image: radial-gradient(ellipse 80% 50% at 80% 0%, #dde5d366, transparent 70%),
    radial-gradient(ellipse 70% 40% at 0% 100%, #efd3c544, transparent 70%);
  line-height: 1.5;
}

a { color: var(--terra-d); }
:focus-visible { outline: 3px solid var(--sage-d); outline-offset: 2px; border-radius: 6px; }

/* topo */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 6px 12px; padding: 14px 16px; max-width: 1080px; width: 100%; margin: 0 auto;
}
.brand { white-space: nowrap; display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; letter-spacing: .01em; font-size: .95rem; }
.brand-mark { width: 28px; height: 28px; }
.langs { display: flex; gap: 2px; font-size: .875rem; margin-left: auto; }
.langs a {
  padding: 6px 9px; border-radius: 999px; text-decoration: none; color: var(--muted);
}
.langs a[aria-current] { background: var(--sage-l); color: var(--sage-d); font-weight: 600; }

/* layout */
.layout {
  flex: 1; width: 100%; max-width: 1080px; margin: 0 auto;
  padding: 8px 16px 32px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start;
}
h1 { margin: 8px 0 8px; font-size: clamp(2rem, 8vw, 3.2rem); line-height: 1.05; letter-spacing: -.02em; color: var(--ink); }
h2 { margin: 0 0 8px; font-size: 1.35rem; line-height: 1.2; }
h3 { margin: 18px 0 8px; font-size: 1rem; color: var(--sage-d); text-transform: uppercase; letter-spacing: .06em; }
.lead { margin: 0 0 20px; color: var(--muted); font-size: 1.05rem; max-width: 34ch; }

/* formulario */
.field-label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 6px; color: var(--sage-d); }
.field {
  display: flex; align-items: stretch; background: var(--paper);
  border: 2px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow);
}
.field:focus-within { border-color: var(--sage-d); }
.field[data-invalid] { border-color: var(--terra); }
.at { display: flex; align-items: center; padding-left: 14px; color: var(--sage-d); font-weight: 700; font-size: 1.1rem; }
input[type="text"] {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  padding: 14px 8px; font: inherit; font-size: 1.1rem; /* >=16px evita zoom no iOS */
}
input[type="text"]:focus-visible { outline: none; }
input::placeholder { color: #9b9684; }
button, .button-link {
  font: inherit; font-weight: 700; cursor: pointer; border: 0; text-decoration: none;
}
#search-button {
  background: var(--terra); color: #fff; padding: 0 18px; font-size: .95rem; white-space: nowrap;
}
#search-button:hover { background: var(--terra-d); }
#search-button:disabled { opacity: .6; cursor: progress; }
.field-error { margin: 8px 2px 0; color: var(--terra-d); font-size: .9rem; }

/* area dos estados */
.stage { min-height: 260px; }
.skyline {
  display: flex; justify-content: center; align-items: flex-end; padding: 8px 0 28px;
}
.skyline img { width: 40%; max-width: 240px; height: auto; margin: 0 -5%; }
.skyline img:nth-child(2) { margin-bottom: -18px; position: relative; z-index: 1; }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card.center { text-align: center; padding: 36px 20px; color: var(--muted); }
.card p { margin: 0 0 10px; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; font-weight: 700; color: var(--sage-d); margin: 0 0 4px !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.spinner {
  display: inline-block; width: 26px; height: 26px; margin-bottom: 10px; background: var(--terra);
  transform: scaleY(.58) rotate(45deg); border-radius: 4px; animation: pulse 1s ease-in-out infinite alternate;
}
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* encontrado */
.found h2 { color: var(--sage-d); word-break: break-word; }
.preview { margin: 0 0 14px; background: var(--cream-2); border-radius: 14px; display: flex; justify-content: center; overflow: hidden; }
.preview img { width: min(100%, 320px); max-width: 100%; height: auto; display: block; }
.preview iframe { width: 100%; height: 280px; border: 0; display: block; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 12px; }
.stats div { background: var(--sage-l); border-radius: 12px; padding: 10px 6px; text-align: center; }
.stats dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sage-d); font-weight: 700; }
.stats dd { margin: 2px 0 0; font-size: 1.15rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* nao encontrado */
.steps { list-style: none; counter-reset: step; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before {
  content: counter(step); flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--terra-l); color: var(--terra-d); font-weight: 700; display: grid; place-items: center; font-size: .85rem;
}
.kw { background: var(--terra-l); color: var(--terra-d); padding: 1px 8px; border-radius: 6px; letter-spacing: .04em; }
.button-link, .secondary {
  display: inline-block; background: var(--terra); color: #fff; padding: 12px 18px; border-radius: 12px;
}
.button-link:hover { background: var(--terra-d); }
.secondary { background: var(--sage-d); }
.secondary:hover { background: #46593f; }
.secondary:disabled { opacity: .55; cursor: not-allowed; }

.footer { max-width: 1080px; width: 100%; margin: 0 auto; padding: 8px 16px 28px; color: var(--muted); font-size: .8rem; }
.footer p { margin: 0 0 4px; }

[hidden] { display: none !important; }

/* desktop: texto e formulario a esquerda, palco a direita */
@media (min-width: 900px) {
  .topbar { padding: 22px 32px; }
  .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; padding: 48px 32px 48px; align-items: start; }
  .intro { padding-top: 28px; }
  .lead { font-size: 1.2rem; }
  .card { padding: 26px; }
  .skyline img { width: 42%; }
  .footer { padding: 8px 32px 32px; }
}


/* ===== MODO MAPA: a cidade ocupa a pagina toda; barra de busca no topo; painel flutuante com o resultado ===== */
.mappage { display: block; min-height: 100vh; min-height: 100dvh; overflow: hidden; background: var(--cream-2); }
.map-full { position: fixed; inset: 0; z-index: 0; background: var(--cream-2); }
.map-full iframe { width: 100%; height: 100%; border: 0; display: block; }

.floatbar {
  position: fixed; z-index: 3; top: max(10px, env(safe-area-inset-top)); left: 12px; right: 12px;
  display: flex; align-items: center; gap: 10px; pointer-events: none; /* so os filhos recebem clique: o mapa fica arrastavel ao redor */
}
.floatbar > * { pointer-events: auto; }
.floatbar .brand, .floatbar .langs {
  background: color-mix(in srgb, var(--paper) 92%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: blur(6px); border-radius: 999px; padding: 8px 14px;
}
.floatbar .langs { padding: 3px; margin-left: 0; }
.searchbar { flex: 1; min-width: 0; max-width: 520px; position: relative; }
.searchbar .field-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.searchbar .field { border-radius: 999px; }
.searchbar input[type="text"] { padding: 11px 8px; font-size: 1rem; }
.searchbar #search-button { padding: 0 18px; }
.searchbar .field-error {
  position: absolute; left: 8px; right: 8px; top: calc(100% + 6px); margin: 0; padding: 8px 12px; border-radius: 12px;
  background: var(--paper); border: 1px solid var(--terra-l); box-shadow: var(--shadow);
}

.map-hint {
  position: fixed; z-index: 2; left: 50%; transform: translateX(-50%); bottom: 64px; margin: 0; padding: 7px 14px;
  border-radius: 999px; background: color-mix(in srgb, var(--paper) 92%, transparent); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: .8rem; color: var(--muted); pointer-events: none; white-space: nowrap; max-width: calc(100vw - 24px);
  overflow: hidden; text-overflow: ellipsis; animation: hint-out 1s ease 9s forwards;
}
@keyframes hint-out { to { opacity: 0; visibility: hidden; } }

.panel {
  position: fixed; z-index: 4; top: 72px; left: 12px; width: min(380px, calc(100vw - 24px));
  max-height: calc(100dvh - 140px); overflow: auto; padding-top: 4px;
}
.panel .card { margin: 0; }
.panel-close {
  position: absolute; top: 12px; right: 12px; z-index: 1; width: 32px; height: 32px; border-radius: 50%;
  background: var(--cream-2); color: var(--ink); font-size: 1.3rem; line-height: 1; padding: 0;
}
.panel-close:hover { background: var(--line); }
.map-footer {
  position: fixed; z-index: 2; left: 12px; bottom: 8px; width: auto; max-width: min(520px, calc(100vw - 24px)); margin: 0; padding: 6px 12px;
  border-radius: 12px; background: color-mix(in srgb, var(--paper) 88%, transparent); font-size: .7rem; line-height: 1.35;
}
.map-footer p { margin: 0; }

@media (max-width: 700px) {
  .floatbar { flex-wrap: wrap; gap: 8px; }
  .floatbar .brand span { display: none; } /* so o icone, para a busca caber */
  .floatbar .brand { padding: 8px; }
  .searchbar { order: 3; flex: 1 0 100%; max-width: none; }
  .floatbar .langs { margin-left: auto; }
  .panel { top: auto; bottom: 64px; left: 12px; right: 12px; width: auto; max-height: 52dvh; }
  .map-hint { bottom: auto; top: 104px; }
  .map-footer { bottom: 6px; }
}
@media (prefers-reduced-motion: reduce) { .map-hint { animation: none; } }
