/* ===== Fuentes (propias, subset latin) ===== */
@font-face{font-family:'Poppins';font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/poppins-400-latin.woff2) format('woff2')}
@font-face{font-family:'Poppins';font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/poppins-500-latin.woff2) format('woff2')}
@font-face{font-family:'Poppins';font-style:normal;font-weight:600;font-display:swap;src:url(/assets/fonts/poppins-600-latin.woff2) format('woff2')}
@font-face{font-family:'Poppins';font-style:normal;font-weight:700;font-display:swap;src:url(/assets/fonts/poppins-700-latin.woff2) format('woff2')}

/* ===== Tokens =====
   Marca: Poppins + azules del logo (#0080FF -> #00D4FF).
   El degradé vive solo en el logo; en la interfaz va un azul sólido legible. */
:root {
  --bg: #F7F9FC;
  --surface: #FFFFFF;
  --ink: #0D1B2E;
  --muted: #526073;
  --line: #DCE3EC;
  --accent: #0068D6;
  --accent-hover: #0057B5;
  --on-accent: #FFFFFF;
  --accent-start: #0080FF;
  --accent-end: #00D4FF;
  --nav-bg: rgba(247, 249, 252, 0.86);
  --media-shadow: 0 1px 2px rgba(13, 27, 46, 0.06), 0 12px 32px -12px rgba(13, 27, 46, 0.18);

  --font: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  --container: 1200px;
  --gutter: clamp(20px, 4vw, 40px);
  --section-space: clamp(88px, 12vw, 168px);
  --radius-media: 14px;
  --radius-control: 999px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1322;
    --surface: #0F1B2D;
    --ink: #E8EEF6;
    --muted: #97A5B7;
    --line: #1E2C40;
    --accent: #4AB3FF;
    --accent-hover: #7CC7FF;
    --on-accent: #06111F;
    --nav-bg: rgba(10, 19, 34, 0.86);
    --media-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
  }
}

:root[data-theme="dark"] {
  --bg: #0A1322;
  --surface: #0F1B2D;
  --ink: #E8EEF6;
  --muted: #97A5B7;
  --line: #1E2C40;
  --accent: #4AB3FF;
  --accent-hover: #7CC7FF;
  --on-accent: #06111F;
  --nav-bg: rgba(10, 19, 34, 0.86);
  --media-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
}

/* ===== Base ===== */

*,
*::before,
*::after {
  box-sizing: border-box;
  /* Fundido de tema claro/oscuro en toda la página (0.6s, decisión anterior) */
  transition: background-color 0.6s ease, color 0.6s ease, border-color 0.6s ease, fill 0.6s ease, stroke 0.6s ease, box-shadow 0.6s ease;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  scrollbar-color: var(--line) var(--bg);
  accent-color: var(--accent);
}

::selection { background: var(--accent); color: var(--on-accent); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: inherit; }
p { margin: 0; }

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

h3 {
  font-size: 1.1875rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  font-size: 0.875rem;
  text-decoration: none;
}

.skip-link:focus { top: 12px; }

/* ===== Nav ===== */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
}

.nav.is-scrolled { border-bottom-color: var(--line); }

.nav-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  margin-right: auto;
}

.brand-mark { flex-shrink: 0; }
.brand-lt { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: 0.9375rem;
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a[aria-current="true"] { color: var(--ink); }

.nav-actions { display: flex; align-items: center; gap: 16px; }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
}

/* Switch de tema: sobrio, perilla en el color de texto */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  padding: 9px 0;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:focus-visible { outline: none; }
.theme-toggle:focus-visible .theme-track { outline: 2px solid var(--accent); outline-offset: 3px; }

.theme-track {
  position: relative;
  display: block;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.theme-toggle:hover .theme-track { border-color: var(--muted); }

.theme-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.6s ease, color 0.6s ease;
}

.knob-icon { width: 12px; height: 12px; }
.knob-icon--moon { display: none; }

:root[data-theme="dark"] .theme-knob { transform: translateX(20px); }
:root[data-theme="dark"] .knob-icon--sun { display: none; }
:root[data-theme="dark"] .knob-icon--moon { display: block; }

/* ===== Botones y enlaces ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 26px;
  border-radius: var(--radius-control);
  border: none;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-sm { min-height: 40px; padding: 0 18px; font-size: 0.875rem; }

.link-quiet {
  display: inline-block;
  padding: 12px 0;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

.link-quiet:hover { text-decoration-color: currentColor; }

/* ===== Hero ===== */

.hero {
  padding: clamp(72px, 12vw, 152px) 0 clamp(80px, 11vw, 136px);
}

.hero-title {
  font-size: clamp(2.5rem, 6.2vw, 5rem);
  line-height: 1.03;
  letter-spacing: -0.04em;
  font-weight: 600;
}

.hero-title .line { display: block; }

@media (min-width: 961px) {
  .hero-title .line { white-space: nowrap; }
}

.hero-foot {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 24px;
  margin-top: clamp(40px, 6vw, 72px);
}

.hero-sub {
  grid-column: 6 / span 6;
  max-width: 46ch;
  font-size: 1.125rem;
  color: var(--muted);
}

.hero-cta {
  grid-column: 6 / span 7;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin-top: 32px;
}

