/* ═══════════════════════════════════════════════════════════════════════════
   GRAAF OBSTACLE RUN - RUGGED TRAIL MAP
   Aesthetic: Adventure cartography meets athletic performance
   Typography: Bebas Neue (display) + Nunito Sans (body)
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Nunito+Sans:ital,wght@0,400;0,600;0,700;0,800;1,400&display=swap');

/* ─────────────────────────────────────────────────────────────────────────────
   CSS Custom Properties
   ───────────────────────────────────────────────────────────────────────────── */
:root {
    /* Primary - Deep Forest */
    --gor-forest: #1B4332;
    --gor-forest-light: #2D6A4F;
    --gor-forest-dark: #0F2A1D;
    --gor-forest-glow: rgba(27, 67, 50, 0.5);

    /* Secondary - Earth tones */
    --gor-earth: #8B7355;
    --gor-earth-light: #A08060;
    --gor-sand: #D4C4A8;
    --gor-sand-light: #F5F0E6;

    /* Accent - Danger/Obstacle Orange */
    --gor-danger: #E85D04;
    --gor-danger-light: #F48C06;
    --gor-danger-glow: rgba(232, 93, 4, 0.4);

    /* POI - Medical/Safety Blue-Green */
    --gor-safety: #0096C7;
    --gor-safety-light: #48CAE4;
    --gor-safety-glow: rgba(0, 150, 199, 0.4);

    /* Routes */
    --gor-route-primary: #E85D04;
    --gor-route-secondary: #2D6A4F;
    --gor-route-tertiary: #9D4EDD;

    /* Neutrals */
    --gor-bg: #FAF8F5;
    --gor-bg-card: #FFFFFF;
    --gor-bg-dark: #1A1A18;
    --gor-border: rgba(27, 67, 50, 0.15);
    --gor-border-strong: rgba(27, 67, 50, 0.3);

    /* Text */
    --gor-text: #1A1A18;
    --gor-text-muted: #5C5C58;
    --gor-text-light: #8A8A85;
    --gor-text-inverse: #FAF8F5;

    /* Typography */
    --font-display: 'Bebas Neue', Impact, sans-serif;
    --font-body: 'Nunito Sans', -apple-system, sans-serif;

    /* Spacing */
    --space-2xs: 4px;
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(26, 26, 24, 0.08);
    --shadow-md: 0 4px 20px rgba(26, 26, 24, 0.12);
    --shadow-lg: 0 8px 40px rgba(26, 26, 24, 0.16);
    --shadow-inset: inset 0 2px 4px rgba(26, 26, 24, 0.06);

    /* Topographic pattern - SVG encoded */
    --topo-pattern: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5c13.8 0 25 11.2 25 25S43.8 55 30 55 5 43.8 5 30 16.2 5 30 5zm0 8c-9.4 0-17 7.6-17 17s7.6 17 17 17 17-7.6 17-17-7.6-17-17-17zm0 8c5 0 9 4 9 9s-4 9-9 9-9-4-9-9 4-9 9-9z' fill='none' stroke='%231B4332' stroke-opacity='0.06' stroke-width='0.5'/%3E%3C/svg%3E");
}

/* ─────────────────────────────────────────────────────────────────────────────
   Map Container - Rugged Frame
   ───────────────────────────────────────────────────────────────────────────── */
.gor-map-wrapper {
    --map-height: var(--gor-map-height, 600px);
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    font-family: var(--font-body);
}

.gor-map {
    position: relative;
    width: 100%;
    height: var(--gor-map-height, 600px);
    min-height: 350px;
    background: var(--gor-bg-card);
    container-type: inline-size;
    z-index: 0;

    /* The rugged frame */
    border: 6px solid var(--gor-forest);
    border-radius: var(--radius-lg);
    box-shadow:
        var(--shadow-lg),
        inset 0 0 0 2px var(--gor-sand),
        0 0 0 1px var(--gor-forest-dark);
    overflow: hidden;
}

/* Topographic texture overlay */
.gor-map::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--topo-pattern);
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}

