/* ===== Base ===== */
html { scroll-behavior: smooth; }
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
::selection { background: #A5192E; color: #fff; }

/* Tabular numbers para stats y precios */
.counter, .stat-num, .tl-num { font-variant-numeric: tabular-nums; }

/* Section eyebrow editorial */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  font-family: 'Montserrat', sans-serif;
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .35em;
  font-weight: 500;
  color: #A5192E;
}
.eyebrow::before {
  content: '';
  width: 32px; height: 1px;
  background: #A5192E;
}

/* Botón arrow slide */
.btn-arrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  overflow: hidden;
}
.btn-arrow svg {
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.btn-arrow:hover svg { transform: translateX(4px); }

/* Exaggerated Minimalism — fluid title */
.hero-title {
  font-size: clamp(2rem, 4.5vw, 4.75rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .hero-bg { transform: none !important; }
}

/* ===== Header ===== */
#siteHeader {
  background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 100%);
}
#siteHeader .nav-links a {
  color: #fff;
  transition: color .3s;
  position: relative;
}
#siteHeader .nav-links a::after {
  content:'';
  position:absolute;
  left:0; bottom:-6px;
  height:1px; width:0;
  background:#A5192E;
  transition: width .3s;
}
#siteHeader .nav-links a:hover::after { width:100%; }

#siteHeader.scrolled {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
#siteHeader.scrolled .nav-links a { color: #2F2F2F; }
#siteHeader.scrolled #menuBtn { color: #2F2F2F; }

/* Logo swap según estado del header */
.brand-logo-dark { display: none; }
#siteHeader.scrolled .brand-logo-light { display: none; }
#siteHeader.scrolled .brand-logo-dark { display: block; }

