/* Eagle Scout Projects – Frontend Styles */

:root {
    --esp-gold:        #B8860B;
    --esp-gold-light:  #F5D76E;
    --esp-navy:        #1B2A4A;
    --esp-navy-mid:    #2C3E6B;
    --esp-bg:          #FAFAF8;
    --esp-border:      #DDD8CC;
    --esp-text:        #2D2D2D;
    --esp-muted:       #6B6B6B;
    --esp-red:         #8B1A1A;
    --esp-radius:      10px;
    --esp-shadow:      0 2px 12px rgba(0,0,0,0.09);
}

/* ---- Layout ---- */

.esp-projects-wrap {
    font-family: Georgia, 'Times New Roman', serif;
    margin: 1.5em 0;
}

.esp-grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.esp-list-view {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.esp-no-projects {
    color: var(--esp-muted);
    font-style: italic;
}

/* ---- Card ---- */

.esp-project-card {
    background: #fff;
    border: 1px solid var(--esp-border);
    border-radius: var(--esp-radius);
    box-shadow: var(--esp-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.esp-card-header {
    background: var(--esp-navy);
    color: #fff;
    padding: 1rem 1.25rem 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.esp-eagle-badge {
    color: var(--esp-gold-light);
    flex-shrink: 0;
    margin-top: 3px;
}

.esp-project-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: bold;
    color: #fff;
    line-height: 1.35;
}

/* ---- Sections ---- */

.esp-card-sections {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.esp-section {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--esp-border);
}

.esp-section:last-child {
    border-bottom: none;
}

.esp-section-label {
    margin: 0 0 0.4rem;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--esp-gold);
    font-family: Arial, sans-serif;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.esp-section-label svg {
    color: var(--esp-gold);
}

.esp-section-content p {
    margin: 0 0 0.2rem;
    font-size: 0.92rem;
    line-height: 1.4;
    color: var(--esp-text);
}

.esp-scout-name,
.esp-benefactor-name {
    font-weight: bold;
    color: var(--esp-navy);
}

.esp-muted {
    color: var(--esp-muted) !important;
    font-size: 0.85rem !important;
}

/* ---- Stats bar ---- */

.esp-card-stats {
    display: flex;
    gap: 0;
    background: var(--esp-bg);
    border-top: 1px solid var(--esp-border);
}

.esp-stat {
    flex: 1;
    text-align: center;
    padding: 0.65rem 0.5rem;
    border-right: 1px solid var(--esp-border);
}

.esp-stat:last-child {
    border-right: none;
}

.esp-stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--esp-navy);
    line-height: 1;
}

.esp-stat-label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--esp-muted);
    font-family: Arial, sans-serif;
    margin-top: 0.2rem;
}

/* ---- Description ---- */

.esp-card-description {
    padding: 0.85rem 1.25rem;
    font-size: 0.9rem;
    color: var(--esp-text);
    line-height: 1.6;
    border-top: 1px solid var(--esp-border);
}

.esp-card-description p:last-child {
    margin-bottom: 0;
}

/* ---- Map ---- */

.esp-map-wrap {
    margin-bottom: 1.75rem;
    border-radius: var(--esp-radius);
    overflow: hidden;
    border: 1px solid var(--esp-border);
    box-shadow: var(--esp-shadow);
}

.esp-leaflet-map {
    width: 100%;
    display: block;
}

/* Leaflet popup overrides */
.esp-map-popup {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.88rem;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.esp-popup-title {
    font-size: 0.97rem;
    color: var(--esp-navy);
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
}

.esp-popup-scout,
.esp-popup-unit,
.esp-popup-loc,
.esp-popup-date,
.esp-popup-hours {
    display: block;
    color: var(--esp-muted);
    font-size: 0.82rem;
}

.esp-popup-scout {
    color: var(--esp-gold);
    font-weight: 600;
}

.esp-coords {
    font-size: 0.78rem !important;
    font-family: monospace;
    color: #999 !important;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
    .esp-grid-view {
        grid-template-columns: 1fr;
    }
}

/* ---- Photo Gallery ---- */

.esp-card-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 4px;
    padding: 4px;
    border-top: 1px solid var(--esp-border);
    background: #000;
}

