@keyframes sp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- travelmap UI Styles --- */
/* Extracted from travelmap.html and adapted to match site styles */

html,
body,
#map-container-travelmap {
    /* Scope to prevent conflicts if needed, but the original was global */
    height: 100%;
    margin: 0;
    text-transform: none;
}

#map {
    position: absolute;
    inset: 0;
}

/* Use the same site font for map UI so it matches the rest of the site */
body,
.panel,
.home-btn,
.attribution,
.panel h3,
.row,
label {
    font-family: "bahnschrift", sans-serif;
}

/* Custom crowbar cursor for interactive map controls */
.home-btn,
[role="button"],
.panel h3 .section-title,
.panel h3 .toggle-icon,
.group-checkbox-label,
.row label {
    cursor: url("../assets/icons/crowbar.cur"), pointer;
}

/* Base home button - theme-aware overrides later */
.home-btn {
    position: absolute;
    top: 12px;
    left: 60px;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.4;
    text-decoration: none;
    background-color: rgba(255, 255, 255, 0.92);
    color: #111;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.home-btn:hover {
    filter: brightness(0.98);
}

/* Panel base - defaults to light look; theme overrides below */
.panel {
    position: absolute;
    top: 12px;
    right: 12px;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    line-height: 1.4;
    background-color: rgba(255, 255, 255, 0.9);
    color: #111;
    border: 1px solid rgba(0, 0, 0, 0.08);
    max-height: calc(100vh - 24px);
    overflow-y: auto;
}

.panel h3 {
    margin: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    padding: 4px 0;
    gap: 6px;
}

.panel h3 .section-title,
.panel h3 .toggle-icon {
    cursor: pointer;
}

.panel h3 .section-title:hover,
.panel h3 .toggle-icon:hover {
    opacity: 0.8;
}

.group-checkbox-label {
    display: inline-flex;
    align-items: center;
    cursor: default;
}

.panel h3 .section-title {
    flex-grow: 1;
}

.section {
    margin-bottom: 12px;
}

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

.collapsible-content {
    display: block;
    margin-top: 6px;
}

.collapsible-content.collapsed {
    display: none;
}

.toggle-icon {
    font-size: 10px;
    transition: transform 0.2s;
}

.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.legend-icon {
    width: 16px;
    height: 16px;
    font-size: 14px;
    text-align: center;
    line-height: 16px;
    flex-shrink: 0;
}

.attribution {
    position: absolute;
    left: 12px;
    bottom: 12px;
    background: rgba(255, 255, 255, .9);
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 12px;
}

/* --- New Sights Marker Styles --- */

.sight-marker {
    /* Wrapper positioned by Mapbox. Size provides center hit area. */
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    /* overflow: visible; important */
    z-index: 10;
}

.sight-icon {
    width: 20px;
    height: 20px;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    /* No absolute needed if flex centered */
    /* Optional: Add a subtle text shadow or filter to make emoji pop */
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    user-select: none;
}

.sight-marker:hover {
    z-index: 20;
    /* Bring hovered marker to front */
}

.sight-icon:hover {
    transform: scale(1.3);
    /* Slight zoom on direct hover (multiplies with translate if applied) */
}

/* When active/spread, we might set styles directly via JS, 
   but hover zoom should still work. 
   Note: JS will set transform: translate(...). 
   CSS hover scale needs to compose or we handle scale in JS too. 
   Actually, combining CSS hover transform with JS inline transform is tricky.
   Easier: Put the hover scale in a wrapper OR just accept JS handles transform.
*/

.sight-line {
    position: absolute;
    top: 0;
    left: 0;
    /* Thick invisible hit area */
    height: 12px;
    background-color: transparent;
    transform-origin: 0 50%;
    pointer-events: auto;
    /* Enable hover */
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    display: flex;
    align-items: center;
}

/* The visible line */
.sight-line::after {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background-color: rgba(0, 0, 0, 0.5);
    /* Semi-transparent black line */
}

[data-theme="dark"] .sight-line::after {
    background-color: rgba(255, 255, 255, 0.5);
    /* White line for dark mode */
}


/* Theme-aware styles */
[data-theme="dark"] .panel {
    background-color: rgba(28, 27, 31, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #fff;
}

[data-theme="light"] .panel {
    background-color: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

:root {
    /* Colors & Theming (Matched to index.css) */
    --md-sys-color-surface: #FFFFFF;
    --md-sys-color-on-surface: #1C1B1F;
    --md-sys-color-on-surface-variant: #49454F;
    --md-sys-color-primary: #6750A4;

    /* Glassmorphism Variables */
    --card-bg: rgba(255, 255, 255, 0.85);
    /* Slightly more opaque for map readability */
    --card-border: rgba(255, 255, 255, 0.5);
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --card-hover-shadow: 0 10px 15px rgba(0, 0, 0, 0.15);

    --bg-color: #f0f0f0;
    --text-color: #333;
    --panel-bg: rgba(255, 255, 255, 0.9);
    --panel-border: #ccc;
}

[data-theme="dark"] {
    --md-sys-color-surface: #1C1B1F;
    --md-sys-color-on-surface: #E6E1E5;
    --md-sys-color-on-surface-variant: #CAC4D0;
    --md-sys-color-primary: #D0BCFF;

    --card-bg: rgba(28, 27, 31, 0.85);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    --card-hover-shadow: 0 10px 15px rgba(0, 0, 0, 0.6);

    --bg-color: #1a1a1a;
    --text-color: #ddd;
    --panel-bg: rgba(30, 30, 30, 0.9);
    --panel-border: #444;
}

/* --- Popup & Tooltip Styles --- */

/* Translucent Pill Popup */
.translucent-popup .mapboxgl-popup-content {
    background-color: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    color: var(--md-sys-color-on-surface);
    font-family: "bahnschrift", sans-serif;
    padding: 12px 20px;
    font-size: 0.9rem;
}

.translucent-popup .mapboxgl-popup-tip {
    /* Hard to make glass tip, usually better to hide or color match */
    border-top-color: var(--card-bg);
    /* Approximate */
    opacity: 0.9;
}

.translucent-popup .mapboxgl-popup-close-button {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 16px;
    right: 8px;
    top: 6px;
}

.translucent-popup .mapboxgl-popup-close-button:hover {
    background: transparent;
    color: var(--md-sys-color-primary);
}

/* Hover Tooltip (Pill) */
.map-tooltip {
    position: absolute;
    pointer-events: none;
    /* Let clicks pass through */
    background-color: var(--card-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    /* Pill shape */
    box-shadow: var(--card-shadow);
    color: var(--md-sys-color-on-surface);
    font-family: "bahnschrift", sans-serif;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    transform: translate(-50%, -150%) scale(0.9);
    /* Center above cursor/icon */
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.map-tooltip.visible {
    opacity: 1;
    transform: translate(-50%, -150%) scale(1);
}

[data-theme="dark"] .home-btn {
    background-color: rgba(28, 27, 31, 0.7);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .home-btn {
    background-color: rgba(255, 255, 255, 0.92);
    color: #111;
    border: 1px solid rgba(0, 0, 0, 0.08);
}