/* Visible RD · sistema visual del portal */
:root {
  --tinta: #121317;
  --tinta-2: #2A2C33;
  --papel: #F4F2EC;
  --papel-2: #EAE6DB;
  --blanco: #FFFFFF;
  --senal: #FF4F1F;
  --senal-suave: #FFE1D6;
  --mar: #1747FF;
  --mar-suave: #DCE4FF;
  --bien: #0E9F57;
  --aviso: #E8A010;
  --mal: #E5484D;
  --gris: #6B6E78;
  --radio: 22px;
  --sombra: 0 1px 0 rgba(18,19,23,.06), 0 18px 50px -18px rgba(18,19,23,.28);
  --envoltura: min(1200px, 100% - 40px);
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --serif: var(--display);
  --texto: "Figtree", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: clip; }
body { background: var(--papel); color: var(--tinta); font-family: var(--texto); font-size: 17px; line-height: 1.55; overflow-x: clip; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
.envoltura { width: var(--envoltura); margin-inline: auto; }
.gordo { font-family: var(--display); font-weight: 800; letter-spacing: -0.035em; line-height: .95; }
.serif { font-family: var(--display); font-weight: 800; font-style: normal; letter-spacing: -0.035em; }
.senal { color: var(--senal); }
.etiqueta { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--tinta-2); }
.etiqueta::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--senal); box-shadow: 0 0 0 4px var(--senal-suave); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Transiciones entre páginas ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-salida .35s cubic-bezier(.7,0,.3,1) both; }
::view-transition-new(root) { animation: vt-entrada .55s cubic-bezier(.2,.8,.2,1) both; }
@keyframes vt-salida { to { opacity: 0; transform: translateY(-24px) scale(.985); filter: blur(4px); } }
@keyframes vt-entrada { from { opacity: 0; transform: translateY(36px); } }
.barra .logo { view-transition-name: logo; }
.titulo-pagina { view-transition-name: titulo; }
.cortina { position: fixed; inset: 0; z-index: 9999; background: var(--senal); transform: translateY(100%); pointer-events: none; }
.cortina.entra { animation: cortina-entra .38s cubic-bezier(.7,0,.3,1) forwards; }
.cortina.sale { transform: translateY(0); animation: cortina-sale .5s cubic-bezier(.2,.8,.2,1) .05s forwards; }
@keyframes cortina-entra { to { transform: translateY(0); } }
@keyframes cortina-sale { to { transform: translateY(-100%); } }

/* ---------- Barra superior ---------- */
.barra { position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); background: rgba(244,242,236,.78); border-bottom: 1px solid rgba(18,19,23,.08); }
.barra .envoltura { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 72px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 1.55rem; letter-spacing: -0.04em; }
.logo sup { font-family: var(--texto); font-size: .55rem; font-weight: 800; letter-spacing: .1em; background: var(--tinta); color: var(--papel); padding: 3px 6px; border-radius: 6px; margin-left: 2px; top: -.9em; position: relative; }
.punto { position: relative; width: 22px; height: 22px; border-radius: 50%; background: var(--senal); flex-shrink: 0; }
.punto::before, .punto::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--senal); animation: onda 2.4s cubic-bezier(.2,.6,.3,1) infinite; }
.punto::after { animation-delay: 1.2s; }
@keyframes onda { from { transform: scale(1); opacity: .7; } to { transform: scale(2.6); opacity: 0; } }
.menu { display: flex; align-items: center; gap: 28px; font-weight: 600; }
.menu a { text-decoration: none; position: relative; }
.menu a:not(.boton)::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: var(--senal); transform: scaleX(0); transform-origin: left; transition: transform .3s; }
.menu a:not(.boton):hover::after, .menu a[aria-current="page"]::after { transform: scaleX(1); }
.hamburguesa { display: none; width: 46px; height: 46px; border-radius: 14px; border: 1.5px solid var(--tinta); background: transparent; }
.hamburguesa span { display: block; width: 18px; height: 2px; background: var(--tinta); margin: 4px auto; transition: transform .3s, opacity .3s; }
@media (max-width: 900px) {
  .hamburguesa { display: block; }
  .menu { position: fixed; inset: 72px 0 auto 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--papel); border-bottom: 1px solid rgba(18,19,23,.1); padding: 10px 20px 24px; transform: translateY(calc(-100% - 90px)); visibility: hidden; transition: transform .45s cubic-bezier(.2,.8,.2,1), visibility 0s .45s; z-index: -1; }
  .menu a { padding: 14px 0; font-size: 1.15rem; border-bottom: 1px solid rgba(18,19,23,.07); }
  .menu .boton { margin-top: 14px; justify-content: center; }
  body.menu-abierto .menu { transform: none; visibility: visible; transition: transform .45s cubic-bezier(.2,.8,.2,1); }
  body.menu-abierto .hamburguesa span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.menu-abierto .hamburguesa span:nth-child(2) { opacity: 0; }
  body.menu-abierto .hamburguesa span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

/* ---------- Botones ---------- */
.boton { display: inline-flex; align-items: center; gap: 10px; justify-content: center; border: 0; border-radius: 999px; padding: 14px 24px; font-weight: 700; text-decoration: none; background: var(--tinta); color: var(--papel); transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, background .25s; white-space: nowrap; }
.boton:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -10px rgba(18,19,23,.5); }
.boton--senal { background: var(--senal); color: var(--blanco); }
.boton--senal:hover { box-shadow: 0 14px 34px -10px rgba(255,79,31,.7); }
.boton--claro { background: transparent; color: var(--tinta); box-shadow: inset 0 0 0 1.5px var(--tinta); }
.boton--grande { padding: 18px 30px; font-size: 1.08rem; }
.boton .flecha { transition: transform .25s; }
.boton:hover .flecha { transform: translateX(4px); }

