/* =========================================================
   MGG Logic / MGG Motion — estilos
   Azul Logic: #26489a · Naranja Motion: #f9901a
   El departamento activo se define con <html data-dept="logic|motion">
   y el tema con <html data-theme="light|dark">.
   ========================================================= */
:root {
  --logic: #26489a;
  --motion: #f9901a;

  /* Tema claro */
  --bg: #ffffff;
  --bg-alt: #f6f8fc;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #475569;
  --line: #e2e8f0;
  --nav-bg: rgba(255, 255, 255, .85);
  --shadow: 0 10px 30px -12px rgba(15, 23, 42, .18);
  --logic-fill: #26489a;
  --logic-hover: #1d3a80;
  --logic-text: #26489a;
  --logic-soft: #eef2fb;
  --motion-text: #c96a00;
  --motion-soft: #fff2e2;

  /* Acento del departamento (Logic por defecto) */
  --accent: var(--logic-fill);
  --accent-hover: var(--logic-hover);
  --accent-text: var(--logic-text);
  --accent-soft: var(--logic-soft);
  --accent-glow: rgba(38, 72, 154, .18);
  --on-accent: #ffffff;

  --black: #0b0b0c;
  --radius: 18px;
  --font-head: "Poppins", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  color-scheme: light;
}

/* Tema oscuro: sin JS sigue al sistema; con JS manda data-theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0a0c11; --bg-alt: #0f1219; --surface: #141821;
    --ink: #eef1f6; --ink-2: #9aa3b2; --line: #242b38;
    --nav-bg: rgba(10, 12, 17, .8);
    --shadow: 0 12px 32px -12px rgba(0, 0, 0, .6);
    --logic-fill: #3a63c9; --logic-hover: #4a73d9; --logic-text: #8aa6ee;
    --logic-soft: rgba(90, 125, 215, .16);
    --motion-text: #fbab4f; --motion-soft: rgba(249, 144, 26, .14);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0c11; --bg-alt: #0f1219; --surface: #141821;
  --ink: #eef1f6; --ink-2: #9aa3b2; --line: #242b38;
  --nav-bg: rgba(10, 12, 17, .8);
  --shadow: 0 12px 32px -12px rgba(0, 0, 0, .6);
  --logic-fill: #3a63c9; --logic-hover: #4a73d9; --logic-text: #8aa6ee;
  --logic-soft: rgba(90, 125, 215, .16);
  --motion-text: #fbab4f; --motion-soft: rgba(249, 144, 26, .14);
  color-scheme: dark;
}

/* Departamento Motion: el acento pasa a naranja */
:root[data-dept="motion"] {
  --accent: var(--motion);
  --accent-hover: #ffa53d;
  --accent-text: var(--motion-text);
  --accent-soft: var(--motion-soft);
  --accent-glow: rgba(249, 144, 26, .2);
  --on-accent: #111111;
}

/* Logo azul: versión clara en modo oscuro */
.logo-dark { display: none !important; }
[data-theme="dark"] .logo-light { display: none !important; }
[data-theme="dark"] .logo-dark { display: block !important; }

/* Transición suave al cambiar de departamento (navegadores compatibles) */
@view-transition { navigation: auto; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .3s, color .3s;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .6em; letter-spacing: -.02em; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.6rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }

/* Íconos (assets/icons.svg) */
.ico { width: 1em; height: 1em; display: inline-block; flex-shrink: 0; vertical-align: -.125em; }
.brand-inline { display: inline-flex; align-items: center; gap: .3em; white-space: nowrap; vertical-align: bottom; }
.brand-inline .ico { width: 1.05em; height: 1.05em; }

.container { width: min(1180px, 100% - 32px); margin-inline: auto; }
.container--narrow { width: min(820px, 100% - 32px); }

.eyebrow {
  display: inline-block;
  font: 600 .78rem/1 var(--font-head);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: .55em 1em;
  border-radius: 999px;
  margin-bottom: 1.1rem;
}
.hl { color: var(--accent-text); }
.hl--logic { color: var(--logic-text); }
.hl--motion { color: var(--motion-text); }
.lead { font-size: 1.12rem; color: var(--ink-2); max-width: 56ch; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: 600 .98rem/1 var(--font-head);
  padding: 1em 1.5em;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .2s, background .2s, box-shadow .2s, color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 20px -8px var(--accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-text); }
