/* =========================================================
   JCX · Sistema de diseño (itsjcx.com y XLive)
   Base: theoutliers.es (Oswald + Open Sans, editorial)
   Ver DISENO.md para el uso.
   ========================================================= */

/* ---------- Tokens ---------- */
:root,
[data-theme="dark"] {
  --paper: #0a0a0a;          /* fondo */
  --paper-2: #121212;        /* superficies elevadas, menú */
  --ink: #f2efe8;            /* texto principal */
  --ink-2: rgba(242, 239, 232, .72);
  --ink-3: rgba(242, 239, 232, .46);
  --line: rgba(242, 239, 232, .12);
  --band: #141414;           /* secciones alternas */
  --band-ink: #f2efe8;
  --band-ink-2: rgba(242, 239, 232, .66);
  --band-line: rgba(242, 239, 232, .12);
  --overlay: rgba(0, 0, 0, .62);
  --accent: #e0a526;         /* ámbar JCX */
  --live: #fa2b3d;           /* rojo directo */
  color-scheme: dark;
}

[data-theme="light"] {
  --paper: #f4f2ed;
  --paper-2: #ffffff;
  --ink: #0b0b0b;
  --ink-2: rgba(11, 11, 11, .70);
  --ink-3: rgba(11, 11, 11, .45);
  --line: rgba(11, 11, 11, .12);
  --band: #0b0b0b;
  --band-ink: #f2efe8;
  --band-ink-2: rgba(242, 239, 232, .66);
  --band-line: rgba(242, 239, 232, .14);
  --overlay: rgba(11, 11, 11, .45);
  color-scheme: light;
}