/* Corner markers - like survey pins */
.gor-map::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 2px dashed var(--gor-border);
    border-radius: var(--radius-md);
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gor-map:hover::after {
    opacity: 1;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Header Bar - Route Info Strip
   ───────────────────────────────────────────────────────────────────────────── */
.gor-map-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    display: flex;
    align-items: stretch;
    background: linear-gradient(180deg,
        var(--gor-forest) 0%,
        var(--gor-forest-dark) 100%);
    border-bottom: 3px solid var(--gor-danger);
    min-height: 52px;
    pointer-events: auto;
}

.gor-map-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--topo-pattern);
    opacity: 0.1;
    pointer-events: none;
}

/* Logo/Title area */
.gor-map-brand {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    position: relative;
    background: var(--gor-danger);
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 100%, 0 100%);
    padding-right: var(--space-xl);
}

.gor-map-brand svg {
    width: 28px;
    height: 28px;
    fill: var(--gor-text-inverse);
    flex-shrink: 0;
}

.gor-map-brand span {
    font-family: var(--font-display);
    font-size: 22px;
    letter-spacing: 0.05em;
    color: var(--gor-text-inverse);
    text-transform: uppercase;
    white-space: nowrap;
}

/* Stats display */
.gor-map-stats {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: 0 var(--space-lg);
    margin-left: auto;
    position: relative;
}

.gor-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.gor-stat-value {
    font-family: var(--font-display);
    font-size: 24px;
    letter-spacing: 0.02em;
    color: var(--gor-text-inverse);
    line-height: 1;
}

.gor-stat-label {
    font-family: var(--font-body);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gor-sand);
    opacity: 0.8;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Control Buttons - Trail Markers Style
   ───────────────────────────────────────────────────────────────────────────── */
.gor-controls {
    position: absolute;
    top: 64px;
    left: var(--space-sm);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.gor-control-btn {
    width: 48px;
    height: 48px;
    background: var(--gor-bg-card);
    border: 3px solid var(--gor-forest);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: var(--shadow-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.gor-control-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gor-danger);
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.gor-control-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gor-danger);
}

.gor-control-btn:hover::before {
    transform: scaleX(1);
}

.gor-control-btn:active {
    transform: translateY(0);
}

.gor-control-btn svg {
    width: 22px;
    height: 22px;
    fill: var(--gor-forest);
    transition: fill 0.2s ease;
}

.gor-control-btn:hover svg {
    fill: var(--gor-danger);
}

/* Fullscreen button */
.gor-fullscreen-btn {
    composes: gor-control-btn;
}

/* Location button states */
.gor-location-btn {
    composes: gor-control-btn;
}

.gor-location-btn.active {
    background: var(--gor-safety);
    border-color: var(--gor-safety);
}

.gor-location-btn.active svg {
    fill: white;
}

.gor-location-btn.active::before {
    background: white;
    transform: scaleX(1);
}

.gor-location-btn.requesting svg {
    animation: gor-pulse 1.2s ease-in-out infinite;
}

@keyframes gor-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.9); }
}

.gor-location-btn.error {
    border-color: #dc2626;
    animation: gor-shake 0.4s ease;
}

.gor-location-btn.error svg {
    fill: #dc2626;
}

@keyframes gor-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Location marker on map */
.gor-location-dot {
    animation: gor-location-pulse 2s ease-in-out infinite;
}

@keyframes gor-location-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Legend Panel - Trail Guide Style
   ───────────────────────────────────────────────────────────────────────────── */
.gor-legend {
    position: absolute;
    top: 64px;
    right: var(--space-sm);
    z-index: 1002;
    width: 280px;
    background: var(--gor-bg-card);
    border: 3px solid var(--gor-forest);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.gor-legend.collapsed {
    width: auto;
}

/* Legend header with diagonal stripe */
.gor-legend-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg,
        var(--gor-forest) 0%,
        var(--gor-forest-light) 100%);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.gor-legend-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 100%;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 4px,
        var(--gor-danger) 4px,
        var(--gor-danger) 8px
    );
    opacity: 0.3;
}

.gor-legend-toggle svg {
    width: 18px;
    height: 18px;
    fill: var(--gor-text-inverse);
    flex-shrink: 0;
    transition: transform 0.3s ease;
    position: relative;
}

