/* ============================================================
   REY DE LA COSTA — Main Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ---- Variables ---- */
:root {
  --font: 'DM Sans', sans-serif;
  --dark: #0d141a;
  --blue: #4A90E2;
  --footer-bg: #1b2d3e;
  --white: #ffffff;
  --max-w: 1240px;
  --nav-h: 150px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--dark); line-height: 1.6; font-size: 16px; }
img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ---- Container ---- */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 32px; }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: #fff;
  height: var(--nav-h);
  box-shadow: none;
  transition: box-shadow 0.3s ease;
}
.navbar--scrolled {
  box-shadow: 0 2px 16px rgba(0,0,0,0.10);
}
.navbar__inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 32px;
  height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.navbar__logo img { height: 137px; width: auto; }

.navbar__links {
  display: flex; align-items: center; gap: 0;
}
.navbar__links a {
  font-size: 15px; font-weight: 400; color: var(--dark);
  padding: 4px 0; margin: 0 20px;
  position: relative; white-space: nowrap;
  transition: font-weight 0.1s;
}
.navbar__links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0; right: 0;
  height: 2px; background: var(--dark); border-radius: 1px;
  transform: scaleX(0); transition: transform 0.2s;
}
.navbar__links a:hover::after,
.navbar__links a.active::after { transform: scaleX(1); }
.navbar__links a.active { font-weight: 600; }

/* Language switcher */
.lang-switcher {
  display: flex; align-items: center; gap: 12px; margin-left: 8px;
}
.lang-switcher a {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--dark); opacity: 0.55;
  transition: opacity 0.2s;
}
.lang-switcher a:hover, .lang-switcher a.active { opacity: 1; }
.lang-switcher img { width: 18px; border-radius: 2px; display: inline; }

/* Hamburger */
.navbar__hamburger {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; background: none; border: none; padding: 6px;
}
.navbar__hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--dark); border-radius: 2px;
  transition: transform 0.32s ease, opacity 0.22s ease;
  transform-origin: center;
}
/* Hamburger → X */
.navbar__hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.navbar__hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.navbar__hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile drawer */
.navbar__drawer {
  display: flex; position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: #fff; z-index: 199;
  padding: 20px 32px 32px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  flex-direction: column; gap: 0;
  /* Hidden state */
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  /* Al cerrar: visibility espera a que opacity/transform terminen */
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0s 0.28s;
}
.navbar__drawer.open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  /* Al abrir: visibility se activa inmediatamente */
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0s 0s;
}
.navbar__drawer a {
  font-size: 16px; color: var(--dark);
  padding: 13px 0; border-bottom: 1px solid #f0f0f0;
}
.navbar__drawer .lang-switcher { margin: 16px 0 0; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  height: 75vh; height: 75svh;
  min-height: 480px;
  max-height: 760px;
  overflow: hidden; display: flex; align-items: center;
  justify-content: center; text-align: center;
}
.hero__video {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; z-index: 0;
}
.hero__overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.38); z-index: 1;
}
.hero__content {
  position: relative; z-index: 2; color: #fff;
  max-width: 780px; padding: 0 24px;
}
.hero__title {
  font-size: clamp(38px, 6.5vw, 64px);
  font-weight: 600; line-height: 1.15; margin-bottom: 22px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.35);
}
.hero__subtitle {
  font-size: clamp(15px, 2.2vw, 21px);
  font-weight: 400; opacity: 0.92;
  text-shadow: 0 1px 10px rgba(0,0,0,0.3);
}

/* ============================================================
   INTRO (home page)
   ============================================================ */
.section-intro { padding: 80px 0 0; background: #fff; }
.section-intro h2 {
  font-size: clamp(28px, 3.8vw, 48px);
  font-weight: 600; margin-bottom: 20px; color: var(--dark);
}
.section-intro .lead {
  font-size: 15px; font-weight: 600; color: var(--dark); margin-bottom: 16px;
}
.section-intro p {
  font-size: 15.5px; color: #56585e; line-height: 1.8;
}
.section-intro__image {
  margin-top: 56px;
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  padding: 0 32px;
  border-radius: 20px;
  overflow: hidden;
}
.section-intro__image img {
  width: 100%; height: 500px; object-fit: cover; display: block;
}

/* ============================================================
   INNER PAGE HEADER
   ============================================================ */
.page-header {
  padding: calc(var(--nav-h) + 56px) 0 48px;
  background: #fff;
}
.page-header h1 {
  font-size: clamp(24px, 3.5vw, 40px);
  font-weight: 700; color: var(--dark); margin-bottom: 28px;
}

/* ============================================================
   FEATURE CARDS (icon grid)
   ============================================================ */
.feature-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
  margin-bottom: 56px;
}
.feature-card {
  background: var(--white);
  border: 0.5px solid #e0e3e8;
  border-radius: 14px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.feature-card:hover {
  border-color: #c5cad4;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.feature-card__icon {
  font-size: 26px;
  line-height: 1;
}
.feature-card__label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--dark);
  line-height: 1.35;
}

