/* ===== Creces · sistema de diseño corporativo ============================= */
:root {
  --paper: #FFFFFF;
  --paper-2: #F4F7FC;
  --paper-3: #EAF0FA;

  --ink: #0B1B33;
  --ink-soft: #43536B;
  --muted: #8A97A8;
  --line: #D3DEEF;

  --blue: #1552D6;
  --blue-deep: #0A2A6B;
  --blue-050: #EEF3FE;
  --blue-ink: #FFFFFF;

  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --display: "Space Grotesk", "IBM Plex Sans", Arial, sans-serif;

  --gutter: clamp(1.25rem, 4vw, 5rem);
  --maxw: 1400px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1rem, .96rem + .2vw, 1.0625rem);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--blue); color: var(--blue-ink); }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -.02em; }

.label {
  font-family: var(--display);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--blue);
}

/* ===== Edición (solo activa en /edit vía body.edit-mode) ================= */
[contenteditable] {
  outline: none;
  cursor: text;
  transition: background .18s var(--ease), box-shadow .18s var(--ease);
}
.edit-mode [contenteditable]:hover { background: var(--blue-050); }
.edit-mode [contenteditable]:focus {
  background: var(--blue-050);
  box-shadow: inset 0 0 0 1px var(--blue);
}
.edit-mode [data-edit][data-ph]:empty::before {
  content: attr(data-ph);
  color: var(--muted);
  pointer-events: none;
}

.editbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 200;
  display: none;
  align-items: center;
  gap: 1rem;
  padding: .5rem var(--gutter);
  background: var(--blue-deep);
  color: #fff;
  font-family: var(--display);
  font-size: .78rem;
  letter-spacing: .04em;
}
.edit-mode .editbar { display: flex; }
.edit-mode .topbar { top: 2.4rem; }
.edit-mode { --editbar-h: 2.4rem; }
.editbar a { color: #fff; }
.editbar .sep { flex: 1; }
.editbar__status { font-size: .72rem; opacity: .9; letter-spacing: .04em; }
.editbar__status.is-ok { color: #7CF2C0; }
.editbar__status.is-err { color: #FFB4A8; }
.editbar__status.is-saving { color: rgba(255,255,255,.65); }
.editbar button {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  font: inherit;
  padding: .3rem .8rem;
  cursor: pointer;
}
.editbar button:hover { background: rgba(255,255,255,.24); }

[data-edit] img { max-width: 100%; height: auto; }

/* Imágenes flotantes */
.fimg {
  position: absolute;
  z-index: 40;
  line-height: 0;
}
.fimg img { width: 100%; height: auto; display: block; }
.edit-mode .fimg { cursor: grab; outline: 1px dashed transparent; }
.edit-mode .fimg:hover { outline-color: var(--blue); }
.edit-mode .fimg.is-active { cursor: grabbing; outline: 1px solid var(--blue); }
.edit-mode .fimg__del,
.edit-mode .fimg__handle { position: absolute; opacity: 0; transition: opacity .15s; }
.edit-mode .fimg:hover .fimg__del,
.edit-mode .fimg:hover .fimg__handle,
.edit-mode .fimg.is-active .fimg__del,
.edit-mode .fimg.is-active .fimg__handle { opacity: 1; }
.fimg__del {
  top: -11px; right: -11px;
  width: 22px; height: 22px;
  border: none;
  background: var(--blue-deep);
  color: #fff;
  font-size: 14px;
  line-height: 22px;
  cursor: pointer;
  border-radius: 999px;
}
.fimg__handle {
  right: -7px; bottom: -7px;
  width: 14px; height: 14px;
  background: #fff;
  border: 2px solid var(--blue);
  cursor: nwse-resize;
}
/* En vista pública no son interactivas */
body:not(.edit-mode) .fimg { pointer-events: none; }

.fmt-menu {
  position: fixed;
  z-index: 300;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(11, 27, 51, .18);
  padding: .3rem;
  display: none;
  font-family: var(--sans);
}
.fmt-menu.open { display: block; }
.fmt-menu button {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .5rem .6rem;
  background: none;
  border: none;
  font: inherit;
  font-size: .85rem;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.fmt-menu button:hover { background: var(--blue-050); color: var(--blue); }
.fmt-menu button b, .fmt-menu button i, .fmt-menu button u { width: 1rem; display: inline-block; text-align: center; color: var(--blue); }
.fmt-menu hr { border: none; border-top: 1px solid var(--line); margin: .3rem 0; }
.fmt-menu .sw { width: .9rem; height: .9rem; border: 1px solid rgba(0,0,0,.15); display: inline-block; }

/* ===== Topbar ============================================================ */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.1rem var(--gutter);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), padding .25s var(--ease);
}
.topbar.is-stuck { border-color: var(--line); padding-block: .7rem; }

.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -.03em;
  display: flex;
  align-items: center;
  gap: .55ch;
}
.brand { text-decoration: none; color: inherit; }
.brand__logo { height: clamp(1.75rem, 1.4rem + 1vw, 2.25rem); width: auto; display: block; }
.topbar.is-stuck .brand__logo { height: 1.75rem; }
.brand .mark {
  width: 1.05rem; height: 1.05rem;
  background: var(--blue);
  display: inline-block;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 35% 100%, 35% 45%, 0 45%);
}

