/* ============================================================
   D3A Mantenimiento Integral — Sistema de diseño
   Ver DESIGN_SYSTEM.md para la guía completa de uso.
   ============================================================ */

:root {
  --ink: #14171c;
  --ink-2: #0b0d10;
  --cream: #f7f6f3;
  --cream-2: #edebe5;
  --orange: #e8632a;
  --orange-dark: #c94f1c;
  --green: #2f6d4f;
  --green-tint: #e3ede7;
  --blue: #2e5aa8;
  --blue-tint: #e3e9f5;
  --ink-muted: #6b7280;
  --cream-muted: #a7abb3;
  --white: #ffffff;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --shadow-soft: 0 20px 40px -20px rgba(11, 13, 16, 0.35);
  --shadow-lift: 0 30px 60px -25px rgba(11, 13, 16, 0.45);

  --font-display: "Fraunces", "IBM Plex Sans", serif;
  --font-body: "IBM Plex Sans", Arial, sans-serif;

  --container: 1160px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

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

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

h1 { font-size: clamp(2.6rem, 5vw, 4.2rem); font-weight: 500; }
h2 { font-size: clamp(2rem, 3.4vw, 2.9rem); }
h3 { font-size: 1.35rem; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 14px;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--orange);
  display: inline-block;
}

.section {
  padding: 96px 0;
}
@media (max-width: 720px) {
  .section { padding: 64px 0; }
}

.section-dark { background: var(--ink); color: var(--white); }
.section-dark .ink-muted { color: var(--cream-muted); }
.section-light { background: var(--cream); color: var(--ink); }
.section-light-2 { background: var(--cream-2); color: var(--ink); }

.section-head {
  max-width: 640px;
  margin-bottom: 56px;
}
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head p { color: var(--ink-muted); font-size: 1.05rem; margin-top: 14px; }
.section-dark .section-head p { color: var(--cream-muted); }

/* ---------- Buttons ---------- */
.btn-primary, .btn-outline, .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 28px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.98rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--orange);
  color: var(--white);
  box-shadow: 0 14px 30px -12px rgba(232, 99, 42, 0.55);
}
.btn-primary:hover { background: var(--orange-dark); transform: translateY(-2px); }

.btn-outline {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--white);
}
.btn-outline:hover { border-color: var(--white); transform: translateY(-2px); }

.section-light .btn-outline, .section-light-2 .btn-outline {
  border-color: rgba(20, 23, 28, 0.25);
  color: var(--ink);
}
.section-light .btn-outline:hover, .section-light-2 .btn-outline:hover { border-color: var(--ink); }

.btn-ghost {
  background: var(--cream-2);
  color: var(--ink);
}
.btn-ghost:hover { background: #e2ded4; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
}
.badge--orange { background: rgba(232, 99, 42, 0.14); color: var(--orange); }
.badge--green  { background: var(--green-tint); color: var(--green); }
.badge--blue   { background: var(--blue-tint); color: var(--blue); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(20, 23, 28, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 84px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 40px; width: auto; }
.brand-text { line-height: 1.1; }
.brand-text strong { font-family: var(--font-display); font-size: 1.15rem; color: var(--white); display: block; }
.brand-text span { font-size: 0.68rem; letter-spacing: 0.12em; color: var(--cream-muted); text-transform: uppercase; }

.main-nav { display: flex; align-items: center; gap: 34px; }
.main-nav a {
  font-size: 0.92rem;
  color: rgba(247, 246, 243, 0.82);
  font-weight: 500;
  transition: color 0.2s ease;
}
.main-nav a:hover { color: var(--orange); }
.main-nav a.blog-link { color: var(--blue); font-weight: 600; }

.nav-toggle { display: none; background: none; border: 0; color: var(--white); font-size: 1.6rem; cursor: pointer; }

@media (max-width: 920px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 84px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--ink);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-soft);
  }
  .main-nav.is-open { display: flex; }
  .main-nav a {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 1rem;
  }
  .main-nav .header-cta-mobile { display: inline-flex; margin: 16px 24px 20px; }
  .nav-toggle { display: block; }
  .header-cta { display: none; }
}
@media (min-width: 921px) {
  .header-cta-mobile { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background: var(--ink);
  color: var(--white);
  overflow: hidden;
  padding: 120px 0 100px;
}
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    radial-gradient(circle at 82% 18%, rgba(232, 99, 42, 0.22), transparent 45%),
    radial-gradient(circle at 10% 85%, rgba(47, 109, 79, 0.20), transparent 40%),
    radial-gradient(circle at 60% 100%, rgba(46, 90, 168, 0.16), transparent 40%),
    linear-gradient(155deg, rgba(20,23,28,0.92) 0%, rgba(15,17,21,0.90) 55%, rgba(11,13,16,0.95) 100%);
  pointer-events: none;
}
.hero .container { position: relative; z-index: 2; }
.hero-kicker { color: var(--orange); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.82rem; margin-bottom: 22px; }
.hero h1 { max-width: 780px; color: var(--white); }
.hero h1 em { font-style: italic; color: var(--orange); }
.hero-sub { max-width: 560px; font-size: 1.12rem; color: var(--cream-muted); margin: 26px 0 38px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 56px; }

