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

:root {
  --color-primary: #1a73e8;
  --color-primary-dark: #1557b0;
  --color-bg: #f4f6f8;
  --color-surface: #ffffff;
  --color-text: #212121;
  --color-text-light: #616161;
  --color-border: #e0e0e0;
  --sidebar-width: 260px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  height: 64px;
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: var(--color-border);
}

.logo-text {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary);
}

.header-nav ul {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.header-nav a {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
  transition: color 0.2s;
}

.header-nav a:hover {
  color: var(--color-primary);
}

/* ===== Layout: sidebar + content ===== */
.layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

.sidebar {
  flex: 0 0 var(--sidebar-width);
  background-color: var(--color-surface);
  border-right: 1px solid var(--color-border);
  height: auto;
}

.sidebar-nav {
  position: sticky;
  top: 64px;
  padding: 1.5rem 1rem;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.5rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--color-text);
  border-radius: 6px;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.sidebar-nav a:hover {
  background-color: var(--color-primary);
  color: var(--color-surface);
}

/* ===== Content ===== */
.content {
  flex: 1;
  padding: 2rem;
  background-color: var(--color-bg);
}

/* ===== Placeholder de imágenes ===== */
.hero-img,
.section-img,
.card-img,
.logo-img {
  background-color: var(--color-border);
  background-size: cover;
  background-position: center;
}

.hero-img {
  width: 100%;
  height: 280px;
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

.section-img {
  width: 100%;
  height: 180px;
  border-radius: 10px;
  margin: 1rem 0;
}

.card-img {
  width: 100%;
  height: 180px;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition:
    transform 0.3s ease,
    filter 0.3s ease;
}

.card:hover .card-img img {
  transform: scale(1.08);
  filter: brightness(1.05);
}

/* ===== Secciones ===== */
.hero {
  text-align: center;
  padding: 1rem 0 2.5rem;
}

.hero h1 {
  font-size: 2.2rem;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}

.hero p {
  font-size: 1.1rem;
  color: var(--color-text-light);
  max-width: 600px;
  margin: 0 auto;
}

.section {
  margin-bottom: 3rem;
  padding: 1.5rem;
  background-color: var(--color-surface);
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.section h2 {
  color: var(--color-primary);
  font-size: 1.6rem;
  margin-bottom: 1rem;
  border-bottom: 3px solid var(--color-primary);
  padding-bottom: 0.5rem;
  display: inline-block;
}

.section p {
  color: var(--color-text-light);
}

/* ===== Tarjetas ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.card {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.card h3 {
  padding: 1rem 1rem 0.25rem;
  color: var(--color-primary-dark);
}

.card p {
  padding: 0 1rem 1rem;
  color: var(--color-text-light);
  font-size: 0.95rem;
}

/* ===== Misión y Visión (tarjetas volteables) ===== */
.mv-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.flip-card {
  flex: 1 1 320px;
  height: 300px;
  perspective: 1200px;
  cursor: pointer;
  outline: none;
  /* sin box-shadow: las sombras aplanan preserve-3d */
}

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.7s ease;
  /* fuerza capa de GPU y evita glitches de rasterizado en Safari/iOS */
  will-change: transform;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
}

.flip-card:hover .flip-inner,
.flip-card:focus .flip-inner,
.flip-card:focus-within .flip-inner {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.flip-face {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: 10px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip-front {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-border);
}

.flip-front img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

/* overlay para oscurecer la imagen: en vez de filter, que rompe el 3D */
.flip-front::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.45);
}

.flip-card:hover .flip-front img {
  transform: scale(1.06);
}

.flip-label {
  position: relative;
  z-index: 2;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.flip-back {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
  padding: 2rem;
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-primary-dark)
  );
  color: #fff;
  /* sombra en la cara trasera via box-shadow interno, no externo */
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.flip-back h3 {
  color: #fff;
  font-size: 1.4rem;
}

.flip-back p {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.98rem;
  max-width: 42ch;
}

@media (max-width: 768px) {
  .flip-card {
    flex: 1 1 100%;
    height: 260px;
  }
}

/* ===== Clientes ===== */
.client-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.client-logos .logo-img {
  width: 120px;
  height: 80px;
  border-radius: 8px;
}

/* ===== Contacto ===== */
.contact-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.contact-info a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

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

/* ===== Footer ===== */
.footer {
  background-color: var(--color-primary-dark);
  color: var(--color-surface);
  text-align: center;
  padding: 1.25rem;
  font-size: 0.9rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .sidebar-nav {
    position: static;
  }

  .sidebar-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .sidebar-nav li {
    margin-bottom: 0;
  }

  .header-nav {
    display: none;
  }
}
