/* ==========================================================================
   Salty · link in bio
   ========================================================================== */

/* Si tienes la licencia de Agrandir (la fuente de tu diseño), copia el
   archivo a /fonts y descomenta este bloque. Mientras, se usa Outfit.

@font-face {
  font-family: "Agrandir";
  src: url("../fonts/Agrandir-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
*/

:root {
  /* Marca */
  --orange: #fc7514;
  --ink: #111111;
  --muted: #929292;
  --bg: #ffffff;
  --social: var(--orange);      /* iconos TikTok / Instagram / YouTube */
  --yt-play: #ffffff;           /* triángulo del icono de YouTube */
  --avatar-ring: rgb(0 0 0 / 0.06);

  /* Superficie y forma */
  --radius: 14px;
  --gap: clamp(14px, 4.2vw, 20px);
  --gutter: clamp(16px, 5.5vw, 28px);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 10px 28px -14px rgb(0 0 0 / 0.28);
  --shadow-hover: 0 2px 4px rgb(0 0 0 / 0.05), 0 18px 36px -16px rgb(0 0 0 / 0.32);
  --social-hover: rgb(252 117 20 / 0.08);

  /* Movimiento */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1); /* curva de las hojas de iOS */

  --font: "Agrandir", "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Tema oscuro: se activa solo si el móvil/ordenador del usuario está en modo oscuro */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #2e2d2d;
    --ink: #ffffff;
    --muted: #c9c9c9;
    --social: #f2f2f2;
    --yt-play: #2e2d2d;
    --avatar-ring: rgb(255 255 255 / 0.1);
    --social-hover: rgb(255 255 255 / 0.08);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.2), 0 12px 30px -14px rgb(0 0 0 / 0.6);
    --shadow-hover: 0 2px 4px rgb(0 0 0 / 0.25), 0 20px 38px -16px rgb(0 0 0 / 0.7);
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scrollbar-gutter: stable; /* evita el salto al bloquear el scroll */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

img,
svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

/* ── Página ───────────────────────────────────────────── */

.page {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding:
    calc(clamp(36px, 11vw, 64px) + env(safe-area-inset-top))
    calc(var(--gutter) + env(safe-area-inset-right))
    calc(48px + env(safe-area-inset-bottom))
    calc(var(--gutter) + env(safe-area-inset-left));
  transform-origin: 50% 0;
  transition: transform 0.5s var(--ease-sheet), filter 0.5s var(--ease-sheet);
}

/* ── Perfil ───────────────────────────────────────────── */

.profile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 7vw, 32px);
  margin-bottom: clamp(26px, 8vw, 36px);
}

.profile__avatar {
  flex: none;
  width: clamp(104px, 34vw, 140px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--avatar-ring);
}

.profile__info {
  display: grid;
  gap: clamp(6px, 2vw, 10px);
  min-width: 0;
}

.profile__name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: clamp(26px, 8.2vw, 34px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}

.profile__badge {
  width: 0.72em;
  height: 0.72em;
  margin-top: 0.06em;
}

.profile__followers {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: clamp(19px, 6vw, 24px);
  line-height: 1;
}

.profile__people {
  width: 1.45em;
  height: 1.45em;
  fill: var(--muted);
  flex: none;
}

.profile__social {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: -8px; /* compensa el área táctil para alinear con el texto */
  color: var(--social);
}

/* Área táctil de 44px aunque el icono sea más pequeño */
.profile__social a {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0 6px;
  border-radius: 12px;
  transition: transform 0.2s var(--ease-out), background-color 0.2s;
}

.profile__social svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.profile__social svg[fill="none"] { fill: none; } /* iconos de contorno (Instagram) */
.profile__social a:last-child svg { width: 30px; }
.profile__social .yt-play { fill: var(--yt-play); }

@media (hover: hover) {
  .profile__social a:hover { background: var(--social-hover); }
}
.profile__social a:active { transform: scale(0.9); }

/* ── Contador (odómetro) ──────────────────────────────── */

.counter {
  display: inline-flex;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  height: 1em;
  overflow: hidden;
}

.counter__col {
  position: relative;
  display: block;
  height: 1em;
  overflow: hidden;
}

.counter__strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.counter__strip > span {
  display: block;
  height: 1em;
  text-align: center;
}

.counter__sep { display: block; }

/* ── Cupón principal ──────────────────────────────────── */

.promo {
  position: relative;
  display: block;
  isolation: isolate;
  margin-bottom: var(--gap);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 0 0 rgb(252 117 20 / 0);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
  animation: promo-glow 3.6s ease-in-out infinite;
}

