/* ==========================================================================
   Javi Villanueva Web — hoja de estilos principal
   CSS puro, sin frameworks (sin Bootstrap / Tailwind).
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-alt: #f7f7f7;
  --text: #111111;
  --text-secondary: #555555;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;

  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --header-height: 92px;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}
ul,
ol {
  padding: 0;
  list-style: none;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}
::selection {
  background: var(--primary);
  color: #fff;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.container.medium {
  max-width: 1000px;
}
.container.narrow {
  max-width: 800px;
}
.center {
  text-align: center;
}

h1 {
  font-size: clamp(40px, 5.5vw, 64px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
}
h2 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 60px;
}
h3 {
  font-size: 22px;
  font-weight: 600;
}
p {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.text-secondary {
  color: var(--text-secondary);
}

.section {
  padding: 96px 0;
}
.section-alt {
  background: var(--bg-alt);
}

.btn {
  display: inline-block;
  padding: 14px 26px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.2s ease;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--primary-hover);
}
.btn-lg {
  padding: 18px 36px;
  font-size: 15px;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  box-shadow: none;
  transition: box-shadow 0.3s ease;
}
.site-header.is-scrolled {
  box-shadow: 0 1px 12px rgba(17, 17, 17, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 18px;
  padding-bottom: 18px;
}
.logo {
  display: flex;
  align-items: center;
}
.logo img {
  height: 60px;
  width: auto;
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.logo:hover img {
  transform: scale(1.08);
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.main-nav a {
  font-weight: 500;
  font-size: 15px;
  transition: color 0.2s ease;
}
.main-nav a:hover,
.main-nav a:focus-visible {
  color: var(--primary);
}
.nav-cta {
  display: none;
}

/* Botón hamburguesa (oculto en escritorio) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.is-open span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   Navegación móvil (menú hamburguesa)
   ========================================================================== */
@media (max-width: 880px) {
  .desktop-cta {
    display: none;
  }
  .nav-toggle {
    display: flex;
  }
  .main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg);
    padding: 0 24px;
    border-top: 1px solid var(--border);
    box-shadow: 0 16px 32px rgba(17, 17, 17, 0.12);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.3s ease;
  }
  .main-nav.is-open {
    max-height: 420px;
    opacity: 1;
    padding: 8px 24px 24px;
  }
  .main-nav a {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-size: 16px;
  }
  .nav-cta {
    display: block;
    text-align: center;
    margin-top: 12px;
    border-bottom: none;
  }
}

@media (max-width: 400px) {
  :root {
    --header-height: 84px;
  }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding: calc(var(--header-height) + 64px) 0 96px;
}
.hero-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 64px;
  align-items: center;
}
.hero-copy {
  flex: 1 1 420px;
  min-width: 0;
  width: 100%;
}
.hero-copy p {
  max-width: 480px;
  margin: 24px 0 36px;
  font-size: clamp(17px, 2vw, 18px);
}
.hero-copy h1 {
  margin: 0;
}

@media (max-width: 860px) {
  .hero-copy {
    text-align: center;
  }
  .hero-copy p {
    margin-left: auto;
    margin-right: auto;
  }
}

.hero-mockup {
  flex: 1 1 420px;
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 340px;
}

.laptop {
  width: min(460px, 100%);
  border-radius: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 16px 16px 40px;
  box-shadow: 0 24px 60px -20px rgba(17, 17, 17, 0.18);
}
.laptop-screen {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  display: flex;
  flex-direction: column;
}
.browser-bar {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.browser-bar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.laptop-base {
  width: 70%;
  height: 8px;
  background: var(--border);
  border-radius: 0 0 8px 8px;
  margin: 0 auto;
}

.screen-content {
  position: relative;
  flex: 1;
}

.phone {
  position: absolute;
  right: 2%;
  bottom: -24px;
  width: 110px;
  border-radius: 20px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 10px 8px;
  box-shadow: 0 20px 40px -16px rgba(17, 17, 17, 0.22);
}
.phone-screen {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 9 / 17.5;
}

.example-panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 1;
  background-size: cover;
  background-position: top center;
  transition: opacity 0.6s ease;
}
.example-panel.is-active {
  opacity: 1;
  z-index: 2;
}