/* Única animación de entrada: el titular, al cargar */
@media (prefers-reduced-motion: no-preference) {
  .hero-title .line,
  .hero-foot {
    animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .hero-title .line:nth-child(2) { animation-delay: 0.08s; }
  .hero-foot { animation-delay: 0.22s; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* ===== Secciones ===== */

.section { padding: var(--section-space) 0 0; }

.section-contact {
  padding-top: clamp(72px, 9vw, 128px);
  padding-bottom: var(--section-space);
}

.split {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 24px;
  row-gap: 32px;
  align-items: start;
}

.split-aside { grid-column: 1 / span 4; }

.split-aside h2 { max-width: 12ch; }

.aside-note {
  margin-top: 20px;
  max-width: 32ch;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Servicios: lista simple con filete arriba de cada fila */
.service-list {
  grid-column: 6 / span 7;
  list-style: none;
  margin: 0;
  padding: 0;
}

.service {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 8px 32px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.service:last-child { border-bottom: 1px solid var(--line); }

.service p { color: var(--muted); max-width: 52ch; }

/* ===== Demos ===== */

.section-intro {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 24px;
  row-gap: 16px;
  align-items: end;
  margin-bottom: clamp(48px, 6vw, 80px);
}

.section-intro h2 { grid-column: 1 / span 5; max-width: 16ch; }

.section-intro p {
  grid-column: 6 / span 6;
  color: var(--muted);
  max-width: 38ch;
}

.gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(56px, 7vw, 96px) clamp(24px, 4vw, 56px);
}

/* La columna derecha baja: ritmo de galería, no de grilla de tarjetas */
.work:nth-child(even) { margin-top: clamp(0px, 10vw, 136px); }

.work { margin: 0; }

.work-media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius-media);
  background: var(--surface);
  box-shadow: var(--media-shadow);
}

.work-media img,
.work-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.work figcaption {
  margin-top: 24px;
  max-width: 48ch;
}

.work figcaption p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9688rem;
}

/* ===== Sobre mí ===== */

.about {
  grid-column: 6 / span 7;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 40rem;
}

.about-lead {
  font-size: clamp(1.375rem, 2.4vw, 1.75rem);
  line-height: 1.4;
  letter-spacing: -0.015em;
  font-weight: 500;
}

.about p:not(.about-lead) { color: var(--muted); }

/* ===== Preguntas ===== */

.faq-list {
  grid-column: 6 / span 7;
  border-top: 1px solid var(--line);
}

.faq-item { border-bottom: 1px solid var(--line); }

.faq-question {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0;
  font-size: 1.0625rem;
  font-weight: 500;
  cursor: pointer;
}

.faq-question::-webkit-details-marker { display: none; }
.faq-question:hover { color: var(--accent); }

.faq-toggle {
  position: relative;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.faq-toggle::before,
.faq-toggle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 1.5px;
  background: currentColor;
  transform: translate(-50%, -50%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.6s ease;
}

.faq-toggle::after { transform: translate(-50%, -50%) rotate(90deg); }
.faq-item[open] .faq-toggle::after { transform: translate(-50%, -50%) rotate(0deg); }

.faq-answer {
  padding: 0 40px 28px 0;
  color: var(--muted);
  max-width: 58ch;
}

/* ===== Contacto ===== */

.section-contact .container {
  border-top: 1px solid var(--line);
  padding-top: clamp(72px, 9vw, 128px);
}

.contact-title {
  font-size: clamp(2.2rem, 5.6vw, 4.5rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  max-width: 18ch;
}

.contact-foot {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 24px;
  row-gap: 32px;
  margin-top: clamp(40px, 5vw, 64px);
}

.contact-sub {
  grid-column: 1 / span 5;
  color: var(--muted);
  max-width: 40ch;
}

.contact-actions {
  grid-column: 6 / span 7;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

.contact-alt {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 0.9375rem;
  color: var(--muted);
}

.contact-alt a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 5px;
}

.contact-alt a:hover { text-decoration-color: currentColor; }

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.copy-btn:hover,
.copy-btn.is-copied { color: var(--accent); border-color: var(--accent); }

.copy-feedback {
  font-size: 0.875rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.copy-feedback.is-visible { opacity: 1; }

/* ===== Footer ===== */

.footer {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.footer a { text-decoration: none; }
.footer a:hover { color: var(--ink); }

/* ===== Página puente de WhatsApp ===== */

.redirect-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.redirect-page a { color: var(--accent); }

/* ===== Responsive ===== */

@media (max-width: 960px) {
  .split-aside,
  .service-list,
  .about,
  .faq-list { grid-column: 1 / -1; }

  .split-aside h2 { max-width: none; }

  .hero-sub,
  .hero-cta { grid-column: 1 / span 10; }

  .section-intro h2,
  .section-intro p { grid-column: 1 / -1; }

  .contact-sub,
  .contact-actions { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .nav-links,
  .nav-cta { display: none; }

  .nav-toggle { display: inline-flex; }

  .nav.menu-open .nav-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    padding: 12px var(--gutter) 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }

  .nav.menu-open .nav-links a {
    display: block;
    padding: 12px 0;
    font-size: 1.125rem;
    color: var(--ink);
  }

  .hero-sub,
  .hero-cta { grid-column: 1 / -1; }

  .gallery { grid-template-columns: 1fr; }
  .work:nth-child(even) { margin-top: 0; }

  .service { grid-template-columns: 1fr; }
}
