/* Final critical fixes loaded after all site styles */

:root,
[data-theme="light"] {
  --brand-blue: #003A70;
  --brand-orange: #FF8200;
  --brand-red: #DA291C;
}

nav#navbar {
  background: rgba(255,255,255,.86) !important;
  border-bottom: 1px solid rgba(255,255,255,.72) !important;
  box-shadow: 0 8px 28px rgba(0,58,112,.08) !important;
  backdrop-filter: blur(16px) saturate(145%) !important;
}

[data-theme="dark"] nav#navbar {
  background: rgba(5,14,26,.74) !important;
}

[data-theme="dark"] .nav-links a,
[data-theme="dark"] .nav-btn,
[data-theme="dark"] .nav-btn i,
[data-theme="dark"] #langBtn,
[data-theme="dark"] #intranetLink {
  color: rgba(255,255,255,.94) !important;
}

[data-theme="dark"] .nav-links a:hover {
  color: #FFB04A !important;
}

.section-title,
.contacto-info h3,
.cert-card-title,
.maq-section-title,
.servicio-title,
.tl-content h4,
#clientes .section-title,
#maquinaria .section-title {
  color: var(--brand-blue) !important;
}

[data-theme="dark"] .section-title,
[data-theme="dark"] .contacto-info h3,
[data-theme="dark"] .cert-card-title,
[data-theme="dark"] .maq-section-title,
[data-theme="dark"] .servicio-title,
[data-theme="dark"] .tl-content h4,
[data-theme="dark"] #clientes .section-title,
[data-theme="dark"] #maquinaria .section-title,
[data-theme="dark"] .sector-chart-copy h3,
[data-theme="dark"] .sector-legend span {
  color: #ffffff !important;
}

/* MAQUINARIA */
#maquinaria .maq-center {
  align-items: stretch !important;
  gap: 1.4rem !important;
}

#maquinaria .maq-table-wrap {
  position: relative !important;
  overflow: hidden !important;
  border-radius: 24px !important;
  padding: 1.45rem !important;
  background:
    radial-gradient(circle at 0% 0%, rgba(255,130,0,.045), transparent 32%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(241,247,253,.98)) !important;
  border: 1px solid rgba(0,58,112,.12) !important;
  box-shadow: 0 22px 56px rgba(0,58,112,.12) !important;
}

#maquinaria .maq-table-wrap::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, #003A70, rgba(255,130,0,.72), #DA291C);
}

[data-theme="dark"] #maquinaria .maq-table-wrap {
  background:
    radial-gradient(circle at 0% 0%, rgba(255,130,0,.08), transparent 32%),
    linear-gradient(180deg, rgba(12,26,44,.98), rgba(7,18,31,.98)) !important;
  border-color: rgba(255,255,255,.10) !important;
  box-shadow: 0 22px 56px rgba(0,0,0,.28) !important;
}

#maquinaria .maq-section-title {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  margin: .3rem 0 1.1rem !important;
  color: #003A70 !important;
  font-size: clamp(1.35rem, 1.9vw, 2rem) !important;
  letter-spacing: .09em !important;
}

#maquinaria .maq-section-title::before {
  display: none !important;
  content: none !important;
}

[data-theme="dark"] #maquinaria .maq-section-title {
  color: #ffffff !important;
}

#maquinaria .maq-table {
  width: 100% !important;
  overflow: hidden !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border-radius: 18px !important;
  background: #ffffff !important;
  box-shadow: inset 0 0 0 1px rgba(0,58,112,.08) !important;
}

[data-theme="dark"] #maquinaria .maq-table {
  background: rgba(255,255,255,.035) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08) !important;
}

#maquinaria .maq-table thead th {
  padding: .9rem .85rem !important;
  background: linear-gradient(135deg, #003A70, #062a4c) !important;
  color: #ffffff !important;
  border: 0 !important;
  font-family: 'Barlow Condensed', sans-serif !important;
  font-size: .95rem !important;
  letter-spacing: .12em !important;
  text-transform: uppercase !important;
}

#maquinaria .maq-table thead th:first-child {
  border-top-left-radius: 18px !important;
}

#maquinaria .maq-table thead th:last-child {
  border-top-right-radius: 18px !important;
}

#maquinaria .maq-table tbody tr {
  transition: transform .2s ease, background .2s ease !important;
}

#maquinaria .maq-table tbody tr:hover {
  background: rgba(0,58,112,.045) !important;
  transform: translateX(3px) !important;
}

[data-theme="dark"] #maquinaria .maq-table tbody tr:hover {
  background: rgba(255,255,255,.055) !important;
}