.gor-legend.collapsed .gor-legend-toggle svg {
    transform: rotate(-90deg);
}

.gor-legend-toggle span {
    font-family: var(--font-display);
    font-size: 18px;
    letter-spacing: 0.08em;
    color: var(--gor-text-inverse);
    text-transform: uppercase;
    position: relative;
}

/* Legend body */
.gor-legend-body {
    max-height: 50vh;
    overflow-y: auto;
    padding: var(--space-sm);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    scrollbar-width: thin;
    scrollbar-color: var(--gor-forest) var(--gor-sand-light);
}

.gor-legend-body::-webkit-scrollbar {
    width: 6px;
}

.gor-legend-body::-webkit-scrollbar-track {
    background: var(--gor-sand-light);
}

.gor-legend-body::-webkit-scrollbar-thumb {
    background: var(--gor-forest);
    border-radius: 3px;
}

.gor-legend.collapsed .gor-legend-body {
    max-height: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
}

/* Legend sections */
.gor-legend-section {
    margin-bottom: var(--space-md);
}

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

.gor-legend-section h4 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-sm) 0;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-display);
    font-size: 14px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gor-forest);
    background: var(--gor-sand-light);
    border-left: 4px solid var(--gor-danger);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Legend items */
.gor-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    margin: 2px 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--gor-text);
    transition: all 0.15s ease;
    border: 2px solid transparent;
}

.gor-legend-item:hover {
    background: var(--gor-sand-light);
    border-color: var(--gor-border-strong);
    transform: translateX(4px);
}

.gor-legend-item:active {
    transform: translateX(2px);
}

.gor-legend-item small {
    margin-left: auto;
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--gor-danger);
    letter-spacing: 0.02em;
}

/* Color swatch */
.gor-legend-color {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    box-shadow:
        inset 0 -2px 0 rgba(0, 0, 0, 0.15),
        0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Category headers */
.gor-legend-cat {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gor-safety);
    padding: var(--space-xs) var(--space-md);
    margin-top: var(--space-sm);
    background: linear-gradient(90deg,
        rgba(0, 150, 199, 0.1) 0%,
        transparent 100%);
    border-left: 3px solid var(--gor-safety);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Custom Marker Icons - Trail Markers
   ───────────────────────────────────────────────────────────────────────────── */
.gor-marker-icon {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    transition: all 0.2s ease;
}

.gor-marker-icon:hover {
    transform: scale(1.15) translateY(-4px);
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.35));
}

/* Obstacle marker - Warning style */
.gor-marker-obstacle {
    filter: drop-shadow(0 4px 8px var(--gor-danger-glow));
}

.gor-marker-obstacle:hover {
    filter: drop-shadow(0 6px 16px var(--gor-danger-glow));
}

/* POI marker - Info style */
.gor-marker-poi {
    filter: drop-shadow(0 4px 8px var(--gor-safety-glow));
}

.gor-marker-poi:hover {
    filter: drop-shadow(0 6px 16px var(--gor-safety-glow));
}

/* Custom icon images */
.gor-custom-icon img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
}

.gor-custom-icon:hover img {
    transform: scale(1.2);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Popup Styling - Info Card
   ───────────────────────────────────────────────────────────────────────────── */
.gor-map .leaflet-popup-content-wrapper {
    background: var(--gor-bg-card);
    border: 3px solid var(--gor-forest);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0;
    overflow: hidden;
}

.gor-map .leaflet-popup-tip-container {
    margin-top: -2px;
}

.gor-map .leaflet-popup-tip {
    background: var(--gor-bg-card);
    border: 3px solid var(--gor-forest);
    border-top: none;
    border-left: none;
    box-shadow: none;
}

.gor-map .leaflet-popup-content {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--gor-text);
    margin: 0;
    padding: 0;
    min-width: 220px;
    max-width: 300px;
}

/* Popup header with colored bar */
.gor-map .leaflet-popup-content h3 {
    margin: 0;
    padding: var(--space-md);
    font-family: var(--font-display);
    font-size: 22px;
    letter-spacing: 0.03em;
    color: var(--gor-text-inverse);
    background: linear-gradient(135deg,
        var(--gor-forest) 0%,
        var(--gor-forest-light) 100%);
    position: relative;
}

