/* =========================================
   Variables de identidad visual (RIPLAS)
   ========================================= */
:root {
  --navy: #153252;
  --navy-dark: #0e223a;
  --navy-light: #224b78;
  --accent-soft: #eaf0f7;
  --white: #ffffff;
  --bg-light: #f6f8fb;
  --text-main: #1e293b;
  --text-muted: #526277;
  --border: #dce4ee;
  --wa-green: #25d366;
  --wa-green-dark: #1da851;
  --radius: 10px;
  --shadow-sm: 0 4px 12px rgba(21, 50, 82, 0.07);
  --shadow-md: 0 12px 28px rgba(21, 50, 82, 0.14);
  --transition: 0.22s ease;
}

/* Reset básico */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text-main);
  background: var(--white);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1160px, 92%);
  margin-inline: auto;
}

/* =========================================
   Botones reutilizables
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.96rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background var(--transition), color var(--transition), transform var(--transition), border-color var(--transition);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--navy);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--navy-light);
}

.btn-light {
  background: var(--white);
  color: var(--navy);
}

.btn-light:hover {
  background: var(--accent-soft);
}

.btn-outline-light {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.65);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--white);
}

.btn-full {
  width: 100%;
}

/* =========================================
   Navbar
   ========================================= */
.navbar {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(21, 50, 82, 0.05);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
}

.brand-logo {
  height: 54px;
  width: auto;
  object-fit: contain;
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

.nav-links a {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--navy);
  transition: color var(--transition);
}

.nav-links a:hover {
  color: var(--navy-light);
}

.btn-nav-contacto {
  background: var(--navy);
  color: var(--white) !important;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius);
}

.btn-nav-contacto:hover {
  background: var(--navy-light);
}

.nav-portal-link {
  border: 1.5px solid var(--navy);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius);
  font-size: 0.88rem !important;
}

.nav-portal-link:hover {
  background: var(--accent-soft);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  width: 26px;
  height: 3px;
  background: var(--navy);
  border-radius: 2px;
}

/* =========================================
   Hero
   ========================================= */
.hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 60%, var(--navy-light) 100%);
  color: var(--white);
  padding: 5.5rem 0 5rem;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -120px;
  width: 420px;
  height: 420px;
  background: rgba(255, 255, 255, 0.04);
  transform: rotate(45deg);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.15;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.hero-eslogan {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 2.2rem;
  max-width: 620px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* =========================================
   Secciones generales
   ========================================= */
.section {
  padding: 4.5rem 0;
}

.section-light {
  background: var(--bg-light);
}

.section-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 3rem;
}

.section-tag {
  display: inline-block;
  color: var(--navy-light);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.45rem;
}

.section-header h2 {
  color: var(--navy);
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
  line-height: 1.2;
}

.section-subtitle {
  color: var(--text-muted);
  margin-top: 0.65rem;
}

/* =========================================
   Nosotros
   ========================================= */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.8rem;
}

.about-card {
  background: var(--white);
  padding: 2.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-accent {
  width: 44px;
  height: 4px;
  background: var(--navy);
  border-radius: 2px;
  margin-bottom: 1rem;
}

.about-card h3 {
  color: var(--navy);
  font-size: 1.35rem;
  margin-bottom: 0.8rem;
}

.about-card p {
  color: var(--text-muted);
}

/* =========================================
   Servicios y Portales Externos
   ========================================= */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.5rem;
}

.service-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 4px solid var(--navy);
  border-radius: var(--radius);
  padding: 1.7rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition), box-shadow var(--transition);
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.service-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy-light);
  letter-spacing: 0.08em;
  margin-bottom: 0.45rem;
}

.service-card h3 {
  color: var(--navy);
  font-size: 1.15rem;
  margin-bottom: 0.55rem;
}

.service-card p {
  color: var(--text-muted);
  font-size: 0.94rem;
  margin-bottom: 1.2rem;
}

.service-cta {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.service-cta:hover {
  color: var(--navy-light);
}

.portales-wrapper {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.portales-heading {
  color: var(--navy);
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
}

.portales-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.portal-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  padding: 2rem;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.2rem;
  box-shadow: var(--shadow-md);
}

.portal-card p {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.95rem;
}

/* =========================================
   Galería de Obras (Subcarpetas)
   ========================================= */
.filtros-obras {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 2.2rem;
}

.filtro-btn {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--border);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.filtro-btn:hover,
.filtro-btn.activo {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.obras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.6rem;
}

.obra-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition);
}

