/* ==========================================================================
   Base · tokens, tipografía, componentes compartidos, header y portada
   ========================================================================== */
:root {
  --bg: oklch(0.12 0.02 262);
  --bg-deep: oklch(0.085 0.015 262);
  --surface: oklch(0.165 0.026 262);
  --surface-2: oklch(0.21 0.032 262);
  --fg: oklch(0.965 0.005 250);
  --fg-soft: oklch(0.87 0.012 252);
  --muted: oklch(0.72 0.022 255);
  --border: oklch(0.31 0.03 262);
  --border-soft: oklch(0.235 0.028 262);
  --accent: oklch(0.62 0.2 262);
  --accent-hi: oklch(0.76 0.13 262);
  --line: oklch(0.58 0.12 262);

  /* rampa de datos (un solo tono) */
  --c1: oklch(0.93 0.02 255);
  --c2: oklch(0.8 0.07 258);
  --c3: oklch(0.62 0.2 262);
  --c4: oklch(0.5 0.15 262);
  --c5: oklch(0.4 0.09 262);
  --c6: oklch(0.31 0.05 262);

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Inter", system-ui, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --pad: clamp(20px, 4.4vw, 64px);
  --header-h: 72px;
  --r-card: 28px;
  --ease: cubic-bezier(0.22, 0.7, 0.2, 1);
}

/* Tema inverso: secciones en blanco roto con tinta casi negra */
.inv {
  --bg: oklch(0.955 0.005 250);
  --bg-deep: oklch(0.925 0.007 250);
  --surface: oklch(0.925 0.007 250);
  --surface-2: oklch(0.885 0.009 250);
  --fg: oklch(0.13 0.02 262);
  --fg-soft: oklch(0.27 0.02 262);
  --muted: oklch(0.42 0.02 260);
  --border: oklch(0.7 0.015 255);
  --border-soft: oklch(0.83 0.01 255);
  --accent-hi: oklch(0.47 0.22 262);
  --c1: oklch(0.13 0.02 262);
  --c2: oklch(0.36 0.1 262);
  --c5: oklch(0.72 0.05 262);
  --c6: oklch(0.84 0.02 262);
  background: var(--bg);
  color: var(--fg);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3, h4, p, ol, ul, dl, dd, figure, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: oklch(0.965 0.005 250); }