/* Orange stripe for obstacles */
.gor-map .leaflet-popup-content h3[data-type="obstacle"] {
    background: linear-gradient(135deg,
        var(--gor-danger) 0%,
        var(--gor-danger-light) 100%);
}

/* Blue stripe for POIs */
.gor-map .leaflet-popup-content h3[data-type="poi"] {
    background: linear-gradient(135deg,
        var(--gor-safety) 0%,
        var(--gor-safety-light) 100%);
}

.gor-map .leaflet-popup-content p {
    margin: 0;
    padding: var(--space-sm) var(--space-md);
    color: var(--gor-text-muted);
}

.gor-map .leaflet-popup-content p:first-of-type {
    padding-top: var(--space-md);
}

.gor-map .leaflet-popup-content p:last-of-type {
    padding-bottom: var(--space-md);
}

.gor-map .leaflet-popup-content strong {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--gor-danger);
    letter-spacing: 0.02em;
}

.gor-map .leaflet-popup-content em {
    font-style: normal;
    font-weight: 700;
    color: var(--gor-safety);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Popup close button */
.gor-map .leaflet-popup-close-button {
    color: var(--gor-text-inverse) !important;
    font-size: 24px;
    font-weight: 300;
    padding: 8px 12px !important;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.gor-map .leaflet-popup-close-button:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Popup images */
.gor-popup-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: var(--space-xs);
    padding: var(--space-md);
    background: var(--gor-sand-light);
    border-top: 2px dashed var(--gor-border);
}

.gor-popup-images img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--gor-border-strong);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gor-popup-images img:hover {
    transform: scale(1.08);
    border-color: var(--gor-danger);
    box-shadow: var(--shadow-md);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Leaflet Control Overrides
   ───────────────────────────────────────────────────────────────────────────── */
.gor-map .leaflet-control-zoom {
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.gor-map .leaflet-control-zoom a {
    width: 48px !important;
    height: 48px !important;
    line-height: 44px !important;
    font-size: 22px !important;
    font-weight: 400 !important;
    background: var(--gor-bg-card) !important;
    border: 3px solid var(--gor-forest) !important;
    border-radius: var(--radius-md) !important;
    color: var(--gor-forest) !important;
    box-shadow: var(--shadow-md) !important;
    transition: all 0.2s ease !important;
    margin-bottom: var(--space-xs) !important;
}

.gor-map .leaflet-control-zoom a:hover {
    background: var(--gor-sand-light) !important;
    border-color: var(--gor-danger) !important;
    color: var(--gor-danger) !important;
    transform: translateY(-2px);
}

.gor-map .leaflet-control-layers {
    display: none; /* Use custom legend instead */
}

/* Attribution */
.gor-map .leaflet-control-attribution {
    background: rgba(250, 248, 245, 0.95) !important;
    color: var(--gor-text-muted) !important;
    font-family: var(--font-body);
    font-size: 10px;
    padding: 4px 12px;
    border-radius: var(--radius-sm) 0 0 0;
    border-top: 2px solid var(--gor-border);
    border-left: 2px solid var(--gor-border);
}

.gor-map .leaflet-control-attribution a {
    color: var(--gor-forest) !important;
    font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Fullscreen Mode
   ───────────────────────────────────────────────────────────────────────────── */
.gor-map.gor-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    z-index: 999999 !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
}

.gor-map.gor-fullscreen::after {
    display: none;
}

body.gor-body-fullscreen {
    overflow: hidden !important;
}

/* Safe areas for notched phones */
.gor-map.gor-fullscreen {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.gor-map.gor-fullscreen .gor-map-header {
    padding-top: env(safe-area-inset-top);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Loading State
   ───────────────────────────────────────────────────────────────────────────── */
.gor-map.loading {
    pointer-events: none;
}

.gor-map.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    border: 4px solid var(--gor-sand);
    border-top-color: var(--gor-danger);
    border-radius: 50%;
    animation: gor-spin 0.8s linear infinite;
    z-index: 2000;
}

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

/* ─────────────────────────────────────────────────────────────────────────────
   Empty State
   ───────────────────────────────────────────────────────────────────────────── */
.gor-empty-state {
    position: absolute;
    inset: 60px 0 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-xl);
    background: var(--gor-sand-light);
    z-index: 500;
}

.gor-empty-state svg {
    width: 80px;
    height: 80px;
    fill: var(--gor-border-strong);
    margin-bottom: var(--space-lg);
}

.gor-empty-state h3 {
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--gor-forest);
    margin: 0 0 var(--space-sm);
    letter-spacing: 0.03em;
}

.gor-empty-state p {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--gor-text-muted);
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Tablet (1024px and below) ─── */
@media (max-width: 1024px) {
    .gor-map {
        border-width: 5px;
    }

    .gor-legend {
        width: 260px;
    }

    .gor-map-brand span {
        font-size: 18px;
    }

    .gor-stat-value {
        font-size: 20px;
    }
}

/* ─── Tablet Portrait / Large phones (768px and below) ─── */
@media (max-width: 768px) {
    .gor-map {
        height: min(var(--gor-map-height, 600px), 60vh);
        min-height: 320px;
        border-width: 4px;
        border-radius: var(--radius-md);
    }

    .gor-map::after {
        display: none;
    }

    /* Compact header */
    .gor-map-header {
        min-height: 48px;
    }

    .gor-map-brand {
        padding: var(--space-xs) var(--space-sm);
        padding-right: var(--space-lg);
    }

    .gor-map-brand svg {
        width: 24px;
        height: 24px;
    }

    .gor-map-brand span {
        font-size: 16px;
    }

    .gor-map-stats {
        gap: var(--space-md);
        padding: 0 var(--space-md);
    }

    .gor-stat-value {
        font-size: 18px;
    }

    .gor-stat-label {
        font-size: 8px;
    }

    /* Controls */
    .gor-controls {
        top: 58px;
    }

    .gor-control-btn,
    .gor-map .leaflet-control-zoom a {
        width: 44px !important;
        height: 44px !important;
        line-height: 40px !important;
    }

    .gor-control-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Legend */
    .gor-legend {
        top: 58px;
        width: 240px;
    }

    .gor-legend.collapsed {
        width: auto;
    }

    .gor-legend-toggle span {
        font-size: 16px;
    }

    .gor-legend-body {
        max-height: 40vh;
    }

    /* Popups */
    .gor-map .leaflet-popup-content {
        min-width: 180px;
        max-width: 260px;
    }

    .gor-map .leaflet-popup-content h3 {
        font-size: 20px;
        padding: var(--space-sm) var(--space-md);
    }
}

/* ─── Mobile (480px and below) ─── */
@media (max-width: 480px) {
    .gor-map {
        height: min(var(--gor-map-height, 600px), 55vh);
        min-height: 280px;
        border-width: 3px;
        border-radius: var(--radius-sm);

        /* Full bleed on mobile */
        margin-left: -16px;
        margin-right: -16px;
        width: calc(100% + 32px);
        border-left: none;
        border-right: none;
        border-radius: 0;
    }

    /* Super compact header */
    .gor-map-header {
        min-height: 44px;
        border-bottom-width: 2px;
    }

    .gor-map-brand {
        clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 100%, 0 100%);
        padding-right: var(--space-md);
    }

    .gor-map-brand svg {
        width: 20px;
        height: 20px;
    }

    .gor-map-brand span {
        font-size: 14px;
        letter-spacing: 0.03em;
    }

    .gor-map-stats {
        gap: var(--space-sm);
        padding: 0 var(--space-sm);
    }

    .gor-stat-value {
        font-size: 16px;
    }

    .gor-stat-label {
        font-size: 7px;
        letter-spacing: 0.05em;
    }

    /* Controls - smaller */
    .gor-controls {
        top: 52px;
        left: var(--space-xs);
    }

    .gor-control-btn,
    .gor-map .leaflet-control-zoom a {
        width: 40px !important;
        height: 40px !important;
        line-height: 36px !important;
        font-size: 18px !important;
        border-width: 2px !important;
    }

    .gor-control-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Legend - full width overlay */
    .gor-legend {
        top: auto;
        bottom: var(--space-sm);
        right: var(--space-xs);
        left: var(--space-xs);
        width: auto;
        border-width: 2px;
        max-width: none;
    }

    .gor-legend.collapsed {
        left: auto;
        width: auto;
    }

    .gor-legend-toggle {
        padding: var(--space-xs) var(--space-sm);
    }

    .gor-legend-toggle span {
        font-size: 14px;
    }

    .gor-legend-body {
        max-height: 30vh;
    }

    .gor-legend-item {
        padding: var(--space-xs) var(--space-sm);
        font-size: 12px;
    }

    .gor-legend-section h4 {
        font-size: 12px;
        padding: var(--space-2xs) var(--space-xs);
    }

    /* Popups - fit screen */
    .gor-map .leaflet-popup-content-wrapper {
        border-width: 2px;
        border-radius: var(--radius-md);
    }

    .gor-map .leaflet-popup-content {
        min-width: 160px;
        max-width: 220px;
        font-size: 13px;
    }

    .gor-map .leaflet-popup-content h3 {
        font-size: 18px;
        padding: var(--space-sm);
    }

    .gor-map .leaflet-popup-content p {
        padding: var(--space-xs) var(--space-sm);
    }

    .gor-popup-images {
        grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
        gap: 4px;
        padding: var(--space-sm);
    }

    /* Attribution - minimal */
    .gor-map .leaflet-control-attribution {
        font-size: 9px;
        padding: 2px 8px;
        max-width: 45%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ─── Very small phones (360px and below) ─── */
@media (max-width: 360px) {
    .gor-map {
        height: min(var(--gor-map-height, 600px), 50vh);
        min-height: 260px;
    }

    .gor-map-brand span {
        display: none;
    }

    .gor-stat:nth-child(n+3) {
        display: none;
    }

    .gor-map .leaflet-popup-content {
        max-width: 180px;
    }
}

/* ─── Landscape phones ─── */
@media (max-height: 500px) and (orientation: landscape) {
    .gor-map {
        height: min(var(--gor-map-height, 600px), 85vh);
        min-height: 200px;
    }

    .gor-map-header {
        min-height: 40px;
    }

    .gor-legend {
        top: 48px;
        max-height: calc(100% - 56px);
    }

    .gor-legend-body {
        max-height: 35vh;
    }

    .gor-controls {
        top: 48px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOUCH DEVICE ENHANCEMENTS
   ═══════════════════════════════════════════════════════════════════════════ */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets */
    .gor-control-btn,
    .gor-map .leaflet-control-zoom a {
        min-width: 48px !important;
        min-height: 48px !important;
    }

    .gor-legend-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .gor-legend-toggle {
        min-height: 48px;
    }

    /* Disable hover transforms on touch */
    .gor-control-btn:hover,
    .gor-map .leaflet-control-zoom a:hover {
        transform: none;
    }

    .gor-marker-icon:hover,
    .gor-custom-icon:hover img {
        transform: none;
    }

    .gor-legend-item:hover {
        transform: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════════════════ */

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --gor-border: rgba(27, 67, 50, 0.4);
        --gor-border-strong: rgba(27, 67, 50, 0.6);
    }

    .gor-map {
        border-width: 6px;
    }

    .gor-control-btn:focus,
    .gor-legend-toggle:focus,
    .gor-legend-item:focus {
        outline: 4px solid var(--gor-danger);
        outline-offset: 2px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard nav */
.gor-control-btn:focus-visible,
.gor-legend-toggle:focus-visible,
.gor-legend-item:focus-visible,
.gor-map .leaflet-control-zoom a:focus-visible {
    outline: 3px solid var(--gor-danger);
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ROUTE LINE ANIMATION
   ═══════════════════════════════════════════════════════════════════════════ */
.gor-route-animated {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: gor-draw-route 2s ease forwards;
}

@keyframes gor-draw-route {
    to {
        stroke-dashoffset: 0;
    }
}

/* Route line glow effect */
.gor-map .leaflet-interactive {
    filter: drop-shadow(0 0 2px currentColor);
}

.gor-map .leaflet-interactive:hover {
    filter: drop-shadow(0 0 6px currentColor);
}