/* ============================================================
   GALLERY — 2-column staggered masonry
   ============================================================ */
.gallery {
  columns: 2; column-gap: 14px; margin-bottom: 80px;
}
.gallery__item {
  break-inside: avoid; margin-bottom: 14px;
  border-radius: 16px; overflow: hidden;
  background: #eee; display: block;
}
.gallery__item img {
  width: 100%; height: auto; display: block;
  transition: transform 0.45s ease;
}
.gallery__item:hover img { transform: scale(1.03); }
.gallery__item--wide {
  columns: unset; column-span: all;
  margin-bottom: 14px; border-radius: 16px; overflow: hidden;
  break-inside: avoid;
}
.gallery__item--wide img {
  width: 100%; height: auto; max-height: 560px;
  object-fit: cover; display: block;
  transition: transform 0.45s ease;
}
.gallery__item--wide:hover img { transform: scale(1.02); }

/* ============================================================
   LOCATION PAGE
   ============================================================ */
.location-text {
  font-size: 16px; color: #444; line-height: 1.85;
  margin-bottom: 44px;
}
.location-map {
  border-radius: 14px; overflow: hidden; margin-bottom: 52px;
}
.location-map iframe { width: 100%; height: 460px; border: none; display: block; }
.weather-section { margin-bottom: 80px; text-align: center; }
.weather-section h2 {
  font-size: 20px; font-weight: 600; color: var(--dark); margin-bottom: 20px;
}
.weather-desktop { display: inline-block; }
.weather-mobile { display: none; }

/* ============================================================
   WEBCAMS PAGE
   ============================================================ */
.webcam-section { padding-bottom: 80px; }
.webcam-block { margin-bottom: 52px; }
.webcam-block h2 {
  font-size: 22px; font-weight: 600; color: var(--dark); margin-bottom: 18px;
}
.webcam-embed {
  border-radius: 14px; overflow: hidden;
  background: #f5f7f9;
  border: 1px solid #e8eaed;
}
.webcam-embed iframe { width: 100%; height: 480px; border: none; display: block; }
.webcam-placeholder {
  padding: 60px 32px; text-align: center; color: #888;
}
.webcam-placeholder p { font-size: 15px; }
.webcam-placeholder a { color: var(--blue); text-decoration: underline; }
.webcam-offline {
  display: none;
  align-items: center; justify-content: center;
  min-height: 220px;
  background: #f5f6f8; border-radius: 10px;
  color: #999; font-size: 15px; gap: 8px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--footer-bg); color: #fff; padding: 64px 0 40px;
}
.footer__inner {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 56px; align-items: start;
}
.footer__contact-title {
  font-size: 12px; font-weight: 600;
  letter-spacing: 1.8px; text-transform: uppercase;
  opacity: 0.5; margin-bottom: 20px;
}
.footer__contact-info { display: flex; flex-direction: column; gap: 10px; }
.footer__contact-info a {
  color: #fff; font-size: 15px; opacity: 0.8; transition: opacity 0.2s;
}
.footer__contact-info a:hover { opacity: 1; }