.btn--sm { padding: .75em 1.15em; font-size: .9rem; }
.btn--block { width: 100%; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s, background .3s;
  view-transition-name: nav;
}
.nav.is-scrolled { border-color: var(--line); box-shadow: 0 4px 20px -12px rgba(0,0,0,.25); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 72px; }
.brand { display: flex; align-items: center; gap: .65rem; }
.brand__mark { width: 40px; height: auto; }
.brand__name { font: 700 1.2rem/1 var(--font-head); color: var(--accent-text); letter-spacing: -.01em; white-space: nowrap; }
.nav__links { display: flex; align-items: center; gap: 1.6rem; font-weight: 500; font-size: .95rem; }
.nav__links a:not(.btn):not(.dept-switch) { color: var(--ink-2); transition: color .2s; }
.nav__links a:not(.btn):not(.dept-switch):hover { color: var(--accent-text); }
.nav__actions { display: flex; align-items: center; gap: 8px; }

/* Botón para cambiar de departamento */
.dept-switch {
  display: inline-flex; align-items: center; gap: .5rem;
  font: 600 .9rem/1 var(--font-head);
  padding: .55em .95em .55em .6em;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  transition: border-color .2s, transform .2s, background .2s;
}
.dept-switch img { width: 26px; }
.dept-switch:hover { transform: translateY(-1px); }
.dept-switch--motion { color: var(--motion-text); }
.dept-switch--motion:hover { border-color: var(--motion); background: var(--motion-soft); }
.dept-switch--neutral { color: var(--ink); }
.dept-switch--neutral:hover { border-color: var(--ink-2); background: var(--bg-alt); }
.dept-switch--logic { color: var(--logic-text); }
.dept-switch--logic:hover { border-color: var(--logic-text); background: var(--logic-soft); }

/* Botón de tema */
.theme-toggle {
  width: 42px; height: 42px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: border-color .2s, color .2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-text); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav__toggle { display: none; background: none; border: 0; width: 44px; height: 44px; cursor: pointer; position: relative; }
.nav__toggle span { position: absolute; left: 11px; right: 11px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .25s, top .25s; }
.nav__toggle span:first-child { top: 17px; }
.nav__toggle span:last-child { top: 25px; }
.nav__toggle[aria-expanded="true"] span:first-child { top: 21px; transform: rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:last-child { top: 21px; transform: rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 150px 0 100px; overflow: hidden; }
.hero__grid {
  position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, #000 30%, transparent 75%);
  opacity: .7;
}
.hero::after {
  content: ""; position: absolute; z-index: -1;
  width: 560px; height: 560px; right: -120px; top: 40px;
  background: radial-gradient(circle, var(--accent-glow), transparent 65%);
}
.hero__inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.8rem; }

/* Flujo ilustrado (Logic) */
.flow { position: relative; aspect-ratio: 1; max-width: 440px; margin-inline: auto; }
.flow__lines { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.flow__lines path {
  fill: none; stroke: var(--accent-text); stroke-width: 2; stroke-dasharray: 6 8; opacity: .55;
  animation: dash 1.6s linear infinite;
}
@keyframes dash { to { stroke-dashoffset: -28; } }
.flow__node {
  position: absolute; z-index: 1;
  display: flex; align-items: center; gap: .7rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: .75rem 1rem; box-shadow: var(--shadow);
  font: 600 .9rem/1.25 var(--font-head);
  animation: float 6s ease-in-out infinite;
}
.flow__node small { font: 400 .76rem var(--font-body); color: var(--ink-2); }
.flow__node > .ico { width: 26px; height: 26px; color: var(--accent-text); }
.flow__node--a { left: 0; top: 8%; }
.flow__node--b { left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--accent); color: #fff; border: 0; padding: 1rem 1.2rem; animation: pulse 3s ease-in-out infinite; }
.flow__node--b small { color: rgba(255,255,255,.75); }
.flow__node--b img { width: 34px; }
.flow__node--c { right: 0; top: 18%; animation-delay: -2s; }
.flow__node--d { left: 6%; bottom: 8%; animation-delay: -4s; }
@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow), var(--shadow); }
  50% { box-shadow: 0 0 0 14px transparent, var(--shadow); }
}

