:root {
  --ink: #14161b;
  --ink-2: #3b3f48;
  --ink-3: #5a5f69;
  --paper: #f6f3ec;
  --paper-2: #ede8dd;
  --card: #ffffff;
  --line: #dcd6c8;
  --accent: #e8a530;
  --accent-ink: #5a3b00;
  --ok: #1f7a4d;
  --warn: #9a4b00;
  --radius: 18px;
  --shadow: 0 1px 0 rgba(20, 22, 27, .04), 0 10px 30px -12px rgba(20, 22, 27, .18);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
body {
  margin: 0;
  font: 400 16px/1.5 var(--font);
  color: var(--ink);
  background: var(--paper);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: inherit; text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 10px; z-index: 100; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- top ---------- */
.top { padding: max(14px, env(safe-area-inset-top)) 0 14px; }
.top__in { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font: 600 19px/1 var(--display); letter-spacing: -.02em; }
.logo svg { width: 28px; height: 28px; color: var(--ink); }
.logo b { font-weight: 800; }
.badge { font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--ink); color: var(--paper); white-space: nowrap; }

/* ---------- hero ---------- */
.hero { padding: 28px 0 40px; }
.hero__in { max-width: 680px; }
.eyebrow { margin: 0 0 10px; font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
h1 { margin: 0; font: 800 clamp(40px, 9vw, 76px)/.98 var(--display); letter-spacing: -.035em; text-wrap: balance; }
.hl { background: linear-gradient(transparent 62%, var(--accent) 62%, var(--accent) 92%, transparent 92%); padding: 0 .06em; }
.lead { margin: 16px 0 26px; font-size: clamp(17px, 2.4vw, 20px); color: var(--ink-2); max-width: 34ch; text-wrap: pretty; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(20, 22, 27, .06); }

/* ---------- form ---------- */
.form { padding: 22px; display: grid; gap: 18px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field label { font-weight: 700; font-size: 15px; }
.hint { margin: 0; font-size: 13.5px; color: var(--ink-3); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row .field--ape { flex: 1 1 220px; }
.row .field--num { flex: 0 0 110px; }

input[type="text"] {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  font-size: 17px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
input[type="text"]::placeholder { color: #a7a9ae; }
input[type="text"]:hover { border-color: #c6bfae; }
input[type="text"]:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(232, 165, 48, .35); }
input.invalid { border-color: #c2410c; box-shadow: 0 0 0 4px rgba(194, 65, 12, .12); }

#ape { width: 76px; text-align: center; font: 800 26px/1 var(--display); text-transform: uppercase; padding: 0; }

.combo { position: relative; }
.combo input { padding-left: 46px; padding-right: 46px; }
.combo__icon { position: absolute; left: 15px; top: 50%; translate: 0 -50%; width: 22px; height: 22px; color: var(--ink-3); pointer-events: none; }
.combo__clear { position: absolute; right: 8px; top: 50%; translate: 0 -50%; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 24px; line-height: 1; color: var(--ink-3); cursor: pointer; }
.combo__clear:hover { background: var(--paper); color: var(--ink); }

.sugs {
  position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none;
  background: #fff; border-radius: 14px; box-shadow: 0 18px 40px -12px rgba(20, 22, 27, .35); border: 1px solid var(--line);
  max-height: min(340px, 50dvh); overflow-y: auto; overscroll-behavior: contain;
}
.sugs li { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border-radius: 10px; cursor: pointer; }
.sugs li[aria-selected="true"], .sugs li:hover { background: var(--paper); }
.sugs li svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 2px; color: var(--ink-3); }
.sugs .s-main { display: block; font-weight: 600; }
.sugs .s-sub { display: block; font-size: 13.5px; color: var(--ink-3); }
.sugs .s-empty { cursor: default; color: var(--ink-3); font-size: 14.5px; }
.sugs .s-empty:hover { background: transparent; }

.form__error { margin: -4px 0 0; padding: 10px 14px; border-radius: 12px; background: #fff3ea; color: #8a2c00; font-size: 14.5px; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1.5px solid transparent;
  font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, background .15s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; flex: 0 0 auto; }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: #2a2d35; }
.btn--accent { background: var(--accent); color: #1d1300; }
.btn--accent:hover { background: #f0b346; }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--lg { min-height: 60px; font-size: 18px; border-radius: 16px; width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn--link { background: none; border: 0; padding: 0; min-height: 0; color: var(--ink-2); text-decoration: underline; font-weight: 600; }

.privacy { margin: -6px 0 0; font-size: 13px; color: var(--ink-3); text-align: center; }
.official { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--paper); font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.official a { font-weight: 600; }

/* aviso legal */
.legal { padding: 20px 0 56px; max-width: 760px; }
.legal h1 { font-size: clamp(32px, 6vw, 48px); margin-bottom: 20px; }
.legal h2 { font: 800 22px/1.2 var(--display); margin: 30px 0 8px; }
.legal p, .legal li { color: var(--ink-2); }
.legal ul { padding-left: 20px; }

.facts { list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.facts li { padding: 12px 14px; border-radius: 14px; background: var(--paper-2); display: grid; gap: 2px; }
.facts b { font-size: 15px; }
.facts span { font-size: 13px; color: var(--ink-3); }

/* ---------- result ---------- */
.result { padding-bottom: 56px; scroll-margin-top: 16px; }
.loading { display: flex; align-items: center; gap: 18px; padding: 24px; max-width: 680px; }
.loading__title { margin: 0; font-weight: 800; font-size: 18px; }
.loading__step { margin: 2px 0 0; color: var(--ink-3); font-size: 15px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3.5px solid var(--paper-2); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { rotate: 360deg; } }

.found { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 0; overflow: hidden; animation: rise .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.found__info { padding: 28px; display: grid; gap: 18px; align-content: start; }
.found__eyebrow { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ok); }
.found__eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(31, 122, 77, .15); }
.found h2 { margin: 0; font: 800 clamp(26px, 4vw, 36px)/1.08 var(--display); letter-spacing: -.025em; text-wrap: balance; }
.found__addr { margin: -8px 0 0; font-size: 17px; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.stats div { background: var(--paper); border-radius: 12px; padding: 10px 12px; }
.stats dt { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.stats dd { margin: 2px 0 0; font: 800 22px/1.1 var(--display); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions .btn--accent { grid-column: 1 / -1; min-height: 56px; font-size: 17px; }
.note { margin: 0; font-size: 13.5px; color: var(--ink-3); }
.note a { font-weight: 600; color: var(--ink-2); }
.again { justify-self: start; }

.map { min-height: 420px; background: var(--paper-2); position: relative; }
.map .leaflet-container { position: absolute; inset: 0; font: inherit; background: var(--paper-2); }

.pin { position: relative; width: 44px; height: 44px; }
.pin__dot { position: absolute; left: 50%; bottom: 4px; width: 38px; height: 46px; translate: -50% 0; }
.pin__pulse { position: absolute; left: 50%; bottom: 0; width: 18px; height: 8px; translate: -50% 50%; border-radius: 50%; background: rgba(20, 22, 27, .35); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(232, 165, 48, .55); } 100% { box-shadow: 0 0 0 22px rgba(232, 165, 48, 0); } }
.home-dot { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--ink-3); box-shadow: 0 1px 4px rgba(0,0,0,.25); }

/* elegir tramo / respaldo */
.panel { padding: 26px; max-width: 760px; display: grid; gap: 16px; animation: rise .4s cubic-bezier(.2, .8, .2, 1); }
.panel h2 { margin: 0; font: 800 26px/1.15 var(--display); letter-spacing: -.02em; }
.panel p { margin: 0; color: var(--ink-2); }
.tramos { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tramos button { width: 100%; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.tramos button:hover { border-color: var(--ink); }
.tramos small { color: var(--ink-3); display: block; font-size: 13.5px; }
.tramos .tag { font-size: 13px; font-weight: 700; background: var(--paper); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.panel--warn { border-left: 6px solid var(--accent); }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; color: var(--ink-2); }
.ine-datos { margin: 0; display: grid; gap: 6px; }
.ine-datos div { display: grid; gap: 2px; padding: 10px 10px 10px 14px; border-radius: 12px; background: var(--paper); }
.ine-datos dt { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.ine-datos dd { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.ine-datos dd span { font: 800 18px/1.25 var(--display); overflow-wrap: break-word; min-width: 0; }
.copy { flex: 0 0 auto; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 12px; font-size: 14px; font-weight: 700; cursor: pointer; min-height: 36px; }
.copy:hover { border-color: var(--ink); }
.manual { display: grid; gap: 10px; }
.manual__row { display: flex; gap: 10px; }
.manual__row input { flex: 1; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding: 26px 0 max(26px, env(safe-area-inset-bottom)); font-size: 14px; color: var(--ink-3); }
.foot__in { display: grid; gap: 10px; }
.foot p { margin: 0; max-width: 80ch; }
.credit { color: var(--ink-2); font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .found { grid-template-columns: 1fr; }
  .map { min-height: 300px; order: -1; }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 28px); }
  .hero { padding: 14px 0 30px; }
  .badge { font-size: 12px; padding: 5px 10px; }
  .form { padding: 18px; gap: 16px; }
  .facts { grid-template-columns: 1fr; }
  .facts li { grid-template-columns: auto 1fr; align-items: baseline; gap: 8px; }
  .found__info { padding: 22px 18px; }
  .panel { padding: 20px 18px; }
  .actions { grid-template-columns: 1fr; }
  .manual__row { flex-direction: column; }
}
@media (max-width: 370px) {
  .badge { display: none; }
}
