/* =====================================================================
   Olana · base compartida (tokens + componentes)
   Concepto "Señal": sereno, preciso, en vivo. Fondo durazno suave en todo el sitio.
   Reglas y ejemplos: design-system/README.md
   ===================================================================== */

@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/fonts/sora-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  /* Superficies */
  --bg: #FFF8F3;            /* durazno suave: fondo de todas las páginas */
  --surface: #FFFFFF;       /* tarjetas, hojas, diálogos */
  --surface-2: #FBEDE3;     /* chips, esqueletos, fondos secundarios */
  --line: #F0DED1;
  /* Texto (contraste sobre --bg) */
  --ink: #1B1410;           /* 17:1 */
  --ink-2: #4A3B32;         /* 10:1 */
  --muted: #6E5C51;         /* 6:1, mínimo para texto pequeño */
  /* Naranja: un solo naranja visible */
  --brand: #EC7521;         /* logo y elementos decorativos */
  --primary: #EB6F18;       /* botón principal: texto blanco 19px negrita (3,08:1, AA texto grande) */
  --primary-press: #D9600F;
  --orange-lg: #E0620F;     /* texto naranja SOLO grande (>= 24px): 3,4:1 sobre --bg */
  --tint: #FFE9DA;          /* seleccionado / avisos */
  --tint-2: #FFF1E6;
  /* Escala de parecido (umbrales del .env) */
  --match-high: #EC7521;    /* >= PET_SUCCESS_THRESHOLD */
  --match-mid: #F5A469;     /* >= DISPLAY_THRESHOLD */
  --match-low: #D3C5BB;     /* < DISPLAY_THRESHOLD */
  /* Estados */
  --live: #22C55E;          /* punto "en vivo" */
  --off: #B9AEA6;           /* búsqueda en pausa / detenida */
  --wa: #25D366;            /* solo botones que abren WhatsApp */
  --wa-ink: #0B3D21;        /* texto sobre --wa (6,2:1) */
  --danger: #B42318;
  /* Forma */
  --r-xl: 28px; --r-lg: 22px; --r: 16px; --r-sm: 12px;
  --shadow: 0 1px 2px rgba(74,40,16,.05), 0 12px 30px -12px rgba(122,62,20,.22);
  --shadow-lg: 0 24px 60px -20px rgba(74,40,16,.35);
  /* Tipografía */
  --display: 'Sora', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* Movimiento */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  /* Márgenes laterales que respetan el notch */
  --gut: max(16px, env(safe-area-inset-left, 0px));
  --gutr: max(16px, env(safe-area-inset-right, 0px));
  --vvh: 100dvh;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.ol-locked { overflow: hidden; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 17px/1.6 var(--body); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; text-wrap: balance; margin: 0; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 8px; }
.wrap { max-width: 1160px; margin: 0 auto; padding-left: var(--gut); padding-right: var(--gutr); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }
.i { width: 1.25em; height: 1.25em; flex: none; stroke-width: 1.9; vertical-align: -.22em; }
.eyebrow { font: 600 .8rem/1.2 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }

/* ---------- Botones: un solo sistema ----------
   Principal: naranja, texto blanco 19px negrita (nunca más pequeño).
   Secundario: blanco con borde tinta. Fantasma: borde suave. WhatsApp: solo para abrir WhatsApp. */
.btn {
  --h: 56px;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: var(--h); padding: 0 1.4em; border-radius: 999px; border: 1.5px solid transparent;
  font: 600 1.06rem/1.15 var(--display); letter-spacing: -.01em; text-align: center; text-decoration: none;
  transition: transform .18s var(--ease), background-color .18s, border-color .18s, box-shadow .18s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; font-size: 1.1875rem; font-weight: 700; box-shadow: 0 8px 20px -10px rgba(235,111,24,.9); }
