/* ==========================================================================
   Paleta corporativa — sobria y elegante:
   --navy       #14243A   primario (títulos, botones, sección oscura)
   --ink        #1C222B   texto principal
   --muted      #5C6672   texto secundario
   --paper      #FAF9F6   fondo marfil
   --paper-deep #F0EEE8   fondos de apoyo (inputs, tarjetas)
   --line       #DAD6CC   líneas y bordes
   --accent     #9C7C46   bronce (acentos, detalles)
   ========================================================================== */

:root {
  --navy:       #14243A;
  --ink:        #1C222B;
  --muted:      #5C6672;
  --paper:      #FAF9F6;
  --paper-deep: #F0EEE8;
  --line:       #DAD6CC;
  --accent:     #9C7C46;

  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Inter", -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --maxw: 1120px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  font-size: 1.0625rem;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--navy);
}

h1 { font-size: clamp(2.6rem, 6.5vw, 4.4rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h3 { font-size: 1.3rem; margin-bottom: .5rem; }

h1 em { font-style: italic; color: var(--accent); }

a { color: inherit; }

/* ------------------------------ utilidades ------------------------------ */
.eyebrow {
  font-family: var(--font-mono);
  font-size: .76rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}
.eyebrow--light { color: var(--accent); }

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: .92rem;
  letter-spacing: .03em;
  text-decoration: none;
  padding: .9rem 1.8rem;
  border-radius: 2px;
  border: 1px solid var(--navy);
  transition: background .2s ease, color .2s ease, border-color .2s ease;
  cursor: pointer;
}
.btn--primary { background: var(--navy); color: var(--paper); }
.btn--primary:hover { background: var(--accent); border-color: var(--accent); }
.btn--ghost { background: transparent; color: var(--navy); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--light {
  background: transparent;
  color: var(--paper);
  border-color: rgba(250, 249, 246, .45);
}
.btn--light:hover { border-color: var(--accent); color: var(--accent); }

.btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* -------------------------------- nav ----------------------------------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: .01em;
}
.nav__mark { width: 26px; height: 26px; color: var(--accent); }
.nav__links { display: flex; gap: 1.8rem; align-items: center; }
.nav__links a {
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.nav__links a:hover { color: var(--navy); border-color: var(--accent); }
.nav__cta {
  color: var(--navy) !important;
  border: 1px solid var(--navy) !important;
  padding: .45rem 1.1rem;
  border-radius: 2px;
}
.nav__cta:hover { background: var(--navy); color: var(--paper) !important; }

/* -------------------------------- hero ---------------------------------- */
.hero {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 2rem;
  align-items: center;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 5rem 1.5rem 6.5rem;
}
.hero__lead {
  margin: 1.6rem 0 2.4rem;
  max-width: 36rem;
  font-size: 1.12rem;
  color: var(--muted);
}
.hero__actions { display: flex; gap: 1rem; flex-wrap: wrap; }

.hero__trace { width: 100%; max-width: 420px; justify-self: end; }
.trace {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw 2.4s ease forwards .3s;
}
.trace--soft { opacity: .3; animation-delay: .8s; }
.trace-labels text {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ------------------------------ secciones ------------------------------- */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 5.5rem 1.5rem;
  border-top: 1px solid var(--line);
  position: relative;
}
/* "pad" de circuito sobre la línea divisoria */
.section::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 1.5rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--accent);
}
.section__head { margin-bottom: 3rem; max-width: 46rem; }
.section__sub { margin-top: 1rem; color: var(--muted); }

/* ------------------------------ servicios ------------------------------- */
.grid--services {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
.card {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2.2rem;
  background: #FFFFFF;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 14px 34px -20px rgba(20, 36, 58, .45);
}
.card__code {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .18em;
  color: var(--accent);
  margin-bottom: 1rem;
}
.card p { font-size: .97rem; color: var(--muted); }

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.3rem;
}
.tags li {
  font-family: var(--font-mono);
  font-size: .72rem;
  padding: .25rem .65rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  background: var(--paper);
}
.tags--light li {
  color: rgba(250, 249, 246, .85);
  border-color: rgba(250, 249, 246, .25);
  background: transparent;
}

/* -------------------------- caso de estudio ----------------------------- */
.section--dark {
  max-width: none;
  border-top: none;
  background: var(--navy);
  color: var(--paper);
}
.section--dark::before { display: none; }
.section--dark > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.section--dark h2 { color: var(--paper); }

.case {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  margin-bottom: 2rem;
}
.case h4 {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .8rem;
}
.case p { font-size: .97rem; color: rgba(250, 249, 246, .82); }

.case__more { margin-top: 2.2rem; }

