:root {
  --primary: #5a2a82;
  --primary-dark: #441f62;
  --text: #1f2430;
  --muted: #5e6675;
  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --border: #e6e8ef;
  --shadow: 0 12px 35px rgba(0, 0, 0, 0.08);
  --container: 1380px;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

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

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

.container {
  width: min(100%, var(--container));
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* =========================
   HEADER
========================= */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0;
}

.topbar-inner {
  height: 74px;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 0;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 0 !important;
  height: 74px;
}

.logo img {
  width: auto;
  height: 180px;
  margin-top: -12px;
  margin-bottom: -24px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 30px;
  flex-wrap: nowrap;
}

.nav a {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  position: relative;
  padding: 6px 0;
  white-space: nowrap;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 3px;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.25s ease;
}

.nav a:hover::after,
.nav a.active::after {
  width: 100%;
}

.sgs-logo {
  height: 46px;
  width: auto;
  object-fit: contain;
  margin-left: 10px;
  flex-shrink: 0;
}

/* =========================
   HERO / PAGE HERO
========================= */
.hero,
.page-hero {
  position: relative;
  min-height: 74vh;
  display: flex;
  align-items: center;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
  margin-top: 0;
}

.page-hero {
  min-height: 44vh;
}

.hero::before,
.hero::after,
.page-hero::before,
.page-hero::after {
  pointer-events: none;
}

.hero::before,
.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  z-index: 0;
}

/* Overlay suave por defecto */
.hero::after,
.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(20, 25, 38, 0.30) 0%,
    rgba(20, 25, 38, 0.18) 45%,
    rgba(20, 25, 38, 0.10) 100%
  );
  z-index: 1;
}

/* Overlay oscuro limpio para mejorar lectura */
.hero-dark::after {
  background: rgba(20, 25, 38, 0.42);
}

.hero-content,
.page-hero-content {
  position: relative;
  z-index: 2;
  width: min(100%, 1320px);
  margin: 0 auto;
  padding-left: 0;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 18px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1,
.page-hero h1 {
  margin: 0 0 18px;
  font-size: clamp(1.8rem, 3.8vw, 3.8rem);
  line-height: 1.04;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  max-width: 1000px;
  color: #ffffff;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.35);
}

.hero p,
.page-hero p {
  margin: 0;
  max-width: 760px;
  font-size: clamp(1rem, 1.7vw, 1.18rem);
  color: rgba(255, 255, 255, 0.98);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.32);
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 32px;
}

/* Ajustes por página */
.hero-empresa h1 {
  max-width: 1220px;
  font-size: clamp(1.8rem, 3.2vw, 3.5rem);
  line-height: 1.05;
}

.hero-maquinaria h1,
.hero-calidad h1,
.hero-contacto h1 {
  max-width: 1120px;
  font-size: clamp(1.8rem, 3.2vw, 3.4rem);
  line-height: 1.05;
}

/* =========================
   BUTTONS
========================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
}

/* =========================
   SECTIONS
========================= */
.section {
  padding: 84px 0;
}

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

.section-head {
  max-width: 860px;
  margin-bottom: 42px;
}