.trust-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  padding-top: 36px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.trust-item { display: flex; align-items: flex-start; gap: 10px; font-size: 0.88rem; color: rgba(247, 246, 243, 0.85); }
.trust-item svg { flex-shrink: 0; color: var(--orange); margin-top: 2px; }
@media (max-width: 920px) {
  .trust-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Services ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
@media (max-width: 920px) { .services-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .services-grid { grid-template-columns: 1fr; } }

.service-card {
  background: var(--white);
  border: 1px solid rgba(20, 23, 28, 0.08);
  border-radius: var(--radius-md);
  padding: 32px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.service-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-soft); }
.service-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink);
  color: var(--orange);
  margin-bottom: 20px;
}
.service-card h3 { margin-bottom: 10px; }
.service-card p { color: var(--ink-muted); font-size: 0.95rem; }
.service-card--cta {
  background: var(--ink);
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.service-card--cta h3 { color: var(--white); margin-bottom: 12px; }
.service-card--cta p { color: var(--cream-muted); margin-bottom: 22px; }

/* ---------- Diferenciador (oficio + tecnología) ---------- */
.diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}
@media (max-width: 860px) { .diff-grid { grid-template-columns: 1fr; gap: 40px; } }

.diff-list { display: grid; gap: 18px; margin-top: 28px; }
.diff-item {
  display: flex;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--white);
  border: 1px solid rgba(20,23,28,0.07);
}
.diff-item .badge { flex-shrink: 0; height: fit-content; }
.diff-item h4 { font-family: var(--font-body); font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.diff-item p { color: var(--ink-muted); font-size: 0.92rem; }

.diff-visual {
  border-radius: var(--radius-lg);
  aspect-ratio: 4/5;
  background:
    linear-gradient(160deg, rgba(20,23,28,0.05), rgba(20,23,28,0) 60%),
    repeating-linear-gradient(135deg, rgba(20,23,28,0.06) 0 2px, transparent 2px 26px),
    var(--ink);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 28px;
}
.diff-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.diff-visual.has-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11,13,16,0) 35%, rgba(11,13,16,0.9) 100%);
  z-index: 1;
}
.diff-visual .tag {
  position: relative;
  z-index: 2;
  background: rgba(247,246,243,0.94);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
}

/* ---------- Portfolio ---------- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 860px) { .portfolio-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .portfolio-grid { grid-template-columns: 1fr; } }

.portfolio-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4/3.2;
  background: linear-gradient(150deg, #22262f, var(--ink-2));
  display: flex;
  align-items: flex-end;
  padding: 20px;
  border: 1px solid rgba(255,255,255,0.06);
}
.portfolio-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  transition: transform 0.4s ease;
}
.portfolio-item:has(img):hover img { transform: scale(1.05); }
.portfolio-item.has-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11,13,16,0) 40%, rgba(11,13,16,0.88) 100%);
  z-index: 1;
}
.portfolio-item.ph-1 { background: linear-gradient(150deg, #2a2f39, #14171c 70%); }
.portfolio-item.ph-2 { background: linear-gradient(150deg, #22301f 0%, #14171c 65%); }
.portfolio-item.ph-3 { background: linear-gradient(150deg, #1c2636, #14171c 65%); }
.portfolio-item.ph-4 { background: linear-gradient(150deg, #2f2318, #14171c 65%); }
.portfolio-item.ph-6 { background: linear-gradient(150deg, #241c30, #14171c 65%); }
.portfolio-item.ph-electrico {
  background: linear-gradient(150deg, #1c2c3e 0%, #14171c 70%);
  position: relative;
}
.portfolio-item.ph-electrico::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 78% 22%, rgba(90,150,220,0.16), transparent 55%);
}
.portfolio-caption { position: relative; z-index: 2; color: var(--white); }
.portfolio-caption .cat { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--cream-muted); margin-bottom: 4px; display:block; }
.portfolio-caption strong { font-family: var(--font-display); font-weight: 500; font-size: 1.1rem; }

/* ---------- Proceso ---------- */
.process-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  counter-reset: step;
}
@media (max-width: 860px) { .process-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .process-grid { grid-template-columns: 1fr; } }
.process-step { position: relative; padding-top: 14px; }
.process-step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--orange);
  opacity: 0.9;
  display: block;
  margin-bottom: 10px;
}
.process-step h4 { font-size: 1.05rem; margin-bottom: 8px; }
.process-step p { color: var(--ink-muted); font-size: 0.92rem; }

/* ---------- Testimonios ---------- */
.testi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
@media (max-width: 860px) { .testi-grid { grid-template-columns: 1fr; } }
.testi-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  padding: 30px;
}
.testi-stars { color: var(--orange); letter-spacing: 3px; margin-bottom: 16px; font-size: 0.9rem; }
.testi-card p.quote { font-size: 1rem; color: rgba(247,246,243,0.92); margin-bottom: 22px; }
.testi-name { font-weight: 700; font-size: 0.92rem; }
.testi-loc { color: var(--cream-muted); font-size: 0.82rem; }