.more-projects { margin-top: 3.5rem; }
.project-line {
  display: grid;
  grid-template-columns: 5rem 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding: 1.2rem 0;
  border-top: 1px solid rgba(250, 249, 246, .18);
  text-decoration: none;
  transition: padding-left .25s ease;
}
.project-line:hover { padding-left: .8rem; }
.project-line__year { font-family: var(--font-mono); font-size: .85rem; color: var(--accent); }
.project-line__title { font-family: var(--font-display); font-size: 1.25rem; color: var(--paper); }
.project-line__arrow { color: var(--accent); }

/* ------------------------------- método --------------------------------- */
.chain {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  counter-reset: step;
}
.chain__step {
  position: relative;
  padding: 2rem 1.6rem 0 1.6rem;
  border-left: 1px solid var(--line);
}
.chain__step::before {
  content: "";
  position: absolute;
  top: 0;
  left: -5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}
.chain__pin {
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .14em;
  color: var(--paper);
  background: var(--navy);
  padding: .22rem .6rem;
  border-radius: 2px;
  display: inline-block;
  margin-bottom: 1rem;
}
.chain__step p { font-size: .94rem; color: var(--muted); }

/* ------------------------------ la empresa ------------------------------ */
.about {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 3.5rem;
  align-items: start;
}
.about__text p { margin-top: 1.2rem; max-width: 36rem; color: var(--muted); }
.about__facts {
  display: grid;
  gap: 1.4rem;
  border-left: 1px solid var(--line);
  padding-left: 1.8rem;
}
.about__facts dt {
  font-family: var(--font-display);
  font-size: 2.3rem;
  color: var(--accent);
  line-height: 1;
}
.about__facts dd { color: var(--muted); font-size: .95rem; }

/* ------------------------------- contacto ------------------------------- */
.contact { max-width: 42rem; }
.contact__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}
.field { margin-bottom: 1.2rem; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: .76rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .45rem;
}
.field input,
.field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: .8rem 1rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(20, 36, 58, .08);
}
.field .errorlist {
  list-style: none;
  color: #8C2F1B;
  font-size: .85rem;
  margin-top: .35rem;
}
.flash {
  font-family: var(--font-body);
  font-size: .95rem;
  padding: 1rem 1.3rem;
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  border-radius: 2px;
  background: rgba(156, 124, 70, .07);
  color: var(--navy);
  margin-bottom: 2rem;
  max-width: 42rem;
}

/* ------------------------------- detalle -------------------------------- */
.section--detail { border-top: none; padding-top: 3rem; }
.section--detail::before { display: none; }
.section--detail h1 { margin-bottom: 1rem; }
.section--detail .case h4 { color: var(--accent); }
.section--detail .case p { color: var(--muted); }
.back {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .85rem;
  text-decoration: none;
  color: var(--muted);
  margin-bottom: 2rem;
}
.back:hover { color: var(--accent); }
.case--detail { margin-top: 3rem; }
.project-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}
.project-links .btn { margin-top: 0; }
.section--detail .btn { margin-top: 2.5rem; }

/* -------------------------------- footer -------------------------------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 3rem 1.5rem 2rem;
  max-width: var(--maxw);
  margin: 0 auto;
}
.footer__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.footer__name { font-family: var(--font-display); font-size: 1.25rem; color: var(--navy); }
.footer__meta { font-size: .9rem; color: var(--muted); }
.footer__links { display: flex; gap: 1.5rem; align-items: center; }
.footer__links a {
  font-size: .88rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.footer__links a:hover { color: var(--navy); border-color: var(--accent); }
.footer__legal {
  margin-top: 2.5rem;
  font-size: .8rem;
  color: var(--muted);
}

/* ---------------------------- animación reveal --------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .trace { animation: none; stroke-dashoffset: 0; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card, .project-line { transition: none; }
}

/* ------------------------------ responsive ------------------------------ */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 3rem; }
  .hero__trace { display: none; }
  .case { grid-template-columns: 1fr; gap: 1.8rem; }
  .chain { grid-template-columns: 1fr 1fr; row-gap: 2.5rem; }
  .about { grid-template-columns: 1fr; }
  .about__facts { grid-template-columns: repeat(3, auto); border-left: none; padding-left: 0; }
  .about__facts > div { border-left: 1px solid var(--line); padding-left: 1rem; }
}

@media (max-width: 640px) {
  .nav { flex-direction: column; gap: 1rem; }
  .nav__links { flex-wrap: wrap; justify-content: center; gap: 1rem; }
  .grid--services { grid-template-columns: 1fr; }
  .chain { grid-template-columns: 1fr; }
  .contact__row { grid-template-columns: 1fr; }
  .section { padding: 3.5rem 1.25rem; }
}