/* ===== Hero ===== */
.hero-bg {
  background: url('img/hero-portada.png') center/cover no-repeat;
  transform: scale(1.02);
  will-change: transform;
}
.hero-gradient {
  background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.25) 40%, rgba(0,0,0,.65) 100%);
}
.hero-meta {
  position: absolute;
  top: 8rem;
  right: 3rem;
  color: rgba(255,255,255,.75);
  font-family: 'Montserrat', sans-serif;
  font-size: .65rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  text-align: right;
  display: none;
  z-index: 5;
}
@media (min-width: 1024px) { .hero-meta { display: block; } }
.hero-meta strong { color: #fff; font-weight: 600; letter-spacing: .25em; display: block; margin-top: .35rem; font-size: .7rem; }

/* Fija tamaño de SVGs para prevenir crecimiento pre-CSS */
svg { flex-shrink: 0; }
.service-card svg { width: 28px; height: 28px; }
.timeline svg.tl-icon { width: 44px; height: 44px; }

/* ===== Reveal animation ===== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .9s ease, transform .9s cubic-bezier(.2,.7,.2,1);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ===== Service cards (editorial) ===== */
.service-card {
  position: relative;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 4px;
  padding: 3rem 2.25rem 2.5rem;
  transition: transform .5s cubic-bezier(.2,.7,.2,1), box-shadow .5s, border-color .3s;
  overflow: hidden;
}
.service-card::before {
  content: attr(data-num);
  position: absolute;
  top: 1.5rem; right: 1.75rem;
  font-family: 'Montserrat', sans-serif;
  font-size: .7rem;
  letter-spacing: .3em;
  color: #b7b8ba;
  font-variant-numeric: tabular-nums;
}
.service-card::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  height: 2px; width: 0;
  background: #A5192E;
  transition: width .6s cubic-bezier(.2,.7,.2,1);
}
.service-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.18);
  border-color: transparent;
}
.service-card:hover::after { width: 100%; }
.service-icon {
  width: 56px; height: 56px;
  display:flex; align-items:center; justify-content:center;
  background: transparent;
  color: #A5192E;
  border: 1px solid #F1D6DA;
  border-radius: 50%;
  margin-bottom: 2rem;
  transition: background .35s, color .35s;
}
.service-card:hover .service-icon { background: #A5192E; color: #fff; border-color: #A5192E; }
.service-card svg { width: 26px; height: 26px; }
.service-card h3 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 1.35rem;
  color: #2F2F2F;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}
.service-card p { color: #58595B; line-height: 1.7; font-size: .95rem; }

/* ===== Project filters ===== */
.filter-btn {
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: .85rem;
  padding: .5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid #d8d8d8;
  color: #58595B;
  background: transparent;
  transition: all .3s;
}
.filter-btn:hover { border-color: #A5192E; color: #A5192E; }
.filter-btn.is-active { background: #A5192E; color: #fff; border-color: #A5192E; }

/* ===== Masonry-ish grid ===== */
.masonry {
  grid-auto-rows: 220px;
}
@media (min-width: 768px) {
  .masonry { grid-auto-rows: 260px; }
}
.project-item {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  display: block;
  cursor: pointer;
  transition: opacity .35s, transform .35s;
}
.project-item.tall { grid-row: span 2; }
.project-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .8s cubic-bezier(.2,.7,.2,1);
}
.project-item:hover img { transform: scale(1.06); }
.project-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, rgba(0,0,0,0) 55%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  opacity: 1;
}
.project-item.is-hidden { display: none; }

/* ===== Timeline editorial ===== */
.timeline {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  counter-reset: step;
}
@media (min-width: 900px) {
  .timeline {
    grid-template-columns: repeat(5, 1fr);
    gap: 2rem;
  }
  .timeline::before {
    content: '';
    position: absolute;
    top: 46px;
    left: 8%;
    right: 8%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d9d9d9 15%, #d9d9d9 85%, transparent);
  }
}
.timeline li {
  position: relative;
  list-style: none;
  text-align: left;
}
@media (min-width: 900px) { .timeline li { text-align: center; } }
.tl-num {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 2.5rem;
  color: #A5192E;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.tl-icon {
  width: 44px; height: 44px;
  color: #2F2F2F;
  margin: 1.25rem 0;
  background: #fff;
  padding: 10px;
  border: 1px solid #eaeaea;
  border-radius: 50%;
  transition: background .35s, color .35s, border-color .35s, transform .35s;
}
@media (min-width: 900px) { .tl-icon { margin: 1.25rem auto; } }
.timeline li:hover .tl-icon { background: #A5192E; color: #fff; border-color: #A5192E; transform: scale(1.08); }
.timeline h4 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  color: #2F2F2F;
  margin-bottom: .5rem;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.timeline p { color: #808285; font-size: .9rem; line-height: 1.65; }

/* ===== Client logos marquee ===== */
.marquee {
  position: relative;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
}
.marquee-track {
  display: flex;
  gap: 4rem;
  width: max-content;
  animation: marquee 32s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track > span {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  letter-spacing: .12em;
  color: #b7b8ba;
  font-size: 1.4rem;
  white-space: nowrap;
  transition: color .3s;
  padding: 0 1rem;
}
.marquee-track > span:hover { color: #A5192E; }
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ===== Testimonials editorial ===== */
.testimonial-card {
  position: relative;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 4px;
  padding: 2.75rem 2rem 2rem;
  box-shadow: 0 15px 40px -25px rgba(0,0,0,.1);
  transition: transform .4s, box-shadow .4s;
}
.testimonial-card::before {
  content: '"';
  position: absolute;
  top: -1rem; left: 1.25rem;
  font-family: 'Montserrat', sans-serif;
  font-size: 6rem;
  color: #A5192E;
  line-height: 1;
  font-weight: 700;
}
.testimonial-card:hover { transform: translateY(-6px); box-shadow: 0 30px 60px -30px rgba(0,0,0,.18); }
.testimonial-card .stars { color: #A5192E; letter-spacing: .2em; margin-bottom: 1rem; font-size: .9rem; }
.testimonial-card p { color: #2F2F2F; line-height: 1.75; font-size: 1.05rem; }
.testimonial-card .who {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid #f0f0f0;
}
.testimonial-card .avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #A5192E;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: .9rem;
}
.testimonial-card .who strong {
  display: block;
  color: #2F2F2F;
  font-family: 'Montserrat', sans-serif;
  font-size: .95rem;
}
.testimonial-card .who span { font-size: .8rem; color: #808285; }

/* ===== CTA premium ===== */
.cta-section {
  position: relative;
  background:
    linear-gradient(135deg, rgba(0,0,0,.55) 0%, rgba(165,25,46,.85) 60%),
    url('img/galeria_3.png') center/cover no-repeat;
  overflow: hidden;
}
.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, rgba(255,255,255,.1), transparent 50%);
  pointer-events: none;
}

/* ===== Blog cards ===== */
.blog-card { display: block; }
.blog-card .thumb {
  aspect-ratio: 16/10;
  overflow: hidden;
  border-radius: 10px;
  margin-bottom: 1.25rem;
}
.blog-card .thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .7s cubic-bezier(.2,.7,.2,1);
}
.blog-card:hover .thumb img { transform: scale(1.05); }
.blog-card .cat {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: .7rem;
  letter-spacing: .25em;
  color: #A5192E;
  text-transform: uppercase;
}
.blog-card h3 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  color: #2F2F2F;
  font-size: 1.25rem;
  line-height: 1.4;
  margin: .75rem 0;
}
.blog-card p { color: #58595B; font-size: .95rem; line-height: 1.6; }

/* ===== Form ===== */
.field { display: block; }
.field span {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: .75rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #58595B;
  margin-bottom: .5rem;
}
.field input,
.field textarea {
  width: 100%;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: .85rem 1rem;
  font-family: inherit;
  font-size: .95rem;
  color: #2F2F2F;
  background: #fff;
  transition: border-color .3s, box-shadow .3s;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: #A5192E;
  box-shadow: 0 0 0 3px rgba(165,25,46,.08);
}

/* ===== Modal ===== */
#projectModal.is-open {
  display: flex !important;
}

/* ===== Media polish ===== */
img { max-width: 100%; display: block; }

/* ===== A11y ===== */
:focus-visible { outline: 2px solid #A5192E; outline-offset: 2px; }

/* ===== Mobile: centrar todo el contenido ===== */
@media (max-width: 767px) {
  section { text-align: center; }
  .eyebrow { justify-content: center; }
  .service-card,
  .timeline li,
  .testimonial-card,
  .blog-card { text-align: center; }
  .service-card::before { left: 50%; right: auto; transform: translateX(-50%); }
  .service-icon,
  .timeline .tl-icon,
  .blog-card .thumb,
  #nosotros img { margin-left: auto; margin-right: auto; }
  .testimonial-card::before { left: 50%; transform: translateX(-50%); }
  .testimonial-card .who { justify-content: center; }
  #projectFilters,
  #contacto .flex.flex-wrap.gap-4 { justify-content: center; }
  .marquee { text-align: left; }
  /* Excepciones: formulario mantiene alineación natural */
  form, form * { text-align: left; }
  form button { text-align: center; }

  /* Footer centrado */
  footer .grid > div,
  footer .grid ul { text-align: center; }
  footer .grid img { margin-left: auto; margin-right: auto; }
  footer .border-t > div { flex-direction: column; text-align: center; }
}