/* ---------- Blog teaser ---------- */
.blog-teaser {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 60px;
  align-items: center;
}
@media (max-width: 860px) { .blog-teaser { grid-template-columns: 1fr; gap: 36px; } }
.blog-teaser-cards { display: grid; gap: 16px; }
.blog-mini-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--white);
  border: 1px solid rgba(20,23,28,0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: transform 0.2s ease;
}
.blog-mini-card:hover { transform: translateX(4px); }
.blog-mini-thumb { width: 64px; height: 64px; border-radius: 12px; flex-shrink: 0; background: var(--ink); }
.blog-mini-thumb.t-green { background: var(--green); }
.blog-mini-thumb.t-blue { background: var(--blue); }
.blog-mini-thumb.t-orange { background: var(--orange); }
.blog-mini-card h4 { font-size: 0.98rem; margin-bottom: 4px; }
.blog-mini-card span { color: var(--ink-muted); font-size: 0.82rem; }

/* ---------- Contacto / CTA final ---------- */
.cta-final {
  background: var(--ink);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
}
.cta-final h2 { max-width: 480px; color: var(--white); }
@media (max-width: 720px) { .cta-final { padding: 40px 28px; } }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink-2);
  color: var(--cream-muted);
  padding: 64px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
@media (max-width: 780px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h5 { color: var(--white); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 16px; }
.footer-grid ul { display: grid; gap: 10px; }
.footer-grid a { font-size: 0.9rem; transition: color 0.2s ease; }
.footer-grid a:hover { color: var(--orange); }
.footer-bottom { padding-top: 26px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 0.82rem; }

/* ---------- Reveal animation ----------
   Solo se oculta si la clase "js" está en <html> (la agrega un script inline
   apenas carga la página). Así, si JavaScript falla o tarda, el contenido
   siempre es visible por defecto — nunca depende del JS para mostrarse. */
.js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

/* ============================================================
   Blog
   ============================================================ */
.blog-hero {
  background: var(--ink);
  color: var(--white);
  padding: 110px 0 70px;
}
.blog-filter { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 30px; }
.blog-filter button {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--white);
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.blog-filter button.active, .blog-filter button:hover {
  background: var(--orange);
  border-color: var(--orange);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}
@media (max-width: 920px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .post-grid { grid-template-columns: 1fr; } }

.post-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(20,23,28,0.08);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.post-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-soft); }
.post-card-media {
  aspect-ratio: 16/10;
  background: linear-gradient(150deg, #22262f, var(--ink-2));
}
.post-card-media.cat-solar { background: linear-gradient(150deg, #22301f, #14171c 70%); }
.post-card-media.cat-tech { background: linear-gradient(150deg, #1c2636, #14171c 70%); }
.post-card-media.cat-proyectos { background: linear-gradient(150deg, #2a2f39, #14171c 70%); }
.post-card-body { padding: 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.post-card-body .badge { align-self: flex-start; }
.post-card-body h3 { font-size: 1.12rem; }
.post-card-body p { color: var(--ink-muted); font-size: 0.9rem; flex: 1; }
.post-card-meta { font-size: 0.78rem; color: var(--ink-muted); display: flex; justify-content: space-between; margin-top: 6px; }

/* Single post */
.post-header {
  background: var(--ink);
  color: var(--white);
  padding: 130px 0 70px;
}
.post-header .badge { margin-bottom: 20px; }
.post-header h1 { color: var(--white); max-width: 780px; }
.post-meta-row { display: flex; gap: 24px; margin-top: 26px; color: var(--cream-muted); font-size: 0.9rem; flex-wrap: wrap; }

.post-body {
  max-width: 740px;
  margin: 0 auto;
  padding: 70px 24px;
}
.post-body p { margin-bottom: 22px; color: #33363c; font-size: 1.05rem; }
.post-body h2 { margin: 40px 0 16px; font-size: 1.7rem; }
.post-body h3 { margin: 30px 0 12px; }
.post-body ul { margin: 0 0 22px 0; display: grid; gap: 10px; }
.post-body li { padding-left: 26px; position: relative; color: #33363c; }
.post-body li::before { content: "→"; position: absolute; left: 0; color: var(--orange); font-weight: 700; }
.post-figure { border-radius: var(--radius-md); overflow: hidden; margin: 34px 0; }
.post-cta {
  margin-top: 50px;
  background: var(--cream-2);
  border-radius: var(--radius-md);
  padding: 34px;
  text-align: center;
}
.post-cta h3 { margin-bottom: 14px; }

.breadcrumb { font-size: 0.85rem; color: var(--cream-muted); margin-bottom: 22px; }
.breadcrumb a:hover { color: var(--orange); }

/* Utility */
.mt-lg { margin-top: 48px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.whatsapp-fab {
  position: fixed;
  bottom: 26px;
  right: 26px;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: #25D366;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 26px -8px rgba(0,0,0,0.4);
  z-index: 200;
}
