/* ==========================================================================
   guipereira.cl — mobile-first
   ========================================================================== */

:root {
  --paper: #f3eee4;
  --paper-2: #fbf8f2;
  --ink: #17162a;
  --muted: #5d5a6e;
  --line: rgba(23, 22, 42, 0.14);

  --blue: #2f4bff;
  --orange: #ff5a1f;
  --yellow: #ffc21a;
  --pink: #ff5fa8;

  --font: "Bricolage Grotesque", system-ui, sans-serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --gutter: 20px;
  --max: 1320px;
  --shadow: 3px 3px 0 var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  overflow-x: clip;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  font-variation-settings: "opsz" 16;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--yellow); color: var(--ink); }

/* Subrayado de plumón: el gesto gráfico del sitio */
mark {
  color: inherit;
  background: linear-gradient(transparent 56%, var(--hl, var(--yellow)) 56% 90%, transparent 90%);
  padding: 0 0.06em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

a, button { touch-action: manipulation; }
button, .btn, .pill, .dock, .mark, .st, .tool {
  -webkit-user-select: none;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
}
.skip:focus { top: 12px; }

/* ---------- Fondo vivo ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.bg canvas {
  width: 100%;
  height: 100%;
  display: block;
}
/* Trama: tenue en toda la página, más marcada alrededor del puntero */
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(23, 22, 42, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 22, 42, 0.09) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(circle 240px at var(--mx, 70%) var(--my, 30%), #000, rgba(0, 0, 0, 0.28));
  mask-image: radial-gradient(circle 240px at var(--mx, 70%) var(--my, 30%), #000, rgba(0, 0, 0, 0.28));
}

/* ---------- Topbar ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) var(--gutter) 12px;
  background: rgba(243, 238, 228, 0.88);
  border-bottom: 1.5px solid transparent;
  transition: border-color 200ms ease;
}
.topbar.is-scrolled { border-bottom-color: var(--ink); }
.mark {
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.05em;
}
.mark span { color: var(--orange); }
.topnav { display: none; }

/* ---------- Stickers & etiquetas ---------- */
.stickers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.st, .label {
  display: inline-block;
  padding: 5px 12px 6px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: 2px 2px 0 var(--ink);
}
.stickers .st:nth-child(odd) { rotate: -2deg; }
.stickers .st:nth-child(even) { rotate: 1.5deg; }
.st--yellow { background: var(--yellow); }
.st--blue { background: var(--blue); color: var(--paper); }
.st--pink { background: var(--pink); }
.st--plain { background: var(--paper-2); }
.label { rotate: -2deg; }

/* ---------- Pills & buttons ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 16px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  background: var(--paper-2);
  transition: transform 160ms var(--ease-out), background-color 200ms ease, box-shadow 160ms var(--ease-out);
}
.pill:active { transform: scale(0.97); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 24px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-weight: 700;
  font-size: 17px;
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background-color 200ms ease;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn--primary { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 var(--orange); }
.btn--primary:active { box-shadow: 0 0 0 var(--orange); }
.btn--primary svg { transition: transform 200ms var(--ease-out); }
.btn--ghost { background: var(--paper-2); box-shadow: var(--shadow); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 22px;
  padding: calc(88px + env(safe-area-inset-top, 0px)) var(--gutter) 36px;
  max-width: var(--max);
  margin: 0 auto;
}

.name {
  margin: 0;
  font-weight: 800;
  font-size: min(18.5vw, 15rem); /* site.js lo ajusta al ancho exacto */
  line-height: 0.84;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 96, "wdth" 75;
  text-transform: uppercase;
}
.name__line { display: block; width: max-content; white-space: nowrap; }
.name__line--alt { padding-left: 0.08em; }
.name em { font-style: normal; color: var(--orange); }

/* Letras arrastrables (las crea site.js) */
.l {
  display: inline-block;
  cursor: grab;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  will-change: transform;
  transition: color 200ms ease;
}
.l:active { cursor: grabbing; }
.l__i { display: inline-block; }
.is-ready .l__i {
  animation: rise 900ms var(--ease-out) both;
  animation-delay: calc(var(--i) * 45ms + 80ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(60%) rotate(6deg); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
.l.is-hot { color: var(--hot, var(--blue)); }

.hero__row {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.portrait {
  width: 104px;
  height: 104px;
  margin: 0;
  flex: none;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: var(--shadow);
  overflow: hidden;
  rotate: -4deg;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.lede {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 450;
  letter-spacing: -0.01em;
  max-width: 36ch;
  text-wrap: pretty;
}
.swap__word {
  font-weight: 650;
  transition: opacity 260ms ease, filter 260ms ease;
}
.swap__word.is-out { opacity: 0; filter: blur(4px); }

.hero__ctas {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.hint { margin: 0; font-size: 14px; color: var(--muted); }
.hint__desk { display: none; }

/* ---------- Cifras ---------- */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px var(--gutter) 0;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1.5px solid var(--ink);
  border-radius: 20px;
  background: var(--paper-2);
}
.stat strong {
  font-size: 56px;
  line-height: 0.9;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-variation-settings: "opsz" 96, "wdth" 75;
}
.stat:nth-child(1) strong { color: var(--orange); }
.stat:nth-child(2) strong { color: var(--blue); }
.stat:nth-child(3) strong { color: var(--pink); }
.stat:nth-child(4) strong { color: #c88f00; }
.stat span { font-size: 14px; line-height: 1.3; color: var(--muted); }

/* ---------- Marquee ---------- */
.marquee {
  position: relative;
  overflow: hidden;
  padding: 16px 0;
  background: var(--ink);
  color: var(--paper);
  transform: rotate(-2deg) scale(1.04);
  margin: 64px 0 8px;
}
.marquee__track {
  display: flex;
  width: max-content;
  gap: 24px;
  align-items: center;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 48, "wdth" 85;
  animation: marquee 32s linear infinite;
}
.marquee__track span { white-space: nowrap; }
.marquee__track span:nth-of-type(8n + 1) { color: var(--yellow); }
.marquee__track i { font-style: normal; font-size: 22px; }
.marquee__track i:nth-of-type(4n + 1) { color: var(--orange); }
.marquee__track i:nth-of-type(4n + 2) { color: var(--yellow); }
.marquee__track i:nth-of-type(4n + 3) { color: var(--pink); }
.marquee__track i:nth-of-type(4n + 4) { color: #7f93ff; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Secciones ---------- */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 96px var(--gutter) 24px;
}
.section__head { margin-bottom: 28px; }
.title {
  margin: 16px 0 0;
  font-size: clamp(40px, 11vw, 104px);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 96, "wdth" 85;
  text-wrap: balance;
}
.hub { --hl: var(--yellow); }
.hitos { --hl: var(--pink); }

/* Revelado al hacer scroll */
[data-reveal] {
  transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out), clip-path 900ms var(--ease-out);
}
.js [data-reveal]:not(.is-in) {
  opacity: 0;
  transform: translateY(24px);
}
.js .title[data-reveal]:not(.is-in) { clip-path: inset(0 0 100% 0); }
.title[data-reveal] { clip-path: inset(-0.2em -0.2em -0.2em -0.2em); }

/* ---------- Herramientas ---------- */
.tool {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  background: var(--paper-2);
  border: 1.5px solid var(--ink);
  border-radius: 28px;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out), opacity 800ms var(--ease-out);
}
.tool:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.tool__top { display: flex; justify-content: space-between; align-items: center; }
.tool__badge {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 700;
}
.tool__go {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--blue);
  color: var(--paper);
  transition: transform 240ms var(--ease-out);
}
.tool__go svg { width: 24px; height: 24px; }
.tool__title {
  margin-top: 28px;
  font-size: clamp(36px, 10vw, 88px);
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 96, "wdth" 80;
  text-wrap: balance;
}
.tool__desc { font-size: 17px; color: var(--muted); max-width: 52ch; }
.tool__cta {
  align-self: flex-start;
  font-weight: 700;
  --hl: var(--yellow);
  background: linear-gradient(transparent 56%, var(--yellow) 56% 90%, transparent 90%);
}

/* ---------- Hitos ---------- */
.hitos__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 84%;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  margin: 0 calc(var(--gutter) * -1);
  padding: 6px var(--gutter) 12px;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}
.hitos__track::-webkit-scrollbar { display: none; }
.hito {
  position: relative;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 400px;
  padding: 24px;
  border: 1.5px solid var(--ink);
  border-radius: 28px;
  box-shadow: 4px 4px 0 var(--ink);
}
.hito--yellow { background: var(--yellow); }
.hito--blue { background: var(--blue); color: var(--paper); }
.hito--orange { background: var(--orange); }
.hito--pink { background: var(--pink); }
.hito__flags {
  position: absolute; top: 20px; right: 20px;
  display: flex; gap: 6px;
}
.flag {
  display: block; width: 30px; height: 20px;
  border: 1.5px solid var(--ink); border-radius: 4px;
  box-shadow: 2px 2px 0 var(--ink);
}
.hito__k { margin: 0; padding-right: 76px; font-size: 15px; font-weight: 600; }
.hito__big {
  margin: auto 0 0;
  font-size: 108px;
  line-height: 0.85;
  font-weight: 800;
  letter-spacing: -0.05em;
  font-variation-settings: "opsz" 96, "wdth" 75;
}
.hito__title { margin: 8px 0 0; font-size: 24px; line-height: 1.1; letter-spacing: -0.02em; }
.hito__desc { margin: 0; font-size: 15px; line-height: 1.4; opacity: 0.85; }
.hito__link {
  align-self: flex-start;
  margin-top: 6px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.hitos__dots { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }
.hitos__dots i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(23, 22, 42, 0.2);
  transition: width 240ms var(--ease-out), background-color 240ms ease;
}
.hitos__dots i.is-on { width: 22px; background: var(--ink); }

/* ---------- Cierre ---------- */
.outro { padding-top: 120px; padding-bottom: 64px; --hl: var(--yellow); }
.outro__title {
  margin: 16px 0 20px;
  font-size: clamp(56px, 17vw, 200px);
  line-height: 0.88;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 96, "wdth" 75;
  text-transform: uppercase;
}
.outro__title a { position: relative; display: inline-block; }
.outro__line { display: block; }
.outro__go {
  display: inline-grid;
  place-items: center;
  width: 0.72em;
  height: 0.72em;
  margin-left: 0.08em;
  vertical-align: -0.04em;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--orange);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 300ms var(--ease-out);
}
.outro__go svg { width: 50%; height: 50%; }
.outro__title a:active .outro__go { transform: scale(0.94) rotate(45deg); }
.outro__note { margin: 0 0 20px; font-size: 19px; max-width: 40ch; }
.outro__alt { display: flex; flex-wrap: wrap; gap: 8px; }


/* ---------- Footer ---------- */
.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--gutter) calc(112px + env(safe-area-inset-bottom, 0px));
  border-top: 1.5px solid var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}
