/* =========================
   RESET BÁSICO
========================= */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f3f3f3;
  color: #222;
  min-width: 320px;
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

/* =========================
   ESTRUCTURA GENERAL
========================= */
.container {
  width: min(1080px, calc(100% - 80px));
  margin: 0 auto;
}

.top-line {
  height: 4px;
  background: #0f6f43;
}

/* =========================
   CABECERA
========================= */
.site-header {
  background: #f3f3f3;
  border-bottom: 1px solid #e3e3e3;
}

.header-inner {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0 14px;
}

.brand h1 {
  margin: 0;
  font-size: 3rem;
  line-height: 1;
  font-weight: 700;
  color: #0f6f43;
  letter-spacing: 0.2px;
}

.brand p {
  margin: 8px 0 0;
  font-size: 1rem;
  color: #2d2d2d;
}

.header-shield-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-shield {
  width: 74px;
  height: auto;
  object-fit: contain;
}

/* =========================
   SLIDER
========================= */
.hero-slider {
  background: #f3f3f3;
}

.slider {
  position: relative;
  width: min(1080px, calc(100% - 80px));
  margin: 0 auto;
  min-height: 290px;
  background: #f3f3f3;
  overflow: hidden;
}

.slider-track {
  width: 100%;
  height: 290px;
  position: relative;
  background: #f3f3f3;
}

.slider-track img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transition: opacity 0.45s ease-in-out;
  background: #ececec;
}

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.38);
  color: rgba(0, 0, 0, 0.18);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.slider-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  color: rgba(0, 0, 0, 0.55);
}

.slider-btn.prev {
  left: 22px;
}

.slider-btn.next {
  right: 22px;
}

.slider-dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 6;
}

.slider-dots button {
  width: 11px;
  height: 11px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.slider-dots button.active {
  background: #0f6f43;
  transform: scale(1.15);
}

/* Sombra inferior del slider */
.hero-slider::after {
  content: "";
  display: block;
  width: min(880px, calc(100% - 180px));
  height: 22px;
  margin: -6px auto 0;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.5) 0%,
    rgba(0, 0, 0, 0.38) 35%,
    rgba(0, 0, 0, 0.16) 65%,
    rgba(0, 0, 0, 0.04) 85%,
    rgba(0, 0, 0, 0) 100%
  );
  filter: blur(2px);
}

/* =========================
   PORTALES
========================= */
.portal-links {
  background: #f3f3f3;
  padding: 30px 0 52px;
}

.portal-grid {
  display: grid;
  gap: 34px;
}

.top-grid {
  grid-template-columns: repeat(4, 1fr);
  align-items: start;
  margin-bottom: 22px;
}

.bottom-grid {
  grid-template-columns: repeat(4, 1fr);
}

/* BLOQUES SUPERIORES */
.portal-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 98px;
  text-align: center;
  padding: 0 6px;
}

.portal-item h2 {
  margin: 0 0 10px;
  font-size: 0.98rem;
  line-height: 1.15;
  font-weight: 700;
}

.portal-item img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

/* =========================
   EFECTO HOVER BLOQUES SUPERIORES
========================= */
.portal-simple {
  --portal-accent: #1f78bf;
  position: relative;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 8px 8px 10px;
  background: transparent;
  overflow: hidden;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

.portal-simple::before {
  content: "";
  position: absolute;
  top: 0;
  left: -1px;
  right: -1px;
  height: 5px;
  background: var(--portal-accent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.portal-simple:hover {
  border-color: var(--portal-accent);
  background: #f7f7f7;
  transform: translateY(-1px);
}

.portal-simple:hover::before {
  opacity: 1;
}

.portal-simple img {
  transition: transform 0.2s ease;
}

.portal-simple:hover img {
  transform: scale(1.015);
}

/* Colores por bloque superior */
.portal-item.ayuntamiento {
  --portal-accent: #1f78bf;
}

.portal-item.transparencia {
  --portal-accent: #222222;
}

.portal-item.sede {
  --portal-accent: #6f6f6f;
}

.portal-item.actualidad {
  --portal-accent: #0f6f43;
}

.portal-item.ayuntamiento h2 {
  color: #1f78bf;
}

.portal-item.transparencia h2,
.portal-item.sede h2,
.portal-item.actualidad h2 {
  color: #111;
}

/* =========================
   BOTONES INFERIORES
========================= */
.portal-button {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #fff;
  font-size: 1rem;
  font-weight: 700;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.portal-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.portal-button.turismo {
  color: #1d7a4b;
  border-color: #72b58f;
}

.portal-button.turismo:hover {
  background: #f6fbf8;
}

.portal-button.cultura {
  color: #eb9700;
  border-color: #e9b95e;
}

.portal-button.cultura:hover {
  background: #fff9ef;
}

.portal-button.deportes {
  color: #e11919;
  border-color: #ef8b8b;
}

.portal-button.deportes:hover {
  background: #fff3f3;
}

.portal-button.bienestar {
  color: #b92d68;
  border-color: #e19bb6;
}

.portal-button.bienestar:hover {
  background: #fff6fa;
}

/* =========================
   PIE
========================= */
.site-footer {
  background: #045a32;
  color: #ffffff;
  padding: 38px 0 34px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 170px 1fr 120px;
  gap: 32px;
  align-items: start;
}

.footer-logo {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
}

.footer-logo img {
  width: 68px;
  max-width: 68px;
  height: auto;
  object-fit: contain;
}

.footer-center {
  text-align: center;
  font-size: 0.84rem;
  line-height: 1.7;
}

.footer-center p {
  margin: 0 0 8px;
}

.footer-legal {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 14px;
}

.footer-legal a {
  color: #b7d97a;
  transition: opacity 0.2s ease;
}

.footer-legal a:hover {
  opacity: 0.8;
}

.footer-social {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
}

.footer-social a {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #b7d97a;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 50%;
  transition: background 0.2s ease, color 0.2s ease;
}

.footer-social a:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1100px) {
  .container {
    width: min(1080px, calc(100% - 50px));
  }

  .brand h1 {
    font-size: 2.4rem;
  }

  .slider {
    width: min(100%, calc(100% - 50px));
    min-height: 260px;
  }

  .slider-track {
    height: 260px;
  }

  .top-grid,
  .bottom-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .footer-social {
    flex-direction: row;
    padding-top: 0;
  }
}

@media (max-width: 680px) {
  .container {
    width: min(100% - 24px, 1080px);
  }

  .header-inner {
    min-height: auto;
    padding: 16px 0 14px;
    gap: 16px;
  }

  .brand h1 {
    font-size: 1.9rem;
  }

  .brand p {
    font-size: 0.95rem;
  }

  .header-shield {
    width: 56px;
  }

  .slider {
    width: min(calc(100% - 12px), 1080px);
    min-height: 210px;
  }

  .slider-track {
    height: 210px;
  }

  .slider-btn {
    width: 40px;
    height: 40px;
    font-size: 1.7rem;
  }

  .slider-btn.prev {
    left: 10px;
  }

  .slider-btn.next {
    right: 10px;
  }

  .hero-slider::after {
    width: calc(100% - 90px);
    height: 18px;
  }

  .top-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .portal-links {
    padding: 24px 0 42px;
  }

  .portal-item {
    min-height: auto;
  }

  .portal-simple {
    padding: 8px 8px 10px;
  }

  .portal-button {
    min-height: 56px;
    font-size: 1rem;
    padding: 10px 12px;
  }

  .site-footer {
    padding: 30px 0 28px;
  }

  .footer-center {
    font-size: 0.82rem;
  }

  .footer-legal {
    gap: 6px;
  }
}