.obra-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.obra-cover {
  height: 210px;
  background: var(--navy);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.obra-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.obra-card:hover .obra-cover img {
  transform: scale(1.04);
}

.obra-placeholder {
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
}

.obra-count {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(14, 34, 58, 0.85);
  color: var(--white);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.obra-body {
  padding: 1.35rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.obra-cat {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--navy-light);
  letter-spacing: 0.06em;
}

.obra-body h3 {
  color: var(--navy);
  font-size: 1.1rem;
}

.obra-meta {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* =========================================
   Modal de Galería
   ========================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 34, 58, 0.84);
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.abierto {
  display: flex;
}

.modal-dialog {
  background: var(--white);
  border-radius: var(--radius);
  width: min(920px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 1.8rem;
  position: relative;
  box-shadow: var(--shadow-md);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--navy);
  cursor: pointer;
}

.modal-cat {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--navy-light);
}

.modal-header h3 {
  color: var(--navy);
  font-size: 1.45rem;
  margin-top: 0.2rem;
}

.modal-meta {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.modal-desc {
  color: var(--text-main);
  margin-bottom: 1.2rem;
  font-size: 0.95rem;
}

.modal-viewer {
  position: relative;
  background: var(--navy-dark);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  max-height: 55vh;
  overflow: hidden;
}

.viewer-stage {
  width: 100%;
  text-align: center;
}

.viewer-stage img {
  margin-inline: auto;
  max-height: 50vh;
  object-fit: contain;
}

.viewer-stage figcaption {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.82rem;
  padding: 0.45rem;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
}

.viewer-nav:hover {
  background: rgba(255, 255, 255, 0.35);
}

.viewer-prev { left: 12px; }
.viewer-next { right: 12px; }

.modal-empty {
  padding: 2.5rem;
  text-align: center;
  background: var(--bg-light);
  border-radius: var(--radius);
  color: var(--text-muted);
}

.modal-thumbs {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  margin-top: 1rem;
  padding-bottom: 0.3rem;
}

.modal-thumbs img {
  width: 76px;
  height: 58px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.6;
  border: 2px solid transparent;
  transition: opacity var(--transition), border-color var(--transition);
}

.modal-thumbs img.activa,
.modal-thumbs img:hover {
  opacity: 1;
  border-color: var(--navy);
}

/* =========================================
   Contacto
   ========================================= */
.contacto-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 2.5rem;
  align-items: start;
}

.contacto-info {
  background: var(--navy);
  color: var(--white);
  padding: 2.2rem;
  border-radius: var(--radius);
}

.contacto-info h3 {
  font-size: 1.4rem;
  margin-bottom: 0.7rem;
}

.contacto-intro {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.94rem;
  margin-bottom: 1.5rem;
}

.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  font-size: 0.94rem;
}

.info-list strong {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.68);
}

.info-list a:hover {
  text-decoration: underline;
}

.redes-box {
  margin-top: 1.8rem;
  padding-top: 1.3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.redes-box h4 {
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
}

.redes-lista {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.red-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  transition: background var(--transition);
}

.red-pill:hover {
  background: rgba(255, 255, 255, 0.26);
}

.contacto-form {
  background: var(--white);
  padding: 2.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.72rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  background: var(--white);
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--navy);
}

.hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
}

.form-status {
  margin-top: 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 1.3em;
}

.form-status.ok { color: #16794c; }
.form-status.err { color: #b91c1c; }

/* =========================================
   Footer
   ========================================= */
.footer {
  background: var(--navy-dark);
  color: rgba(255, 255, 255, 0.82);
  padding: 1.8rem 0;
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a:hover {
  color: var(--white);
  text-decoration: underline;
}

/* =========================================
   Widget Flotante de WhatsApp
   ========================================= */
.wa-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.8rem;
}

.wa-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--wa-green);
  color: var(--white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.42);
  transition: transform var(--transition), background var(--transition);
}

.wa-fab:hover {
  background: var(--wa-green-dark);
  transform: scale(1.06);
}

.wa-panel {
  width: min(350px, calc(100vw - 32px));
  background: var(--white);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(14, 34, 58, 0.25);
  border: 1px solid var(--border);
  overflow: hidden;
  display: none;
  flex-direction: column;
}

.wa-panel.abierto {
  display: flex;
}

.wa-header {
  background: var(--navy);
  color: var(--white);
  padding: 1rem 1.15rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
}

.wa-header strong {
  display: block;
  font-size: 0.98rem;
}

.wa-header small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
}

.wa-close {
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.wa-body {
  padding: 1rem;
  background: #f0f4f8;
  max-height: 370px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wa-bubble {
  background: var(--white);
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.wa-options {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.wa-opt-btn {
  text-align: left;
  background: var(--white);
  border: 1.5px solid var(--navy);
  color: var(--navy);
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.wa-opt-btn:hover {
  background: var(--navy);
  color: var(--white);
}

.wa-nota-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.86rem;
}

.wa-send-link {
  display: block;
  text-align: center;
  background: var(--wa-green);
  color: var(--white);
  font-weight: 700;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.92rem;
}

.wa-send-link:hover {
  background: var(--wa-green-dark);
}

.wa-footer {
  padding: 0.6rem 1rem;
  background: var(--white);
  border-top: 1px solid var(--border);
  text-align: right;
}

.wa-reset-btn {
  background: transparent;
  border: none;
  color: var(--navy-light);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.wa-reset-btn:hover {
  text-decoration: underline;
}

/* =========================================
   Responsivo (móviles y tablets)
   ========================================= */
@media (max-width: 860px) {
  .contacto-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    top: 76px;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 1.2rem 4%;
    display: none;
    box-shadow: var(--shadow-md);
  }

  .nav-menu.abierto {
    display: block;
  }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 0.9rem;
  }

  .btn-nav-contacto,
  .nav-portal-link {
    text-align: center;
  }
}