.promo img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* Contorno de luz que recorre el borde */
.promo::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: calc(var(--radius) + 2px);
  background: conic-gradient(
    from var(--angle, 0deg),
    transparent 0deg 250deg,
    rgb(252 117 20 / 0.15) 280deg,
    #ff9a3d 330deg,
    #fff3e6 350deg,
    transparent 360deg
  );
  animation: promo-border 3.6s linear infinite;
}

/* Reflejo que cruza la tarjeta */
.promo__shine {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: var(--radius);
  pointer-events: none;
}

.promo__shine::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 38%;
  background: linear-gradient(
    100deg,
    rgb(255 255 255 / 0) 0%,
    rgb(255 255 255 / 0.15) 35%,
    rgb(255 255 255 / 0.75) 50%,
    rgb(255 255 255 / 0.15) 65%,
    rgb(255 255 255 / 0) 100%
  );
  mix-blend-mode: soft-light;
  transform: translateX(-130%) skewX(-18deg);
  animation: promo-shine 3.6s var(--ease-out) infinite;
}

/* Una segunda capa, normal, para que el reflejo se note también en la zona blanca */
.promo__shine::before {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 14%;
  background: linear-gradient(100deg, transparent, rgb(255 236 214 / 0.55), transparent);
  transform: translateX(-130%) skewX(-18deg);
  animation: promo-shine 3.6s var(--ease-out) infinite;
  animation-delay: 0.06s;
}

@property --angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes promo-border {
  to { --angle: 360deg; }
}

@keyframes promo-shine {
  0%   { transform: translateX(-130%) skewX(-18deg); }
  45%  { transform: translateX(330%) skewX(-18deg); }
  100% { transform: translateX(330%) skewX(-18deg); }
}

@keyframes promo-glow {
  0%, 100% { box-shadow: var(--shadow), 0 0 0 0 rgb(252 117 20 / 0); }
  50%      { box-shadow: var(--shadow), 0 8px 34px -8px rgb(252 117 20 / 0.45); }
}

@media (hover: hover) {
  .promo:hover { transform: translateY(-2px) scale(1.01); }
}
.promo:active {
  transform: scale(0.98);
  transition-duration: 0.12s;
}

/* ── Rejilla de enlaces ───────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}

.tile {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}

.tile img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

@media (hover: hover) {
  .tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
  }
}
.tile:active {
  transform: scale(0.96);
  transition-duration: 0.12s;
}

/* ── Entrada escalonada al cargar ─────────────────────── */

.js .profile { animation: rise 0.6s var(--ease-out) both; }
.js .promo   { animation: rise 0.6s var(--ease-out) 0.08s both, promo-glow 3.6s ease-in-out 0.7s infinite; }
.js .tile    { animation: rise 0.6s var(--ease-out) both; }
.js .tile:nth-child(1) { animation-delay: 0.16s; }
.js .tile:nth-child(2) { animation-delay: 0.22s; }
.js .tile:nth-child(3) { animation-delay: 0.28s; }
.js .tile:nth-child(4) { animation-delay: 0.34s; }

/* Usa "translate" (no "transform") para no pisar los efectos hover/pulsación */
@keyframes rise {
  from { opacity: 0; translate: 0 14px; }
  to   { opacity: 1; translate: 0 0; }
}

/* ── Ventana de registro (hoja inferior en móvil) ─────── */

html.is-locked { overflow: hidden; }

/* La página "retrocede" detrás de la hoja, como en iOS */
html.sheet-open .page {
  transform: scale(0.94);
  filter: brightness(0.92);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 0.5s; /* se oculta al terminar de bajar */
}

.sheet.is-open {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(12 8 4 / 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.45s var(--ease-sheet);
  touch-action: none;
}

.sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(100dvh - max(28px, env(safe-area-inset-top) + 12px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 40px rgb(0 0 0 / 0.18);
  overflow: hidden;
  transform: translate3d(0, 100%, 0);
  transition: transform 0.5s var(--ease-sheet);
  will-change: transform;
}

.sheet.is-open .sheet__backdrop { opacity: 1; }
.sheet.is-open .sheet__panel { transform: translate3d(0, 0, 0); }
.sheet.is-dragging .sheet__panel,
.sheet.is-dragging .sheet__backdrop { transition: none; }

.sheet__bar {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 56px;
  padding: 10px 8px 0 16px;
  border-bottom: 1px solid rgb(0 0 0 / 0.06);
  touch-action: none; /* permite arrastrar para cerrar */
  cursor: grab;
  user-select: none;
}

.sheet__grabber {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 38px;
  height: 5px;
  margin-left: -19px;
  border-radius: 3px;
  background: rgb(0 0 0 / 0.16);
}

.sheet__title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 15px;
  font-weight: 500;
  color: #444;
}

.sheet__title svg {
  width: 16px;
  height: 16px;
  fill: #22a559;
  flex: none;
}

.sheet__ext,
.sheet__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #333;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s var(--ease-out);
}