.screen-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 18px;
  background: linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0)
  );
  pointer-events: none;
  z-index: 3;
}
.caption-brand {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
}
.caption-cta {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
}
.phone-caption {
  padding: 8px 10px;
}
.phone-caption .caption-cta {
  font-size: 7px;
  padding: 5px 8px;
}

/* ==========================================================================
   Cards (Servicios / Por qué elegirme) — con interacción hover a azul
   ========================================================================== */
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}
.cards-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 28px;
  background: var(--bg);
  text-align: center;
}
.card h3 {
  margin-bottom: 14px;
  transition: color 0.25s ease;
  text-align: center;
}
.card ul {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.card li {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
  transition: color 0.25s ease;
  text-align: center;
}

@media (max-width: 860px) {
  .cards-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .cards-3 {
    grid-template-columns: 1fr;
  }
}

.card-hover {
  cursor: default;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease,
    background 0.25s ease;
}
.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px -20px rgba(17, 17, 17, 0.25);
  border-color: var(--primary);
  background: var(--primary);
}
.card-hover:hover h3 {
  color: #fff;
}
.card-hover:hover li,
.card-hover:hover p {
  color: #e5eeff;
}

.why-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 860px) {
  .why-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .why-grid {
    grid-template-columns: 1fr;
  }
}
.card-sm {
  padding: 48px 28px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.card-sm h3 {
  font-size: 20px;
  margin-bottom: 10px;
  text-align: center;
}
.card-sm p {
  font-size: 16px;
  line-height: 1.6;
  transition: color 0.25s ease;
  text-align: center;
}

/* ==========================================================================
   Proceso
   ========================================================================== */
.timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: center;
}
.timeline li {
  flex: 1 1 240px;
  min-width: 0;
  max-width: 280px;
  text-align: center;
}
.step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  margin: 0 auto 18px;
  transition:
    transform 0.25s ease,
    background 0.25s ease;
}
.timeline li:hover .step-number {
  transform: scale(1.12);
  background: var(--primary);
}
.step-text {
  display: block;
  font-size: 16px;
  font-weight: 600;
}

/* ==========================================================================
   Proyectos — marquee
   ========================================================================== */
.projects-section h2 {
  margin-bottom: 56px;
}
.marquee-mask {
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 6%,
    #000 94%,
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 6%,
    #000 94%,
    transparent
  );
}
.marquee-track {
  display: flex;
  gap: 28px;
  width: max-content;
  animation: marquee-scroll linear infinite;
}
.marquee-mask:hover .marquee-track {
  animation-play-state: paused;
}

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

.project-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  width: 280px;
  flex-shrink: 0;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}
.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px -20px rgba(17, 17, 17, 0.2);
}
.project-thumb {
  aspect-ratio: 4 / 3;
  background-size: cover;
  background-position: top center;
  border-bottom: 1px solid var(--border);
}
.project-body {
  padding: 24px;
}
.project-body h3 {
  font-size: 19px;
  margin-bottom: 8px;
}
.project-body p {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 18px;
}
.project-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  transition: color 0.2s ease;
}
.project-link:hover {
  color: var(--primary-hover);
}

/* ==========================================================================
   Sobre mí
   ========================================================================== */
.about {
  display: flex;
  gap: 120px;
  align-items: center;
  flex-wrap: wrap;
}
.about-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  cursor: pointer;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}
.about-photo:hover {
  transform: scale(1.07) rotate(-2deg);
  box-shadow: 0 20px 40px -12px rgba(37, 99, 235, 0.35);
}
.about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.about-copy {
  flex: 1;
  min-width: 0;
  width: 100%;
}
.about-copy h2 {
  margin-bottom: 20px;
}
.about-copy p {
  font-size: 17px;
  margin-bottom: 16px;
}
.about-copy p:last-child {
  margin-bottom: 0;
}

