/**
 * map.css
 * Styles for the overview map, single project map, and popups.
 * Enqueued automatically by leaflet-map.php on relevant pages.
 */


/* ── Map containers ─────────────────────────────────────── */

#project-map {
    width: 100%;
    height: 520px;
    border-radius: 8px;
    z-index: 0;
}

/* ── Scroll-to-zoom overlay message ────────────────────── */

.map-scroll-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 8px;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.map-scroll-overlay.visible {
    opacity: 1;
}

/* ── Empty filter result overlay on map ───────────────── */

.map-empty-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    color: #286961;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 8px;
    z-index: 999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.map-empty-overlay.visible {
    opacity: 1;
}


/* ── Filter bar ────────────────────────────────────────── */

.prosjektfilter {
    padding-bottom: 0 !important;
}

.prosjektfilter__bar {
    border-bottom: 1px solid #d0d0d0;
    width: 100% !important;
    flex: 1 1 100% !important;
}

.prosjektfilter__row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    width: 100% !important;
}

.prosjektfilter__search {
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center !important;
    min-width: 0 !important;
}

.prosjektfilter__input {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    padding: 0.85rem 1rem !important;
    font-size: 1rem !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    outline: none !important;
    margin: 0 !important;
    box-shadow: none !important;
    height: auto !important;
}

.prosjektfilter__input::placeholder {
    color: #aaa;
}

.prosjektfilter__search-icon {
    flex: 0 0 auto !important;
    padding: 0 0.75rem !important;
    font-size: 1.4rem !important;
    color: #286961;
    line-height: 1;
}

.prosjektfilter__select {
    flex: 1 1 0 !important;
    width: 0 !important;
    padding: 0.85rem 2.25rem 0.85rem 1rem !important;
    font-size: 1rem !important;
    border: none !important;
    border-left: 1px solid #d0d0d0 !important;
    border-radius: 0 !important;
    background-color: transparent !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    outline: none !important;
    margin: 0 !important;
    box-shadow: none !important;
    height: auto !important;
    cursor: pointer;
    color: #333;
    white-space: nowrap !important;
}

/* Mobile: stack vertically */
@media screen and (max-width: 63.99em) {
    .prosjektfilter__row {
        flex-wrap: wrap !important;
    }

    .prosjektfilter__search {
        flex: 1 1 100% !important;
        border-right: none;
        border-bottom: 1px solid #e8e8e8;
    }

    .prosjektfilter__select {
        flex: 1 1 100% !important;
        border-left: none !important;
        border-bottom: 1px solid #e8e8e8;
    }

    .prosjektfilter__select:last-child {
        border-bottom: none;
    }
}

/* Empty state for filtered card list */
.prosjektliste__empty {
    text-align: center;
    color: #999;
    font-size: 1.05rem;
    padding: 2rem 0;
}


/* ── Prosjektliste: card grid ──────────────────────────── */

.prosjektliste {
    padding-bottom: 3rem;
}

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

@media screen and (min-width: 40em) {
    .prosjektliste__grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media screen and (min-width: 64em) {
    .prosjektliste__grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* Project card */
.prosjektkort {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.prosjektkort:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.prosjektkort__bilde {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f0f4f8;
}

.prosjektkort__bilde img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.prosjektkort__innhold {
    flex: 1;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.prosjektkort__tittel {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 0.75rem;
    color: #286961;
}

.prosjektkort__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.prosjektkort__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #666;
}

.prosjektkort__badge .material-icons {
    font-size: 1.1rem;
    color: #b0b0b0;
}

#single-project-map {
    width: 100%;
    height: 360px;          /* ← ADJUST: height of single project map */
    border-radius: 8px;
    z-index: 0;
}


/* ── Single prosjekt page ───────────────────────────────── */

/* Hero image: full-width above title */
.prosjekt-hero {
    width: 100%;
    max-height: 480px;
    overflow: hidden;
    background-color: #f0f4f8;
}

.prosjekt-hero__img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 480px;
}

/* Content container */
.prosjekt-innhold {
    max-width: 50rem;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

@media screen and (min-width: 64em) {
    .prosjekt-innhold {
        padding: 2.5rem 0 4rem;
    }
}

/* Title */
.prosjekt-tittel {
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 1.25rem;
}

@media screen and (min-width: 40em) {
    .prosjekt-tittel {
        font-size: 2.5rem;
    }
}

/* Meta fields: icon + label/value */
.prosjekt-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin: 0 0 2.5rem;
    padding: 1.5rem 0;
    list-style: none;
}

.prosjekt-meta__item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.prosjekt-meta__item > .material-icons {
    font-size: 1.6rem;
    color: #b0b0b0;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.prosjekt-meta dt {
    font-size: 0.8rem;
    font-weight: 600;
    color: #286961;
    margin-bottom: 0.1rem;
}

.prosjekt-meta dd {
    font-size: .85rem;
    font-weight: 600;
    color: #222;
    margin: 0;
}

/* Ingress (uses the WP Excerpt field) */
.prosjekt-ingress {
    margin-bottom: 2rem;
}

.prosjekt-ingress h2 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #286961;
    margin-bottom: 0.4rem;
}

.prosjekt-ingress p {
    font-size: 1.2rem;
    line-height: 1.6;
    color: #333;
    margin: 0;
}

/* Map wrapper */
.prosjekt-kart {
    margin-bottom: 2.5rem;
}

@media screen and (min-width: 64em) {
    #single-project-map {
        height: 440px;
    }
}

/* Body content from Gutenberg */
.prosjekt-brødtekst {
    font-size: 1.05rem;
    line-height: 1.7;
}

.prosjekt-brødtekst a:not(.button) {
    text-decoration: none;
    border-bottom: 2px solid #c00;
    font-weight: bold;
}

.prosjekt-brødtekst a:not(.button):hover {
    border-bottom-color: transparent;
}


/* ── Popup styles ────────────────────────────────────────── */

.lm-popup-wrapper .leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 0;
}

.lm-popup-wrapper .leaflet-popup-content {
    margin: 0;
    padding: 0;
}

.lm-popup {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    min-width: 160px;
}

.lm-popup__title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #286961;
    text-decoration: underline;
    text-underline-offset: 2px;
    line-height: 1.3;
}

.lm-popup__title:hover {
    color: #1d4e48;
}

.lm-popup__status {
    font-size: 0.75rem;
    color: #666;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}


/* ── Cluster icon colours ────────────────────────────────── */
/* Override defaults to match your brand. */

.marker-cluster-small div,
.marker-cluster-medium div {
    background-color: rgba(0, 112, 192, 0.7);   /* ← ADJUST: brand blue */
}
.marker-cluster-small,
.marker-cluster-medium {
    background-color: rgba(0, 112, 192, 0.3);
}

.marker-cluster-large div {
    background-color: rgba(240, 150, 0, 0.7);
}
.marker-cluster-large {
    background-color: rgba(240, 150, 0, 0.3);
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin: 5px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-size: 13px;
    font-weight: 700;
    color: #000;
}
