/* =========================================================
   COMPRAR | Catálogo editorial y mapa territorial
   Estilos aislados: no modifican la portada ni el CSS global.
   ========================================================= */
.market-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    color: #fff;
    background: linear-gradient(110deg, rgba(8, 18, 15, .86), rgba(8, 18, 15, .57)), url('../images/home.webp') center / cover fixed;
}

/* Encabezado comercial: jerarquía SEO visible y compacta. */
.market-main {
    width: min(100% - 48px, 1320px);
    margin: auto;
    padding: 20px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.market-intro {
    margin-bottom: 20px;
}
.market-kicker {
    color: #b7ff82;
    font-size: 10px;
    letter-spacing: .24em;
    text-transform: uppercase;
}
.market-intro h1 {
    font-size: clamp(24px, 2.6vw, 38px);
    font-weight: 300;
    letter-spacing: -.035em;
    line-height: 1.2;
    margin: 6px 0;
}
.market-intro p {
    font-size: 13px;
    color: #dce8dd;
    line-height: 1.5;
}

/* Ofertas a la izquierda y mapa a la derecha. */
.market-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
    grid-template-areas: "offers map";
    gap: 24px;
    align-items: stretch;
}
.offer-list {
    grid-area: offers;
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-width: 0;
}
.offers-heading,
.map-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.offers-heading h2,
.map-heading h2 {
    font-size: 16px;
    font-weight: 500;
}
.offers-heading > span {
    color: #b7ff82;
    font-size: 11px;
    letter-spacing: .1em;
}

/* Tarjetas compactas: región y precio en una misma línea. */
.offer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    row-gap: 5px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, .19);
    border-radius: 13px;
    background: rgba(255, 255, 255, .075);
    transition: border-color .25s ease, background .25s ease;
    scroll-margin-top: 16px;
}
.offer:hover,
.offer.selected,
.offer:target {
    border-color: #a8f577;
    background: rgba(105, 229, 42, .10);
}
.offer-type {
    font-size: 10px;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: #b7ff82;
}
.offer h3 {
    font-size: clamp(15px, 1.5vw, 20px);
    font-weight: 400;
    line-height: 1.3;
    margin: 3px 0;
}
.offer-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 14px;
    border-top: 1px solid rgba(255, 255, 255, .10);
    padding-top: 5px;
}
.offer-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    font-size: 12px;
    color: #b7ff82;
}
.offer-link:hover {
    color: #fff;
}
.offer-note,
#map-status {
    font-size: 11px;
    line-height: 1.5;
    color: #dce8dd;
}

/* Cartografía: geometrías originales, sin recortes. */
.map-card {
    grid-area: map;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, .17);
    border-radius: 18px;
    background: rgba(255, 255, 255, .065);
    padding: 15px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.map-legend {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: #e4eee4;
}
.map-legend span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #83ed42;
}
#spain-map {
    display: block;
    width: 100%;
    height: auto;
    max-height: 370px;
    margin: 4px auto;
}
#spain-map[hidden] {
    display: none;
}
.map-region {
    fill: #52635a;
    stroke: #a4b5a8;
    stroke-width: .65;
    stroke-linejoin: round;
}
.map-region.available {
    fill: url(#metal-green);
    stroke: #c7ff9f;
    cursor: pointer;
}
.map-region.available:hover,
.map-region.available:focus-visible,
.map-region.selected {
    fill: #b7ff82;
    stroke: #fff;
    stroke-width: 2;
}
.map-label {
    fill: #f2fff0;
    font-size: 12px;
    text-anchor: middle;
    pointer-events: none;
    paint-order: stroke;
    stroke: #16301d;
    stroke-width: 3px;
}
.map-inset {
    fill: none;
    stroke: #718577;
    stroke-width: 1;
    stroke-dasharray: 4 4;
}
.market-page a:focus-visible,
.market-page button:focus-visible {
    outline: 2px solid #b7ff82;
    outline-offset: 4px;
}

/* Tablet y móvil: mapa primero, catálogo después. */
@media (max-width: 900px) {
    .market-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "map"
            "offers";
    }
    .market-page {
        background-attachment: scroll;
    }
    #spain-map {
        max-height: 460px;
    }
}
@media (max-width: 480px) {
    .market-main {
        width: calc(100% - 28px);
        padding: 18px 0;
    }
    .market-grid {
        gap: 18px;
    }
    .offer {
        padding: 10px 12px;
    }
    .map-card {
        padding: 12px;
    }
    .map-label {
        font-size: 16px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .offer {
        transition: none;
    }
}

/* Catálogo sin precios ni controles secundarios. */
.offer {
    grid-template-columns: minmax(0, 1fr);
}
.offer-actions {
    justify-content: flex-end;
}

/* Ficha de licencia: también accesible mediante :target sin JavaScript. */
.license-detail {
    display: none;
}
.license-detail:target,
.license-detail.is-open {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
    overflow-y: auto;
    background: rgba(3, 12, 8, .72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.license-detail-card {
    position: relative;
    width: min(100%, 560px);
    padding: clamp(24px, 5vw, 46px);
    border: 1px solid rgba(197, 255, 145, .42);
    border-radius: 22px;
    background: linear-gradient(145deg, #263b2e, #101e16);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .4);
    color: #fff;
}
.license-detail-card h2 {
    margin: 10px 0;
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 400;
}
.license-detail-card p {
    line-height: 1.65;
    margin: 12px 0;
}
.license-price {
    font-size: 32px;
    color: #c5ff91;
    font-weight: 500;
}
.license-note {
    font-size: 12px;
    color: #dce8dd;
}
.license-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    font-size: 27px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .25);
}
.license-contact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-top: 16px;
    padding: 12px 22px;
    border-radius: 999px;
    background: linear-gradient(120deg, #c5ff91, #69e52a);
    color: #102410;
    font-weight: 600;
}
.license-open {
    overflow: hidden;
}
.map-status[hidden] {
    display: none;
}
@media (max-width: 480px) {
    .license-detail:target,
    .license-detail.is-open {
        padding: 14px;
    }
    .license-contact {
        width: 100%;
    }
}
