:root {
  --night: #101B30;
  --night-2: #1A2742;
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --accent: #FF7A1A;
  --accent-ink: #C2410C;
  --accent-deep: #9A3412;
  --accent-soft: #FFEDD5;
  --muted: #5B6577;
  --on-night: #C9D1E0;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;
  --wa: #25D366;
  --wa-ink: #08341B;
  --mp: #009EE3;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: 20px;
  --max: 1200px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--night); font-family: var(--font); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
a { color: var(--accent-ink); }
a:hover { color: var(--accent-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 900px) { :root { --gutter: 24px; } }

/* Encabezado */
.top { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top .wrap { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--night); }
.brand:hover { color: var(--night); }
.mark { width: 38px; height: 38px; border-radius: 11px; background: var(--night); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 16px; letter-spacing: -.5px; flex: none; }
.mark span, .accent { color: var(--accent); }
.brand-name { font-weight: 800; font-size: 16px; line-height: 1; letter-spacing: -.3px; }
.brand-name b { color: var(--accent-ink); font-weight: 800; }
.brand-sub { font-size: 10px; font-weight: 700; letter-spacing: 1.6px; color: var(--muted); line-height: 1; margin-top: 4px; }
.nav { display: none; align-items: center; gap: 4px; }
.nav a { padding: 10px 14px; border-radius: 10px; color: var(--night); font-weight: 600; font-size: 14px; text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--bg); }
.nav a.cta { background: var(--accent); font-weight: 800; margin-left: 4px; }
.menu-btn { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: #fff; display: grid; place-items: center; cursor: pointer; }
.drawer { display: none; border-top: 1px solid var(--line); background: #fff; }
.drawer.open { display: block; }
.drawer a { display: block; padding: 14px var(--gutter); font-weight: 700; color: var(--night); text-decoration: none; border-bottom: 1px solid var(--line); }
@media (min-width: 900px) { .nav { display: flex; } .menu-btn, .drawer, .drawer.open { display: none; } .top .wrap { min-height: 72px; } }

/* Tipografía */
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--accent-ink); }
.on-night .eyebrow { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 800; }
.h1 { font-size: clamp(42px, 7vw, 64px); line-height: 1.02; letter-spacing: -.03em; }
.h2 { font-size: clamp(26px, 3.6vw, 36px); line-height: 1.12; letter-spacing: -.02em; }
.lead { font-size: 16px; color: var(--muted); margin: 0; }
.on-night .lead { color: var(--on-night); }
.num { font-family: var(--mono); font-weight: 600; }
@media (min-width: 900px) { .eyebrow { font-size: 12px; } .lead { font-size: 18px; } }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: 14px; border: 0; font-weight: 800; font-size: 16px; text-decoration: none; cursor: pointer; transition: transform .12s ease, background .15s ease; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--night); }
.btn-primary:hover { background: #F26B0B; color: var(--night); }
.btn-dark { background: var(--night); color: #fff; }
.btn-dark:hover { background: var(--night-2); color: #fff; }
.btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); font-weight: 700; font-size: 15px; }
.btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn-light { background: #fff; color: var(--night); border: 1px solid var(--line-strong); font-weight: 700; font-size: 15px; min-height: 50px; }
.btn-light:hover { color: var(--night); background: var(--bg); }
.btn-wa { background: var(--wa); color: var(--wa-ink); }
.btn-wa:hover { color: var(--wa-ink); filter: brightness(.96); }
.btn-mp { background: var(--mp); color: #fff; font-size: 19px; min-height: 56px; }
.btn-mp:hover { color: #fff; filter: brightness(.95); }
.btn-block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; display: grid; place-items: center; background: #fff; color: var(--night); flex: none; }

/* Portada */
.hero { position: relative; background: var(--night); color: #fff; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background: repeating-linear-gradient(135deg, #16233D 0 18px, #13203A 18px 36px); }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; opacity: .45; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(16,27,48,.95), rgba(16,27,48,.6) 60%, rgba(16,27,48,.35)); }
.hero .wrap { position: relative; padding-top: 28px; padding-bottom: 36px; display: flex; flex-direction: column; gap: 18px; }
.pill { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18); font-size: 13px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); flex: none; }
.hero h1 { margin-top: 72px; }
.hero-actions { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 640px) { .hero-actions { flex-direction: row; } }
@media (min-width: 900px) { .hero .wrap { padding-top: 72px; padding-bottom: 80px; max-width: var(--max); } .hero h1 { margin-top: 24px; max-width: 680px; } .hero .lead { max-width: 520px; } }

/* Secciones */
.section { padding: 32px 0 8px; }
.section-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
@media (min-width: 900px) { .section { padding: 64px 0 16px; } .section-head { margin-bottom: 24px; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.steps { display: grid; gap: 10px; }
@media (min-width: 900px) { .steps { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; } }
.step { padding: 16px; display: flex; gap: 14px; align-items: flex-start; }
.step-n { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--night); color: #fff; font-family: var(--mono); font-weight: 600; display: grid; place-items: center; }
.step:last-child .step-n { background: var(--accent); color: var(--night); }
.step b { display: block; font-size: 16px; font-weight: 800; }
.step span { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; line-height: 1.5; }

.events { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.event { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: var(--night); transition: transform .15s ease, box-shadow .15s ease; }
.event:hover { color: var(--night); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(16,27,48,.08); }
.event-img { position: relative; aspect-ratio: 16 / 10; background: repeating-linear-gradient(135deg, #2A3A5C 0 16px, #273657 16px 32px); }
.event-img img { width: 100%; height: 100%; object-fit: cover; }
.datebadge { position: absolute; left: 14px; bottom: 14px; width: 58px; height: 58px; border-radius: 14px; background: var(--accent); color: var(--night); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.datebadge b { font-size: 22px; font-weight: 800; }
.datebadge small { font-size: 10px; font-weight: 800; letter-spacing: 1px; margin-top: 3px; }
.event-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.meta { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.event-title { font-size: 19px; font-weight: 800; letter-spacing: -.3px; line-height: 1.2; }
.tag { display: inline-flex; align-self: flex-start; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); font-size: 12px; font-weight: 700; }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: #EA580C; }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 15px; border-style: dashed; }

.prices { background: var(--night); color: #fff; border-radius: 20px; padding: 22px 20px; display: flex; flex-direction: column; gap: 16px; }
.price-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.price { border-radius: 14px; padding: 14px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); }
.price small { display: block; font-size: 12px; font-weight: 600; color: var(--on-night); }
.price .num { display: block; font-size: 22px; margin-top: 6px; }
.price.hot { background: var(--accent); color: var(--night); border-color: var(--accent); }
.price.hot small { color: var(--night); font-weight: 700; }

.promo { display: flex; gap: 14px; align-items: center; padding: 20px; text-decoration: none; color: var(--night); }
.promo:hover { color: var(--night); background: #FBFCFD; }
.promo-ico { flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--bg); display: grid; place-items: center; }
.cta-card { background: var(--accent); color: var(--night); border-radius: 20px; padding: 22px 20px; display: flex; flex-direction: column; gap: 10px; }

.two { display: grid; gap: 16px; }
@media (min-width: 900px) { .two { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; align-items: stretch; } }

/* Página de carrera */
.event-hero { position: relative; min-height: 220px; background: repeating-linear-gradient(135deg, #2A3A5C 0 16px, #273657 16px 32px); color: #fff; display: flex; align-items: flex-end; }
.event-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.event-hero .bar { position: relative; width: 100%; background: linear-gradient(0deg, rgba(16,27,48,1) 30%, rgba(16,27,48,0)); padding: 48px 0 20px; }
.event-hero .meta { color: var(--accent); }
.search-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.search-card label { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.bib-input { height: 64px; border: 2px solid var(--night); border-radius: 14px; padding: 0 18px; font-family: var(--mono); font-size: 28px; font-weight: 600; letter-spacing: 3px; background: #fff; width: 100%; }
.bib-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255,122,26,.2); }
.narrow { max-width: 560px; }

/* Resultados */
.results-head { background: #fff; border-bottom: 1px solid var(--line); }
.results-head .wrap { min-height: 64px; display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.packbar { background: var(--night); color: #fff; border-radius: 16px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.packbar p { flex: 1; margin: 0; font-size: 14px; line-height: 1.45; color: var(--on-night); }
.packbar strong { color: #fff; }
.packbar .btn { min-height: 44px; padding: 0 14px; font-size: 14px; flex: none; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; } }
.thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; padding: 0; cursor: pointer; background: #2A3A5C; border: 3px solid transparent; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb[aria-pressed="true"] { border-color: var(--accent); }
.thumb .check { position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; border-radius: 999px; border: 2px solid rgba(255,255,255,.85); background: rgba(16,27,48,.3); display: grid; place-items: center; }
.thumb[aria-pressed="true"] .check { background: var(--accent); border-color: var(--accent); }
.thumb .code { position: absolute; left: 8px; bottom: 8px; font-family: var(--mono); font-size: 10px; color: rgba(255,255,255,.85); text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.zoom { position: absolute; left: 8px; top: 8px; width: 32px; height: 32px; border-radius: 999px; background: rgba(16,27,48,.55); display: grid; place-items: center; border: 0; color: #fff; cursor: zoom-in; }
.buybar { position: sticky; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(16,27,48,.08); padding: 14px 0 calc(16px + env(safe-area-inset-bottom)); }
.buybar .wrap { display: flex; flex-direction: column; gap: 10px; }
.buybar-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.buybar-row .num { font-size: 22px; }
.hint { font-size: 12px; font-weight: 700; color: var(--accent-deep); }
@media (min-width: 900px) { .buybar .wrap { flex-direction: row; align-items: center; } .buybar-row { flex: 1; } .buybar .btn-mp { width: 340px; } }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; }
.input { height: 50px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 0 14px; font-size: 16px; font-weight: 500; background: #fff; width: 100%; min-width: 0; }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; min-height: 110px; }
.input:focus { outline: none; border-color: var(--night); box-shadow: 0 0 0 3px rgba(16,27,48,.12); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--night); color: #fff; border-color: var(--night); }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 600; }
.ok { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 600; }

/* Modal y visor */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(16,27,48,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; background: #fff; border-radius: 24px 24px 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; max-height: 92vh; overflow: auto; }
.sheet .grab { align-self: center; width: 44px; height: 5px; border-radius: 999px; background: var(--line-strong); }
@media (min-width: 640px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 24px; padding-bottom: 24px; } }
.viewer { position: fixed; inset: 0; z-index: 70; background: rgba(10,16,30,.96); display: flex; align-items: center; justify-content: center; padding: 56px 12px 24px; }
.viewer img { max-height: 100%; max-width: 100%; object-fit: contain; border-radius: 8px; }
.viewer .icon-btn { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }

/* Pie */
.foot { margin-top: 48px; background: var(--night); color: var(--on-night); font-size: 14px; }
.foot .wrap { padding-top: 28px; padding-bottom: 28px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.foot a { color: #fff; }
.foot b { color: #fff; }

.wa-fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40; width: 56px; height: 56px; border-radius: 999px; background: var(--wa); display: grid; place-items: center; box-shadow: 0 8px 24px rgba(37,211,102,.35); }
.has-buybar .wa-fab { display: none; }

.spinner { width: 22px; height: 22px; border: 3px solid rgba(16,27,48,.15); border-top-color: var(--night); border-radius: 999px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px 0; color: var(--muted); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