:root {
  --f-display: "Oswald", "Arial Narrow", sans-serif;
  --f-body: "Open Sans", Helvetica, Arial, sans-serif;
  --pad: clamp(20px, 7.6vw, 110px);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.76, 0, .24, 1);
  --header-h: 92px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .5s var(--ease), color .5s var(--ease);
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--accent); color: #0b0b0b; }
.wrap { padding-left: var(--pad); padding-right: var(--pad); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Tipografía ---------- */
.label {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.t-mega, .t-display, .t-h2, .t-h3 {
  font-family: var(--f-display);
  font-weight: 700;
  text-transform: uppercase;
  margin: 0;
}
.t-mega    { font-size: clamp(72px, 12.5vw, 200px); line-height: .88; letter-spacing: -.012em; }
.t-display { font-size: clamp(46px, 7.2vw, 118px); line-height: .92; letter-spacing: -.01em; }
.t-h2      { font-size: clamp(36px, 4.6vw, 64px);  line-height: .98; letter-spacing: -.01em; }
.t-h3      { font-size: clamp(20px, 1.6vw, 24px);  line-height: 1.1; letter-spacing: -.005em; font-weight: 600; }
.light     { font-weight: 300; }
.muted     { color: var(--ink-3); }
.lede { font-size: 15px; line-height: 1.75; color: var(--ink-2); max-width: 56ch; margin: 0; }

/* Líneas con máscara para animaciones de entrada */
.line { display: block; overflow: hidden; }
.line > span { display: block; will-change: transform; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 26px;
  border: 1px solid currentColor;
  font-family: var(--f-display); font-weight: 500; font-size: 12px;
  letter-spacing: .24em; text-transform: uppercase;
  position: relative; overflow: hidden; isolation: isolate;
  transition: color .45s var(--ease);
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: currentColor; transform: translateY(101%);
  transition: transform .5s var(--ease);
}
.btn span { position: relative; }
.btn:hover::before { transform: translateY(0); }
.btn:hover { color: var(--paper); }
.btn.on-image:hover { color: #0b0b0b; }
.btn .arr { transition: transform .45s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }

.link-arrow {
  font-family: var(--f-display); font-weight: 500; font-size: 12px;
  letter-spacing: .24em; text-transform: uppercase;
  display: inline-flex; gap: 10px; align-items: center;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  padding-bottom: 4px; transition: background-size .5s var(--ease);
}
.link-arrow:hover { background-size: 100% 1px; }

/* ---------- Cabecera ---------- */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 80;
  height: var(--header-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 var(--pad);
  color: #f2efe8;
  transition: background-color .5s var(--ease), color .5s var(--ease), height .5s var(--ease), border-color .5s var(--ease);
  border-bottom: 1px solid transparent;
}
.header.is-solid {
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  color: var(--ink);
  height: 72px;
  border-bottom-color: var(--line);
}
.logo {
  display: block; width: 86px; height: 49px;
  background: currentColor;
  -webkit-mask: url("jcx-firma.png") center / contain no-repeat;
          mask: url("jcx-firma.png") center / contain no-repeat;
}
.nav { display: flex; gap: clamp(18px, 2.4vw, 38px); }
.nav a {
  font-family: var(--f-display); font-weight: 500; font-size: 13px;
  letter-spacing: .18em; text-transform: uppercase;
  opacity: .82; position: relative; padding: 6px 0; transition: opacity .3s;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform .45s var(--ease);
}
.nav a:hover { opacity: 1; }
.nav a:hover::after, .nav a.is-active::after { transform: scaleX(1); transform-origin: left; }
.tools { display: flex; align-items: center; justify-content: flex-end; gap: 20px; }

/* Interruptor claro / oscuro */
.theme {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--f-display); font-size: 10px; letter-spacing: .24em; text-transform: uppercase;
}
.theme .track {
  position: relative; width: 38px; height: 20px; border-radius: 20px;
  border: 1px solid currentColor; opacity: .85;
}
.theme .knob {
  position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: currentColor; transition: transform .5s var(--ease);
}
[data-theme="light"] .theme .knob { transform: translateX(18px); }
.theme .lbl { opacity: .7; min-width: 44px; }
@media (max-width: 1500px) { .theme .lbl { display: none; } }

/* Botón XLIVE */
.xlive {
  display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 18px;
  border: 1px solid currentColor;
  font-family: var(--f-display); font-weight: 600; font-size: 14px; letter-spacing: .2em;
  transition: background-color .4s var(--ease), color .4s var(--ease), border-color .4s var(--ease);
}
.xlive .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .35; }
.xlive.is-live .dot { background: var(--live); opacity: 1; box-shadow: 0 0 0 0 rgba(250, 43, 61, .6); animation: livePulse 1.6s infinite; }
.xlive.is-live { border-color: var(--live); }
.xlive:hover { background: currentColor; }
.xlive:hover .txt { color: var(--paper); }
.header:not(.is-solid) .xlive:hover .txt { color: #0b0b0b; }
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(250, 43, 61, .6); }
  70% { box-shadow: 0 0 0 9px rgba(250, 43, 61, 0); }
  100% { box-shadow: 0 0 0 0 rgba(250, 43, 61, 0); }
}

/* Botón menú (rejilla 3x3, como Outliers) */
.burger { display: grid; grid-template-columns: repeat(3, 4px); gap: 4px; padding: 8px; }
.burger i { width: 4px; height: 4px; background: currentColor; transition: transform .45s var(--ease); }
.burger:hover i:nth-child(odd) { transform: scale(.4); }

@media (max-width: 1300px) {
  .nav { display: none; }
  .header { grid-template-columns: auto 1fr; }
}

