/* Define custom fonts and apply base styles */
* {
    -webkit-tap-highlight-color: transparent !important;
}

a,
button {
    -webkit-tap-highlight-color: transparent !important;
}

a:focus,
button:focus {
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
}

/* Prevent tap highlight on map and location cards */
#map,
#map-container,
.location-card,
#locations-panel,
#drawer-content,
#places-list,
#places-list-desktop {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

.location-card * {
    -webkit-tap-highlight-color: transparent !important;
}

/* Prevent blue selection state on all map-related elements */
#map *,
#map-container *,
.gm-style *,
.gm-style-iw *,
.gm-style-iw-c *,
.gm-style-iw-d * {
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
}

/* Specifically prevent focus outline on map overlay */
.gm-style,
.gm-style>div,
.gm-style-iw-c,
.gm-style-iw-d,
.gm-style-iw-t {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Prevent any focus rings on the entire map container */
#map-container,
#map-container * {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

body {
    /* UPDATED: Removed font-family: 'Roboto' */
    color: #2D4739;
    /* Body text updated to Deep Forest */
    background-color: #FFFFF0;
    /* Primary Ivory */
    background-image: url('data:image/svg+xml;utf8,<svg width="6" height="6" viewBox="0 0 6 6" xmlns="http://www.w3.org/2000/svg"><g fill="%238F9779" fill-opacity="0.05" fill-rule="evenodd"><path d="M5 0h1L0 6V5zM6 5v1H5z"/></g></svg>');
    /* Dot pattern */
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    /* Offset for fixed navbar */
}

/* UPDATED: Changed font to Libre Baskerville */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Libre Baskerville', serif;
}

.section-header {
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="20" xmlns="http://www.w3.org/2000/svg"><path d="M0 10 C 20 0, 80 0, 100 10 L 100 10 L 0 10 Z" fill="%235C7457"/></svg>');
    /* Underline updated to Moss Green */
    background-repeat: no-repeat;
    background-position: center bottom;
    padding-bottom: 20px;
    background-size: 0 15px;
    /* Initially hidden for animation */
    transition: background-size 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    font-variant: small-caps;
}

.section-header.is-visible {
    background-size: 150px 15px;
    /* Animate to full size */
}

details>summary {
    list-style: none;
}

details>summary::-webkit-details-marker {
    display: none;
}

.font-small-caps {
    font-variant: small-caps;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-15px);
    }

    60% {
        transform: translateY(-5px);
    }
}

.scroll-arrow {
    animation: bounce 2s infinite;
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 1.2s ease-in-out;
}

#game-canvas {
    background-color: #FFFFF0;
    border-bottom: 2px solid #8F9779;
    /* Updated to Sage */
}

/* --- ✨ SUBTLE SCROLL ANIMATIONS --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(10px);
    /* Made more subtle */
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    transition-delay: 0.1s;
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- ✨ TOOLTIP LOGIC --- */
.tooltip {
    opacity: 0;
    transform: scale(0.9) translateY(4px);
    /* Start slightly down and small */
    pointer-events: none;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
    transform-origin: bottom center;
}

.tooltip.is-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* --- ✨ THIS ENTIRE BLOCK IS THE FIX ✨ --- */
/* More robust styling for Google Material Symbols */
.material-symbols-outlined {
    font-weight: 300;
    /* Corresponds to wght@300 */
    font-style: normal;
    font-size: 24px;
    /* Corresponds to opsz@24 */
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    /* Support for all WebKit browsers. */
    -webkit-font-smoothing: antialiased;
    /* Support for Safari and Chrome. */
    text-rendering: optimizeLegibility;
    /* Support for Firefox. */
    -moz-osx-font-smoothing: grayscale;
    /* Support for IE. */
    font-feature-settings: 'liga';
}

/* --- Page transition effect --- */
body {
    transition: opacity 0.4s ease-in-out;
}

body.is-leaving {
    opacity: 0;
}

/* --- COMPREHENSIVE FIX: Prevent all zoom/parallax/scale effects on header image --- */
header {
    position: relative !important;
    transform: none !important;
    -webkit-transform: none !important;
    will-change: auto !important;
    overflow: hidden !important;
    /* Prevent any viewport-related resizing */
    contain: layout !important;
}

