/* ?? Tokens ??????????????????????????????????????????????? */
:root {
  --bg: #ffffff;
  --teal: #23756c;
  --teal-deep: #1a5a54;
  --teal-light: #2f9a8f;
  --teal-shine: #4ec4b6;
  --ink: #1a2e2b;
  --space-xs: clamp(0.75rem, 2vw, 1rem);
  --space-sm: clamp(1rem, 3vw, 1.5rem);
  --space-md: clamp(1.5rem, 4vw, 2.25rem);
  --space-lg: clamp(2rem, 5vw, 3rem);
  --logo-vh: clamp(3.5rem, 10vw, 4.75rem);
  --logo-core: clamp(14.5rem, 58vw, 24rem);
  --box-w: clamp(16.5rem, 68vw, 24rem);
  --btn-w: clamp(11rem, 42vw, 14rem);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ?? Reset ???????????????????????????????????????????????? */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  overflow-x: hidden;
  position: relative;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ?? Background detail ???????????????????????????????????? */
.bg-detail {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("recursos/BackgroundDetalles.png");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: min(100vw, 48rem) auto;
  opacity: 0.85;
}

@media (min-width: 768px) {
  .bg-detail {
    background-size: cover;
    background-position: center;
  }
}

/* ?? Stage ???????????????????????????????????????????????? */
.stage {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding:
    max(var(--space-md), env(safe-area-inset-top))
    max(var(--space-sm), env(safe-area-inset-right))
    max(var(--space-lg), env(safe-area-inset-bottom))
    max(var(--space-sm), env(safe-area-inset-left));
  text-align: center;
}

/* ?? Brand / logos ???????????????????????????????????????? */
.brand {
  display: flex;
  justify-content: center;
}

.logo-vitalhealth {
  width: var(--logo-vh);
  height: auto;
  opacity: 0;
  animation: drop-soft 1.05s var(--ease-out) 0.18s forwards;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  width: min(100%, 32rem);
}

.logo-vitalcore {
  width: var(--logo-core);
  height: auto;
  opacity: 0;
  animation: drop-soft 1.05s var(--ease-out) 0.22s forwards;
}

.product-box {
  width: var(--box-w);
  height: auto;
  transform-origin: center bottom;
  will-change: transform, opacity, filter;
  opacity: 0;
  animation: box-launch 1.15s cubic-bezier(0.16, 1, 0.3, 1) 0.42s forwards;
}

/* ?? CTA button (metallic teal) ??????????????????????????? */
.cta {
  margin-top: 0.15rem;
  opacity: 0;
  animation: rise-in 0.95s var(--ease-out) 1.15s forwards;
}

.btn-guide {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--btn-w);
  min-height: 3.15rem;
  padding: 0.85rem 1.75rem;
  border: none;
  border-radius: 0.55rem;
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  font-family: inherit;
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffffff;
  background:
    linear-gradient(
      165deg,
      var(--teal-shine) 0%,
      var(--teal-light) 18%,
      var(--teal) 48%,
      var(--teal-deep) 82%,
      #0f3d39 100%
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 4px rgba(0, 0, 0, 0.22),
    0 8px 20px rgba(35, 117, 108, 0.28),
    0 2px 4px rgba(15, 61, 57, 0.2);
  transition:
    transform 0.35s var(--ease-out),
    box-shadow 0.35s var(--ease-out),
    filter 0.35s var(--ease-out);
}

.btn-guide__sheen {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(255, 255, 255, 0.28) 48%,
    transparent 62%
  );
  transform: translateX(-120%);
  animation: sheen 4.5s var(--ease-out) 1.4s infinite;
  pointer-events: none;
}

.btn-guide__label {
  position: relative;
  z-index: 1;
}

.btn-guide:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 4px rgba(0, 0, 0, 0.22),
    0 12px 28px rgba(35, 117, 108, 0.36),
    0 3px 6px rgba(15, 61, 57, 0.22);
}

.btn-guide:active {
  transform: translateY(1px);
  filter: brightness(0.97);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.28),
    0 4px 10px rgba(35, 117, 108, 0.2);
}

.btn-guide:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