/* ---------- Menú lateral ---------- */
.menu {
  position: fixed; inset: 0; z-index: 120; pointer-events: none;
}
.menu .shade {
  position: absolute; inset: 0; background: var(--overlay);
  opacity: 0; transition: opacity .6s var(--ease);
}
.menu .panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(560px, 100%);
  background: var(--paper-2); color: var(--ink);
  display: flex; flex-direction: column;
  padding: 34px clamp(28px, 4vw, 56px) 40px;
  transform: translateX(100%);
  transition: transform .8s var(--ease-in-out);
}
.menu.is-open { pointer-events: auto; }
.menu.is-open .shade { opacity: 1; }
.menu.is-open .panel { transform: translateX(0); }
.menu .top { display: flex; justify-content: space-between; align-items: center; }
.menu .close { width: 30px; height: 30px; position: relative; }
.menu .close::before, .menu .close::after {
  content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 1.5px; background: currentColor;
  transition: transform .5s var(--ease);
}
.menu .close::before { transform: rotate(45deg); }
.menu .close::after { transform: rotate(-45deg); }
.menu .close:hover::before { transform: rotate(135deg); }
.menu .close:hover::after { transform: rotate(45deg); }
.menu nav { margin: auto 0; display: flex; flex-direction: column; }
.menu nav a {
  display: flex; align-items: baseline; gap: 18px;
  font-family: var(--f-display); font-weight: 600; text-transform: uppercase;
  font-size: clamp(36px, 4.4vw, 54px); line-height: 1.12; letter-spacing: -.005em;
  overflow: hidden;
}
.menu nav a .n { font-size: 12px; font-weight: 400; letter-spacing: .2em; color: var(--ink-3); width: 22px; }
.menu nav a .w { display: inline-block; transition: transform .5s var(--ease), color .3s; }
.menu nav a:hover .w { transform: translateX(10px); color: var(--accent); }
.menu .foot { display: flex; flex-direction: column; gap: 12px; }
.menu .foot .mail { font-family: var(--f-display); font-size: 18px; letter-spacing: .02em; }
.menu .socials { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.menu .socials a { font-family: var(--f-display); font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--ink-3); transition: color .3s; }
.menu .socials a:hover { color: var(--ink); }

/* ---------- Redes verticales (borde derecho) ---------- */
.rail {
  position: fixed; right: 26px; top: 50%; z-index: 60;
  transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  color: var(--ink); mix-blend-mode: difference;
}
.rail a {
  writing-mode: vertical-rl;
  font-family: var(--f-display); font-size: 10px; letter-spacing: .3em; text-transform: uppercase;
  color: #f2efe8; opacity: .7; transition: opacity .3s;
}
.rail a:hover { opacity: 1; }
.rail i { width: 1px; height: 46px; background: #f2efe8; opacity: .35; }
@media (max-width: 980px) { .rail { display: none; } }

/* ---------- Cursor ---------- */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 200; pointer-events: none;
  width: 36px; height: 36px; margin: -18px 0 0 -18px;
  border: 1px solid #f2efe8; border-radius: 50%;
  mix-blend-mode: difference;
  display: grid; place-items: center;
  transition: width .45s var(--ease), height .45s var(--ease), margin .45s var(--ease), background-color .45s var(--ease), opacity .3s;
}
.cursor .c-label {
  font-family: var(--f-display); font-size: 11px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase;
  color: #0b0b0b; opacity: 0; transition: opacity .3s;
}
.cursor.is-big { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: #f2efe8; mix-blend-mode: normal; }
.cursor.is-big .c-label { opacity: 1; }
.cursor.is-hover { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
.cursor.is-hidden { opacity: 0; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ---------- Loader (la X de JCX) ---------- */
.loader {
  position: fixed; inset: 0; z-index: 300;
  background: #070707;
  display: grid; place-items: center;
}
.loader svg { width: 74px; height: 74px; overflow: visible; }
.loader .x-dim path { fill: #f2efe8; opacity: .13; }
.loader .x-full path { fill: #f2efe8; }
.loader .meta {
  position: absolute; bottom: 34px; left: 0; right: 0;
  display: flex; justify-content: space-between; padding: 0 var(--pad);
  font-family: var(--f-display); font-size: 10px; letter-spacing: .3em; text-transform: uppercase;
  color: rgba(242, 239, 232, .4);
}
html.no-loader .loader { display: none; }
/* Red de seguridad: si algún script falla, el loader se quita solo */
.loader { animation: loaderSafety .4s 7s forwards; }
@keyframes loaderSafety { to { opacity: 0; visibility: hidden; } }

/* ---------- Imágenes ---------- */
.media { position: relative; overflow: hidden; background: var(--paper-2); }
.media img { width: 100%; height: 100%; object-fit: cover; }
.bw img { filter: grayscale(1) contrast(1.05); transition: filter .9s var(--ease), transform 1.2s var(--ease); }
a:hover .bw img, .bw:hover img { filter: grayscale(0) contrast(1); transform: scale(1.04); }

/* ---------- Accesibilidad: reducir animaciones ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
