:root {
  --bg: #040507;
  --bg-soft: #0d1117;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-strong: rgba(255, 255, 255, 0.1);
  --text: #f5f7fa;
  --muted: #8c94a3;
  --muted-strong: #aab2c2;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #2cff8f;
  --accent-2: #3fa2ff;
  --shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
  /* Valor de respaldo; script.js lo actualiza con la altura real del header */
  --header-h: 84px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: Inter, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(63, 162, 255, 0.14), transparent 24%),
    linear-gradient(135deg, #020304, var(--bg));
  color: var(--text);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

.site-shell {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  backdrop-filter: blur(12px);
  background: rgba(4, 5, 7, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 260ms ease;
  /* Tira hacia arriba al contenido siguiente (el hero) para que quede debajo
     del header, así el video de fondo se ve también a través del nav. */
  margin-bottom: calc(-1 * var(--header-h));
}

.topbar-inner {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.4rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Usar esta clase en el <img> del logo real (ver comentarios en index.html) */
.brand-logo {
  height: 3.1rem;
  width: auto;
  display: block;
}

.footer-logo {
  height: 2.4rem;
}

.topnav {
  display: flex;
  gap: 1.2rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 180ms ease;
}

.footer-links a:hover {
  color: var(--text);
}

.topnav a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 200ms ease;
}

.topnav a:hover {
  color: rgba(255, 255, 255, 1);
}

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.1fr 0.95fr;
  align-items: center;
  gap: 2rem;
  padding: calc(var(--header-h) + 2rem) 0 3rem;
}

.hero-bg {
  /* Full-bleed: se estira al ancho completo del viewport aunque .hero
     esté dentro del contenedor centrado de 1200px (.site-shell). */
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.55) saturate(0.9);
}

.hero-bg-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(63, 162, 255, 0.14), transparent 30%),
    linear-gradient(135deg, rgba(2, 3, 4, 0.5), rgba(4, 5, 7, 0.62));
}

.hero-copy,
.hero-visual {
  position: relative;
  z-index: 2;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.78rem;
  font-weight: 700;
}

.hero h1,
.section-heading h2,
.contact-copy h2,
.final-cta h2 {
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 1.04;
  margin: 0 0 0.6rem;
  letter-spacing: -0.03em;
}

.text-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-text,
.copy-panel p,
.contact-copy p,
.trust-stat p,
.site-footer p {
  color: var(--muted);
  max-width: 62ch;
}

.hero-text {
  margin: 0.9rem 0 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.4rem 0 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.9rem 1.3rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 220ms ease, box-shadow 220ms ease, background 220ms ease;
  border: 1px solid transparent;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #29d77f);
  color: #021106;
  box-shadow: 0 8px 30px rgba(44, 255, 143, 0.24);
}