.btn-primary:hover { background: var(--primary-press); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-2); background: var(--surface); }
.btn-wa { background: var(--wa); color: var(--wa-ink); font-weight: 700; }
.btn-wa:hover { background: #1FC15A; }
.btn-sm { --h: 46px; font-size: .98rem; padding: 0 1.05em; }
.btn-block { width: 100%; }
.btn-icon { --h: 48px; width: var(--h); padding: 0; }
.icon-btn { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; transition: background-color .15s; }
.icon-btn:hover { background: var(--tint); }

/* ---------- Logo en código ---------- */
.ol-logo, .ol-pinmark { display: block; overflow: visible; }
.ol-ring, .ol-ping { fill: none; stroke: currentColor; stroke-width: 11.8; }
.ol-tail, .ol-ch { fill: currentColor; }
.ol-pin, .ol-ping, .ol-ch { transform-box: fill-box; transform-origin: 50% 50%; }
.logo-anim .ol-pin { animation: olPinDrop .9s var(--spring) both; transform-origin: 50% 100%; }
.logo-anim .ol-ch { animation: olChUp .6s var(--ease) both; animation-delay: calc(.35s + var(--i) * 60ms); }
.logo-anim .ol-ping { stroke-width: 3; opacity: 0; animation: olPing 9s var(--ease) 1.2s infinite; }
.logo-anim .ol-ping + .ol-ping { animation-delay: 1.55s; }
.paused, .paused * { animation-play-state: paused !important; }
@keyframes olPinDrop { 0% { transform: translateY(-40%) scale(.9); opacity: 0 } 60% { opacity: 1 } 100% { transform: none } }
@keyframes olChUp { from { transform: translateY(18%); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes olPing { 0% { transform: scale(1); opacity: 0 } 1% { opacity: .55 } 20% { transform: scale(2.1); opacity: 0 } 100% { transform: scale(2.1); opacity: 0 } }

/* ---------- Header ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 61; background: var(--bg); }
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; background: rgba(255,248,243,.88); -webkit-backdrop-filter: saturate(1.5) blur(14px); backdrop-filter: saturate(1.5) blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-header.scrolled { border-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.brand { display: block; width: 106px; color: var(--brand); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-ctas { display: none; gap: 8px; }
@media (min-width: 900px) { html.dock-on .header-ctas { display: flex; } .header-ctas .btn { --h: 46px; padding: 0 1.1em; } .header-ctas .btn-primary { font-size: 1.1875rem; } }
@media (max-width: 380px) { .header-actions .btn-sm { padding: 0 .85em; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 36px calc(36px + env(safe-area-inset-bottom, 0px)); margin-top: 24px; }
.site-footer .wrap { display: grid; gap: 20px; justify-items: start; }
@media (min-width: 760px) { .site-footer .wrap { grid-template-columns: auto 1fr auto; align-items: center; } }
.site-footer .brand { width: 112px; }
.social { display: flex; gap: 8px; flex-wrap: wrap; }
.social a { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-weight: 600; font-size: .95rem; }
.social a:hover { border-color: var(--ink-2); }
.site-footer small { color: var(--muted); font-size: .9rem; }

/* ---------- Campos ---------- */
.field { display: grid; gap: 8px; }
.field > label, .field > .label { font-weight: 600; }
.input, .select select, .textarea {
  width: 100%; min-height: 58px; padding: 14px 16px; border-radius: 16px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 1.06rem; line-height: 1.4; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 140px; resize: vertical; }
.input:focus, .select select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(235,111,24,.18); }
.input::placeholder, .textarea::placeholder { color: #9A8A80; }
.select { position: relative; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 48px; cursor: pointer; }
.select .i { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); }
.hint { font-size: .95rem; color: var(--muted); }
.field-error { display: flex; gap: 8px; align-items: flex-start; color: var(--danger); font-weight: 600; font-size: .98rem; }
.field-error .i { margin-top: .15em; }
.invalid .input, .invalid .select select, .invalid .textarea, .invalid .dropzone { border-color: var(--danger); }

/* ---------- Chips y control segmentado ---------- */
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: .96rem; color: var(--ink-2); transition: border-color .15s, box-shadow .15s, color .15s; }
.chip:hover { border-color: var(--ink-2); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.seg { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 4px; border-radius: 999px; background: var(--surface-2); }
.seg button { min-height: 48px; padding: 0 10px; min-width: 0; border: 0; border-radius: 999px; background: transparent; font: 600 1rem var(--display); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background-color .2s, color .2s, box-shadow .2s; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 12px rgba(122,62,20,.12); }
.seg .count { font: 600 .82rem var(--body); color: var(--muted); background: var(--bg); border-radius: 999px; padding: 2px 8px; font-variant-numeric: tabular-nums; }

/* ---------- Etiquetas sobre fotos ---------- */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: rgba(255,255,255,.95); color: var(--ink); font: 600 .8rem/1 var(--display); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.tag .i { width: 15px; height: 15px; color: var(--brand); stroke-width: 2.2; }
.tag-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; }
.tag-dot.ink { background: var(--ink); }

/* ---------- Punto "en vivo" ---------- */
.dot { position: relative; width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--live); }
.dot.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: olDot 2s var(--ease) infinite; }
.dot.off { background: var(--off); }
@keyframes olDot { from { transform: scale(1); opacity: .6 } to { transform: scale(3); opacity: 0 } }