.esp-gallery-thumb {
    display: block;
    overflow: hidden;
    aspect-ratio: 1;
    background: #111;
}

.esp-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.88;
}

.esp-gallery-thumb:hover img {
    transform: scale(1.06);
    opacity: 1;
}

/* ---- Lightbox ---- */

.esp-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 99999;
    display: none; /* shown via JS as display:flex when open */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: zoom-out;
}

.esp-lightbox-overlay.esp-lb-open {
    opacity: 1;
}

.esp-lightbox-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    cursor: default;
}

.esp-lightbox-img {
    display: block;
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 3px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.esp-lb-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 32px;
    height: 32px;
    background: var(--esp-gold);
    color: #000;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.esp-lb-prev,
.esp-lb-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 100000;
}

.esp-lb-prev { left: 16px; }
.esp-lb-next { right: 16px; }

.esp-lb-prev:hover,
.esp-lb-next:hover {
    background: rgba(255,255,255,0.25);
}

.esp-lb-counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.6);
    font-size: 0.82rem;
    font-family: Arial, sans-serif;
    z-index: 100000;
}


/* ---- Clickable card link wrapper ---- */

.esp-project-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--esp-radius);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.esp-project-card-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.14);
    text-decoration: none;
    color: inherit;
}

.esp-project-card-link:hover .esp-project-card {
    border-color: var(--esp-navy-mid);
}

/* ---- View Details footer ---- */

.esp-card-view-details {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
    padding: 0.6rem 1.1rem;
    background: var(--esp-bg);
    border-top: 1px solid var(--esp-border);
    font-size: 0.78rem;
    font-family: Arial, sans-serif;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--esp-navy);
    transition: background 0.15s, color 0.15s;
}

.esp-project-card-link:hover .esp-card-view-details {
    background: var(--esp-navy);
    color: var(--esp-gold-light);
    border-top-color: var(--esp-navy);
}

/* ============================================================
   DETAIL PAGE
   ============================================================ */