.footer__form { display: flex; flex-direction: column; gap: 12px; }
.footer__form label {
  font-size: 14px; color: rgba(255,255,255,0.65); display: block; margin-bottom: 2px;
}
.footer__form input[type="email"] {
  width: 100%; padding: 13px 16px;
  border-radius: 10px; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.95);
  font-size: 15px; font-family: var(--font); color: var(--dark);
  outline: none; transition: border-color 0.2s;
}
.footer__form input[type="email"]::placeholder { color: #aaa; }
.footer__form input[type="email"]:focus { border-color: var(--blue); }
.footer__form button {
  padding: 13px 28px; background: var(--blue); color: #fff;
  border: none; border-radius: 50px;
  font-size: 14px; font-weight: 600; font-family: var(--font);
  cursor: pointer; align-self: flex-start;
  transition: background 0.2s, transform 0.15s;
}
.footer__form button:hover { background: #3a7ecc; transform: translateY(-1px); }
.footer__form .form-success {
  display: none; font-size: 14px; color: #a8e6cf; padding: 8px 0;
}
.footer__bottom {
  margin-top: 52px; padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 13px; color: rgba(255,255,255,0.35);
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
#lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
}
#lightbox.lb-visible { display: flex; }

/* Prevent body scroll when lightbox is open */
body.lb-open { overflow: hidden; }

.lb-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Stage — the image container */
.lb-stage {
  position: relative; z-index: 2;
  max-width: 90vw; max-height: 88vh;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.2s;
}
.lb-img {
  max-width: 88vw; max-height: 86vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  transition: opacity 0.25s ease;
  display: block;
}

/* Loader spinner */
.lb-loader {
  display: none;
  position: absolute; inset: 0;
  align-items: center; justify-content: center;
}
.lb-loader::after {
  content: '';
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lb-spin 0.7s linear infinite;
}
.lb-loader[style*="block"] { display: flex; }
@keyframes lb-spin { to { transform: rotate(360deg); } }

/* Close button */
.lb-close {
  position: absolute; top: 20px; right: 24px; z-index: 3;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; font-size: 28px; line-height: 1;
  width: 44px; height: 44px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.15s;
}
.lb-close:hover { background: rgba(255,255,255,0.22); transform: scale(1.1); }

/* Arrows */
.lb-arrow {
  position: absolute; top: 50%; z-index: 3;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; font-size: 40px; line-height: 1;
  width: 52px; height: 52px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.15s;
  user-select: none;
}
.lb-arrow:hover { background: rgba(255,255,255,0.22); }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-prev:hover { transform: translateY(-50%) scale(1.08); }
.lb-next:hover { transform: translateY(-50%) scale(1.08); }

/* Counter */
.lb-counter {
  position: absolute; bottom: 22px; left: 50%; z-index: 3;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.45); color: #fff;
  font-size: 13px; font-weight: 500; font-family: var(--font);
  padding: 5px 14px; border-radius: 20px;
  letter-spacing: 0.5px;
}

/* Slide animations */
.lb-stage.lb-slide-out-left  { animation: lb-out-left  0.2s ease forwards; }
.lb-stage.lb-slide-out-right { animation: lb-out-right 0.2s ease forwards; }
.lb-stage.lb-slide-in        { animation: lb-in        0.3s ease forwards; }

@keyframes lb-out-left  { to { opacity: 0; transform: translateX(-40px); } }
@keyframes lb-out-right { to { opacity: 0; transform: translateX(40px);  } }
@keyframes lb-in        { from { opacity: 0; transform: translateX(0) scale(0.97); } to { opacity: 1; transform: none; } }

/* Mobile */
@media (max-width: 820px) {
  .lb-arrow { width: 40px; height: 40px; font-size: 30px; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
  .lb-img { max-width: 96vw; max-height: 80vh; }
}

/* ============================================================
   SCROLL ANIMATION
   ============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
/* Staggered delay for sibling elements */
.fade-in:nth-child(2) { transition-delay: 0.08s; }
.fade-in:nth-child(3) { transition-delay: 0.16s; }
.fade-in:nth-child(4) { transition-delay: 0.24s; }
.fade-in:nth-child(5) { transition-delay: 0.32s; }
.fade-in:nth-child(n+6) { transition-delay: 0.38s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
  :root { --nav-h: 116px; }
  .navbar__links { display: none; }
  .navbar__hamburger { display: flex; }
  .navbar__logo img { height: 101px; width: auto; }
  .container { padding: 0 20px; }

  .section-intro { padding: 60px 0 0; }
  .section-intro__image { padding: 0 20px; }
  .section-intro__image img { height: 260px; }

  .page-header { padding: calc(var(--nav-h) + 36px) 0 32px; }

  .gallery { columns: 1; }

  .footer__inner { grid-template-columns: 1fr; gap: 36px; }
  .location-map iframe { height: 300px; }
  .webcam-embed iframe { height: 260px; }

  .weather-desktop { display: none; }
  .weather-mobile { display: inline-block; }
}