header img {
    /* Lock position and size */
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;

    /* Completely disable all transforms */
    transform: none !important;
    -webkit-transform: none !important;
    -ms-transform: none !important;
    -moz-transform: none !important;

    /* Lock scale at 1 */
    transform: scale(1) !important;
    -webkit-transform: scale(1) !important;

    /* Disable hardware acceleration that could cause unwanted effects */
    transform: translate3d(0, 0, 0) scale(1) !important;
    -webkit-transform: translate3d(0, 0, 0) scale(1) !important;

    /* Prevent any GPU-accelerated transforms */
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    will-change: auto !important;
    perspective: none !important;
    -webkit-perspective: none !important;

    /* Disable any transition or animation */
    transition: none !important;
    animation: none !important;

    /* Lock object-fit to prevent responsive scaling */
    object-fit: cover !important;

    /* Prevent touch-based zoom */
    touch-action: none !important;
    -ms-touch-action: none !important;

    /* Additional vendor prefixes for older browsers */
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* iOS-specific fixes - completely lock down transforms */
@supports (-webkit-touch-callout: none) {
    header img {
        transform: translate3d(0, 0, 0) scale(1) !important;
        -webkit-transform: translate3d(0, 0, 0) scale(1) !important;
        /* Prevent elastic scrolling effects */
        -webkit-overflow-scrolling: auto !important;
    }

    header {
        /* Prevent iOS viewport resizing effects */
        -webkit-overflow-scrolling: auto !important;
    }
}

/* Mobile-specific: Lock dimensions and prevent viewport-based scaling */
@media (max-width: 640px) {
    header {
        /* Use fixed viewport height to prevent address bar resize effects */
        height: calc(100vh - 80px) !important;
        min-height: 600px !important;
    }

    header img {
        object-fit: cover !important;
        /* Lock to exact container size */
        min-height: 100% !important;
        max-height: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        /* Completely disable transforms */
        transform: none !important;
        -webkit-transform: none !important;
    }
}

.custom-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #FFFFF0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #FFFFF0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-marker:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
}


#locations-panel {
    box-shadow: 0 -15px 35px -5px rgba(45, 71, 57, 0.15), 0 -10px 15px -5px rgba(45, 71, 57, 0.08);
    /* height and transition are now controlled by JavaScript */
    /* Ensure proper rendering on all devices */
    transform: translateZ(0);
    backface-visibility: hidden;
}

#drawer-header {
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

#drawer-header .w-12 {
    transition: background-color 0.3s ease, width 0.3s ease;
}

#drawer-header:active .w-12 {
    background-color: #8F9779;
    width: 3.5rem;
}

#drawer-content {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overflow-x: hidden;
    /* Ensure content always renders properly */
    will-change: scroll-position;
    contain: layout;
}

#drawer-content::-webkit-scrollbar {
    width: 4px;
}

#drawer-content::-webkit-scrollbar-track {
    background: transparent;
}

#drawer-content::-webkit-scrollbar-thumb {
    background: rgba(143, 151, 121, 0.3);
    border-radius: 2px;
}

#drawer-content::-webkit-scrollbar-thumb:hover {
    background: rgba(143, 151, 121, 0.5);
}

/* Enhanced location card animations */
#places-list>div>div {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#places-list>div>div:active {
    transform: scale(0.98);
}

/* Hide the default close button on the Google Maps InfoWindow */
.gm-ui-hover-effect {
    display: none !important;
}

/* Style the InfoWindow */
.gm-style .gm-style-iw-c {
    padding: 16px !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(45, 71, 57, 0.2), 0 4px 8px rgba(45, 71, 57, 0.1) !important;
    max-width: 280px !important;
    background: #F8F9F7 !important;
}

.gm-style .gm-style-iw-d {
    overflow: auto !important;
    max-height: none !important;
}

.gm-style .gm-style-iw-tc::after {
    background: #F8F9F7 !important;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.no-scrollbar {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}