/* =========================================================================
   Proyectos: filtros, mapa Leaflet (#mapa), resultados, detalle y galería.
   Usa las variables de site.css. Se carga con @section Styles en Views/Projects.
   ========================================================================= */

/* ---------- Filtros (tarjeta superpuesta al banner) ---------- */
.projects-filters-wrap { position: relative; z-index: 5; margin-top: -1.75rem; }
.filter-card { background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1rem; }
@media (min-width: 768px) { .filter-card { padding: 1.25rem 1.5rem; } }

/* ---------- Mapa ---------- */
.projects-map-section { padding-top: 2.25rem; }
.map-aside { background: var(--c-navy-800); color: rgba(255,255,255,.82); border-radius: var(--radius-lg); padding: 1.5rem; height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.map-aside .eyebrow { color: var(--c-green-300); }
.map-aside-title { color: #fff; font-size: 1.35rem; margin: .35rem 0; }
.map-aside-text { font-size: .92rem; margin: 0 0 1rem; }
.province-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.province-list a { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .5rem .75rem; border-radius: var(--radius-sm); color: rgba(255,255,255,.9); background: rgba(255,255,255,.05); border: 1px solid transparent; font-size: .9rem; transition: background .2s, border-color .2s; }
.province-list a:hover, .province-list a:focus-visible { background: rgba(255,255,255,.12); color: #fff; }
.province-list a:focus-visible { outline: 2px solid var(--c-green-300); outline-offset: 1px; }
.province-list a.is-active { border-color: var(--c-green); background: rgba(122,185,41,.18); color: #fff; }
.province-list i { color: var(--c-green-300); margin-right: .45rem; }
.province-count { min-width: 28px; height: 24px; border-radius: 12px; background: rgba(255,255,255,.14); color: #fff; font-size: .78rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 .5rem; }
.map-aside-reset { margin-top: 1rem; color: var(--c-green-300); font-weight: 600; font-size: .88rem; display: inline-flex; gap: .35rem; align-items: center; }
.map-aside-reset:hover { color: #fff; }
@media (min-width: 992px) { .province-list { max-height: 330px; overflow-y: auto; scrollbar-width: thin; padding-right: .25rem; } }

.map-shell { position: relative; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--c-line); box-shadow: var(--shadow); background: #EEF1F5; }
.projects-map { width: 100%; height: 360px; }
@media (min-width: 992px) { .projects-map { height: 470px; } }
.map-empty { position: absolute; left: 1rem; right: 1rem; bottom: 1rem; z-index: 800; margin: 0; background: rgba(255,255,255,.96); border-radius: var(--radius); box-shadow: var(--shadow); padding: .75rem 1rem; font-size: .9rem; color: var(--c-ink); }
.map-hint { font-size: .82rem; color: var(--c-muted); margin: .6rem 0 0; display: flex; gap: .4rem; align-items: center; }
.leaflet-container { font-family: var(--font); background: #EEF1F5; }
.leaflet-container a { color: var(--c-blue); }

/* Marcador L.divIcon con forma de pin (azul, como en el mockup) */
.project-marker { background: none; border: 0; }
.map-pin { position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50% 50% 50% 0; background: var(--c-blue); border: 3px solid #fff; transform: rotate(-45deg); box-shadow: -2px 4px 12px rgba(8,24,58,.35); transition: background .2s; }
.map-pin::after { content: ''; position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #fff; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.leaflet-marker-icon.project-marker:hover .map-pin { background: var(--c-green); }
.leaflet-marker-icon.project-marker:focus { outline: none; }
.leaflet-marker-icon.project-marker:focus-visible .map-pin { background: var(--c-green); box-shadow: 0 0 0 4px rgba(122,185,41,.45); }

/* Ventana emergente del marcador */
.leaflet-popup-content-wrapper { border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 0; }
.leaflet-popup-content { margin: 0; width: 240px !important; }
.project-popup { display: block; }
.project-popup img { display: block; width: 100%; height: 124px; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; }
.project-popup-body { padding: .75rem .9rem .85rem; display: flex; flex-direction: column; gap: .2rem; }
.project-popup-type { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--c-green-700); }
.project-popup-title { font-size: .95rem; font-weight: 700; color: var(--c-ink); line-height: 1.3; }
.project-popup-location { font-size: .8rem; color: var(--c-muted); display: flex; gap: .3rem; align-items: center; }
.project-popup-location i { color: var(--c-green-600); }
.leaflet-container a.project-popup-link { margin-top: .35rem; font-weight: 700; font-size: .85rem; color: var(--c-blue); display: inline-flex; gap: .3rem; align-items: center; }
.leaflet-container a.project-popup-link:hover { color: var(--c-blue-700); }
.project-popup-wrap a.leaflet-popup-close-button { top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; line-height: 24px; font-size: 18px; }
.project-popup-wrap.has-image a.leaflet-popup-close-button { color: #fff; background: rgba(8,24,58,.55); }
.project-popup-wrap.has-image a.leaflet-popup-close-button:hover { color: #fff; background: rgba(8,24,58,.8); }

/* ---------- Resultados ---------- */
.results-bar { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.results-count { color: var(--c-muted); font-size: .9rem; margin: 0; }
.page-projects .empty-state p { margin-bottom: 1rem; }

/* ---------- Detalle: banner ---------- */
.page-banner.project-hero { min-height: 340px; display: flex; align-items: flex-end; padding: 3.25rem 0 2.75rem; }
.page-banner.project-hero > .container-xxl { width: 100%; }
.page-banner.project-hero::after { background: linear-gradient(0deg, rgba(8,24,58,.96) 0%, rgba(8,24,58,.72) 45%, rgba(8,24,58,.38) 100%); }
@media (min-width: 992px) { .page-banner.project-hero { min-height: 440px; padding: 4.5rem 0 3.5rem; } }
.project-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.project-hero-label { display: inline-block; text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--c-green-300); margin-bottom: .5rem; }
.hero-chips { list-style: none; padding: 0; margin: 1.25rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.hero-chips li { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .85rem; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.24); color: #fff; font-size: .86rem; font-weight: 600; backdrop-filter: blur(4px); }
.hero-chips i { color: var(--c-green-300); }

/* ---------- Detalle: galería ---------- */
.project-gallery { display: grid; gap: .6rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 2.25rem; }
.gallery-item { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; background: var(--c-soft); aspect-ratio: 4 / 3; cursor: zoom-in; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.gallery-item:hover img { transform: scale(1.05); }
.gallery-item:focus-visible { outline: 3px solid var(--c-green); outline-offset: 2px; }
.gallery-item:first-child { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.gallery-more { position: absolute; inset: 0; background: rgba(8,24,58,.62); color: #fff; font-size: 1.5rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
@media (min-width: 768px) {
    .project-gallery.count-2 { grid-template-columns: repeat(2, 1fr); }
    .project-gallery.count-2 .gallery-item:first-child { grid-column: auto; aspect-ratio: 4 / 3; }
    .project-gallery.count-3 { grid-template-columns: 2fr 1fr; }
    .project-gallery.count-3 .gallery-item:first-child { grid-column: auto; grid-row: span 2; aspect-ratio: auto; }
    .project-gallery.count-4 { grid-template-columns: repeat(3, 1fr); }
    .project-gallery.count-4 .gallery-item:first-child { grid-column: 1 / -1; aspect-ratio: 21 / 9; }
    .project-gallery.count-5 { grid-template-columns: repeat(4, 1fr); }
    .project-gallery.count-5 .gallery-item:first-child { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
}

.gallery-modal .modal-content { background: var(--c-navy-950); color: #fff; border: 0; border-radius: var(--radius-lg); overflow: hidden; }
.gallery-modal .modal-header { border: 0; gap: 1rem; padding: .9rem 1.25rem; }
.gallery-modal .modal-title { color: #fff; font-size: 1rem; font-weight: 700; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-counter { font-size: .85rem; color: rgba(255,255,255,.72); white-space: nowrap; }
.gallery-modal .modal-body { padding: 0 0 1rem; }
.gallery-modal .carousel-item img { display: block; width: 100%; max-height: 74vh; object-fit: contain; background: #000; }
.gallery-caption { text-align: center; padding: .75rem 1rem 0; margin: 0; color: rgba(255,255,255,.85); font-size: .9rem; }
.gallery-modal .carousel-control-prev, .gallery-modal .carousel-control-next { width: 12%; }

/* ---------- Detalle: contenido y ficha ---------- */
.project-body { margin-bottom: 1rem; }
.project-facts { padding: 1.5rem; }
.project-facts-title { font-size: 1.1rem; margin: 0 0 .5rem; }
.fact-list { margin: 0; }
.fact-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: .65rem 0; border-bottom: 1px solid var(--c-line); font-size: .9rem; }
.fact-row:last-child { border-bottom: 0; }
.fact-row dt { font-weight: 500; color: var(--c-muted); display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.fact-row dt i { color: var(--c-green-600); }
.fact-row dd { margin: 0; font-weight: 700; color: var(--c-ink); text-align: right; overflow-wrap: anywhere; }
.fact-row dd a { color: var(--c-blue); }
.fact-row dd a:hover { text-decoration: underline; }
.mini-map { height: 220px; border-radius: var(--radius); overflow: hidden; margin-top: 1rem; border: 1px solid var(--c-line); background: #EEF1F5; position: relative; z-index: 0; }
.mini-map-link { display: inline-flex; gap: .35rem; align-items: center; font-size: .82rem; margin-top: .5rem; font-weight: 600; }