.nav {
  display: flex;
  gap: clamp(1rem, 2.4vw, 2.5rem);
  font-family: var(--display);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding-block: .3rem;
  border-bottom: 2px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.nav a:hover { color: var(--blue); border-color: var(--blue); }

.btn {
  --pad: .72rem 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: .6ch;
  padding: var(--pad);
  font-family: var(--display);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1.5px solid var(--blue);
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.btn:hover { background: var(--blue); color: #fff; }
.btn--solid { background: var(--blue); color: #fff; }
.btn--solid:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.btn--lg { --pad: .95rem 2.1rem; font-size: .82rem; }
.btn--ghost { border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); background: var(--ink); color: #fff; }

.nav-toggle { display: none; }

.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: var(--p, 0%);
  background: var(--blue);
  z-index: 101;
  transition: width .1s linear;
}

/* ===== Animaciones de scroll =========================================== */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: .07s; }
.reveal[data-d="2"] { transition-delay: .14s; }
.reveal[data-d="3"] { transition-delay: .21s; }
.reveal[data-d="4"] { transition-delay: .28s; }

.rule {
  height: 1px;
  background: var(--line);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .9s var(--ease);
}
.rule.in { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  .reveal, .rule { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ===== Hero =========================================================== */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 9rem;
  padding-bottom: 5rem;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: clamp(48px, 7vw, 96px) clamp(48px, 7vw, 96px);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 20%, #000 60%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 20%, #000 60%, transparent);
  opacity: .55;
  pointer-events: none;
}
.hero__inner { position: relative; }
.hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 1ch;
  margin-bottom: 1.8rem;
}
.hero__kicker::before { content: ""; width: 2.5rem; height: 2px; background: var(--blue); }

.hero h1 {
  font-size: clamp(2.6rem, 1rem + 7.5vw, 6.5rem);
  line-height: 1.02;
  letter-spacing: -.035em;
  max-width: 15ch;
  text-wrap: balance;
}
.hero h1 .hl { color: var(--blue); }

.hero__lead {
  margin-top: 2rem;
  max-width: 44ch;
  font-size: clamp(1.05rem, 1rem + .45vw, 1.3rem);
  color: var(--ink-soft);
  text-wrap: pretty;
}
.hero__actions { margin-top: 2.75rem; display: flex; flex-wrap: wrap; gap: .9rem; }

.hero__scroll {
  position: absolute;
  bottom: 2rem;
  right: var(--gutter);
  font-family: var(--display);
  font-size: .7rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  writing-mode: vertical-rl;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.hero__scroll::after {
  content: "";
  width: 2px; height: 3.5rem;
  background: var(--blue);
  animation: drop 2.2s var(--ease) infinite;
}
@keyframes drop {
  0% { transform: scaleY(0); transform-origin: top; }
  45% { transform: scaleY(1); transform-origin: top; }
  55% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ===== Secciones =================================================== */
.section { padding-block: clamp(4.5rem, 11vw, 9rem); }
.section__head { display: grid; grid-template-columns: 5rem 1fr; gap: clamp(1.5rem, 4vw, 3rem); margin-bottom: clamp(3rem, 6vw, 5rem); }
.section__no {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--blue);
  padding-top: .5rem;
  letter-spacing: .05em;
}
.section__title { font-size: clamp(1.9rem, 1rem + 3.6vw, 3.5rem); line-height: 1.04; max-width: 20ch; text-wrap: balance; }
.section__intro { margin-top: 1.25rem; max-width: 46ch; color: var(--ink-soft); text-wrap: pretty; }

/* Servicios */
.services { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); }
.service {
  padding: clamp(1.75rem, 3.5vw, 2.75rem);
  display: flex;
  flex-direction: column;
  gap: .9rem;
  min-height: 21rem;
  border-left: 1px solid var(--line);
  transition: background .25s var(--ease);
}
.service:first-child { border-left: none; }
.service:hover { background: var(--paper-2); }
.service__idx {
  font-family: var(--display);
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .1em;
  color: var(--blue);
  border: 1.5px solid var(--blue);
  width: 2.2rem; height: 2.2rem;
  display: grid; place-items: center;
}
.service h3 { font-size: clamp(1.35rem, 1rem + 1.4vw, 1.85rem); line-height: 1.12; }
.service p { color: var(--ink-soft); font-size: .96rem; margin-top: auto; }

/* Método · scroll lateral fijado */
.hscroll { position: relative; background: var(--paper-2); border-block: 1px solid var(--line); }
.hscroll__sticky {
  position: sticky;
  top: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-block: clamp(3rem, 7vw, 5rem);
  overflow: hidden;
}
.hscroll__head { display: grid; grid-template-columns: 5rem 1fr; gap: clamp(1.5rem, 4vw, 3rem); }
.hscroll__head .section__no { font-family: var(--display); font-weight: 600; color: var(--blue); padding-top: .4rem; }
.hscroll__bar { margin-top: 1.75rem; height: 2px; background: var(--line); max-width: 22rem; }
.hscroll__fill { display: block; height: 100%; width: 0%; background: var(--blue); transition: width .1s linear; }

.hscroll__viewport { width: 100%; }
.hscroll__track {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2rem);
  padding-inline: var(--gutter);
  width: max-content;
  will-change: transform;
}
.hpanel {
  flex: 0 0 min(78vw, 30rem);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: clamp(1.75rem, 3.5vw, 2.75rem);
  display: flex;
  flex-direction: column;
  gap: .9rem;
  min-height: 20rem;
}
.hpanel__no {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 1rem + 3vw, 3.25rem);
  color: var(--blue);
  line-height: 1;
}
.hpanel h3 { font-size: clamp(1.35rem, 1rem + 1.4vw, 1.9rem); }
.hpanel p { color: var(--ink-soft); text-wrap: pretty; }
.hpanel .btn { align-self: flex-start; margin-top: auto; }
.hpanel--end { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; justify-content: center; }
.hpanel--end p { color: rgba(255,255,255,.72); }
.edit-mode .hpanel--end [contenteditable]:hover { background: rgba(255,255,255,.12); }
.edit-mode .hpanel--end [contenteditable]:focus { background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 1px #fff; }
.edit-mode .hpanel--end [data-ph]:empty::before { color: rgba(255,255,255,.5); }

/* Sin fijado: en móvil o sin JS el track se apila / hace scroll táctil normal */
.hscroll.is-static .hscroll__track { transform: none !important; }
@media (max-width: 720px) {
  .hscroll__sticky { position: static; min-height: 0; }
  .hscroll__track { flex-direction: column; width: auto; padding-inline: 0; }
  .hpanel { flex: none; }
  .hscroll__bar { display: none; }
}

/* Cita */
.quote { padding-block: clamp(4.5rem, 11vw, 8rem); background: var(--blue-deep); color: #fff; }
.quote ::selection { background: #fff; color: var(--blue-deep); }
.quote blockquote {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.5rem, 1rem + 3vw, 3rem);
  line-height: 1.18;
  letter-spacing: -.025em;
  max-width: 26ch;
  text-wrap: balance;
}
.quote__by {
  margin-top: 2.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--display);
  font-size: .85rem;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, .8);
}
.quote__by .avatar {
  width: 2.75rem; height: 2.75rem;
  background: var(--blue);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--display);
  font-weight: 600;
}
.edit-mode .quote [contenteditable]:hover { background: rgba(255,255,255,.12); }
.edit-mode .quote [contenteditable]:focus { background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 1px #fff; }
.edit-mode .quote [data-ph]:empty::before { color: rgba(255,255,255,.5); }

/* CTA */
.cta { padding-block: clamp(4.5rem, 13vw, 10rem); text-align: center; }
.cta h2 { font-size: clamp(2.1rem, 1rem + 5.5vw, 5rem); line-height: 1.02; letter-spacing: -.035em; max-width: 18ch; margin-inline: auto; text-wrap: balance; }
.cta p { margin: 1.5rem auto 0; max-width: 42ch; color: var(--ink-soft); }
.cta .hero__actions { justify-content: center; }

/* ===== Footer ===================================================== */
.footer { background: var(--ink); color: #fff; padding-block: clamp(3.5rem, 8vw, 6rem); }
.footer ::selection { background: #fff; color: var(--ink); }
.edit-mode .footer [contenteditable]:hover { background: rgba(255,255,255,.1); }
.edit-mode .footer [contenteditable]:focus { background: rgba(255,255,255,.15); box-shadow: inset 0 0 0 1px #fff; }
.edit-mode .footer [data-ph]:empty::before { color: rgba(255,255,255,.45); }

.footer__top {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 3.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, .16);
}
.footer__brand { font-family: var(--display); font-weight: 700; font-size: 1.5rem; letter-spacing: -.03em; }
.footer__tagline { margin-top: .9rem; max-width: 32ch; color: rgba(255, 255, 255, .62); font-size: .93rem; }
.footer__col h4 { font-size: .72rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .5); margin-bottom: 1.1rem; }
.footer__col ul { list-style: none; display: grid; gap: .65rem; }
.footer__col a, .footer__col span { color: rgba(255, 255, 255, .82); text-decoration: none; font-size: .93rem; }
.footer__col a:hover { color: #fff; }
.footer__bottom {
  padding-top: 1.75rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .8rem;
  color: rgba(255, 255, 255, .5);
}

/* ===== Responsive ============================================== */
@media (max-width: 960px) {
  .services { grid-template-columns: 1fr; }
  .service { border-left: none; border-top: 1px solid var(--line); }
  .service:first-child { border-top: none; }
  .footer__top { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .nav, .topbar .btn { display: none; }
  .nav-toggle {
    display: inline-flex;
    background: none;
    border: 1.5px solid var(--blue);
    color: var(--blue);
    padding: .5rem .9rem;
    font-family: var(--display);
    font-size: .74rem;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .nav.open {
    display: flex;
    position: fixed;
    inset: 3.8rem 0 auto 0;
    flex-direction: column;
    gap: 1.4rem;
    padding: 1.75rem var(--gutter) 2.25rem;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    font-size: .95rem;
  }
  .edit-mode .nav.open { inset: 6.2rem 0 auto 0; }
  .section__head { grid-template-columns: 1fr; gap: .5rem; }
  .footer__top { grid-template-columns: 1fr; }
  .editbar { font-size: .72rem; gap: .5rem; }
}