.sheet__ext svg { width: 19px; height: 19px; fill: currentColor; }
.sheet__close svg { width: 20px; height: 20px; fill: currentColor; }

.sheet__close { background: rgb(0 0 0 / 0.05); }

@media (hover: hover) {
  .sheet__ext:hover,
  .sheet__close:hover { background: rgb(0 0 0 / 0.08); }
}
.sheet__ext:active,
.sheet__close:active { transform: scale(0.9); }

.sheet__body {
  position: relative;
  flex: 1;
  background: #fff;
}

.sheet__body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.sheet__body.is-loaded iframe { opacity: 1; }

.sheet__loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity 0.3s;
}

.sheet__body.is-loaded .sheet__loader { opacity: 0; pointer-events: none; }

.sheet__loader span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgb(252 117 20 / 0.2);
  border-top-color: var(--orange);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* En tablet/escritorio: un "móvil" centrado para que la web cargue en versión mobile */
@media (min-width: 640px) {
  .sheet__panel {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: 400px;
    height: min(860px, calc(100dvh - 48px));
    border-radius: 28px;
    box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.45), 0 0 0 1px rgb(0 0 0 / 0.06);
    opacity: 0;
    transform: translate3d(-50%, -46%, 0) scale(0.94);
    transition: transform 0.5s var(--ease-sheet), opacity 0.3s ease;
  }

  .sheet.is-open .sheet__panel {
    opacity: 1;
    transform: translate3d(-50%, -50%, 0) scale(1);
  }

  .sheet__bar { cursor: default; padding-top: 0; height: 52px; }
  .sheet__grabber { display: none; }

  html.sheet-open .page { transform: scale(0.97); }
}

/* ── Aviso para el navegador interno de TikTok ───────── */

.inapp,
.inapp-arrows { display: none; }

.in-tiktok .promo,
.in-tiktok .grid { display: none; }

.in-tiktok .inapp {
  display: block;
  padding: clamp(22px, 7vw, 30px) clamp(20px, 7vw, 32px) clamp(26px, 8vw, 36px);
  border-radius: clamp(20px, 6vw, 26px);
  background: #5c5c5c;
  color: #fff;
  box-shadow: var(--shadow);
}

.js.in-tiktok .inapp { animation: rise 0.6s var(--ease-out) 0.08s both; }

.inapp__lock {
  width: clamp(44px, 13vw, 54px);
  height: auto;
  margin: 0 auto clamp(16px, 5vw, 22px);
  fill: #fff;
}

.inapp__title {
  margin: 0 0 clamp(16px, 5vw, 22px);
  font-size: clamp(21px, 6.4vw, 27px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-align: center;
}

.inapp__steps {
  display: grid;
  gap: 0.75em;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: clamp(16px, 4.8vw, 20px);
  line-height: 1.35;
}

.inapp__steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.6em;
}

.inapp__num {
  display: grid;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  margin-top: -0.12em;
  border: 1.5px solid #fff;
  border-radius: 50%;
  font-size: 0.95em;
  line-height: 1;
}

.inapp__steps strong {
  font-weight: 400;
  color: #76ff60;
}

/* Los tres puntos dibujados, como el botón real de TikTok */
.inapp__dots {
  display: inline-flex;
  gap: 0.16em;
  margin: 0 0.25em;
  vertical-align: middle;
}

.inapp__dots i {
  width: 0.24em;
  height: 0.24em;
  border-radius: 50%;
  background: currentColor;
}

.in-tiktok .inapp-arrows {
  display: block;
  position: fixed;
  z-index: 50;
  top: calc(8px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  width: clamp(26px, 8vw, 34px);
  height: auto;
  overflow: visible;
  pointer-events: none;
  animation: arrows-bob 1.4s var(--ease-out) infinite;
}

/* Se iluminan de abajo arriba, en cascada, señalando el menú ··· */
.inapp-arrows path { animation: arrows-chase 1.4s ease-in-out infinite; }
.inapp-arrows__a1 { fill: #75ff60; animation-delay: 0.4s !important; }
.inapp-arrows__a2 { fill: #62ca53; animation-delay: 0.2s !important; }
.inapp-arrows__a3 { fill: #519445; animation-delay: 0s !important; }

@keyframes arrows-chase {
  0%, 100% { opacity: 0.35; }
  35%      { opacity: 1; }
}

@keyframes arrows-bob {
  0%, 100% { transform: translateY(0); }
  45%      { transform: translateY(-8px); }
}

/* ── Movimiento reducido ──────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .promo__shine { display: none; }
  html.sheet-open .page { transform: none; }
}
