/* ===== CSS VARIABLES (Dark Mode Default) ===== */
:root {
  /* Colors - Dark Mode */
  --primary-color: #0b1120;
  --secondary-color: #1a2333;
  --accent-color: #d4af37;
  --accent-hover: #b08d2b;
  --text-light: #f8fafc;
  --text-muted: #94a3b8;
  --bg-color: #040813;

  /* Fonts */
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Inter', sans-serif;

  /* Glassmorphism setup */
  --glass-bg: rgba(26, 35, 51, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
}

/* ===== LIGHT MODE VARIABLES ===== */
html.light-mode {
  --primary-color: #e8e0cc;
  --secondary-color: #f4eed8;
  --accent-color: #b08d2b;
  --accent-hover: #8c6e1e;
  --text-light: #1a1a2e;
  --text-muted: #4a4a6a;
  --bg-color: #fdf8ee;
  /* Reduced opacity from 0.85 to 0.55 so the backdrop-filter blur shows through beautifully */
  --glass-bg: rgba(244, 238, 216, 0.55);
  --glass-border: rgba(176, 141, 43, 0.4);
}

/* ===== BASE BODY ===== */
body {
  background-color: var(--bg-color);
  color: var(--text-light);
  font-family: var(--font-body);
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
}

/* Custom Navbar (Glass) */
.navbar-custom {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Scrolled state — applied by JS, inherits CSS variables automatically */
.navbar-custom.scrolled {
  background: rgba(11, 17, 32, 0.95) !important;
}

html.light-mode .navbar-custom.scrolled {
  background: rgba(244, 238, 216, 0.97) !important;
}


.navbar-custom .nav-link {
  color: var(--text-light) !important;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.9rem;
  transition: color 0.3s;
}

.navbar-custom .nav-link:hover, .navbar-custom .nav-link.active {
  color: var(--accent-color) !important;
}

.navbar-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent-color) !important;
  font-size: 1.5rem;
}

/* Logo image in navbar */
.navbar-logo-img {
  height: 48px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
  transition: filter 0.4s ease;
}

/* In light mode the logo (white/gold) would vanish — darken it to deep gold */
html.light-mode .navbar-logo-img {
  filter: brightness(0) sepia(1) saturate(6) hue-rotate(5deg) brightness(0.55);
}

.navbar-toggler {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 4px;
}

.navbar-toggler:focus {
  box-shadow: none !important;
  outline: none;
}

/* ===== BUTTONS ===== */
.btn-gold {
  background-color: var(--accent-color);
  color: #000;
  font-weight: 600;
  border: none;
  padding: 10px 24px;
  transition: all 0.3s;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.9rem;
}

.btn-gold:hover {
  background-color: var(--accent-hover);
  color: #fff;
  transform: translateY(-2px);
}

.btn-outline-gold {
  background-color: transparent;
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  padding: 10px 24px;
  transition: all 0.3s;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-outline-gold:hover {
  background-color: var(--accent-color);
  color: #000;
}

/* Force light outline buttons to become dark outline buttons in light mode */
html.light-mode .btn-outline-light {
  color: var(--text-light) !important;
  border-color: var(--text-muted) !important;
}

html.light-mode .btn-outline-light:hover {
  background-color: var(--text-light) !important;
  color: var(--bg-color) !important;
}

/* ===== HERO SECTION (kept for other pages) ===== */
.hero-section {
  height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  background: linear-gradient(rgba(4, 8, 19, 0.8), rgba(4, 8, 19, 0.95)), url('../img/hero-bg.jpg') center/cover no-repeat;
}

html.light-mode .hero-section {
  background: linear-gradient(rgba(232, 224, 204, 0.75), rgba(253, 248, 238, 0.9)), url('../img/hero-bg.jpg') center/cover no-repeat;
}

/* ===== HERO CAROUSEL (inicio) ===== */
.hero-carousel-wrapper {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 560px;
  overflow: hidden;
}

#heroCarousel,
#heroCarousel .carousel-inner {
  height: 100%;
}

/* Bootstrap sets display:block on active items — override to flex so centering works */
.carousel-item.hero-slide {
  display: flex !important;
  height: 100vh;
  min-height: 560px;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  position: relative;
  padding-top: 76px; /* clear the fixed navbar */
}

/* Full-slide background image (more reliable than CSS background-image for external URLs) */
.hero-slide-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}

.hero-slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(4, 8, 19, 0.30) 0%,
    rgba(4, 8, 19, 0.60) 55%,
    rgba(4, 8, 19, 0.82) 100%
  );
  z-index: 1;
}