.footer p { margin: 0; }
.footer a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Dock (CTA móvil) ---------- */
.dock {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 12px 32px rgba(23, 22, 42, 0.35);
  transform: translateY(calc(100% + 24px));
  opacity: 0;
  transition: transform 420ms var(--ease-out), opacity 300ms ease;
}
.dock.is-shown { transform: none; opacity: 1; }
.dock.is-shown:active { transform: scale(0.98); transition-duration: 160ms; }
.dock__avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--yellow); }
.dock__text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.dock__text strong { font-size: 15px; font-weight: 700; }
.dock__text small { font-size: 13px; opacity: 0.7; }
.dock__go {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 800;
}

/* ==========================================================================
   Tablet & escritorio
   ========================================================================== */
@media (min-width: 720px) {
  .tool { padding: 40px; }
  :root { --gutter: 40px; }
  .hero__row { flex-direction: row; align-items: flex-end; gap: 32px; }
  .portrait { width: 168px; height: 168px; }
  .hero__copy { max-width: 620px; }
  .lede { font-size: 28px; }
  .hero__ctas { flex-direction: row; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .stat { padding: 20px; }
  .stat strong { font-size: 76px; }
  .hitos__track { grid-auto-columns: calc((100% - 28px) / 2.2); }
  .footer { flex-direction: row; justify-content: space-between; padding-bottom: 32px; }
  .dock { display: none; }
}

@media (min-width: 1024px) {
  .topnav { display: flex; gap: 28px; font-size: 16px; font-weight: 600; }
  .topnav a { color: var(--muted); transition: color 200ms ease; }
  .hitos__track { grid-auto-columns: calc((100% - 42px) / 3.3); }
}

@media (min-width: 1280px) {
  .hitos__track {
    grid-auto-flow: row;
    grid-template-columns: repeat(5, 1fr);
    overflow: visible;
    margin: 0;
    padding: 0 0 6px;
  }
  .hito { min-height: 460px; }
  .hitos__dots { display: none; }
}

/* ---------- Hover solo en puntero fino ---------- */
@media (hover: hover) and (pointer: fine) {
  .hint__desk { display: inline; }
  .hint__touch { display: none; }

  .pill:hover { box-shadow: var(--shadow); transform: translate(-1px, -1px); }
  .btn:hover { transform: translate(-1px, -1px); }
  .btn--primary:hover { box-shadow: 5px 5px 0 var(--orange); }
  .btn--primary:hover svg { transform: translate(2px, -2px); }
  .btn--ghost:hover { box-shadow: 5px 5px 0 var(--ink); }
  .topnav a:hover { color: var(--ink); }
  .tool:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
  .tool:hover .tool__go { transform: translateX(4px); }


  .outro__title a:hover .outro__go { transform: rotate(45deg); }

}

/* ---------- Movimiento reducido: sin desplazamientos, solo opacidad ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .is-ready .l__i { animation: fade 300ms ease both; }
  @keyframes fade { from { opacity: 0; } }
  .marquee__track { animation: none; }
  .js [data-reveal]:not(.is-in) { transform: none; clip-path: none; }
  .swap__word.is-out { filter: none; }
}