#maquinaria .maq-table tbody td {
  padding: 1rem .9rem !important;
  color: #243a55 !important;
  border-bottom: 1px solid rgba(0,58,112,.08) !important;
  font-weight: 700 !important;
  text-align: center !important;
  vertical-align: middle !important;
}

#maquinaria .maq-table tbody tr:last-child td {
  border-bottom: 0 !important;
}

[data-theme="dark"] #maquinaria .maq-table tbody td {
  color: rgba(255,255,255,.84) !important;
  border-color: rgba(255,255,255,.07) !important;
}

#maquinaria .maq-table tbody td:first-child {
  color: #003A70 !important;
  font-family: 'Barlow Condensed', sans-serif !important;
  font-size: 1.22rem !important;
  letter-spacing: .04em !important;
}

[data-theme="dark"] #maquinaria .maq-table tbody td:first-child {
  color: #FFB04A !important;
}

#maquinaria .maq-tooling-cards {
  gap: 1rem !important;
}

#maquinaria .maq-tool-card {
  position: relative !important;
  min-height: 116px !important;
  overflow: hidden !important;
  border-radius: 22px !important;
  border: 1px solid rgba(255,130,0,.16) !important;
  background:
    radial-gradient(circle at 92% 12%, rgba(255,130,0,.045), transparent 35%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(249,247,244,.98)) !important;
  box-shadow: 0 16px 34px rgba(0,58,112,.08) !important;
  display: grid !important;
  grid-template-columns: 72px 1fr !important;
  align-items: center !important;
  column-gap: 1.35rem !important;
  padding: 1.25rem 1.45rem !important;
}

[data-theme="dark"] #maquinaria .maq-tool-card {
  background:
    radial-gradient(circle at 92% 12%, rgba(255,130,0,.09), transparent 35%),
    linear-gradient(180deg, rgba(12,26,44,.98), rgba(7,18,31,.98)) !important;
  border-color: rgba(255,130,0,.18) !important;
  box-shadow: 0 16px 34px rgba(0,0,0,.24) !important;
}

#maquinaria .maq-tool-card::before,
#maquinaria .maq-tool-card::after {
  display: none !important;
  content: none !important;
}

#maquinaria .maq-tool-card svg {
  display: block !important;
  grid-column: 1 !important;
  justify-self: center !important;
  align-self: center !important;
  width: 66px !important;
  height: 66px !important;
  padding: 17px !important;
  box-sizing: border-box !important;
  border-radius: 18px !important;
  color: #003A70 !important;
  stroke: currentColor !important;
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(244,238,230,.92)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 10px 20px rgba(0,58,112,.08) !important;
}

#maquinaria .maq-tool-card span {
  grid-column: 2 !important;
  justify-self: start !important;
  position: relative !important;
  z-index: 1 !important;
  color: #E66F1A !important;
  font-family: 'Barlow Condensed', sans-serif !important;
  font-size: 1.08rem !important;
  font-weight: 900 !important;
  letter-spacing: .07em !important;
  text-transform: uppercase !important;
}

/* HISTORIA - horizontal timeline on desktop */
@media (min-width: 901px) {
  #historia .historia-layout {
    display: block !important;
    max-width: 1180px !important;
    margin: 0 auto !important;
  }

  #historia .historia-piezas-col {
    display: none !important;
  }

  #historia .timeline {
    position: relative !important;
    display: grid !important;
    grid-template-columns: repeat(6, minmax(145px, 1fr)) !important;
    gap: 1rem !important;
    padding: 3.1rem 0 0 !important;
    margin: 0 auto !important;
  }

  #historia .timeline::before {
    content: '' !important;
    position: absolute !important;
    left: 4% !important;
    right: 4% !important;
    top: 1.42rem !important;
    width: auto !important;
    height: 2px !important;
    background: linear-gradient(90deg, rgba(0,58,112,.18), rgba(0,58,112,.42), rgba(255,130,0,.55)) !important;
  }

  #historia .timeline-item {
    position: relative !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: left !important;
  }

  #historia .timeline-item::before {
    display: none !important;
  }

  #historia .tl-dot {
    position: absolute !important;
    top: -2.02rem !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    border: 2px solid rgba(0,58,112,.28) !important;
    background: #f4f8fc !important;
    z-index: 2 !important;
  }

  #historia .tl-current .tl-dot {
    width: 14px !important;
    height: 14px !important;
    background: #FF8200 !important;
    border-color: #FF8200 !important;
    box-shadow: 0 0 0 7px rgba(255,130,0,.12) !important;
  }

  #historia .tl-year {
    position: static !important;
    display: block !important;
    margin-bottom: .65rem !important;
    text-align: center !important;
    color: rgba(0,58,112,.38) !important;
    font-family: 'Barlow Condensed', sans-serif !important;
    font-size: 1.35rem !important;
    font-weight: 900 !important;
  }

  #historia .tl-current .tl-year {
    color: #FF8200 !important;
  }

  #historia .tl-content {
    min-height: 210px !important;
    padding: 1.05rem !important;
    border-radius: 18px !important;
    background: rgba(255,255,255,.58) !important;
    border: 1px solid rgba(0,58,112,.09) !important;
    box-shadow: 0 12px 28px rgba(0,58,112,.06) !important;
  }

  #historia .tl-content h4 {
    font-size: .95rem !important;
    margin-bottom: .45rem !important;
  }

  #historia .tl-content p {
    font-size: .86rem !important;
    line-height: 1.55 !important;
  }
}