.hero-slide-content {
  position: relative;
  z-index: 2;
  width: 100%;
}

/* Ensure carousel and article hero text stays white even in light mode because the backgrounds are images */
html.light-mode .hero-slide-content,
html.light-mode .hero-slide-content h1,
html.light-mode .hero-slide-content h2,
html.light-mode .hero-slide-content p,
html.light-mode .hero-slide-content .text-light,
html.light-mode .hero-slide-content .text-white,
html.light-mode .article-hero,
html.light-mode .article-hero h1,
html.light-mode .article-hero h2,
html.light-mode .article-hero p,
html.light-mode .article-hero .text-light,
html.light-mode .article-hero .text-white {
  color: #f8fafc !important;
}

/* Eyebrow label */
.hero-eyebrow {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent-color);
  margin-bottom: 1.1rem;
  display: block;
}

/* Gold pill indicators */
.hero-indicators {
  bottom: 32px;
  gap: 6px;
  z-index: 10;
}

.hero-indicators [data-bs-target] {
  width: 28px;
  height: 3px;
  border-radius: 2px;
  background-color: rgba(212, 175, 55, 0.35);
  border-top: none;
  border-bottom: none;
  transition: background-color 0.35s, width 0.35s;
  margin: 0 3px;
  opacity: 1;
}

.hero-indicators .active {
  background-color: var(--accent-color);
  width: 48px;
}

/* Navigation arrows */
.hero-arrow {
  width: 64px;
  opacity: 1 !important;
  background: transparent;
  border: none;
  transition: background 0.2s;
}

.hero-arrow:hover {
  background: rgba(0, 0, 0, 0.20);
}

.hero-arrow svg {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.7));
  transition: transform 0.2s;
}

.hero-arrow:hover svg {
  transform: scale(1.15);
}

.carousel-control-prev.hero-arrow { left: 0; }
.carousel-control-next.hero-arrow { right: 0; }




/* ===== SECTIONS ===== */
.bg-dark {
  background-color: var(--primary-color) !important;
}

html.light-mode .bg-dark {
  background-color: var(--secondary-color) !important;
}

/* ===== FOOTER ===== */
footer {
  background-color: var(--primary-color);
  border-top: 1px solid var(--glass-border);
  transition: background-color 0.4s ease;
}

/* ===== TEXT OVERRIDES ===== */
.text-muted {
  color: var(--text-muted) !important;
}

.form-label {
  color: var(--text-muted) !important;
}

footer p {
  color: var(--text-muted) !important;
}

h2 {
  color: var(--text-light);
}

html.light-mode h1,
html.light-mode h2,
html.light-mode h3 {
  color: var(--text-light);
}

html.light-mode .text-white {
  color: var(--text-light) !important;
}

html.light-mode .text-light {
  color: var(--text-light) !important;
}

/* ===== FORMS (Light Mode) ===== */
html.light-mode .form-control {
  background-color: #fff8e8;
  border-color: rgba(176, 141, 43, 0.3);
  color: var(--text-light);
}

html.light-mode .form-control::placeholder {
  color: #9a8c6a;
}

html.light-mode .form-control:focus {
  background-color: #fff;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 0.25rem rgba(176, 141, 43, 0.2);
  color: var(--text-light);
}

/* ===== ANIMATIONS ===== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ===== DARK / LIGHT MODE TOGGLE BUTTON (Floating) ===== */
#theme-toggle {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 9999;
  width: 80px;
  height: 42px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  outline: none;
  filter: drop-shadow(0 4px 16px rgba(212, 175, 55, 0.45));
  transition: filter 0.3s ease, transform 0.2s ease;
}

#theme-toggle:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 6px 22px rgba(212, 175, 55, 0.75));
}

#theme-toggle:active {
  transform: scale(0.96);
}

.toggle-track {
  width: 80px;
  height: 42px;
  border-radius: 21px;
  background-color: #1a2333;
  border: 2px solid var(--accent-color);
  position: relative;
  transition: background-color 0.4s ease;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.2),
    inset 0 1px 3px rgba(0,0,0,0.4);
}

html.light-mode .toggle-track {
  background-color: #f4eed8;
  box-shadow:
    0 0 0 1px rgba(176, 141, 43, 0.3),
    inset 0 1px 3px rgba(0,0,0,0.1);
}

.toggle-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f0d060, var(--accent-color));
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

