html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

/* Fondo decorativo global: grilla de puntos difuminada en los bordes + orbes de color en movimiento lento */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -10;
  overflow: hidden;
  pointer-events: none;
}

.bg-decor::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(25, 37, 91, .35) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 15%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 55% at 50% 15%, #000 40%, transparent 100%);
  opacity: .4;
}

.dark .bg-decor::before {
  opacity: .5;
}

.bg-decor .orb {
  position: absolute;
  border-radius: 9999px;
  filter: blur(90px);
  opacity: .35;
  animation: orbFloat 24s ease-in-out infinite alternate;
}

.dark .bg-decor .orb {
  opacity: .2;
}

.bg-decor .orb-1 {
  width: 34rem;
  height: 34rem;
  top: -12rem;
  left: -10rem;
  background: radial-gradient(circle, #576dd1, transparent 70%);
}

.bg-decor .orb-2 {
  width: 30rem;
  height: 30rem;
  top: 20%;
  right: -12rem;
  background: radial-gradient(circle, #d7b56a, transparent 70%);
  animation-delay: -8s;
}

.bg-decor .orb-3 {
  width: 32rem;
  height: 32rem;
  bottom: -12rem;
  left: 20%;
  background: radial-gradient(circle, #19255b, transparent 70%);
  animation-delay: -16s;
}

@keyframes orbFloat {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(3%, 4%) scale(1.06); }
  100% { transform: translate(-3%, -2%) scale(0.97); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-decor .orb {
    animation: none;
  }
}

.project-card {
  animation: fadeIn .25s ease-out;
}

.social-dock.hero-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.social-float {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background: #fff;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .22);
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.dark .social-float {
  background: #1e293b;
}

.social-float:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 12px 24px rgba(15, 23, 42, .28);
}

.social-icon {
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
}

.social-whatsapp { border-color: #25d366; }
.social-instagram { border-color: #d94675; }
.social-facebook { border-color: #1877f2; }
.social-email { border-color: #ea4335; }

@keyframes socialToggleMotion {
  0%, 70%, 100% { transform: rotate(0deg); }
  74% { transform: rotate(-8deg); }
  78% { transform: rotate(8deg); }
  82% { transform: rotate(-5deg); }
  86% { transform: rotate(5deg); }
}

.social-toggle {
  width: 3.5rem;
  height: 3.5rem;
  border: 3px solid #fff;
  border-radius: 9999px;
  background: #19255b;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .28);
  transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.social-toggle:hover,
.social-toggle[aria-expanded="true"] {
  background: #131c44;
  transform: scale(1.06);
}

.social-toggle-icon {
  width: 1.25rem;
  height: 1.25rem;
  transition: transform .3s ease;
}

.social-toggle[aria-expanded="true"] .social-toggle-icon {
  transform: rotate(90deg);
}

@media (min-width: 768px) {
  .social-toggle {
    display: none;
  }

  .social-links {
    display: flex;
  }
}

@media (max-width: 767px) {
  .social-dock {
    left: 1.5rem;
    right: auto;
    bottom: 1.5rem;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: .625rem;
  }

  .social-links {
    display: none;
    gap: .625rem;
  }

  .social-dock.is-open .social-links {
    display: flex;
  }

  .social-links {
    align-items: center;
    transform: translateX(.2rem);
  }

  .social-float {
    width: 2.75rem;
    height: 2.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .social-toggle-icon {
    animation: none;
    transition: none;
  }
}

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background: rgba(25, 37, 91, .4);
  border-radius: 999px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero: fases del proceso que rotan automáticamente */
.hero-step-text {
  transition: opacity .35s ease, transform .35s ease;
}

.hero-step-text.is-hidden {
  opacity: 0;
  transform: translateY(6px);
}

.hero-step-dot {
  width: .4rem;
  height: .4rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, .3);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background-color .3s ease, width .3s ease;
}

.hero-step-dot.is-active {
  background: #d7b46a;
  width: 1.25rem;
}

@media (prefers-reduced-motion: reduce) {
  .hero-step-text {
    transition: none;
  }
  .hero-step-text.is-hidden {
    opacity: 1;
    transform: none;
  }
}

/* Pasarela automática de texto */
.marquee {
  overflow: hidden;
  white-space: nowrap;
  padding: .9rem 0;
}

.marquee-navy {
  background: #19255b;
}

.marquee-track {
  display: inline-flex;
  width: max-content;
  align-items: center;
  animation: marqueeLeft 45s linear infinite;
}

.marquee-track.marquee-track-right {
  animation-name: marqueeRight;
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

@keyframes marqueeLeft {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes marqueeRight {
  from { transform: translateX(-50%); }
  to { transform: translateX(0); }
}

.marquee-item {
  display: inline-block;
  padding: 0 1.5rem;
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .14em;
}

.marquee-navy .marquee-item {
  color: #ffffff;
}

.marquee-sep {
  display: inline-block;
  color: #d7b46a;
  font-weight: 700;
}

@media (max-width: 640px) {
  .marquee {
    padding: .65rem 0;
  }
  .marquee-item {
    padding: 0 1rem;
    font-size: .68rem;
    letter-spacing: .08em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track {
    animation: none;
  }
  .marquee {
    overflow-x: auto;
  }
}

/* Revelado progresivo de secciones al hacer scroll */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .6s cubic-bezier(.22, .61, .36, 1), transform .6s cubic-bezier(.22, .61, .36, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Galería de dispositivos de los casos de estudio: las capturas web van
   en un navegador y las de celular en un teléfono. Las capturas de página
   completa se recorren con scroll; las de una pantalla la llenan (.is-fit).
   Modos: .device-gallery-both (navegador + celular), -web y -mobile. */
.device-gallery {
  --device-surface: #ffffff;
  --device-border: #e2e8f0;
  --device-chrome: #e8ecf3;
  --device-url-bg: #ffffff;
  --device-muted: #64748b;
  --device-label: #94a3b8;
  --device-active: #2a3e98;
  --device-bezel: #0b1022;
  --device-scroll-thumb: rgba(19, 28, 68, .35);
  --device-scroll-thumb-hover: rgba(19, 28, 68, .55);
  --device-shadow: 0 30px 60px -20px rgba(19, 28, 68, .35);
}

.dark .device-gallery {
  --device-surface: #0f172a;
  --device-border: #1e293b;
  --device-chrome: #1e293b;
  --device-url-bg: #0f172a;
  --device-muted: #94a3b8;
  --device-label: #64748b;
  --device-active: #97a5e2;
  --device-scroll-thumb: rgba(203, 213, 225, .35);
  --device-scroll-thumb-hover: rgba(203, 213, 225, .6);
  --device-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7);
}

.device-scene {
  position: relative;
}

.device-gallery-both .device-scene {
  padding-right: 22%;
  padding-bottom: 6%;
}

/* Solo celular (apps móviles): el teléfono va centrado en un panel que
   ocupa el ancho del contenido. */
.device-gallery-mobile .device-scene {
  display: flex;
  justify-content: center;
  padding: 40px 16px;
  border-radius: 16px;
  background: var(--device-surface);
  border: 1px solid var(--device-border);
}

.device-browser {
  border-radius: 14px;
  overflow: hidden;
  background: var(--device-surface);
  border: 1px solid var(--device-border);
  box-shadow: var(--device-shadow);
}

.device-browser-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--device-chrome);
}

.device-dots {
  display: flex;
  gap: 6px;
}

.device-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.device-dots i:nth-child(1) { background: #f87171; }
.device-dots i:nth-child(2) { background: #fbbf24; }
.device-dots i:nth-child(3) { background: #34d399; }

.device-url {
  flex: 1;
  min-width: 0;
  max-width: 360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 7px;
  background: var(--device-url-bg);
  color: var(--device-muted);
  font-size: .75rem;
  white-space: nowrap;
  overflow: hidden;
}

.device-url svg {
  width: 12px;
  height: 12px;
  flex: none;
}

.device-screen {
  position: relative;
  max-width: 100%;
}

/* Proporción de una pantalla de escritorio (1440 × 816) */
.device-screen-web {
  aspect-ratio: 1440 / 816;
  background: var(--device-chrome);
}

.device-phone {
  width: min(300px, 70%);
  padding: 8px;
  border-radius: 34px;
  background: var(--device-bezel);
  box-shadow: var(--device-shadow), inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.device-gallery-both .device-phone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22%;
}

/* La proporción real la fija el generador según las capturas del proyecto */
.device-screen-phone {
  aspect-ratio: 9 / 20;
  border-radius: 26px;
  overflow: hidden;
  background: #000;
}

.device-scroller {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--device-scroll-thumb) transparent;
}

.device-scroller::-webkit-scrollbar { width: 10px; }
.device-scroller::-webkit-scrollbar-track { background: transparent; }
.device-scroller::-webkit-scrollbar-thumb {
  background: var(--device-scroll-thumb);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 999px;
}
.device-scroller::-webkit-scrollbar-thumb:hover {
  background: var(--device-scroll-thumb-hover);
  background-clip: padding-box;
}
.device-screen-phone .device-scroller::-webkit-scrollbar { width: 6px; }

.device-scroller:focus-visible {
  outline: 2px solid #d7b46a;
  outline-offset: -2px;
}

.device-scroller img {
  display: block;
  width: 100%;
  height: auto;
}

/* Captura de una sola pantalla: la llena sin scroll */
.device-scroller.is-fit {
  overflow: hidden;
}

.device-scroller.is-fit img {
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.device-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(19, 28, 68, .85);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
  animation: device-hint-nudge 1.8s ease-in-out infinite;
}

.device-hint[hidden] { display: none; }

.device-hint svg {
  width: 14px;
  height: 14px;
}

.device-screen-phone .device-hint {
  bottom: 12px;
  padding: 5px 9px;
  font-size: .62rem;
}

@keyframes device-hint-nudge {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 4px; }
}

.device-thumbs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 20px;
}

/* Las miniaturas web quedan bajo el navegador y las móviles bajo el
   celular: mismas columnas que la escena (78 % / 22 %). */
.device-gallery-both .device-thumbs {
  grid-template-columns: minmax(0, 78fr) minmax(0, 22fr);
}

.device-gallery-mobile .device-strip {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.device-thumb-row {
  display: grid;
  gap: 10px;
  align-content: start;
}

.device-thumb-row + .device-thumb-row {
  padding-left: 8px;
}

.device-row-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--device-label);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.device-row-label svg {
  width: 16px;
  height: 16px;
}

.device-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 3px 3px 6px;
}

.device-thumb {
  flex: none;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 9px;
  background: var(--device-surface);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}

.device-thumb:hover { transform: translateY(-2px); }
.device-thumb[aria-pressed="true"] { border-color: var(--device-active); }

.device-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.device-thumb-web { width: 112px; height: 64px; }
.device-thumb-mobile { width: 46px; height: 92px; }

/* En pantallas pequeñas el celular pasa debajo del navegador */
@media (max-width: 640px) {
  .device-gallery-both .device-scene {
    padding-right: 0;
    padding-bottom: 0;
  }
  .device-gallery-both .device-phone {
    position: relative;
    width: 58%;
    margin: 24px auto 0;
  }
  .device-gallery-mobile .device-scene {
    padding: 24px 16px;
  }
  .device-screen-web .device-hint {
    bottom: 10px;
    padding: 5px 10px;
    font-size: .65rem;
  }
  .device-gallery-both .device-thumbs {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .device-thumb-row + .device-thumb-row {
    padding-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .device-hint { animation: none; }
  .device-thumb { transition: none; }
}