/* ?? Motion ??????????????????????????????????????????????? */
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(1.1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drop-soft {
  from {
    opacity: 0;
    transform: translateY(-1.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Product reveal: aparece pequeño, “aterriza” con overshoot y sombra */
@keyframes box-launch {
  0% {
    opacity: 0;
    transform: translateY(-2.75rem) scale(0.28);
    filter: drop-shadow(0 4px 8px rgba(26, 90, 84, 0.05));
  }
  55% {
    opacity: 1;
    transform: translateY(0.35rem) scale(1.06);
    filter: drop-shadow(0 28px 36px rgba(26, 90, 84, 0.2));
  }
  75% {
    transform: translateY(-0.12rem) scale(0.985);
    filter: drop-shadow(0 16px 24px rgba(26, 90, 84, 0.14));
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 18px 28px rgba(26, 90, 84, 0.12));
  }
}

@keyframes sheen {
  0%,
  70% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo-vitalhealth,
  .logo-vitalcore,
  .product-box,
  .cta,
  .btn-guide__sheen {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .product-box {
    filter: drop-shadow(0 18px 28px rgba(26, 90, 84, 0.12));
  }

  .btn-guide {
    transition: none;
  }
}

/* ?? Responsive refinements ??????????????????????????????? */
@media (max-width: 380px) {
  .stage {
    gap: 0.65rem;
    justify-content: flex-start;
    padding-top: 1.75rem;
  }

  .btn-guide {
    min-height: 2.9rem;
    border-radius: 0.45rem;
  }
}

@media (min-width: 900px) {
  .stage {
    gap: 0.65rem;
  }

  .hero {
    gap: 0.25rem;
  }
}

@media (max-height: 720px) and (orientation: landscape) {
  .stage {
    justify-content: flex-start;
    padding-block: 1.25rem 2rem;
    gap: 0.75rem;
  }

  .logo-vitalhealth {
    width: 2.4rem;
  }

  .logo-vitalcore {
    width: min(12rem, 36vw);
  }

  .product-box {
    width: min(9.5rem, 28vw);
  }
}

/* Language gate */
body.is-picking-lang {
  overflow: hidden;
}

.lang-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(1.5rem, env(safe-area-inset-top))
    max(1.25rem, env(safe-area-inset-right))
    max(1.5rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: rise-in 0.55s var(--ease-out) both;
}

.lang-gate[hidden] {
  display: none;
}

.lang-gate__panel {
  width: min(100%, 22rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-align: center;
}

.lang-gate__logo {
  width: clamp(3.25rem, 12vw, 4.25rem);
  height: auto;
  margin-bottom: 0.35rem;
}

.lang-gate__title {
  font-size: clamp(1.35rem, 4.5vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.lang-gate__hint {
  font-size: 0.92rem;
  font-weight: 400;
  color: rgba(26, 46, 43, 0.55);
  margin-bottom: 0.5rem;
}

.lang-gate__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 3.15rem;
  padding: 0.8rem 1.25rem;
  border: 1px solid rgba(35, 117, 108, 0.22);
  border-radius: 0.55rem;
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(26, 90, 84, 0.08);
  transition:
    transform 0.3s var(--ease-out),
    border-color 0.3s var(--ease-out),
    box-shadow 0.3s var(--ease-out),
    background 0.3s var(--ease-out);
}

.lang-btn__flag {
  display: inline-flex;
  flex-shrink: 0;
  border-radius: 0.2rem;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.lang-btn__flag svg {
  display: block;
}

.lang-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(35, 117, 108, 0.45);
  box-shadow: 0 12px 28px rgba(35, 117, 108, 0.14);
}

.lang-btn:active {
  transform: translateY(0);
}

.lang-btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.lang-switch {
  margin-top: 0.35rem;
  border: none;
  background: transparent;
  color: rgba(26, 46, 43, 0.45);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.25s ease;
}

.lang-switch:hover {
  color: var(--teal);
}

.lang-switch:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

@media (min-width: 560px) {
  .lang-gate__actions {
    flex-direction: row;
  }

  .lang-btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lang-gate {
    animation: none;
  }

  .lang-btn {
    transition: none;
  }
}