.wrap { width: 100%; max-width: none; margin-inline: auto; padding-inline: var(--pad); }
.wrap--narrow { max-width: 1000px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip { position: absolute; left: 16px; top: -60px; z-index: 120; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* ---------- tipografía ---------- */
.h1, .h2 {
  font-family: var(--display); font-stretch: 76%; font-weight: 800; text-transform: uppercase;
  letter-spacing: -0.012em; line-height: 0.9; text-wrap: balance;
}
.h1 { font-size: clamp(44px, 9.4vw, 164px); }
.h2 { font-size: clamp(36px, 6.4vw, 104px); }
.h2--sm { font-size: clamp(30px, 4.4vw, 68px); }
.h3 { font-family: var(--display); font-stretch: 92%; font-weight: 600; font-size: clamp(20px, 1.8vw, 26px); line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
.h3--lg { font-stretch: 78%; font-weight: 800; text-transform: uppercase; font-size: clamp(30px, 3.8vw, 58px); line-height: 0.94; letter-spacing: -0.01em; }
.lead { font-size: clamp(17px, 1.4vw, 22px); line-height: 1.45; color: var(--fg-soft); max-width: none; text-wrap: pretty; }
p { text-wrap: pretty; }

.micro, .label {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.13em; color: var(--muted);
}
.label { display: flex; align-items: baseline; gap: 12px; margin-bottom: clamp(16px, 2vw, 28px); font-size: 12px; }
.label__n { color: var(--accent-hi); }
.label__n::after { content: " —"; color: var(--border); }

.ph { font-family: var(--mono); font-size: 0.86em; color: var(--accent-hi); border: 1px dashed var(--border); border-radius: 6px; padding: 2px 8px; display: inline-block; }

/* títulos que suben palabra a palabra */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-top: 0.14em; margin-top: -0.14em; }
.w > span { display: inline-block; transform: translateY(108%); transition: transform 0.95s var(--ease); transition-delay: calc(var(--i) * 38ms); }
.is-in > .w > span { transform: none; }

/* ---------- cabecera de sección ---------- */
.head { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; margin-bottom: clamp(40px, 6vw, 96px); }
.head > * { grid-column: 1 / -1; }
.head > .lead, .head > div + .lead { grid-column: 7 / -1; margin-top: clamp(24px, 3vw, 44px); }
#carteras > .wrap > .head > .lead { grid-column: 1 / span 7; }
.js .head .lead { opacity: 0; transform: translateY(18px); transition: opacity 0.9s var(--ease) 0.35s, transform 0.9s var(--ease) 0.35s; }
.js .head.is-in .lead { opacity: 1; transform: none; }

/* ---------- botones y enlaces ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 54px; padding: 0 30px; border-radius: 999px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  text-decoration: none; border: 1px solid transparent;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn--solid { background: var(--fg); color: var(--bg); }
.btn--solid:hover { background: color-mix(in oklch, var(--fg) 86%, var(--bg)); color: var(--bg); transform: translateY(-2px); }
.btn--ghost { border-color: color-mix(in oklch, var(--fg) 40%, transparent); color: var(--fg); }
.btn--ghost:hover { border-color: var(--fg); background: color-mix(in oklch, var(--fg) 12%, transparent); color: var(--fg); }
.btn:active { transform: translateY(0); }

.link {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  text-decoration: none; color: var(--fg);
  background: linear-gradient(var(--fg), var(--fg)) 0 calc(100% - 10px) / 100% 1px no-repeat;
}
.link::after { content: "→"; transition: transform 0.25s var(--ease); }
.link:hover::after { transform: translateX(5px); }
.link:hover { background-size: 100% 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips li {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 999px; color: var(--fg-soft);
}
.chips--quiet li { padding: 7px 13px; font-size: 11.5px; }

.stamp {
  display: inline-block; font-family: var(--mono); font-size: 12.5px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fg); border: 1px solid var(--fg); padding: 7px 12px; border-radius: 6px; white-space: nowrap;
}
.stamp--sm { font-size: 10.5px; padding: 3px 8px; border-color: var(--muted); border-radius: 5px; }

.grain {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.24; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- secciones ---------- */
.sec { position: relative; padding-block: clamp(84px, 11vw, 190px); }
.sec--tight { padding-block: clamp(56px, 6.5vw, 110px); }

/* aparición progresiva */
.js [data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); transition-delay: var(--d, 0ms); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- capas globales: entrada y progreso ---------- */

.progress-top { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60; pointer-events: none; }
.progress-top i { display: block; height: 100%; background: var(--accent); transform: scaleX(var(--page, 0)); transform-origin: left; }

/* ==========================================================================
   Header
   ========================================================================== */
/* Arriba: transparente a todo el ancho. Con scroll (.is-pill): píldora flotante de cristal líquido. */
.header { --pill-ease: cubic-bezier(0.23, 1, 0.32, 1); --bar-w: min(100%, 1440px); position: fixed; inset: 0 0 auto 0; z-index: 60; pointer-events: none; }
.header.is-pill, .header.is-open { --bar-w: min(100% - 24px, 960px); }
.header__row {
  position: relative; pointer-events: auto; width: var(--bar-w); height: 60px; margin: 12px auto 0;
  padding-inline: var(--pad); display: flex; align-items: center; gap: 24px;
  transition: width 0.7s var(--pill-ease), padding 0.7s var(--pill-ease);
}
.header.is-pill .header__row, .header.is-open .header__row { padding-inline: clamp(14px, 2.4vw, 28px); }
.header__row > :not(.header__glass) { position: relative; z-index: 1; }
.header__glass {
  position: absolute; inset: 0; z-index: 0; border-radius: 999px; overflow: hidden; pointer-events: none;
  opacity: 0; transform: scale(1.05, 1.3);
  background: oklch(0.1 0.02 262 / 0.55);
  -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
  box-shadow: inset 0 0 0 1px oklch(0.965 0.005 250 / 0.16), inset 0 1px 0 oklch(0.965 0.005 250 / 0.3), 0 10px 34px oklch(0.04 0.02 262 / 0.55);
  transition: opacity 0.45s var(--pill-ease), transform 0.7s var(--pill-ease);
}
.header__glass::before {
  content: ""; position: absolute; inset: 0; opacity: 0.38; mix-blend-mode: screen;
  background: url("../ref-header-cristal-liquido.jpg") center / cover no-repeat;
}
.header__glass::after { /* oscurece la textura bajo el texto y deja el brillo en los extremos */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, oklch(0.08 0.02 262 / 0.5), oklch(0.08 0.02 262 / 0.22) 30%, oklch(0.08 0.02 262 / 0.5));
}
.header.is-pill .header__glass, .header.is-open .header__glass { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .header__row, .header__glass { transition: none; }
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; min-height: 44px; }
.brand__mark { width: 34px; height: 34px; flex: none; object-fit: contain; }
.brand__logo { height: clamp(22px, 2.4vw, 30px); width: auto; flex: none; display: block; }
.brand__mark--pl { display: none; height: 34px; width: 34px; }
.header.is-pill .brand__logo, .header.is-open .brand__logo { display: none; }
.header.is-pill .brand__mark--pl, .header.is-open .brand__mark--pl { display: block; }
.brand__name { font-family: var(--display); font-stretch: 78%; font-weight: 800; font-size: 22px; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1; }

.nav { margin-left: auto; display: flex; align-items: center; gap: clamp(14px, 1.8vw, 28px); }
.nav a { font-size: 14px; text-decoration: none; color: var(--fg-soft); padding: 12px 0; position: relative; white-space: nowrap; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 8px; height: 1px; background: var(--fg); transform: scaleX(0); transform-origin: left; transition: transform 0.3s var(--ease); }
.nav a:hover { color: var(--fg); }
.nav a:hover::after { transform: scaleX(1); }
.nav a.nav__contact { border: 1px solid oklch(0.965 0.005 250 / 0.4); border-radius: 999px; padding: 9px 18px; color: var(--fg); transition: background-color 0.25s, border-color 0.25s; }
.nav a.nav__contact::after { display: none; }
.nav a.nav__contact:hover { background: oklch(0.965 0.005 250 / 0.12); border-color: var(--fg); }

.header__tools { display: flex; align-items: center; gap: 8px; }
.lang { display: flex; align-items: center; }
.lang button {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; color: var(--muted);
  min-width: 36px; height: 44px; position: relative; transition: color 0.2s;
}
.lang button:hover { color: var(--fg); }
.lang button[aria-pressed="true"] { color: var(--fg); }
.lang button[aria-pressed="true"]::after { content: ""; position: absolute; left: 9px; right: 9px; bottom: 9px; height: 1px; background: var(--fg); }
.lang button + button::before { content: ""; position: absolute; left: 0; top: 17px; bottom: 17px; width: 1px; background: var(--border); }

.burger { display: none; width: 44px; height: 44px; position: relative; }
.burger span { position: absolute; left: 11px; right: 11px; height: 1.5px; background: var(--fg); transition: transform 0.3s var(--ease), top 0.3s var(--ease); }
.burger span:first-child { top: 18px; }
.burger span:last-child { top: 26px; }
.burger[aria-expanded="true"] span:first-child { top: 22px; transform: rotate(45deg); }
.burger[aria-expanded="true"] span:last-child { top: 22px; transform: rotate(-45deg); }

/* ==========================================================================
   Portada: velas en 3D + titular a todo el ancho, fijada mientras se hace scroll
   ========================================================================== */
.hero { position: relative; height: 240vh; background: var(--bg-deep); }
.hero__pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; isolation: isolate; display: flex; }
.hero__pin > canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -3; }
.hero .grain { z-index: -2; }
.hero__shade { position: absolute; inset: 0; z-index: -1; pointer-events: none; background:
  linear-gradient(0deg, oklch(0.085 0.015 262 / 0.94) 0%, oklch(0.085 0.015 262 / 0.5) 34%, transparent 62%),
  linear-gradient(180deg, oklch(0.085 0.015 262 / 0.7) 0%, transparent 22%); }

