/* =====================================================================
   Celltek tienda · BASE
   Reset, tipografía, utilidades y animaciones de entrada.
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; scroll-padding-top: calc(var(--nav-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: var(--fs-body); line-height: 1.55;
  overflow-x: clip; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background .4s var(--ease), color .4s var(--ease);
}
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; text-wrap: balance; }
ul, ol { margin: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--on-accent); }
[hidden] { display: none !important; }

/* Transición entre páginas (navegadores con View Transitions; los demás la ignoran) */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: vt-out .18s var(--ease) both; }
  ::view-transition-new(root) { animation: vt-in .32s var(--ease) both; }
}
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

/* Grano fijo, muy leve */
.grain {
  position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: var(--grain-o); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='.9'/></svg>");
}

/* Contenedores y ritmo */
.wrap { width: min(var(--max), 100% - 2 * var(--gutter)); margin-inline: auto; }
.sec { padding: var(--sec) 0; position: relative; }
.sec-tight { padding: calc(var(--sec) * .55) 0; }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: clamp(22px, 3vw, 36px); }
.sec-head h2 { max-width: 20ch; }
.sec-head .lead { margin-top: 10px; max-width: 56ch; }
.band { background: var(--band-bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* Tipografía */
.display { font-family: var(--font-display); font-variation-settings: "wdth" var(--display-wdth); font-weight: var(--display-wght); text-transform: var(--display-tt); letter-spacing: var(--display-ls); line-height: var(--display-lh); }
h2.display, .h2 { font-size: var(--fs-display); }
h1.display { font-size: var(--fs-hero); }
h3.display { font-size: calc(clamp(1.5rem, 2.6vw, 2.2rem) * var(--display-scale) * var(--k-display)); }
.eyebrow { font-size: calc(12px * var(--k-eyebrow)); letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--accent-2); margin: 0 0 14px; }
.lead { font-size: var(--fs-lead); color: var(--muted); max-width: 60ch; line-height: 1.55; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.prose { max-width: 68ch; color: var(--muted); font-size: 1.02rem; line-height: 1.7; }
.prose > * + * { margin-top: 1em; }
.prose strong, .prose b { color: var(--text); font-weight: 700; }
.prose h2, .prose h3, .prose h4 { color: var(--text); margin-top: 1.6em; letter-spacing: -.01em; }
.prose h2 { font-size: 1.35rem; } .prose h3 { font-size: 1.15rem; } .prose h4 { font-size: 1.02rem; }
.prose ul, .prose ol { padding-left: 1.3em; display: grid; gap: .45em; }
.prose a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
.prose table { width: 100%; border-collapse: collapse; font-size: .95em; }
.prose td, .prose th { padding: 8px 10px; border: 1px solid var(--line); text-align: left; }
.prose .rt-small { font-size: .85em; } .prose .rt-large { font-size: 1.2em; } .prose .rt-huge { font-size: 1.5em; }
.rt-al-center { text-align: center; } .rt-al-right { text-align: right; } .rt-al-justify { text-align: justify; }
.ic-svg { width: 1em; height: 1em; display: inline-block; vertical-align: middle; fill: currentColor; flex: none; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Entrada por scroll (IntersectionObserver añade .in) */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .07s } .reveal.d2 { transition-delay: .14s } .reveal.d3 { transition-delay: .21s } .reveal.d4 { transition-delay: .28s } .reveal.d5 { transition-delay: .35s }

/* Entrada al cargar (hero) */
.up { opacity: 0; transform: translateY(24px); animation: up .9s var(--ease) forwards; }
.up:nth-child(2) { animation-delay: .1s } .up:nth-child(3) { animation-delay: .18s } .up:nth-child(4) { animation-delay: .26s } .up:nth-child(5) { animation-delay: .34s }
@keyframes up { to { opacity: 1; transform: none; } }

/* Esqueletos de carga */
.sk { position: relative; overflow: hidden; background: var(--bg2); border-radius: var(--r-in); }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); animation: sk 1.4s infinite; }
@keyframes sk { to { transform: translateX(100%); } }

/* Modo "?editable": marca lo que administra el panel */
.show-cms [data-cms] { outline: 1px dashed var(--accent-2); outline-offset: 3px; }
.cms-badge { position: fixed; left: 16px; bottom: 16px; z-index: 70; font-size: 12px; padding: 10px 14px; border-radius: 10px; background: var(--accent); color: var(--on-accent); }

@media (max-width: 560px) { body { font-size: calc(16px * var(--k-body, 1)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .up, .reveal { opacity: 1; transform: none; }
}
