/* ── Hebra Cemetery Interactive Map ─────────────────────────────────── */

/* ── Outer wrap ───────────────────────────────────────────────────── */
.hebra-map-wrap {
    margin: 0 0 32px;
    font-family: inherit;
    user-select: none;
    -webkit-user-select: none;
    animation: map-fade-in 0.4s ease both;
}

@keyframes map-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Header bar ───────────────────────────────────────────────────── */
.hebra-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 0 14px 0;
    background: transparent;
    border-bottom: none;
}
.hebra-map-title {
    font-size: 22px;
    font-weight: 700;
    color: #c9a84c;
    margin: 0;
    letter-spacing: 0.02em;
}
.hebra-map-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.hebra-map-hint {
    font-size: 11px;
    color: #9a9080;
    letter-spacing: 0.02em;
}
.hebra-map-clear-btn {
    padding: 4px 12px;
    background: #fff;
    border: 1.5px solid #c9a84c;
    color: #a8862e;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: none;
    transition: background 0.15s, color 0.15s;
    letter-spacing: 0.03em;
}
.hebra-map-clear-btn:hover { background: #c9a84c; color: #fff; }

/* ── Map outer wrapper ────────────────────────────────────────────── */
.hebra-map-outer {
    position: relative;
    padding-left: 24px;
    padding-bottom: 20px;
    background: #f7f4ee;
}

/* ── Map image container ──────────────────────────────────────────── */
.hebra-map-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 10px;
    background: #f7f4ee;
    line-height: 0;
    cursor: default;
    border: 1px solid #e0d9cc;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
}

.hebra-map-img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
    filter: contrast(1.04) brightness(1.01);
    transition: filter 0.3s;
}

/* SVG overlay */
.hebra-map-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ── Grid cells ───────────────────────────────────────────────────── */
.hebra-cell {
    fill: transparent;
    stroke: transparent;
    stroke-width: 0;
    pointer-events: all;
    cursor: pointer;
    transition: fill 0.1s, stroke 0.1s;
}
.hebra-cell:hover {
    fill: rgba(201, 168, 76, 0.22);
    stroke: rgba(168, 134, 46, 0.85);
    stroke-width: 1.5px;
}
.hebra-cell.active {
    fill: rgba(201, 168, 76, 0.36);
    stroke: #c9a84c;
    stroke-width: 2px;
}
.hebra-cell.has-records {
    fill: rgba(60, 100, 62, 0.06);
}
.hebra-cell.has-records:hover {
    fill: rgba(201, 168, 76, 0.22);
    stroke: rgba(168, 134, 46, 0.85);
    stroke-width: 1.5px;
}
.hebra-cell.result-highlight {
    fill: rgba(201, 168, 76, 0.30);
    stroke: #c9a84c;
    stroke-width: 1.5px;
}

/* ── Tooltip ──────────────────────────────────────────────────────── */
.hebra-map-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(40, 32, 18, 0.92);
    color: #f5e9c8;
    font-size: 11px;
    font-family: inherit;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 30;
    opacity: 0;
    transition: opacity 0.1s;
    transform: translate(-50%, calc(-100% - 10px));
    letter-spacing: 0.02em;
}
.hebra-map-tooltip.visible { opacity: 1; }

/* ── Y-axis ───────────────────────────────────────────────────────── */
.hebra-axis-y {
    position: absolute;
    left: 0;
    top: 0;
    width: 22px;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}
.hebra-axis-y-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #b8a88a;
    border-radius: 2px;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    flex-shrink: 0;
}
.hebra-axis-y-label.active {
    background: #c9a84c;
    color: #fff;
    transform: scale(1.1);
}

/* ── X-axis ───────────────────────────────────────────────────────── */
.hebra-axis-x {
    position: absolute;
    bottom: 0;
    height: 18px;
    display: flex;
    pointer-events: none;
}
.hebra-axis-x-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #b8a88a;
    border-radius: 2px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.hebra-axis-x-label.active {
    background: #c9a84c;
    color: #fff;
}

/* ── Selected ref pill ────────────────────────────────────────────── */
.hebra-map-selected {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fdf6e3;
    border-top: 1px solid #e8d898;
    font-size: 12px;
    color: #7a6020;
    font-weight: 600;
    animation: ref-slide-in 0.2s ease both;
}
@keyframes ref-slide-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.hebra-map-selected.visible { display: flex; }
.hebra-map-selected-ref {
    font-size: 15px;
    font-weight: 700;
    color: #c9a84c;
    background: #fff;
    border: 1.5px solid #e0c97a;
    border-radius: 6px;
    padding: 1px 8px;
}

@media (max-width: 640px) {
    .hebra-map-outer { padding-left: 18px; padding-bottom: 16px; }
    .hebra-axis-y { width: 16px; }
    .hebra-axis-y-label { font-size: 8px; }
    .hebra-axis-x-label { font-size: 7px; }
    .hebra-map-header { padding: 10px 14px; }
    .hebra-map-title { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .hebra-map-wrap, .hebra-map-selected { animation: none !important; }
    .hebra-axis-y-label, .hebra-cell { transition: none !important; }
}