@media (max-width: 700px) {
  .about {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
  }
  .about-photo {
    margin: 0 auto;
  }
  .about-copy h2 {
    text-align: center;
  }
}
.intro {
  margin-bottom: 48px;
}
.contact-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 96px;
}
.contact-form {
  flex: 1 1 380px;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.contact-form input,
.contact-form textarea {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  width: 100%;
}
.contact-form textarea {
  resize: vertical;
}
.contact-form .btn {
  width: 100%;
  text-align: center;
  padding: 18px;
  font-size: 15px;
}
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.form-note {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  text-align: center;
}
.form-status {
  font-size: 15px;
  margin: 0;
  min-height: 1.2em;
}
.form-status.success {
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: 8px;
}
.form-status.error {
  color: #b91c1c;
}

.contact-info {
  flex: 1 1 260px;
  min-width: 0;
  width: 100%;
  margin-top: 64px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}
.contact-info .label {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.contact-info a,
.contact-info .value {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  transition: color 0.2s ease;
}
.contact-info a:hover {
  color: var(--primary);
}

/* ==========================================================================
   FAQ
   ========================================================================== */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.faq-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.faq-question {
  width: 100%;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  transition: background 0.2s ease;
}
.faq-question:hover {
  background: var(--bg-alt);
}
.faq-icon {
  font-size: 18px;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.faq-item.is-open .faq-icon {
  transform: rotate(45deg);
}
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.faq-answer p {
  padding: 0 24px 20px;
  font-size: 15px;
  line-height: 1.6;
}
.faq-item.is-open .faq-answer {
  max-height: 240px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 56px 0 32px;
}
.footer-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  margin-bottom: 32px;
}
.footer-tagline {
  font-size: 15px;
  color: var(--text-secondary);
}
.footer-logo {
  height: 80px;
  width: auto;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
}
.footer-nav a {
  color: var(--text-secondary);
  font-size: 14px;
  transition: color 0.2s ease;
}
.footer-nav a:hover {
  color: var(--primary);
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.footer-bottom span {
  font-size: 13px;
  color: var(--text-secondary);
}
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-legal a {
  color: var(--text-secondary);
  font-size: 13px;
  transition: color 0.2s ease;
}
.footer-legal a:hover {
  color: var(--primary);
}

@media (max-width: 600px) {
  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .footer-legal {
    justify-content: center;
  }
}

/* ==========================================================================
   Botón flotante de WhatsApp
   ========================================================================== */
.whatsapp-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #25d366;
  color: #fff;
  padding: 14px 20px 14px 14px;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(17, 17, 17, 0.22);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.whatsapp-fab:hover,
.whatsapp-fab:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(17, 17, 17, 0.28);
}
.whatsapp-fab-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.whatsapp-fab-label {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .whatsapp-fab {
    padding: 18px;
  }
  .whatsapp-fab-icon {
    width: 32px;
    height: 32px;
  }
  .whatsapp-fab-label {
    display: none;
  }
}

/* ==========================================================================
   Páginas legales (aviso-legal / privacidad / cookies)
   ========================================================================== */
.legal-header {
  border-bottom: 1px solid var(--border);
}
.legal-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
}
.legal-header a.back {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease;
}
.legal-header a.back:hover {
  color: var(--primary);
}
.legal-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 64px 24px 96px;
}
.legal-main h1 {
  font-size: clamp(32px, 4vw, 44px);
  margin-bottom: 32px;
}
.legal-main h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 12px;
}
.legal-main p {
  font-size: 17px;
  margin-bottom: 28px;
}
.legal-main ul {
  margin-bottom: 28px;
  padding-left: 20px;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.legal-main li {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.legal-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
}
.legal-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
}