.btn-secondary {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.btn-sm {
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 1.05rem 1.8rem;
  font-size: 1.05rem;
}

.hero-visual {
  position: relative;
  min-height: 620px;
  display: grid;
  place-items: center;
}

.phone-glow {
  position: absolute;
  inset: 12% 10% 8% 14%;
  background: radial-gradient(circle, rgba(44, 255, 143, 0.24), transparent 60%);
  filter: blur(24px);
}

.task-card {
  grid-area: 1 / 1;
  width: min(300px, 78vw);
  padding: 1.1rem;
  border-radius: 1.5rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  transition: transform 550ms ease, box-shadow 550ms ease;
}

/* script.js asigna data-pos (0 = al frente) para rotar el stack solo, cada
   4s, sin reordenar el DOM: así el cambio de tarjeta siempre es una
   transición suave en vez de un salto. */
.task-card[data-pos="0"] {
  z-index: 4;
  transform: rotate(0deg) translate(0, 0) scale(1);
}

.task-card[data-pos="1"] {
  z-index: 3;
  transform: rotate(6deg) translate(10%, -6%) scale(0.96);
}

.task-card[data-pos="2"] {
  z-index: 2;
  transform: rotate(-5deg) translate(-9%, 4%) scale(0.92);
}

.task-card[data-pos="3"] {
  z-index: 1;
  transform: rotate(10deg) translate(17%, 9%) scale(0.88);
}

.task-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.task-chip {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #021106;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

.task-comuna {
  font-size: 0.78rem;
  color: var(--muted-strong);
}

.task-title {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.task-date {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--muted-strong);
}

.applicant-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.applicant {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.applicant-avatar {
  flex-shrink: 0;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
}

.applicant-info {
  min-width: 0;
}

.applicant-name {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.verified-tag {
  display: inline-grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--accent);
  color: #021106;
  font-size: 0.65rem;
  font-weight: 900;
}

.applicant-msg {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--muted-strong);
  font-style: italic;
}

.applicant-rating {
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
}

.task-apply-btn {
  display: block;
  width: 100%;
  text-align: center;
  margin-bottom: 1rem;
}

.how-section,
.trust-section,
.contact-section {
  padding: 5rem 0 2rem;
}

.how-section {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  align-items: center;
}

.section-heading {
  margin-bottom: 2rem;
}

.section-heading.compact {
  margin-bottom: 1.4rem;
}

.switch-shell {
  display: inline-flex;
  gap: 0.6rem;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  margin-bottom: 2rem;
}

.toggle-option {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.8rem 1.2rem;
  border-radius: 999px;
  font-size: 0.98rem;
  cursor: pointer;
  transition: all 180ms ease;
}

.toggle-option.active {
  background: linear-gradient(135deg, var(--accent), #24db7e);
  color: #031008;
  box-shadow: 0 6px 20px rgba(44, 255, 143, 0.2);
}

.how-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

.how-copy-col {
  min-width: 0;
}

.copy-panel {
  display: none;
  animation: fadeUp 280ms ease;
}

.copy-panel.active {
  display: block;
}

.step-list {
  list-style: none;
  margin: 0;
  padding-left: 0;
  display: grid;
  gap: 1.1rem;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: transform 220ms ease, background 220ms ease, border-color 220ms ease;
}

.step:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.step-num {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #021106;
  font-weight: 800;
  font-size: 0.95rem;
}

.step h3 {
  margin: 0.1rem 0 0.2rem;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.step p {
  margin: 0;
  color: var(--muted);
}

.how-visual {
  position: relative;
  display: grid;
  place-items: center;
}

.visual-card {
  display: none;
  animation: fadeUp 280ms ease;
}

.visual-card.active {
  display: block;
}

.visual-phone {
  width: min(320px, 76vw);
  max-height: 78vh;
  aspect-ratio: 9 / 19.8;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.04));
  border-radius: 2.4rem;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow);
}

.visual-phone.alt {
  transform: rotate(6deg);
}

.visual-screen {
  flex: 1;
  min-height: 0;
  background: linear-gradient(160deg, rgba(5,7,10,0.96), rgba(20,23,30,0.96));
  border-radius: 1.6rem;
  overflow: hidden;
}

/* Video de flujo real dentro del marco de teléfono (ver comentarios en index.html) */
.screen-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.trust-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 0.8fr;
  gap: 1.2rem;
  align-items: center;
}

.trust-stat {
  padding: 1.2rem;
  border-radius: 1.4rem;
  background: linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
}

.trust-stat strong {
  display: inline-block;
  font-size: 1.6rem;
  margin-bottom: 0.6rem;
  color: var(--accent);
}

.trust-visual {
  display: grid;
  place-items: center;
  min-height: 260px;
}

.security-ring {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: conic-gradient(from 180deg, var(--accent), var(--accent-2), var(--accent));
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.45);
  animation: spin 8s linear infinite;
}

.ring-core {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(4,5,7,0.75), rgba(4,5,7,0.95));
  border: 1px solid rgba(255,255,255,0.09);
  display: grid;
  place-items: center;
  /* Contrarresta el giro del anillo exterior para que el ícono se vea fijo */
  animation: spin 8s linear infinite reverse;
}

.ring-icon {
  width: 42px;
  height: 42px;
  animation: pulse 3s ease-in-out infinite;
}

