/* ==========================================================================
   Base y Variables (Mobile First)
   ========================================================================== */
:root {
  --arn-primary: #004884;     /* Azul institucional Gobierno */
  --arn-secondary: #0085C8;   /* Azul claro */
  --arn-text-dark: #333333;
  --arn-text-light: #666666;
  --arn-bg-light: #F4F6F9;
  --arn-white: #FFFFFF;
  --arn-radius: 16px;
  --arn-shadow: 0 8px 24px rgba(0, 72, 132, 0.08);
  --arn-shadow-hover: 0 12px 32px rgba(0, 72, 132, 0.15);
  --arn-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --arn-focus: 0 0 0 3px rgba(0, 133, 200, 0.5);
}

.arn-directory-wrapper {
  font-family: 'Work Sans', sans-serif;
  color: var(--arn-text-dark);
  background-color: var(--arn-bg-light);
  line-height: 1.6;
  box-sizing: border-box;
  padding-bottom: 40px;
}

.arn-directory-wrapper * {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   Accesibilidad
   ========================================================================== */
.arn-directory-wrapper *:focus-visible {
  outline: none;
  box-shadow: var(--arn-focus);
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .arn-directory-wrapper *,
  .arn-directory-wrapper *::before,
  .arn-directory-wrapper *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.arn-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ==========================================================================
   1. Hero
   ========================================================================== */
.arn-hero {
  background-color: var(--arn-white);
  padding: 0;
  text-align: center;
  border-bottom: 1px solid #E2E8F0;
}

.arn-banner-container {
  width: 100%;
  max-width: 1096px;
  margin: 0 auto;
  overflow: hidden;
}

.arn-banner {
  width: 100%;
  height: auto;
  max-height: 187px;
  object-fit: cover;
  display: block;
}

.arn-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--arn-primary);
  padding: 24px 16px 16px;
}

/* ==========================================================================
   2. Introducción
   ========================================================================== */
.arn-intro {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px 32px;
  text-align: center;
  color: var(--arn-text-light);
  font-size: 1rem;
}

/* ==========================================================================
   3. Filtros
   ========================================================================== */
.arn-filters-section {
  padding: 0 16px 32px;
  max-width: 1200px;
  margin: 0 auto;
}

.arn-filters {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.arn-filters::-webkit-scrollbar {
  height: 6px;
}

.arn-filters::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
}

.arn-filter-btn {
  flex: 0 0 auto;
  background-color: var(--arn-white);
  color: var(--arn-text-light);
  border: 1px solid #cbd5e1;
  border-radius: 24px;
  padding: 10px 20px;
  font-family: 'Work Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--arn-transition);
}

.arn-filter-btn:hover {
  background-color: #f8fafc;
  color: var(--arn-primary);
  border-color: var(--arn-primary);
}

.arn-filter-btn.active {
  background-color: var(--arn-primary);
  color: var(--arn-white);
  border-color: var(--arn-primary);
  box-shadow: 0 4px 12px rgba(0, 72, 132, 0.2);
}

/* ==========================================================================
   4. Tarjetas (Grid)
   ========================================================================== */
.arn-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 0 16px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.arn-card {
  background: var(--arn-white);
  border-radius: var(--arn-radius);
  overflow: hidden;
  box-shadow: var(--arn-shadow);
  transition: var(--arn-transition);
  display: flex;
  flex-direction: column;
}

.arn-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--arn-shadow-hover);
}

.arn-card-img-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background-color: #e2e8f0;
}

.arn-card-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.arn-card:hover .arn-card-img-container img {
  transform: scale(1.05);
}

.arn-card-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.arn-card-region {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--arn-secondary);
  font-weight: 700;
  margin-bottom: 8px;
}

.arn-card-title {
  font-size: 1.25rem;
  color: var(--arn-primary);
  margin-bottom: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.arn-card-location, 
.arn-card-area {
  font-size: 0.9rem;
  color: var(--arn-text-light);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.arn-btn-primary {
  margin-top: auto;
  padding: 12px;
  width: 100%;
  background-color: transparent;
  color: var(--arn-primary);
  border: 1px solid var(--arn-primary);
  border-radius: 8px;
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--arn-transition);
}

.arn-btn-primary:hover {
  background-color: var(--arn-primary);
  color: var(--arn-white);
}

/* ==========================================================================
   5. Panel de Detalle
   ========================================================================== */
.arn-detail-panel {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 1;
  transform: translateY(0);
}

.arn-detail-panel.arn-hidden {
  display: none;
  opacity: 0;
  transform: translateY(20px);
}

.arn-detail-content {
  background: var(--arn-white);
  border-radius: var(--arn-radius);
  box-shadow: var(--arn-shadow-hover);
  padding: 24px;
  position: relative;
}

.arn-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--arn-text-light);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: var(--arn-transition);
  z-index: 10;
}

.arn-close-btn:hover {
  background-color: #f1f5f9;
  color: #ef4444;
}

.arn-detail-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.arn-detail-left {
  width: 100%;
}

.arn-detail-left img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
}

.arn-detail-right {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.arn-detail-title {
  font-size: 1.5rem;
  color: var(--arn-primary);
  line-height: 1.2;
  margin-right: 32px; /* espacio para el botón cerrar */
}

.arn-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.arn-badge {
  background-color: var(--arn-bg-light);
  color: var(--arn-primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.arn-badge-outline {
  background-color: transparent;
  border: 1px solid #cbd5e1;
  color: var(--arn-text-light);
}

.arn-detail-info p {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.arn-detail-desc {
  font-size: 0.95rem;
  color: var(--arn-text-light);
  background-color: #f8fafc;
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid var(--arn-secondary);
}

.arn-detail-share {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.arn-share-box h3 {
  font-size: 1rem;
  color: var(--arn-primary);
  margin-bottom: 4px;
}

.arn-share-box p {
  font-size: 0.9rem;
  color: var(--arn-text-light);
}

.arn-detail-contact {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.arn-email-link {
  color: var(--arn-secondary);
  text-decoration: none;
  font-weight: 600;
  word-break: break-all;
}

.arn-email-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Breakpoints (Tablet & Desktop)
   ========================================================================== */
@media (min-width: 480px) {
  .arn-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (min-width: 768px) {
  .arn-title {
    font-size: 2rem;
  }
  
  .arn-intro {
    font-size: 1.1rem;
  }

  .arn-filters {
    justify-content: center;
  }
  
  .arn-detail-content {
    padding: 32px;
  }
}

@media (min-width: 1024px) {
  .arn-detail-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 40px;
  }

  .arn-detail-left {
    width: 35%;
    flex-shrink: 0;
  }

  .arn-detail-right {
    width: 65%;
  }

  .arn-detail-share {
    flex-direction: row;
  }
  
  .arn-share-box {
    flex: 1;
  }
}