﻿/* Tokens y componentes comunes (tienda + panel) */
:root {
  --bg: #ffffff; --bg2: #f3f7fc; --surface: #f6f9fd; --surface2: #e8eff8; --line: color-mix(in srgb, var(--text) 13%, transparent);
  --text: #0b1a33; --muted: #5a6a85; --accent: #00438f; --accent2: color-mix(in srgb, var(--accent) 72%, #3b9bff); --on-accent: #ffffff; --ok: #1b8f48; --warn: #b7790a; --bad: #d03a2a;
  --r: 14px; --ease: cubic-bezier(.22, 1, .36, 1); --display: 'Bricolage Grotesque', system-ui, sans-serif; --serif: 'Fraunces', Georgia, serif; --body: 'Inter', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--body); overflow-x: hidden; -webkit-font-smoothing: antialiased; }
body.lock { overflow: hidden; }
[hidden] { display: none !important; }
.logo { display: inline-flex; align-items: center; gap: 10px; font: 800 1.15rem var(--display); }
.logo span { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); display: grid; place-items: center; font-size: 1rem; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.05; margin: 0 0 .5em; letter-spacing: -.02em; font-weight: 800; }
em { font-family: var(--serif); font-style: italic; font-weight: 500; color: var(--accent); letter-spacing: 0; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.wrap { width: min(1240px, 100% - 40px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 40px); margin: 0 auto; padding: 56px 0 90px; }
.kicker { font: 600 .78rem/1 var(--body); letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 1000; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: 8px; transition: top .2s; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Botones */
.btn { --b: var(--line); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 24px; border-radius: 999px; border: 1px solid var(--b); background: transparent; font: 600 .95rem/1 var(--body); transition: transform .35s var(--ease), background .2s, border-color .2s, box-shadow .3s; white-space: nowrap; }
.btn.pri { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); border-color: transparent; box-shadow: 0 8px 28px -10px var(--accent); }
.btn.pri:hover { box-shadow: 0 12px 36px -8px var(--accent); }
.btn.ghost:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.btn:active { transform: scale(.97) !important; }
.btn.sm { padding: 10px 16px; font-size: .85rem; } .btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.linkbtn { background: none; border: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; padding: 0; }
.link { color: var(--accent); font-weight: 600; } .link:hover { text-decoration: underline; }
[data-magnetic] { transition: transform .25s var(--ease); will-change: transform; }

/* Formularios */
.form { display: grid; gap: 14px; } .form.inline { grid-template-columns: 1fr 1fr auto; align-items: end; margin: 24px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fld { display: grid; gap: 6px; } .fld > span { font-size: .82rem; color: var(--muted); font-weight: 500; }
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); }
.err { color: var(--bad); font-size: .8rem; font-style: normal; font-family: var(--body); min-height: 0; }
.err-box { background: rgba(224, 97, 78, .12); border: 1px solid rgba(224, 97, 78, .4); padding: 12px 16px; border-radius: 12px; color: var(--bad); }
.chk { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; color: var(--muted); } .chk input { width: auto; margin-top: 4px; accent-color: var(--accent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input[type=range] { padding: 0; accent-color: var(--accent); background: none; border: 0; }

/* Cursor luminoso */
.cursor-glow { position: fixed; left: 0; top: 0; width: 460px; height: 460px; pointer-events: none; z-index: 9990; opacity: 0; border-radius: 50%; mix-blend-mode: multiply;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent) 0%, color-mix(in srgb, var(--accent) 8%, transparent) 35%, transparent 65%); transition: opacity .4s, width .3s var(--ease), height .3s var(--ease); }
.cursor-dot { position: fixed; left: 0; top: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); pointer-events: none; z-index: 9991; opacity: 0; box-shadow: 0 0 14px 2px var(--accent); transition: width .25s var(--ease), height .25s var(--ease), opacity .3s; }
body.cursor-hot .cursor-dot { width: 34px; height: 34px; background: color-mix(in srgb, var(--accent) 18%, transparent); box-shadow: 0 0 0 1px var(--accent), 0 0 24px 4px color-mix(in srgb, var(--accent) 50%, transparent); }
body.cursor-hot .cursor-glow { width: 560px; height: 560px; }

/* Revelado */
[data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease) var(--d, 0ms), transform .8s var(--ease) var(--d, 0ms); }
[data-reveal].in { opacity: 1; transform: none; }