.hero__inner { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; padding-top: calc(var(--header-h) + clamp(10px, 2.4vh, 28px)); padding-bottom: clamp(18px, 3vh, 34px); }
.hero__top { display: flex; justify-content: space-between; gap: 24px; }
.hero__top .micro { color: var(--fg-soft); }
.hero__top, .hero__row, .hero__index, .hero__hint {
  opacity: clamp(0, calc(1 - var(--p, 0) * 5), 1);
  transform: translateY(calc(var(--p, 0) * -60px));
}
.hero__title {
  grid-row: 3; font-family: var(--display); font-stretch: 75%; font-weight: 800; text-transform: uppercase;
  font-size: clamp(40px, 6.2vw, 124px); line-height: 0.86; letter-spacing: -0.012em;
  color: oklch(1 0 0); mix-blend-mode: difference;
}
.hero__title span { display: block; opacity: clamp(0, calc(1 - (var(--p, 0) - 0.26) * 3.4), 1); will-change: transform; }
.hero__l1 { transform: translateX(calc(var(--p, 0) * -52vw)); }
.hero__l2 { transform: translateX(calc(var(--p, 0) * 52vw)); }
.hero__title.is-fit span { white-space: nowrap; }

.hero__row { grid-row: 4; display: flex; justify-content: space-between; align-items: flex-end; gap: clamp(20px, 4vw, 64px); margin-top: clamp(16px, 2.8vh, 34px); }
.hero__sub { max-width: 50ch; font-size: clamp(16px, 1.3vw, 20px); line-height: 1.45; color: var(--fg-soft); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; flex: none; }