/* ---------- Diálogos: hoja inferior en móvil, centrados en escritorio ---------- */
dialog.sheet {
  border: 0; padding: 0; background: var(--bg); color: var(--ink);
  width: 100%; max-width: 100%; max-height: min(94dvh, calc(var(--vvh) - 8px)); margin: auto 0 0;
  border-radius: 26px 26px 0 0; overflow: hidden; box-shadow: var(--shadow-lg);
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: olSheetIn .4s var(--ease); }
dialog.sheet.closing { animation: olSheetOut .2s ease-in forwards; }
dialog.sheet::backdrop { background: rgba(27,20,16,.5); }
@keyframes olSheetIn { from { transform: translateY(48px); opacity: 0 } }
@keyframes olSheetOut { to { transform: translateY(32px); opacity: 0 } }
@media (min-width: 700px) { dialog.sheet { margin: auto; max-width: 580px; border-radius: 26px; max-height: min(90dvh, calc(var(--vvh) - 32px)); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 6px; flex: none; }
.sheet-head h2 { font-size: 1.3rem; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 20px 22px; -webkit-overflow-scrolling: touch; }
.sheet-foot { flex: none; display: flex; gap: 10px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--bg); }
.sheet-foot .btn { flex: 1; min-width: 0; padding: 0 .8em; }
.sheet-form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin: 0; }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 0; flex: none; }
@media (min-width: 700px) { .grabber { display: none; } }

/* ---------- Dock inferior: los CTA del hero, cuando ya no se ven ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px var(--gutr) calc(12px + env(safe-area-inset-bottom, 0px)) var(--gut); background: rgba(255,248,243,.95); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); transform: translateY(110%); transition: transform .35s var(--ease); }
.dock.show { transform: none; }
.dock .btn { --h: 54px; padding: 0 .5em; line-height: 1.1; }
.dock .btn-secondary { font-size: 1rem; }
html.dock-on body { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 900px) { .dock { display: none; } html.dock-on body { padding-bottom: 0; } }

/* ---------- Avisos (toasts) ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 16px; background: var(--ink); color: #fff; font-weight: 600; font-size: .98rem; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px); transition: opacity .3s var(--ease), transform .3s var(--ease); }
.toast.in { opacity: 1; transform: none; }
.toast .i { color: #8BE3AE; }
.toast.error .i { color: #FFB4A8; }

/* ---------- Estados ---------- */
.state-ic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--ink); margin: 0 auto; }
.state-ic .i { width: 30px; height: 30px; }
.skel { background: linear-gradient(90deg, var(--surface-2) 0, #FFF4EC 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: olShimmer 1.2s linear infinite; border-radius: var(--r); }
@keyframes olShimmer { to { background-position: -200% 0 } }
.empty { text-align: center; padding: 32px 18px; border: 1.5px dashed var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink-2); display: grid; gap: 10px; justify-items: center; }
.social-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Comparar fotos (resultados y vista rápida del inicio) ----------
   Todo cabe en la hoja sin desplazarse. Las fotos parten en 3:4 y, si falta alto, solo ellas se achican */
.sheet-body.cmp { display: flex; flex-direction: column; }
.sheet-body.cmp > * { flex: none; }
.sheet-body.cmp > .compare { flex: 0 1 calc((min(100vw, 580px) - 50px) * 2 / 3 + 34px); min-height: 150px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr); gap: 10px; }
.compare figure { margin: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 8px; min-height: 0; }
.compare .c { min-height: 0; border-radius: 16px; overflow: hidden; background: var(--surface-2); position: relative; }
.compare .c .bg { position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px); object-fit: cover; filter: blur(18px); opacity: .55; }
.compare .c .fg { position: relative; width: 100%; height: 100%; object-fit: contain; }
.compare figcaption { font-weight: 600; font-size: .92rem; text-align: center; }
.compare-score { text-align: center; margin-top: 12px; display: grid; gap: 4px; }
.compare-score b { font: 700 1.3rem var(--display); }
.compare-score span { color: var(--ink-2); }
.cmp-cta { margin-top: 14px; }

/* ---------- Yape ---------- */
.yape { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.yape img { width: 46px; height: 46px; border-radius: 12px; }
.yape .num { font: 700 clamp(1.6rem, 6vw, 2.1rem)/1 var(--display); letter-spacing: .01em; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .logo-anim .ol-ping, .dot.pulse::after { display: none; }
}