/* FOOTER - keep stable */
.site-footer-refresh,
footer.site-footer-refresh {
  padding: 1.9rem 5% 1rem !important;
  background: linear-gradient(180deg, #05121e 0%, #020d17 100%) !important;
  border-top: 3px solid #FF8200 !important;
}

.site-footer-refresh .footer-shell {
  width: 100% !important;
  max-width: 1180px !important;
  margin: 0 auto !important;
}

.site-footer-refresh .footer-main-row {
  display: grid !important;
  grid-template-columns: minmax(250px, 1fr) minmax(360px, auto) minmax(250px, 1fr) !important;
  grid-template-areas: "social logos links" !important;
  align-items: center !important;
  gap: 2rem !important;
  padding-bottom: 1.2rem !important;
  border-bottom: 1px solid rgba(255,255,255,.08) !important;
}

.site-footer-refresh .footer-social {
  grid-area: social !important;
  justify-self: start !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: .75rem !important;
  margin: 0 !important;
}

.site-footer-refresh .footer-logo-block {
  grid-area: logos !important;
  justify-self: center !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: .9rem !important;
  text-align: center !important;
}

.site-footer-refresh .footer-links {
  grid-area: links !important;
  justify-self: end !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-direction: row !important;
  gap: 1rem !important;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.site-footer-refresh .footer-social a {
  width: 42px !important;
  height: 42px !important;
  display: grid !important;
  place-items: center !important;
  border-radius: 999px !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  background: rgba(255,255,255,.04) !important;
  text-decoration: none !important;
}

.site-footer-refresh .footer-social a:hover {
  background: #FF8200 !important;
  border-color: #FF8200 !important;
}

.site-footer-refresh .footer-logo-cluster {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: .85rem !important;
}

.site-footer-refresh .footer-logo-quell,
.site-footer-refresh .footer-logo-group {
  width: 80px !important;
  height: 80px !important;
  object-fit: contain !important;
  border-radius: 22px !important;
  padding: .5rem !important;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(240,244,248,.94)) !important;
  border: 1px solid rgba(255,255,255,.9) !important;
  box-shadow: 0 10px 24px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.85) !important;
}

.site-footer-refresh .footer-logo-separator {
  width: 1px !important;
  height: 36px !important;
  background: rgba(255,255,255,.16) !important;
}

.site-footer-refresh .footer-alliance {
  margin: 0 !important;
  max-width: 520px !important;
  text-align: center !important;
  color: rgba(255,255,255,.82) !important;
  font-size: .92rem !important;
  line-height: 1.5 !important;
}

.site-footer-refresh .footer-links li {
  display: flex !important;
  align-items: center !important;
  gap: 1rem !important;
}

.site-footer-refresh .footer-links li:not(:last-child)::after {
  content: '' !important;
  width: 2px !important;
  height: 18px !important;
  background: #FF8200 !important;
  display: inline-block !important;
  margin-left: .2rem !important;
}

.site-footer-refresh .footer-links a {
  color: rgba(255,255,255,.78) !important;
  text-decoration: none !important;
  font-family: 'Barlow Condensed', sans-serif !important;
  font-size: .88rem !important;
  font-weight: 700 !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
}

.site-footer-refresh .footer-copy-bottom {
  margin: 0 !important;
  padding-top: 1rem !important;
  border-top: 1px solid rgba(255,255,255,.06) !important;
  text-align: center !important;
  color: rgba(255,255,255,.52) !important;
  font-size: .8rem !important;
}

@media (max-width: 900px) {
  .site-footer-refresh .footer-main-row {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "logos"
      "social"
      "links" !important;
    text-align: center !important;
  }

  .site-footer-refresh .footer-social,
  .site-footer-refresh .footer-links {
    justify-self: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
  }
}
