/* Iglesias de Chiloé - Responsive CSS */
/* Mobile-first Design */

/* ========================================
   CSS Variables
======================================== */
:root {
  --primary-color: #8B4513;
  --secondary-color: #D2691E;
  --accent-color: #DAA520;
  --text-color: #333;
  --text-light: #666;
  --bg-light: #f9f7f4;
  --bg-white: #fff;
  --border-color: #ddd;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --max-width: 1200px;
  --font-main: 'Georgia', 'Times New Roman', serif;
  --font-heading: 'Georgia', serif;
}

/* ========================================
   Reset & Base
======================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--bg-light);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--secondary-color);
  text-decoration: underline;
}

/* ========================================
   Typography
======================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.3;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

h1 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-color);
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
}

p {
  margin-bottom: 1rem;
}

ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* ========================================
   Layout
======================================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

main {
  flex: 1;
}

/* ========================================
   Header
======================================== */
.site-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.site-logo {
  max-height: 60px;
  width: auto;
}

.site-title {
  font-size: 1.25rem;
  margin: 0;
  color: white;
}

.site-title a {
  color: white;
  text-decoration: none;
}

/* ========================================
   Navigation
======================================== */
.main-nav {
  width: 100%;
}

.nav-toggle {
  display: block;
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
  text-align: center;
  border-radius: 4px;
}

.nav-toggle:hover {
  background: rgba(255,255,255,0.3);
}

.nav-menu {
  display: none;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0 0;
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
}

.nav-menu.active {
  display: block;
}

.nav-menu li {
  margin: 0;
}

.nav-menu a {
  display: block;
  padding: 0.75rem 1rem;
  color: white;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.nav-menu a:hover {
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

.nav-menu .has-submenu > a::after {
  content: ' ▼';
  font-size: 0.7em;
}

.submenu {
  display: none;
  list-style: none;
  padding: 0;
  background: rgba(0,0,0,0.1);
}

.submenu.active {
  display: block;
}

.submenu a {
  padding-left: 2rem;
  font-size: 0.9rem;
}

/* ========================================
   Hero Section
======================================== */
.hero {
  position: relative;
  height: 250px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  padding: 2rem 1rem 1rem;
  color: white;
}

.hero-title {
  color: white;
  font-size: 1.5rem;
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* ========================================
   Content Sections
======================================== */
.content-section {
  background: var(--bg-white);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro-text {
  font-size: 1.1rem;
  color: var(--text-light);
  border-left: 4px solid var(--accent-color);
  padding-left: 1rem;
  margin-bottom: 2rem;
}

/* ========================================
   Church Grid
======================================== */
.church-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}

.church-card {
  background: var(--bg-white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.church-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.church-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.church-card-content {
  padding: 1rem;
}

.church-card h3 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem 0;
}

.church-card h3 a {
  color: var(--primary-color);
}

.church-card p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin: 0;
}

/* ========================================
   Article Content
======================================== */
.article-header {
  margin-bottom: 2rem;
}

.article-meta {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.article-content {
  font-size: 1rem;
}

.article-content img {
  margin: 1.5rem 0;
  border-radius: 8px;
}

.article-content figure {
  margin: 1.5rem 0;
}

.article-content figcaption {
  font-size: 0.875rem;
  color: var(--text-light);
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

/* ========================================
   Info Box
======================================== */
.info-box {
  background: var(--bg-light);
  border-left: 4px solid var(--accent-color);
  padding: 1rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
}

.info-box h4 {
  margin: 0 0 0.5rem 0;
  color: var(--primary-color);
}

.info-box ul {
  margin: 0;
  padding-left: 1.25rem;
}

/* ========================================
   FAQ Section
======================================== */
.faq-section {
  margin-top: 2rem;
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

.faq-question {
  font-weight: bold;
  color: var(--primary-color);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question::after {
  content: '+';
  font-size: 1.5rem;
  transition: transform 0.3s ease;
}

.faq-item.active .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  padding-top: 0.75rem;
  display: none;
}

.faq-item.active .faq-answer {
  display: block;
}

/* ========================================
   Related Content
======================================== */
.related-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border-color);
}

.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.related-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
}

.related-item img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.related-item-content h4 {
  font-size: 1rem;
  margin: 0 0 0.25rem 0;
}

.related-item-content p {
  font-size: 0.875rem;
  color: var(--text-light);
  margin: 0;
}

/* ========================================
   Sidebar
======================================== */
.sidebar {
  background: var(--bg-white);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar h3 {
  font-size: 1.1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-color);
  margin-bottom: 1rem;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
}

.sidebar-nav li {
  margin-bottom: 0.5rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.sidebar-nav a:hover {
  background: var(--bg-light);
  text-decoration: none;
}

/* ========================================
   Footer
======================================== */
.site-footer {
  background: var(--primary-color);
  color: white;
  padding: 2rem 0;
  margin-top: 3rem;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.footer-section h4 {
  color: var(--accent-color);
  margin-bottom: 1rem;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section a {
  color: rgba(255,255,255,0.8);
}

.footer-section a:hover {
  color: white;
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  margin-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.2);
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
}

/* ========================================
   Breadcrumbs
======================================== */
.breadcrumbs {
  padding: 1rem 0;
  font-size: 0.9rem;
  color: var(--text-light);
}

.breadcrumbs a {
  color: var(--text-light);
}

.breadcrumbs span {
  margin: 0 0.5rem;
}

/* ========================================
   Responsive - Tablet (768px+)
======================================== */
@media screen and (min-width: 768px) {
  h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  .header-inner {
    flex-direction: row;
    justify-content: space-between;
  }

  .site-logo {
    max-height: 80px;
  }

  .site-title {
    font-size: 1.5rem;
  }

  .nav-toggle {
    display: none;
  }

  .nav-menu {
    display: flex !important;
    background: transparent;
    margin: 0;
    gap: 0.5rem;
  }

  .nav-menu li {
    position: relative;
  }

  .nav-menu > li > a {
    padding: 0.5rem 1rem;
    border-bottom: none;
    border-radius: 4px;
  }

  .submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--primary-color);
    border-radius: 4px;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
  }

  .has-submenu:hover .submenu {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .submenu a {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  .submenu li:last-child a {
    border-bottom: none;
  }

  .hero {
    height: 350px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .church-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-wrapper {
    flex-direction: row;
  }

  main {
    flex: 3;
  }

  .sidebar {
    flex: 1;
    align-self: flex-start;
    position: sticky;
    top: 100px;
  }

  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-content {
    flex-direction: row;
    justify-content: space-between;
  }

  .footer-section {
    flex: 1;
  }
}

/* ========================================
   Responsive - Desktop (1024px+)
======================================== */
@media screen and (min-width: 1024px) {
  h1 {
    font-size: 2.5rem;
  }

  .container {
    padding: 0 2rem;
  }

  .hero {
    height: 400px;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .church-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .content-section {
    padding: 2rem;
  }

  .related-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ========================================
   Utilities
======================================== */
.text-center {
  text-align: center;
}

.mt-2 {
  margin-top: 2rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

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

/* ========================================
   Print Styles
======================================== */
@media print {
  .site-header,
  .site-footer,
  .nav-toggle,
  .sidebar {
    display: none;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    color: black;
    background: white;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  h1, h2, h3 {
    color: black;
    page-break-after: avoid;
  }

  img {
    max-width: 100%;
    page-break-inside: avoid;
  }
}