/* Reset / base */
.esp-detail-body {
    margin: 0;
    padding: 0;
    background: var(--esp-bg, #FAFAF8);
    font-family: Georgia, 'Times New Roman', serif;
    color: #2D2D2D;
}

.esp-detail-page {
    min-height: 100vh;
}

/* ---- Back nav ---- */

.esp-detail-nav {
    background: var(--esp-navy, #1B2A4A);
    padding: 0.6rem 0;
}

.esp-detail-nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.esp-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-family: Arial, sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    transition: color 0.15s;
}

.esp-back-link:hover {
    color: var(--esp-gold-light, #F5D76E);
    text-decoration: none;
}

/* ---- Hero ---- */

.esp-detail-hero {
    background: linear-gradient(135deg, var(--esp-navy, #1B2A4A) 0%, #2C3E6B 100%);
    color: #fff;
    padding: 3rem 0 2.5rem;
}

.esp-detail-hero-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.esp-detail-hero-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
}

.esp-detail-hero-badge svg {
    color: var(--esp-gold-light, #F5D76E);
    flex-shrink: 0;
}

.esp-detail-eagle-label {
    font-family: Arial, sans-serif;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--esp-gold-light, #F5D76E);
    font-weight: 700;
}

.esp-detail-title {
    margin: 0 0 0.6rem;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: bold;
    line-height: 1.2;
    color: #fff;
}

.esp-detail-byline {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    color: rgba(255,255,255,0.8);
}

.esp-detail-scout-name {
    font-weight: bold;
    color: #fff;
}

.esp-detail-scout-unit::before {
    content: ' · ';
    color: rgba(255,255,255,0.4);
}

.esp-detail-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.esp-hero-meta-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: Arial, sans-serif;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.7);
}

.esp-hero-meta-item svg {
    color: var(--esp-gold-light, #F5D76E);
    flex-shrink: 0;
}

/* ---- Body layout ---- */

.esp-detail-body-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 768px) {
    .esp-detail-body-wrap {
        grid-template-columns: 1fr;
    }
    .esp-detail-sidebar {
        order: -1;
    }
    .esp-detail-map-section,
    .esp-detail-leaflet-map,
    .esp-detail-map-wrap {
        z-index: auto;
        position: relative;
    }
}

/* ---- Content sections ---- */

.esp-detail-section {
    background: #fff;
    border: 1px solid var(--esp-border, #DDD8CC);
    border-radius: 10px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.esp-detail-section-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    font-size: 0.95rem;
    font-family: Arial, sans-serif;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--esp-navy, #1B2A4A);
    padding-bottom: 0.65rem;
    border-bottom: 2px solid var(--esp-gold, #B8860B);
}

.esp-detail-section-heading svg {
    color: var(--esp-gold, #B8860B);
    flex-shrink: 0;
}

.esp-detail-location-text {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ---- Detail map ---- */

.esp-detail-map-wrap {
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--esp-border, #DDD8CC);
}

.esp-detail-leaflet-map {
    width: 100%;
    height: 380px;
    display: block;
}

@media (max-width: 600px) {
    .esp-detail-leaflet-map {
        height: 260px;
    }
}

/* ---- Description ---- */

.esp-detail-description {
    font-size: 1rem;
    line-height: 1.75;
    color: #2D2D2D;
}

.esp-detail-description p:last-child { margin-bottom: 0; }

/* ---- Detail gallery ---- */

/* ---- Detail page gallery lives in esp-frontend.css under "Detail gallery figures" ---- */

.esp-detail-map-section {
    position: relative;
    z-index: 1;
    isolation: isolate;
}

/* ---- Sidebar ---- */

.esp-detail-sidebar {
    /* not sticky by default — enabled only on desktop below */
}

@media (min-width: 769px) {
    .esp-detail-sidebar {
        position: sticky;
        top: 1.5rem;
    }
}

.esp-detail-sidebar-card {
    background: #fff;
    border: 1px solid var(--esp-border, #DDD8CC);
    border-radius: 10px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
    padding: 1.2rem 1.4rem;
    margin-bottom: 1rem;
}

.esp-detail-sidebar-card:last-child {
    margin-bottom: 0;
}

.esp-sidebar-heading {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.9rem;
    font-size: 0.68rem;
    font-family: Arial, sans-serif;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--esp-gold, #B8860B);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--esp-border, #DDD8CC);
}

.esp-sidebar-heading svg {
    color: var(--esp-gold, #B8860B);
}

.esp-sidebar-dl {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.3rem 0.8rem;
    font-size: 0.88rem;
}

.esp-sidebar-dl dt {
    font-family: Arial, sans-serif;
    font-weight: 600;
    color: var(--esp-muted, #6B6B6B);
    white-space: nowrap;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    align-self: start;
    margin: 0;
}

.esp-sidebar-dl dd {
    align-self: start;
}

.esp-sidebar-dl dd {
    margin: 0;
    color: var(--esp-text, #2D2D2D);
    line-height: 1.4;
}

.esp-coord-value {
    font-family: monospace;
    font-size: 0.78rem;
    color: #999;
}

/* ---- Detail gallery figures & captions ---- */

.esp-detail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.esp-detail-gallery-figure {
    margin: 0;
    display: flex;
    flex-direction: column;
}

.esp-detail-gallery-figure .esp-gallery-thumb {
    aspect-ratio: 4/3;
    border-radius: 4px;
    display: block;
    overflow: hidden;
}

.esp-detail-gallery-figure .esp-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.9;
}

.esp-detail-gallery-figure .esp-gallery-thumb:hover img {
    transform: scale(1.04);
    opacity: 1;
}

.esp-detail-gallery-caption {
    margin: 6px 0 0;
    font-size: 0.78rem;
    font-family: Arial, sans-serif;
    color: var(--esp-muted);
    line-height: 1.4;
    text-align: center;
    font-style: italic;
}

/* ---- Lightbox caption ---- */

.esp-lightbox-caption {
    margin: 10px auto 0;
    max-width: 80vw;
    text-align: center;
    color: rgba(255,255,255,0.8);
    font-family: Georgia, serif;
    font-size: 0.88rem;
    line-height: 1.5;
    font-style: italic;
}

/* ---- Mobile map touch hint overlay ---- */

.esp-map-touch-hint {
    position: absolute;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: opacity 0.2s ease;
    border-radius: inherit;
}

.esp-map-touch-hint span {
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.esp-map-touch-hint:hover {
    background: rgba(0, 0, 0, 0.25);
}