.hero__index { grid-row: 5; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(12px, 2vw, 32px); margin-top: clamp(18px, 3.2vh, 40px); }
.hero__index a { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: baseline; padding-top: 12px; border-top: 1px solid oklch(0.965 0.005 250 / 0.3); text-decoration: none; transition: border-color 0.3s, transform 0.3s var(--ease); min-height: 44px; }
.hero__index b { font-family: var(--display); font-stretch: 76%; font-weight: 800; font-size: clamp(20px, 1.8vw, 28px); line-height: 1; grid-row: span 2; }
.hero__index span { font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.12em; }
.hero__index small { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.hero__index a:hover { border-top-color: var(--fg); transform: translateY(-3px); }

.hero__quote {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 24px; text-align: center; padding-inline: var(--pad); pointer-events: none;
  opacity: clamp(0, calc((var(--p, 0) - 0.5) * 4), 1);
  transform: scale(calc(0.88 + var(--p, 0) * 0.12));
  filter: blur(calc(clamp(0, (0.78 - var(--p, 0)) * 34, 14) * 1px));
}
.hero__quote p { font-family: var(--display); font-stretch: 84%; font-weight: 700; font-size: clamp(26px, 4.3vw, 72px); line-height: 1.02; letter-spacing: -0.02em; max-width: 20ch; text-wrap: balance; }
.hero__quote p::before { content: "“"; } .hero__quote p::after { content: "”"; }
.hero__quote cite { font-style: normal; color: var(--fg-soft); }

.hero__hint { position: absolute; right: var(--pad); top: calc(var(--header-h) + 64px); display: flex; align-items: center; gap: 10px; writing-mode: vertical-rl; color: var(--fg-soft); }
.hero__hint i, .hpanel__go i { display: block; width: 1px; height: 54px; background: currentColor; transform-origin: top; animation: hint 1.8s var(--ease) infinite; }
@keyframes hint { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* versión estática (sin JS o con movimiento reducido) */
.hero.hero--static { height: auto; }
.hero--static .hero__pin { position: relative; height: auto; min-height: 100svh; flex-direction: column; }
.hero--static .hero__inner { flex: none; min-height: 100vh; min-height: 100svh; }
.hero--static .hero__quote { position: static; opacity: 1; transform: none; filter: none; padding-block: clamp(48px, 8vw, 110px); }
.hero--static .hero__hint { display: none; }

/* ==========================================================================
   Responsive · header y portada
   ========================================================================== */
@media (max-width: 1100px) {
  .burger { display: block; }
  .header__tools { margin-left: auto; }
  .nav {
    position: fixed; inset: var(--header-h) 0 0 0; margin: 0; padding: 12px var(--pad) 40px;
    flex-direction: column; align-items: stretch; gap: 0; overflow-y: auto;
    background: oklch(0.085 0.015 262 / 0.98);
    opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity 0.3s, transform 0.3s var(--ease), visibility 0.3s;
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav a { font-family: var(--display); font-stretch: 76%; font-weight: 800; text-transform: uppercase; font-size: 34px; line-height: 1; padding: 16px 0; border-bottom: 1px solid var(--border-soft); color: var(--fg); }
  .nav a::after { display: none; }
  .nav a.nav__contact { margin-top: 24px; border: 1px solid oklch(0.965 0.005 250 / 0.4); text-align: center; font-family: var(--mono); font-stretch: 100%; font-weight: 500; font-size: 13px; letter-spacing: 0.12em; padding: 18px; }
}
@media (max-width: 900px) {
  .head > .lead, .head > div + .lead, #carteras > .wrap > .head > .lead { grid-column: 1 / -1; }
  .hero__row { flex-direction: column; align-items: flex-start; }
  .hero__index { grid-template-columns: repeat(5, auto); justify-content: space-between; }
  .hero__index small { display: none; }
  .hero__hint { display: none; }
}
@media (max-width: 700px) {
  :root { --header-h: 64px; }
  .hero__who { display: none; }
  .hero__title { font-size: clamp(40px, 13.2vw, 92px); line-height: 0.88; }
  .hero__cta { width: 100%; }
  .hero__cta .btn { flex: 1 1 100%; }
  .hero__cta .btn { min-height: 48px; }
  .hero__index { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--pad) * -1); padding-inline: var(--pad); }
  .hero__index::-webkit-scrollbar { display: none; }
  .hero__index a { flex: none; grid-template-columns: auto auto; column-gap: 8px; padding-top: 12px; }
  .hero__index b { grid-row: auto; font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; transition-delay: 0ms !important; }
  .js [data-reveal], .js .head .lead { opacity: 1; transform: none; }
  .w > span { transform: none; }
}