/* Toasts */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 9995; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: var(--surface2); border: 1px solid var(--line); padding: 11px 18px; border-radius: 999px; font-size: .9rem; box-shadow: 0 14px 40px rgba(10, 30, 70, 0.2); opacity: 0; transform: translateY(14px) scale(.96); transition: .3s var(--ease); max-width: 90vw; }
.toast.show { opacity: 1; transform: none; } .toast.ok { border-color: rgba(111, 191, 115, .5); } .toast.warn { border-color: rgba(230, 177, 60, .6); }

/* Chatbot */
.chat { position: fixed; right: 22px; bottom: 22px; z-index: 9000; }
.chat-fab { position: relative; width: 62px; height: 62px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); display: grid; place-items: center; box-shadow: 0 14px 34px -8px var(--accent); transition: transform .3s var(--ease); }
.chat-fab:hover { transform: scale(1.07); }
.chat-ping { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; pointer-events: none; }
.chat.nudge .chat-ping { animation: ping 1.8s ease-out 3; }
@keyframes ping { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.7); } }
.chat.open .chat-fab { display: none; }
.chat-panel { position: absolute; right: 0; bottom: 0; width: min(380px, calc(100vw - 28px)); height: min(560px, calc(100dvh - 40px)); background: var(--bg2); border: 1px solid var(--line); border-radius: 22px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(10, 30, 70, 0.26); opacity: 0; transform: translateY(16px) scale(.96); transform-origin: bottom right; transition: .25s var(--ease); }
.chat-panel[hidden] { display: none; } .chat-panel.on { opacity: 1; transform: none; }
.chat-panel header { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-panel header div:nth-child(2) { flex: 1; display: grid; line-height: 1.2; } .chat-panel header small { color: var(--muted); font-size: .75rem; }
.chat-av { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); font: 800 .85rem var(--display); display: grid; place-items: center; }
.chat-x { background: none; border: 0; color: var(--muted); font-size: 1.1rem; padding: 6px; }
.chat-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: .92rem; line-height: 1.45; animation: pop .3s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.msg.bot { background: var(--surface2); border-bottom-left-radius: 4px; align-self: flex-start; } .msg.user { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; align-self: flex-end; font-weight: 500; }
.msg.typing { display: flex; gap: 4px; padding: 14px; } .msg.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: dot 1s infinite; } .msg.typing i:nth-child(2) { animation-delay: .15s; } .msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-4px); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; } .chip { background: transparent; border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 7px 13px; font-size: .82rem; font-weight: 600; transition: .2s; display: inline-block; }
.chip:hover { background: var(--accent); color: var(--on-accent); } .chip.pri { background: var(--accent); color: var(--on-accent); } .chip[disabled] { opacity: .4; pointer-events: none; }
.pc-list { display: grid; gap: 8px; } .pc { display: grid; grid-template-columns: 52px 1fr; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px; align-items: center; }
.pc img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; background: var(--surface2); } .pc strong { display: block; font-size: .85rem; line-height: 1.25; } .pc span { color: var(--muted); font-size: .8rem; }
.pc-a { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-form input { border-radius: 999px; } .chat-form button { width: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }

img.bad { opacity: 0; }

/* Modo "animaciones reducidas": lo elige el usuario con el interruptor del pie (guardado en este navegador) */
html.rm *, html.rm *::before, html.rm *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
html.rm [data-reveal] { opacity: 1; transform: none; }
@media (max-width: 640px) { .two, .form.inline { grid-template-columns: 1fr; } .chat { right: 14px; bottom: 14px; } .chat-panel { height: min(78dvh, 560px); } }

.cursor-ring { position: fixed; left: 0; top: 0; width: 30px; height: 30px; z-index: 9989; border-radius: 50%; pointer-events: none; opacity: 0; will-change: transform; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); transition: opacity .4s ease; }
.cursor-light { width: 220px; height: 220px; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 9%, transparent) 0%, color-mix(in srgb, var(--accent) 3%, transparent) 45%, transparent 70%); }
.cursor-dot { width: 6px; height: 6px; box-shadow: none; }
body.cursor-on .cursor-ring { opacity: 1; }

/* ===== Táctil (iPad / móvil) ===== */
html { -webkit-tap-highlight-color: transparent; }
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; } /* evita el zoom automático de iOS al enfocar */
  .btn, .chip, .mini-btn, .tabs button, .nav a, .side a.m { min-height: 44px; }
  .btn-add { width: 46px; height: 46px; }
  .qty button { width: 48px; height: 48px; }
}
.chat { right: max(22px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); }
@media (max-width: 640px) { .chat { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); } }
.drawer footer { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.foot { padding-bottom: max(90px, calc(env(safe-area-inset-bottom) + 90px)); }
