/* Accessibility and PWA enhancements */

html,
body {
  height: 100%;
  scroll-behavior: smooth;
  margin: 0;
  padding: 0;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    Segoe UI,
    Roboto,
    Helvetica Neue,
    Arial,
    sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* Hero header styles */

.hero-header {
  color: #3f3f3f;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  padding: 1rem;
  text-align: center;
}

@media (width >= 768px) {
  .hero-header {
    padding-top: 3rem;
  }
}

/* Hero text styles */

.hero-text {
  font-size: 1.25rem;
  font-weight: 300;
  line-height: 1.6;
  margin-bottom: 0;
}

/* Main content styles */

.main-content {
  flex: 1 0 auto;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem 1rem;
}

/* Site footer styles */

.site-footer {
  background-color: #f5f5f5;
  flex: 0 0 80px;
  width: 100%;
  margin-top: auto;
  padding: 1rem;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Version styles */

.version {
  color: #999;
  font-size: 0.8rem;
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

/* Screen reader only content */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for accessibility */

a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #ff5231;
  outline-offset: 2px;
}

/* Skip to main content link */

.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #ff5231;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
}

.skip-link:focus {
  top: 6px;
}

a,
a:hover {
  color: #ff5231;
  font-weight: 700;
  text-decoration: underline;
}

a:focus {
  text-decoration: none;
}

header {
  color: #3f3f3f;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

header > img,
header picture {
  width: 100%;
  max-width: 600px;
  margin-bottom: 0.5rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
  aspect-ratio: 1200 / 630;
}

/* Ensure picture element and its contents are properly styled */

header picture {
  display: block;
  width: 100%;
  max-width: 600px;
  margin: 0 auto 0.5rem;
}

header picture img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 1200 / 630;
  object-fit: contain;
}

main {
  flex: 1 0 auto;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* Responsive adjustments */
@media (width <= 768px) {
  header {
    max-width: 100%;
    padding: 0 15px;
  }

  header > img,
  header picture {
    max-width: 100%;
  }

  header picture img {
    max-width: 100%;
  }
}

/* Small mobile screens (≤375px) */
@media (width <= 375px) {
  .hero-header {
    padding: 0.25rem;
    text-align: center;
  }

  .hero-text {
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: center;
    margin: 0 auto;
    word-wrap: break-word;
    hyphens: auto;
  }

  .main-content {
    padding: 0 0.25rem 0.5rem;
  }

  .site-footer {
    padding: 0.25rem;
    justify-content: center;
  }

  .version {
    right: 0.25rem;
  }
}

/* Extra small screens (≤320px) */
@media (width <= 320px) {
  .hero-header {
    padding: 0.125rem;
  }

  .hero-text {
    font-size: 0.85rem;
    line-height: 1.3;
    padding: 0 0.125rem;
  }

  .main-content {
    padding: 0 0.125rem 0.25rem;
  }

  .site-footer {
    padding: 0.125rem;
    justify-content: center;
  }

  .version {
    right: 0.125rem;
  }
}

@media (width >= 769px) and (width <= 1200px) {
  header {
    max-width: 800px;
  }
}

#map {
  width: 100%;
  height: 600px;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: opacity 0.3s ease;
  position: relative;
}

/* Target any header elements that might appear in the iframe */

#map iframe {
  border: none;
  isolation: isolate;
  contain: layout style paint;
}

/* Loading state for map iframe */

#map:not([src]) {
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  font-style: italic;
}

#map:not([src])::before {
  content: 'Cargando mapa...';
}

footer {
  background-color: #f5f5f5;
  flex: 0 0 48px;
  width: 100%;
  margin-top: auto;
}

footer img {
  height: 64px;
  width: auto;
}

footer picture {
  display: inline-block;
  height: 64px;
}

footer picture img {
  height: 64px;
  width: auto;
}

#version {
  color: #555;
  font-size: 0.8rem;
}