.section-head .kicker {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.section-head h2 {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 3.2vw, 3rem);
  line-height: 1.1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 36px;
  align-items: center;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-body {
  padding: 28px;
}

.feature-list {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.feature-item {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.feature-item strong {
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.highlight-boxes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 36px;
}

.highlight {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.highlight h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.highlight p {
  margin: 0;
  color: var(--muted);
}

.machine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.machine-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}

.machine-card:hover {
  transform: translateY(-4px);
}

.machine-card img {
  width: 100%;
  height: 240px;
  object-fit: cover;
}

.machine-card .content {
  padding: 22px;
}

.machine-card .tag {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
}

.machine-card h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.machine-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.97rem;
}

.iso-block {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}

.iso-block img {
  width: 130px;
  height: auto;
  flex-shrink: 0;
}

.iso-block h3 {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.iso-block p {
  margin: 0;
  color: var(--muted);
}

.contact-wrap {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 28px;
  align-items: stretch;
}

.contact-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}

.contact-card h3 {
  margin: 0 0 18px;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.contact-list {
  display: grid;
  gap: 14px;
}

.contact-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.contact-item:last-child {
  border-bottom: none;
}

.contact-item strong {
  display: block;
  font-size: 0.82rem;
  color: var(--primary);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.contact-item span,
.contact-item a {
  color: var(--text);
  font-size: 1rem;
}

.map-box {
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: #fff;
  min-height: 520px;
}

.map-box iframe {
  width: 100%;
  height: 100%;
  min-height: 520px;
  border: 0;
}

.cta-band {
  padding: 34px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary) 0%, #7440a3 100%);
  color: #fff;
  box-shadow: var(--shadow);
}

.cta-band h3 {
  margin: 0 0 10px;
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cta-band p {
  margin: 0 0 22px;
  color: rgba(255, 255, 255, 0.93);
}

.footer {
  background: #161a24;
  color: #dce1ea;
  margin-top: 0;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  padding: 42px 0;
}

.footer strong {
  display: block;
  margin-bottom: 10px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer p,
.footer a {
  margin: 0;
  color: #dce1ea;
}

.footer-links {
  display: grid;
  gap: 8px;
}

.small-note {
  padding: 18px 0 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #aab2c2;
  font-size: 0.92rem;
}

.image-cover {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: cover;
}

/* =========================
   RESPONSIVE
   SOLO AJUSTES MÓVIL / TABLET
   ESCRITORIO SE MANTIENE IGUAL
========================= */
@media (max-width: 1080px) {
  .machine-grid,
  .highlight-boxes,
  .contact-wrap,
  .grid-2,
  .footer-inner {
    grid-template-columns: 1fr;
  }

  .machine-card img {
    height: 260px;
  }
}

@media (max-width: 980px) {
  .nav {
    gap: 18px;
    flex-wrap: wrap;
  }

  .nav a {
    font-size: 0.92rem;
  }

  .sgs-logo {
    height: 40px;
  }

  .logo img {
    height: 92px;
  }

  .topbar-inner {
    height: auto;
    min-height: 68px;
    padding: 10px 0;
    align-items: center;
  }

  .logo {
    height: auto;
  }
}

@media (max-width: 860px) {
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }

  .topbar {
    position: sticky;
  }

  .topbar-inner {
    min-height: auto;
    height: auto;
    padding: 12px 0;
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .logo {
    height: auto;
  }

  .logo img {
    height: 74px;
    width: auto;
    margin-top: 0;
    margin-bottom: 0;
  }

  .nav {
    width: 100%;
    gap: 10px 16px;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav a {
    font-size: 0.88rem;
    line-height: 1.2;
  }

  .sgs-logo {
    margin-left: 0;
    height: 34px;
  }

  .hero-content,
  .page-hero-content {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero,
  .page-hero {
    min-height: 56vh;
  }

  .page-hero {
    min-height: 38vh;
  }

  .section {
    padding: 60px 0;
  }

  .section-head {
    margin-bottom: 30px;
  }

  .highlight-boxes {
    margin-top: 26px;
  }

  .card-body,
  .contact-card {
    padding: 24px;
  }

  .iso-block {
    flex-direction: column;
    align-items: flex-start;
  }

  .iso-block img {
    width: 110px;
  }

  .image-cover {
    min-height: 300px;
  }

  .map-box,
  .map-box iframe {
    min-height: 380px;
  }
}

@media (max-width: 760px) {
  .hero,
  .page-hero {
    min-height: 52vh;
  }

  .page-hero {
    min-height: 34vh;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
    max-width: none;
  }

  .machine-grid,
  .highlight-boxes {
    grid-template-columns: 1fr;
  }

  .hero h1,
  .page-hero h1,
  .hero-empresa h1,
  .hero-maquinaria h1,
  .hero-calidad h1,
  .hero-contacto h1 {
    font-size: clamp(1.7rem, 7vw, 2.55rem);
    line-height: 1.08;
    max-width: 100%;
  }

  .hero p,
  .page-hero p {
    font-size: 0.98rem;
    max-width: 100%;
  }

  .section-head h2 {
    font-size: clamp(1.6rem, 6vw, 2.25rem);
  }

  .machine-card img {
    height: 230px;
  }

  .feature-item,
  .highlight,
  .machine-card .content {
    padding: 18px;
  }
}

@media (max-width: 560px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar-inner {
    gap: 10px;
    padding: 10px 0;
  }

  .logo img {
    height: 62px;
  }

  .nav {
    gap: 8px 12px;
  }

  .nav a {
    font-size: 0.82rem;
    letter-spacing: 0.05em;
  }

  .sgs-logo {
    height: 28px;
  }

  .hero-content,
  .page-hero-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .eyebrow {
    margin-bottom: 14px;
    padding: 7px 12px;
    font-size: 0.72rem;
  }

  .hero h1,
  .page-hero h1,
  .hero-empresa h1,
  .hero-maquinaria h1,
  .hero-calidad h1,
  .hero-contacto h1 {
    font-size: clamp(1.55rem, 8vw, 2.1rem);
  }

  .hero p,
  .page-hero p {
    font-size: 0.94rem;
  }

  .section {
    padding: 48px 0;
  }

  .section-head h2 {
    font-size: clamp(1.45rem, 7vw, 1.95rem);
  }

  .highlight,
  .feature-item,
  .contact-card,
  .card-body,
  .cta-band {
    padding: 20px;
  }

  .machine-card img {
    height: 210px;
  }

  .image-cover {
    min-height: 240px;
  }

  .map-box,
  .map-box iframe {
    min-height: 320px;
  }

  .small-note {
    font-size: 0.84rem;
  }
}

.hero-maquinaria::before {
  background-size: 100%;
}

.hero-calidad::before {
  background-size: 100%;
}

.hero-contacto::before {
  background-size: 100%;
}


/* ==========================================
   AJUSTE FINO SOLO PARA MÓVIL
   CONSISTENCIA ENTRE DISTINTOS TELÉFONOS
   Añadir al FINAL del CSS
========================================== */

@media (max-width: 640px) {
  /* Cabecera móvil más estable */
  .topbar-inner {
    align-items: center;
    justify-content: center;
  }

  .logo {
    justify-content: center;
    width: 100%;
  }

  .logo img {
    height: 58px;
  }

  /* Menú móvil fijo en rejilla para que no "baile" según pantalla */
  .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    width: 100%;
    align-items: stretch;
  }

  .nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 10px;
    text-align: center;
    white-space: nowrap;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
  }

  .nav a::after {
    display: none;
  }

  .nav a.active {
    border-color: var(--primary);
    box-shadow: inset 0 -3px 0 var(--primary);
  }

  .sgs-logo {
    grid-column: 1 / -1;
    justify-self: center;
    align-self: center;
    height: 28px;
    margin: 2px 0 0;
  }

  /* Hero más consistente entre móviles */
  .hero,
  .page-hero {
    min-height: auto;
    padding-top: 34px;
    padding-bottom: 34px;
  }

  .hero-content,
  .page-hero-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Título principal controlado para que no varíe tanto entre móviles */
  .hero h1 {
    width: min(100%, 10.8ch);
    max-width: none;
    margin-bottom: 16px;
    font-size: clamp(2.05rem, 8.1vw, 2.55rem);
    line-height: 0.98;
    letter-spacing: 0.01em;
    text-wrap: balance;
  }

  /* Resto de titulares de páginas interiores */
  .page-hero h1,
  .hero-empresa h1,
  .hero-maquinaria h1,
  .hero-calidad h1,
  .hero-contacto h1 {
    width: min(100%, 16ch);
    max-width: none;
    font-size: clamp(1.7rem, 6.4vw, 2.15rem);
    line-height: 1.02;
    text-wrap: balance;
  }

  .hero p,
  .page-hero p {
    max-width: 30ch;
    font-size: 0.97rem;
    line-height: 1.45;
  }

  .hero-actions {
    margin-top: 22px;
    gap: 12px;
  }

  .btn {
    min-height: 54px;
  }
}

@media (max-width: 400px) {
  .nav {
    grid-template-columns: 1fr;
  }

  .nav a {
    font-size: 0.8rem;
  }

  .hero h1 {
    width: min(100%, 10.2ch);
    font-size: clamp(1.85rem, 8vw, 2.2rem);
  }

  .page-hero h1,
  .hero-empresa h1,
  .hero-maquinaria h1,
  .hero-calidad h1,
  .hero-contacto h1 {
    width: min(100%, 14.5ch);
    font-size: clamp(1.55rem, 6.8vw, 1.95rem);
  }
}
