/* =========================================================
   Radici Territorio Map – Stili plugin
   ========================================================= */

/* ---- Wrapper generale ---- */
.rtm-wrapper {
    position: relative;
    width: 100%;
    font-family: 'Roboto', 'Helvetica Neue', sans-serif;
}

/* =========================================================
   MAPPA  (#map gestito da mappa.js)
   ========================================================= */
#map {
    width: 100%;
    background: #e8e0d5;
    z-index: 0;
}

/* =========================================================
   MARKER PERSONALIZZATO  (classe usata da mappa.js)
   ========================================================= */
.custom-marker {
    width: 18px !important;
    height: 18px !important;
    background: #1c5c52;
    border: 2.5px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s;
    cursor: pointer;
    height: 90vh;
}

.custom-marker:hover {
    transform: scale(1.35);
}

/* =========================================================
   TIMELINE VERTICALE (overlay sulla mappa)
   ========================================================= */
.rtm-timeline-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 110px;
    height: calc(100% - 60px);
    z-index: 500;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.rtm-timeline-label {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    background: #e9efea;
    color: #333;
    white-space: nowrap;
    pointer-events: none;
    flex-shrink: 0;
}

.rtm-timeline-label.top  { margin-bottom: 6px; }
.rtm-timeline-label.bottom { margin-top: 6px; }

.rtm-timeline {
    position: relative;
    width: 100%;
    flex: 1;
    pointer-events: all;
}

/* Asse */
.rtm-timeline-axis {
    position: absolute;
    left: 50%;
    width: 2px;
    height: 100%;
    background: rgba(0, 0, 0, 0.18);
    transform: translateX(-50%);
}

/* Tacche */
.rtm-timeline-ticks { position: absolute; inset: 0; }

.rtm-tick {
    position: absolute;
    left: 50%;
    height: 1px;
    width: 12px;
    background: rgba(0, 0, 0, 0.25);
    transform: translateX(-100%);
    cursor: pointer;
    transition: width 0.15s, background 0.15s;
}

.rtm-tick.major {
    width: 24px;
    background: rgba(0, 0, 0, 0.38);
}

.rtm-tick:hover {
    width: 28px;
    background: #2d6cdf;
    transform: translateX(-100%);
}

/* Cursore anno */
.rtm-timeline-cursor {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: grab;
    transition: top 0.2s ease-out;
    white-space: nowrap;
}

.rtm-timeline-cursor:active { cursor: grabbing; }

.rtm-cursor-year {
    font-size: 13px;
    font-weight: 700;
    padding: 3px 9px;
    color: #fff;
    background: #1c5c52;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.rtm-cursor-icon {
    width: 30px;
    height: 30px;
    background: #1c5c52;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
}

/* =========================================================
   CARD DETTAGLIO — 500 px, top-left rispetto a .rtm-wrapper
   ========================================================= */
.rtm-detail-card-container {
    position: fixed;
    top: 110px;
    left: 16px;
    z-index: 1000;
    width: 500px;
    max-width: calc(100% - 32px);
    pointer-events: auto;
}

.rtm-detail-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.20);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /*max-height: 90vh;*/
    height: calc(90vh - 110px);    
    position: relative;
}

/* Pulsante chiudi */
.rtm-btn-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.88);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.2s;
}

.rtm-btn-close:hover { background: #eee; }

/* Hero */
.rtm-detail-hero {
    height: 300px;
    background-size: cover;
    background-position: center;
    background-color: #ccc;
    flex-shrink: 0;
    position: relative;
    border-radius: 16px;
    border: 3px solid #fff;
}

.rtm-hero-video {
    position: absolute;
    inset: 0;
}

.rtm-hero-video iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Corpo card */
.rtm-detail-body {
    display: flex;
    flex-direction: column;
    padding: 16px;
    flex: 1;
    overflow: hidden;
}

.rtm-detail-header { flex-shrink: 0; }

.rtm-eyebrow {
    font-size: 12px;
    color: #777;
    font-weight: 500;
    margin-bottom: 2px;
}

.rtm-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

/* ---- Tabs interni ---- */
.rtm-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e5e5e5;
    margin-bottom: 10px;
}

.rtm-tab-btn {
    background: none;
    border: none;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.rtm-tab-btn.active {
    color: #1c5c52;
    border-bottom-color: #1c5c52;
    font-weight: 700;
}

.rtm-tab-btn:hover:not(.active) { color: #333; }

/* Scroll */
.rtm-detail-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

/* Pannelli */
.rtm-tab-pane         { display: none; }
.rtm-tab-pane.active  { display: block; }

#rtm-description {
    font-size: 14px;
    color: #444;
    line-height: 1.65;
    margin: 0;
}

/* ---- Gallery ---- */
.rtm-masonry {
    column-count: 2;
    column-gap: 10px;
    margin-top: 10px;
}

.rtm-masonry img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 10px;
    display: block;
    break-inside: avoid;
    cursor: pointer;
    transition: opacity 0.2s;
}

.rtm-masonry img:hover { opacity: 0.82; }

/* ---- Documenti ---- */
.rtm-document-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.rtm-document-item {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.rtm-document-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

.rtm-doc-left {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.rtm-doc-icon { font-size: 28px; color: #e63946; flex-shrink: 0; }

.rtm-doc-info { display: flex; flex-direction: column; overflow: hidden; }

.rtm-doc-title {
    font-weight: 600;
    font-size: 13px;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rtm-doc-year { font-size: 11px; color: #888; }

.rtm-doc-open {
    color: #e63946;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.rtm-doc-open:hover { color: #b91d2e; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 560px) {
    .rtm-detail-card-container {
        top: 30;
        left: 0;
        width: 100%;
        max-width: 100%;
    }

    .rtm-detail-card {
        border-radius: 0;
		height: calc(100vh - 10px);
    }

    .rtm-timeline-wrapper {
        right: 6px;
        width: 80px;
    }
}
