/* ==========================================================================
   Carmín · Estudio digital — base
   Layout: negro grafito cinematográfico; luz plateada y película iridiscente
   (melocotón, carmín, lila, azul) generadas por shaders; el carmín de la
   cochinilla peruana es el acento de marca.
   ========================================================================== */
:root {
  /* Color */
  --ink: #060708;            /* fondo */
  --ink-2: #0C0E11;          /* superficies */
  --ink-3: #15181D;          /* superficies elevadas */
  --pearl: #F3F2EF;          /* texto principal */
  --silver: #C5CAD0;         /* texto destacado secundario */
  --silver-2: #8C939B;       /* texto secundario */
  /* Paleta "Oro" de la marca; palette.js la cambia en vivo */
  --accent: #D9A441;          /* acento de marca (decorativo) */
  --accent-text: #F0C46A;     /* acento legible en textos pequeños */
  --c1: #FFE6B3;              /* película iridiscente: cuatro tonos */
  --c2: #D9A441;
  --c3: #F6D58E;
  --c4: #B5865A;
  --accent-rgb: 217, 164, 65;
  --accent-text-rgb: 240, 196, 106;
  --c1-rgb: 255, 230, 179;
  --c2-rgb: 217, 164, 65;
  --c3-rgb: 246, 213, 142;
  --c4-rgb: 181, 134, 90;
  --line: rgba(243, 242, 239, .09);
  --line-2: rgba(243, 242, 239, .18);
  --line-3: rgba(243, 242, 239, .32);
  --glass: rgba(18, 20, 24, .55);
  --irid: linear-gradient(100deg, var(--c1) 0%, var(--c2) 28%, var(--c3) 56%, var(--c4) 78%, var(--c1) 100%);

  /* Tipografía */
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --f-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --fs-hero: clamp(3.6rem, 12vw, 13rem);
  --fs-giant: clamp(4.5rem, 17vw, 17rem);
  --fs-h2: clamp(2.2rem, 4.6vw, 4.6rem);
  --fs-h3: clamp(1.5rem, 2.3vw, 2.2rem);
  --fs-lead: clamp(1.1rem, 1.3vw, 1.3rem);
  --fs-body: 1.0625rem;
  --fs-sm: .9375rem;
  --fs-xs: .75rem;

  /* Espacio y movimiento */
  --gutter: clamp(20px, 4vw, 56px);
  --gap: clamp(16px, 2vw, 32px);
  --maxw: 1480px;
  --section: clamp(6rem, 12vw, 12rem);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.76, 0, .24, 1);
  --dur: .35s;

  color-scheme: dark;
  transition: --accent .9s ease, --accent-text .9s ease, --c1 .9s ease, --c2 .9s ease, --c3 .9s ease, --c4 .9s ease;
}

/* Colores registrados para que el cambio de paleta se anime */
@property --accent { syntax: "<color>"; inherits: true; initial-value: #D9A441; }
@property --accent-text { syntax: "<color>"; inherits: true; initial-value: #F0C46A; }
@property --c1 { syntax: "<color>"; inherits: true; initial-value: #FFE6B3; }
@property --c2 { syntax: "<color>"; inherits: true; initial-value: #D9A441; }
@property --c3 { syntax: "<color>"; inherits: true; initial-value: #F6D58E; }
@property --c4 { syntax: "<color>"; inherits: true; initial-value: #B5865A; }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--ink); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--pearl);
  font-family: var(--f-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

/* Grano de película sobre toda la página */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: .1;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' 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 1.2 -.1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

[hidden] { display: none !important; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, p, figure, dl, dd, ol, ul { margin: 0; }
ul, ol { padding: 0; }
::selection { background: var(--accent); color: var(--pearl); }

:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: fixed;
  left: max(16px, env(safe-area-inset-left, 0px));
  top: calc(12px + env(safe-area-inset-top, 0px));
  z-index: 120;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--pearl);
  color: var(--ink);
  transform: translateY(-200%);
  transition: transform var(--dur) var(--ease);
}
.skip:focus { transform: none; }

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* Lienzo de shader que llena su sección */
.fx-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.6s ease;
  pointer-events: none;
}
.fx-canvas.is-on { opacity: 1; }

/* ---------- Tipografía ---------- */
.mono { font-family: var(--f-mono); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--silver-2);
}
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 2px rgba(var(--accent-rgb), .6);
}

.label {
  display: block;
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--silver-2);
}

.h2 {
  font-family: var(--f-display);
  font-stretch: 110%;
  font-weight: 500;
  font-size: var(--fs-h2);
  line-height: 1;
  letter-spacing: -.045em;
  text-wrap: balance;
}

.irid {
  background: var(--irid);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: irid-shift 9s linear infinite;
}
@keyframes irid-shift { to { background-position: -220% 0; } }

.h2 em,
.hero__title em,
.contact__title em {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 300;
  font-stretch: normal;
  letter-spacing: -.02em;
  padding-right: .06em;
}
.h2 em { font-size: 1.1em; line-height: .9; }

/* ---------- Iconos ---------- */
.i { width: 16px; height: 16px; flex: none; }
.i--lg { width: 22px; height: 22px; }

/* ---------- Botones ---------- */
.btn {
  --btn-bg: var(--pearl);
  --btn-fg: var(--ink);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 54px;
  padding-inline: 28px;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--f-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: .01em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease), color .4s;
}
/* Brillo iridiscente que sigue al cursor dentro del botón */
.btn::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(140px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--c1-rgb), .9), rgba(var(--c2-rgb), .7) 35%, rgba(var(--c3-rgb), .45) 60%, transparent 75%);
  opacity: 0;
  transition: opacity .45s var(--ease);
}
.btn .i { transition: transform .5s var(--ease); }
@media (hover: hover) {
  .btn:hover::before { opacity: 1; }
  .btn:hover .i { transform: translateX(3px); }
}

