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

body {
  font-family: "Raleway", system-ui, sans-serif;
  color: #222;
  background: #fff;
}
a { color: inherit; }

/* ---------- Cabecera con vídeo (home) ---------- */
.hero {
  position: relative;
  background: #fff; /* fondo blanco detrás del vídeo */
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-video {
  position: relative;
  width: 100%;
  height: auto;          /* respeta la altura natural del vídeo, sin recortar */
  max-height: 88vh;      /* tope de altura en pantallas muy grandes */
  object-fit: contain;   /* nunca recorta ni deforma el vídeo */
  display: block;
}
.hero-frame {
  position: relative;
  width: 100%;
  height: auto;
  max-height: 88vh;
  object-fit: contain;
  display: none;   /* se muestra solo tras terminar el vídeo */
}
.hero-frame.visible { display: block; }
.hero-frame.visible + .hero-video { display: none; }

/* Navegación flotante */
.hero-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  z-index: 2;
}

/* Botones: bold, cuadrados, con fade al pasar el ratón */
.hero-nav a,
.cabecera nav a {
  font-weight: 700;
  text-decoration: none;
  background: #111;
  color: #fff;
  padding: 0.65rem 1.5rem;
  transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
}
.hero-nav a:hover,
.cabecera nav a:hover {
  background: #444;
}
.hero-nav a.activo,
.cabecera nav a.activo {
  background: #e6e6e6;
  color: #111;
}
.hero-nav a.activo:hover,
.cabecera nav a.activo:hover {
  background: #d5d5d5;
}

/* ---------- Cabecera (contacto) ---------- */
.cabecera {
  background: #fff;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem 1rem;
}
.logotipo {
  height: 200px;
  width: auto;
  display: block;
}
.cabecera nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ---------- Portfolio ---------- */
.titulo-pagina {
  text-align: center;
  margin: 2.5rem 0 1.5rem;
  font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.portfolio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto 3rem;
  padding: 0 1rem;
}
.media {
  overflow: hidden;
  cursor: zoom-in;
}
.media img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.media:hover img,
.media:focus img {
  transform: scale(1.03);
}

/* ---------- Lightbox con fade ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.lightbox.abierto {
  opacity: 1;
  visibility: visible;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform: scale(0.96);
  transition: transform 0.35s ease;
}
.lightbox.abierto img {
  transform: scale(1);
}
.lightbox-cerrar {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.75rem;
  transition: opacity 0.3s ease;
}
.lightbox-cerrar:hover {
  opacity: 0.6;
}

/* ---------- Formulario ---------- */
.formulario {
  max-width: 560px;
  margin: 0 auto 3rem;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.formulario label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.95rem;
}
.formulario input,
.formulario textarea {
  padding: 0.7rem 0.9rem;
  border: 1px solid #bbb;
  font: inherit;
  font-weight: 400;
  background: #fff;
  resize: vertical;
  border-radius: 0; /* cuadrados */
}
.formulario input:focus,
.formulario textarea:focus {
  outline: 2px solid #111;
  border-color: transparent;
}
.boton-enviar {
  padding: 0.85rem;
  border: none;
  background: #111;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.3s ease;
}
.boton-enviar:hover { background: #444; }
.boton-enviar:disabled { opacity: 0.6; cursor: wait; }
.estado { font-weight: 400; font-size: 0.95rem; }
.estado.ok { color: #1a7f37; }
.estado.error { color: #c0272d; }

/* ---------- Pie ---------- */
.pie {
  text-align: center;
  padding: 2rem;
  font-size: 0.85rem;
  color: #666;
}

/* ---------- Responsive ---------- */
@media (max-width: 780px) {
  .portfolio { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .portfolio { grid-template-columns: 1fr; }
  .logotipo { height: 140px; }   /* logo algo más pequeño en móvil */
  .hero-nav a,
  .cabecera nav a { padding: 0.55rem 1rem; font-size: 0.9rem; }
}