html.light-mode .toggle-thumb {
  transform: translateX(38px);
}

/* Stars decoration inside track (dark mode) */
.toggle-track::before {
  content: '✦ ✦';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  color: rgba(212, 175, 55, 0.6);
  letter-spacing: 2px;
  transition: opacity 0.3s;
}

html.light-mode .toggle-track::before {
  opacity: 0;
}

/* Tooltip label on hover */
#theme-toggle::after {
  content: 'Modo claro';
  position: absolute;
  bottom: 48px;
  right: 0;
  background: var(--primary-color);
  color: var(--accent-color);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--accent-color);
  letter-spacing: 0.5px;
  transition: opacity 0.2s;
}

html.light-mode #theme-toggle::after {
  content: 'Modo oscuro';
}

#theme-toggle:hover::after {
  opacity: 1;
}

/* ===================================================
   RESPONSIVE — Tablets (≤ 768 px)
   =================================================== */
@media (max-width: 768px) {

  /* --- Navbar ----------------------------------------- */
  .navbar-logo-img {
    height: 38px;
    max-width: 170px;
  }

  /* Collapsed menu background */
  .navbar-collapse {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--glass-border);
    padding: 1rem 0.5rem;
    border-radius: 0 0 8px 8px;
  }

  .navbar-custom .nav-link {
    padding: 0.6rem 1rem;
    letter-spacing: 0.5px;
  }

  /* --- Hero ------------------------------------------- */
  .hero-section {
    height: auto;
    min-height: 100svh;
    padding: 100px 0 60px;
    text-align: center;
  }

  .hero-section .display-3 {
    font-size: 2.2rem;
    line-height: 1.25;
  }

  .hero-section .lead {
    font-size: 1rem;
    max-width: 100% !important;
  }

  /* Stack CTA buttons vertically */
  .hero-section .btn-gold,
  .hero-section .btn-outline-gold {
    display: block;
    width: 100%;
    margin: 0.4rem 0 !important;
    text-align: center;
  }

  /* --- Page headers ----------------------------------- */
  .display-4 {
    font-size: 2rem;
  }

  /* --- Featured post (Publicaciones) ----------------- */
  .featured-post-img {
    height: 220px;
  }

  .featured-title {
    font-size: 1.4rem;
  }

  /* --- Theme toggle ----------------------------------- */
  #theme-toggle {
    bottom: 20px;
    right: 18px;
    width: 66px;
    height: 36px;
  }

  .toggle-track {
    width: 66px;
    height: 36px;
    border-radius: 18px;
  }

  .toggle-thumb {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }

  html.light-mode .toggle-thumb {
    transform: translateX(30px);
  }

  /* --- Contact page — stack form below info ---------- */
  .col-lg-5,
  .col-lg-7 {
    width: 100%;
  }
}

/* ===================================================
   RESPONSIVE — Phones (≤ 576 px)
   =================================================== */
@media (max-width: 576px) {

  /* --- Navbar ----------------------------------------- */
  .navbar-logo-img {
    height: 32px;
    max-width: 140px;
  }

  /* --- Hero ------------------------------------------- */
  .hero-section .display-3 {
    font-size: 1.75rem;
  }

  /* --- Section spacing -------------------------------- */
  section.py-5,
  header.py-5 {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }

  .container.py-4,
  .container.py-5 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  /* --- Blog cards — single column on phones ---------- */
  .col-md-6.col-lg-4 {
    width: 100%;
  }

  .blog-card-img {
    height: 170px;
  }

  /* --- Featured post ---------------------------------- */
  .featured-post-img {
    height: 180px;
  }

  .featured-title {
    font-size: 1.2rem;
  }

  /* --- Nosotros values — single column --------------- */
  .col-md-4 {
    width: 100%;
  }

  /* --- Contact form ----------------------------------- */
  .p-4.p-md-5 {
    padding: 1.25rem !important;
  }

  /* --- Hide tooltip on small screens (avoids overflow) */
  #theme-toggle::after {
    display: none;
  }

  /* --- Theme toggle — smaller still ------------------ */
  #theme-toggle {
    bottom: 14px;
    right: 14px;
    width: 58px;
    height: 32px;
  }

  .toggle-track {
    width: 58px;
    height: 32px;
    border-radius: 16px;
  }

  .toggle-thumb {
    width: 22px;
    height: 22px;
    font-size: 11px;
    top: 3px;
    left: 3px;
  }

  html.light-mode .toggle-thumb {
    transform: translateX(26px);
  }
}