.btn--primary { --btn-bg: var(--pearl); --btn-fg: var(--ink); box-shadow: 0 0 0 1px rgba(255, 255, 255, .2), 0 20px 50px -20px rgba(var(--accent-rgb), .55); }
.btn--glass {
  --btn-bg: rgba(243, 242, 239, .06);
  --btn-fg: var(--pearl);
  box-shadow: inset 0 0 0 1px var(--line-2);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.btn--glass::before { background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%), rgba(243, 242, 239, .18), transparent 70%); }

.btn--sm { height: 40px; padding-inline: 18px; font-size: .875rem; }
.btn--lg { height: 62px; font-size: 1rem; }
.btn--block { width: 100%; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  font-weight: 500;
  padding-bottom: 4px;
  background: linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat;
  transition: color .3s;
}
.link-arrow .i { transition: transform .5s var(--ease); }
@media (hover: hover) {
  .link-arrow:hover { color: var(--accent-text); }
  .link-arrow:hover .i { transform: translateX(4px); }
}

/* ---------- Indicador en vivo ---------- */
.live-dot {
  position: relative;
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-text);
  flex: none;
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: .7; }
  80%, 100% { transform: scale(3.4); opacity: 0; }
}

/* ---------- Navegación: píldora de vidrio ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  pointer-events: none;
  transition: transform .7s var(--ease);
}
.nav.is-hidden { transform: translateY(-140%); }
.nav__inner {
  pointer-events: auto;
  max-width: 1260px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 8px 8px 8px 20px;
  border-radius: 999px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--line), 0 20px 60px -30px rgba(0, 0, 0, .8);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
}

.brand { display: inline-flex; align-items: center; gap: 10px; justify-self: start; }
.brand__mark { width: 20px; height: 20px; fill: var(--accent); filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), .6)); transition: transform .9s var(--ease); }
.brand__name {
  font-family: var(--f-display);
  font-stretch: 118%;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -.04em;
}
@media (hover: hover) { .brand:hover .brand__mark { transform: rotate(90deg); } }

.nav__links { display: flex; justify-content: center; gap: 4px; font-size: .875rem; }
.nav__links a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--silver);
  transition: color .3s, background-color .3s;
}
@media (hover: hover) { .nav__links a:hover { color: var(--pearl); background: rgba(243, 242, 239, .07); } }

.nav__end { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.nav__clock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--silver-2);
  font-variant-numeric: tabular-nums;
}

.nav__menu {
  display: none;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(243, 242, 239, .08);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
}
.nav__menu-icon { position: relative; width: 18px; height: 8px; }
.nav__menu-icon::before,
.nav__menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transition: transform .5s var(--ease), top .5s var(--ease);
}
.nav__menu-icon::before { top: 0; }
.nav__menu-icon::after { top: 6.5px; }
.nav__menu[aria-expanded="true"] .nav__menu-icon::before { top: 3.25px; transform: rotate(45deg); }
.nav__menu[aria-expanded="true"] .nav__menu-icon::after { top: 3.25px; transform: rotate(-45deg); }

/* Menú móvil a pantalla completa */
.menu {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: calc(120px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  background: radial-gradient(120% 80% at 100% 0%, rgba(var(--accent-rgb), .22), transparent 60%), var(--ink);
  visibility: hidden;
  clip-path: inset(0 0 100% 0);
  transition: clip-path .9s var(--ease-io), visibility 0s linear .9s;
}
.menu.is-open { visibility: visible; clip-path: inset(0 0 0 0); transition: clip-path .9s var(--ease-io), visibility 0s; }
.menu__links { display: grid; gap: 2px; }
.menu__links a {
  font-family: var(--f-display);
  font-stretch: 118%;
  font-weight: 500;
  font-size: clamp(2.4rem, 11vw, 4.5rem);
  line-height: 1.06;
  letter-spacing: -.05em;
  transform: translateY(40px);
  opacity: 0;
  transition: transform .9s var(--ease), opacity .9s var(--ease), color .3s;
}
.menu.is-open .menu__links a { transform: none; opacity: 1; }
.menu.is-open .menu__links a:nth-child(2) { transition-delay: .05s; }
.menu.is-open .menu__links a:nth-child(3) { transition-delay: .1s; }
.menu.is-open .menu__links a:nth-child(4) { transition-delay: .15s; }
.menu.is-open .menu__links a:nth-child(5) { transition-delay: .2s; }
.menu.is-open .menu__links a:nth-child(6) { transition-delay: .25s; color: var(--accent-text); }
.menu__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  color: var(--silver-2);
}

@media (max-width: 1080px) {
  .nav__inner { grid-template-columns: auto minmax(0, 1fr); }
  .nav__links { display: none; }
  .nav__menu { display: inline-flex; }
}
.nav__clock { display: none; }
@media (max-width: 640px) { .nav__cta { display: none; } }

/* ---------- Aparición al hacer scroll ---------- */
.js [data-reveal] {
  transform: translateY(40px);
  opacity: .2;
  filter: blur(8px);
  transition:
    transform 1.2s var(--ease) var(--d, 0s),
    opacity 1.2s var(--ease) var(--d, 0s),
    filter 1.2s var(--ease) var(--d, 0s);
}
.js [data-reveal].is-in { transform: none; opacity: 1; filter: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
  .js [data-reveal] { transform: none; opacity: 1; filter: none; }
}