.final-cta {
  position: relative;
  padding: 5rem 0;
  text-align: center;
  overflow: hidden;
}

.final-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(44, 255, 143, 0.16), transparent 60%);
  pointer-events: none;
}

.final-cta-inner {
  position: relative;
  width: min(640px, 100%);
  margin: 0 auto;
}

.final-cta p {
  color: var(--muted);
  margin: 0 auto 1.6rem;
  max-width: 48ch;
}

.final-cta-note {
  margin: 1rem 0 0 !important;
  font-size: 0.85rem;
}

.contact-section {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 2rem;
  align-items: start;
  padding-bottom: 5rem;
}

.contact-form {
  display: grid;
  gap: 1rem;
  padding: 1.3rem;
  border-radius: 1.5rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.16);
  color: var(--text);
  padding: 0.8rem 0;
  font: inherit;
  outline: none;
  transition: border-color 180ms ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent);
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

.form-status {
  min-height: 1.4rem;
  margin: 0;
  color: var(--accent);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0 2rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 1.4rem;
  color: var(--muted);
}

.footer-about p {
  margin: 0.6rem 0 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.legal-shell {
  padding: 2rem 0 4rem;
}

.legal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.legal-shell h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
  margin-bottom: 1rem;
}

.legal-shell h2 {
  margin-top: 2rem;
  font-size: 1.2rem;
}

.legal-shell p,
.legal-shell li {
  color: var(--muted);
}

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.14);
    opacity: 1;
  }
}

.preloader {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(44, 255, 143, 0.14), transparent 55%),
    var(--bg);
  transition: opacity 420ms ease, visibility 420ms ease;
}

.preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-frame {
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 900px) {
  .hero,
  .how-grid,
  .contact-section,
  .trust-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(var(--header-h) + 1rem) 0 2rem;
    gap: 0.5rem;
  }

  /* Decorativo, no crítico: se quita en teléfono para despejar espacio */
  .hero .eyebrow {
    display: none;
  }

  .hero h1 {
    margin-bottom: 0.4rem;
  }

  .hero-text {
    margin-top: 0.6rem;
  }

  .hero-actions {
    margin-top: 1rem;
  }

  /* "auto" no alcanza: las tarjetas rotadas/desplazadas (data-pos 1-3) se salen
     de su caja sin transformar y chocan con .hero-actions si no se les da aire. */
  .hero-visual {
    min-height: 380px;
    margin-top: 1.5rem;
  }

  /* Abanico más compacto en mobile para que no se salga del stack */
  .task-card[data-pos="1"] {
    transform: rotate(4deg) translate(6%, -4%) scale(0.96);
  }

  .task-card[data-pos="2"] {
    transform: rotate(-3deg) translate(-6%, 3%) scale(0.92);
  }

  .task-card[data-pos="3"] {
    transform: rotate(6deg) translate(10%, 6%) scale(0.88);
  }

  .trust-grid {
    gap: 1rem;
  }

  .task-card {
    width: min(280px, 82vw);
  }

  .final-cta {
    padding: 3.5rem 0;
  }
}

@media (max-width: 640px) {
  .legal-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
  }

  .site-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.4rem;
  }

  .footer-about {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .footer-about p {
    margin: 0.5rem 0 0;
  }

  .footer-links {
    width: 100%;
    justify-content: center;
    gap: 0.7rem 1.3rem;
  }

  .topbar-inner {
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
  }

  .topnav {
    width: 100%;
    justify-content: space-between;
    gap: 0.6rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .switch-shell {
    width: 100%;
    justify-content: space-between;
  }

  .toggle-option {
    flex: 1;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .how-section,
  .trust-section,
  .contact-section {
    padding: 3rem 0 1.5rem;
  }

  .task-card {
    width: min(240px, 78vw);
    padding: 0.9rem;
  }

  .visual-phone {
    width: min(228px, 62vw);
    padding: 0.5rem;
    border-radius: 1.6rem;
  }

  .visual-screen {
    border-radius: 1.1rem;
  }

  .topbar.nav-hidden {
    transform: translateY(-100%);
  }
}