/* Formatos verticales (Motion) */
.reels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 480px; margin-inline: auto; width: 100%; }
.reel {
  position: relative; aspect-ratio: 9 / 16; border-radius: 16px;
  background:
    linear-gradient(160deg, rgba(249,144,26,.35), rgba(249,144,26,0) 55%),
    repeating-linear-gradient(135deg, #18181b 0 12px, #141416 12px 24px);
  border: 1px solid rgba(249,144,26,.3);
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  transition: transform .3s, border-color .3s;
}
.reel--offset { transform: translateY(28px); }
.reel:hover { transform: translateY(-6px); border-color: var(--motion); }
.reel--offset:hover { transform: translateY(20px); }
.reel__tag {
  position: absolute; top: 10px; left: 10px;
  font: 600 .7rem/1 var(--font-head); text-transform: uppercase; letter-spacing: .08em;
  display: inline-flex; align-items: center; gap: .4em;
  background: rgba(11, 11, 12, .85); color: #fff; padding: .45em .7em; border-radius: 6px;
  border: 1px solid rgba(249, 144, 26, .55);
}
.reel__tag .ico { width: 12px; height: 12px; }
.reel__play {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.12); backdrop-filter: blur(4px); color: #fff; padding-left: 4px;
  border: 1px solid rgba(255,255,255,.2);
}
.reel__label { position: absolute; bottom: 12px; font-size: .78rem; color: #8d8d93; }
.hero__logo { width: 72px; margin-bottom: 1.4rem; }

/* ---------- Secciones ---------- */
.section { padding: 100px 0; }
.section--alt { background: var(--bg-alt); }
.section__head { text-align: center; max-width: 720px; margin: 0 auto 56px; }
.section__head p { color: var(--ink-2); font-size: 1.08rem; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  padding: 2rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
.card__icon {
  width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 1.2rem;
}
.card__icon .ico { width: 26px; height: 26px; }
.card p { color: var(--ink-2); margin: 0; font-size: .97rem; }

/* ---------- Enlace al otro departamento ---------- */
.crosslink__inner {
  display: grid; grid-template-columns: auto 1fr auto; gap: 48px; align-items: center;
  border-radius: 28px; padding: 48px 56px;
  border: 1px solid var(--line);
}
.crosslink__inner img { width: 96px; }
.crosslink__inner h2 { margin-bottom: .4em; }
.crosslink__inner p { margin: 0; }
.crosslink--motion .crosslink__inner {
  background:
    radial-gradient(circle at 90% 0%, rgba(249,144,26,.22), transparent 50%),
    linear-gradient(135deg, var(--motion-soft), var(--surface) 70%);
}
.crosslink--motion p { color: var(--ink-2); }
.crosslink--motion h2 span { color: var(--motion-text); }
.crosslink--motion .btn { background: var(--motion); color: #111; }
.crosslink--motion .btn:hover { background: #ffa53d; }
.crosslink--logic .crosslink__inner {
  background:
    radial-gradient(circle at 90% 0%, rgba(90,125,215,.25), transparent 50%),
    linear-gradient(135deg, var(--logic-soft), var(--surface) 70%);
}
.crosslink--logic p { color: var(--ink-2); }
.crosslink--logic h2 span { color: var(--logic-text); }
.crosslink--logic .btn { background: var(--logic-fill); color: #fff; }
.crosslink--logic .btn:hover { background: var(--logic-hover); }

/* ---------- Proceso ---------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.step { position: relative; padding: 2rem 1.6rem; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); }
.step__num { display: block; font: 800 2.4rem/1 var(--font-head); color: transparent; -webkit-text-stroke: 1.5px var(--accent-text); margin-bottom: 1rem; }
.step p { color: var(--ink-2); margin: 0; font-size: .96rem; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 12px; }
.faq details { border: 1px solid var(--line); border-radius: 14px; padding: 0 1.4rem; background: var(--surface); transition: border-color .2s; }
.faq details[open] { border-color: var(--accent); }
.faq summary {
  cursor: pointer; list-style: none; padding: 1.2rem 0;
  font: 600 1.02rem var(--font-head);
  display: flex; justify-content: space-between; gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--accent-text); transition: transform .25s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--ink-2); padding-bottom: 1.2rem; margin: 0; }

/* ---------- Contacto ---------- */
.contact { background: var(--bg-alt); }
.contact__inner { display: grid; grid-template-columns: .9fr 1.1fr; gap: 56px; align-items: start; }
.contact__copy p { color: var(--ink-2); font-size: 1.06rem; }
.contact__list { list-style: none; padding: 0; margin: 1.6rem 0 0; display: grid; gap: .8rem; }
.contact__list li { display: flex; align-items: center; gap: .8rem; font-weight: 500; }
.contact__list > li > span { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.contact__list a:hover { color: var(--accent-text); }
.contact__list > li > span { color: var(--accent-text); }
.contact__list > li > span .ico { width: 20px; height: 20px; }
.contact__list div { display: grid; line-height: 1.35; min-width: 0; }
.contact__list div a { overflow-wrap: anywhere; }
.contact__label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--logic-text); }
.contact__label--motion { color: var(--motion-text); }

.form { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 2rem; box-shadow: var(--shadow); display: grid; gap: 1rem; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form label { display: grid; gap: .4rem; font-weight: 500; font-size: .92rem; }
.form small { color: var(--ink-2); font-weight: 400; }
.form input[type="text"], .form input[type="email"], .form textarea {
  font: inherit; font-size: 1rem; padding: .85em 1em;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink);
  transition: border-color .2s, box-shadow .2s; resize: vertical;
}
.form input:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.form .is-invalid { border-color: #dc2626 !important; }
.form__choice { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.form__choice legend { font-weight: 500; font-size: .92rem; margin-bottom: .5rem; padding: 0; }
.chip { display: inline-flex !important; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { padding: .6em 1.1em; border-radius: 999px; border: 1.5px solid var(--line); font-size: .9rem; transition: all .2s; }
.chip input:checked + span { background: var(--logic-fill); border-color: var(--logic-fill); color: #fff; }
.chip--motion input:checked + span { background: var(--motion); border-color: var(--motion); color: #111; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-glow); }
.form__status { margin: 0; font-size: .92rem; min-height: 1.2em; color: var(--ink-2); }

/* ---------- Footer ---------- */
.footer { background: var(--black); color: #b9b9be; padding: 48px 0; border-top: 1px solid var(--line); }
.footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
.footer__brands { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.footer__brand { display: flex; align-items: center; gap: 12px; }
.footer__brand img { width: 44px; }
.footer__brand div { display: grid; line-height: 1.3; font-size: .85rem; }
.footer__brand strong { font-family: var(--font-head); color: #fff; font-size: 1rem; }
.footer__brand--motion { margin-left: 18px; }
.footer__brand--motion strong { color: var(--motion); }
.footer__brand--logic strong { color: #7c9ce8; }
.footer a:hover { color: #fff; }
.footer__copy { margin: 0; font-size: .85rem; }

/* ---------- Animación de aparición ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation: none !important; }
  @view-transition { navigation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .hero__inner, .contact__inner { grid-template-columns: 1fr; }
  .hero__visual { max-width: 420px; width: 100%; margin-inline: auto; }
  .crosslink__inner { grid-template-columns: 1fr; padding: 40px 28px; gap: 24px; }
  .crosslink__inner img { width: 72px; }
}
@media (max-width: 900px) {
  .nav__toggle { display: block; }
  .nav__links {
    position: absolute; top: 72px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px 16px 20px;
    clip-path: inset(0 0 100% 0); transition: clip-path .3s ease;
  }
  .nav__links.is-open { clip-path: inset(0 0 0 0); }
  .nav__links a:not(.btn):not(.dept-switch) { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav__links .btn { margin-top: 14px; }
  .nav__links .dept-switch { margin-top: 14px; justify-content: center; padding: .8em 1em; }
}
@media (max-width: 640px) {
  .hero { padding: 116px 0 72px; }
  .section { padding: 72px 0; }
  .cards, .steps, .form__row { grid-template-columns: 1fr; }
  .flow__node { font-size: .8rem; padding: .6rem .75rem; }
  .flow__node small { font-size: .7rem; }
  .reels { gap: 10px; }
  .form { padding: 1.4rem; }
  .footer__brand--motion { margin-left: 0; }
  .brand__name { font-size: 1.05rem; }
  .dept-switch__mgg { display: none; }
  .dept-switch { padding-right: .8em; }
}
@media (max-width: 360px) {
  .brand__name { display: none; }
}