/* ---------- Apariciones al bajar ---------- */
.aparece { opacity: 0; transform: translateY(28px); transition: opacity .8s cubic-bezier(.2,.8,.2,1), transform .8s cubic-bezier(.2,.8,.2,1); transition-delay: var(--retraso, 0s); }
.aparece.visto { opacity: 1; transform: none; }
.palabra { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; }
.palabra > span { display: inline-block; transform: translateY(105%); animation: sube .9s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: calc(var(--i) * 70ms + 120ms); }
@keyframes sube { to { transform: none; } }

/* ---------- Secciones ---------- */
.seccion { padding: clamp(80px, 11vw, 140px) 0; position: relative; }
.seccion--tinta { background: var(--tinta); color: var(--papel); }
.seccion--tinta .etiqueta { color: #C9CBD3; }
.titulo-seccion { font-size: clamp(2.4rem, 6vw, 4.6rem); max-width: 16ch; }
.bajada { font-size: clamp(1.05rem, 1.8vw, 1.25rem); color: var(--tinta-2); max-width: 56ch; margin-top: 20px; }
.seccion--tinta .bajada { color: #C9CBD3; }

/* ---------- Pie ---------- */
.pie { background: var(--tinta); color: #C9CBD3; padding: 70px 0 34px; }
.pie .logo { color: var(--papel); display: inline-flex; padding: 0; }
.pie .logo sup { background: var(--senal); color: var(--blanco); }
.pie-columnas { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
.pie h4 { color: var(--papel); font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 14px; }
.pie a { text-decoration: none; display: block; padding: 4px 0; }
.pie a:hover { color: var(--papel); }
.pie-legal { margin-top: 50px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.1); font-size: .88rem; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
@media (max-width: 800px) { .pie-columnas { grid-template-columns: 1fr; } }

/* ---------- Chat con Sofía ---------- */
.chat-boton { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; align-items: center; gap: 12px; background: var(--tinta); color: var(--papel); border: 0; border-radius: 999px; padding: 10px 20px 10px 10px; box-shadow: var(--sombra); font-weight: 700; transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.chat-boton:hover { transform: translateY(-3px); }
.chat-boton .avatar { width: 40px; height: 40px; }
.avatar { position: relative; width: 36px; height: 36px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FF8A5E, var(--senal)); display: grid; place-items: center; color: var(--blanco); font-family: var(--display); font-weight: 800; flex-shrink: 0; }
.avatar::after { content: ""; position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: #2BD576; border: 2px solid var(--tinta); }
.chat { position: fixed; right: 20px; bottom: 20px; z-index: 90; width: min(400px, calc(100vw - 24px)); height: min(640px, calc(100dvh - 40px)); display: flex; flex-direction: column; background: var(--blanco); border-radius: 26px; box-shadow: 0 30px 80px -20px rgba(18,19,23,.45), 0 0 0 1px rgba(18,19,23,.06); overflow: hidden; transform-origin: bottom right; transform: scale(.6) translateY(30px); opacity: 0; pointer-events: none; transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .3s; }
.chat.abierto { transform: none; opacity: 1; pointer-events: auto; }
.chat-cabeza { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: var(--tinta); color: var(--papel); }
.chat-cabeza b { display: block; font-size: 1rem; }
.chat-cabeza small { color: #AEB2BD; font-size: .8rem; }
.chat-cerrar { margin-left: auto; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: var(--papel); font-size: 1.2rem; line-height: 1; }
.chat-mensajes { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(var(--papel), var(--blanco) 140px); }
.burbuja { max-width: 86%; padding: 11px 15px; border-radius: 18px; font-size: .97rem; line-height: 1.45; animation: burbuja .35s cubic-bezier(.2,.8,.2,1); white-space: pre-wrap; overflow-wrap: anywhere; }
.burbuja.ella { background: var(--blanco); border: 1px solid rgba(18,19,23,.08); border-bottom-left-radius: 6px; align-self: flex-start; }
.burbuja.yo { background: var(--tinta); color: var(--papel); border-bottom-right-radius: 6px; align-self: flex-end; }
.burbuja a { color: var(--senal); font-weight: 700; }
@keyframes burbuja { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.escribiendo { display: inline-flex; gap: 4px; padding: 14px 16px; }
.escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: var(--gris); animation: salta 1s infinite; }
.escribiendo i:nth-child(2) { animation-delay: .15s; } .escribiendo i:nth-child(3) { animation-delay: .3s; }
@keyframes salta { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.chat-sugerencias { display: flex; gap: 8px; padding: 0 18px 12px; flex-wrap: wrap; }
.chat-sugerencias button { border: 1.5px solid rgba(18,19,23,.15); background: var(--blanco); border-radius: 999px; padding: 7px 12px; font-size: .86rem; font-weight: 600; }
.chat-sugerencias button:hover { border-color: var(--senal); color: var(--senal); }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid rgba(18,19,23,.08); }
.chat-form input { flex: 1; min-width: 0; border: 1.5px solid rgba(18,19,23,.12); border-radius: 999px; padding: 12px 16px; font: inherit; }
.chat-form input:focus { outline: none; border-color: var(--senal); }
.chat-form button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--senal); color: var(--blanco); display: grid; place-items: center; }
.chat-form button:disabled { opacity: .5; }
.chat-aviso { font-size: .74rem; color: var(--gris); text-align: center; padding: 0 16px 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .aparece { opacity: 1; transform: none; }
  .palabra > span { transform: none; }
}
