/* ===================================
   Global Styles
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #8B4513;
    --secondary-color: #D2691E;
    --dark-color: #2C1810;
    --light-color: #F5E6D3;
    --text-color: #333;
    --white: #fff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 10px;
    --gap: 1rem;
    --header-height: 80px; /* used to offset fixed header */
    --bg-accent: linear-gradient(180deg, #fff, #fbf8f5);
    --contact-bg: #c89b73; /* darker, warmer tone for stronger contrast */

    /* Additional design tokens for a more modern, consistent UI */
    --bg: #ffffff;
    --surface: #fbfbfd;
    --accent: #0b74de;
    --muted: #6b6f76;
    --shadow-sm: 0 1px 2px rgba(16,24,40,0.04);
    --shadow-md: 0 6px 18px rgba(16,24,40,0.08);
    --max-content-width: 1100px;
    --base-font-size: 16px;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
}

@media (max-width: 768px) {
    :root { --header-height: 70px; }
}

@media (max-width: 480px) {
    :root { --header-height: 65px; }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ==============================
   UI Helpers & Utilities
   - Buttons, cards, grids, improved image handling
   - Focus and reduced-motion accessibility
   ============================== */

html { font-size: var(--base-font-size); }

/* Container that respects the max content width and responsive padding */
.container{
    max-width:var(--max-content-width);
    margin:0 auto;
    padding-left:clamp(1rem,3vw,2rem);
}
/* Apply the custom cursor only when the script verifies the resource.
    padding-right:clamp(1rem,3vw,2rem);
/* Apply the custom cursor only when the script verifies the resource.
   Two classes may be added to <html> by the detection script:
   - `has-truetrowel-cursor-svg` -> use the SVG cursor
html.has-truetrowel-cursor-svg, html.has-truetrowel-cursor-svg *:not(input):not(textarea):not(select):not(option):not([contenteditable="true"]) {
    cursor: url('/assets/images/truetrowel.svg') 16 16, auto;
}

html.has-truetrowel-cursor-png, html.has-truetrowel-cursor-png *:not(input):not(textarea):not(select):not(option):not([contenteditable="true"]) {
    cursor: url('/assets/images/fallback.png') 8 8, auto;
}
    cursor: url('/assets/images/fallback.png') 8 8, auto;
}

/* Readable measure for article-type text blocks */
.article, main, .content{
    max-width:70ch;
    margin:0 auto;
}

/* Buttons: apply class `btn` to <a> or <button> */
.btn{
    display:inline-flex;
    align-items:center;
    gap:.5rem;
    padding:.5rem 1rem;
    background:var(--accent);
    color:var(--white);
    border-radius:calc(var(--radius) - 2px);
    border:0;
    text-decoration:none;
    box-shadow:var(--shadow-sm);
    transition:transform .16s ease, box-shadow .16s ease, background .16s ease;
    cursor:pointer;
    font-weight:600;
}
.btn:hover{ transform:translateY(-3px); box-shadow:var(--shadow-md); }

/* Generic card */
.card{
    background:var(--surface);
    border-radius:var(--radius);
    padding:var(--space-3);
    box-shadow:var(--shadow-sm);
    transition:transform .18s ease, box-shadow .18s ease;
    overflow:hidden;
}
.card:hover{ transform:translateY(-6px); box-shadow:var(--shadow-md); }

/* Responsive grid helper */
.grid{
    display:grid;
    gap:clamp(.5rem,1.2vw,1.25rem);
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
}

/* Better default image handling to avoid layout jumps */
img{ max-width:100%; height:auto; display:block; object-fit:cover; border-radius:6px; }
.responsive-figure img{ width:100%; aspect-ratio:16/9; }

/* Focus and accessibility improvements */
:focus{ outline:3px solid color-mix(in srgb, var(--accent) 32%, white); outline-offset:3px }

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce){
    *{ animation-duration:0.01ms !important; animation-iteration-count:1 !important; transition-duration:0.01ms !important; scroll-behavior:auto !important }
}

/* ===================================
    Custom cursor (robust)
    - Tries the site PNG first, then an embedded SVG fallback, then system default
    - Keeps native cursors for form fields and contenteditable areas
    - Recommended: place `trowelcursor.png` at `/assets/images/trowelcursor.png`
    =================================== */

/* Data-URI SVG fallback: simple circular trowel-like mark (works even if PNG missing) */
/* Note: '#' characters are escaped as %23 in the URI */
/* Example hotspot values (16 16) assume a 32x32 image; adjust if needed */
html, body, *:not(input):not(textarea):not(select):not(option):not([contenteditable="true"]) {
    /* Use ONLY `truetrowel.svg` as the cursor (no fallbacks) */
    /* Use ONLY `truetrowel.svg` as requested */
    cursor: url('/assets/images/truetrowel.svg') 16 16, auto;
}

/* Ensure form controls keep their expected cursors for usability */
input, textarea, select, [contenteditable="true"] { cursor: auto; }

/* Clickable elements: use brushclick cursor with PNG fallback for broader support
   This replaces the default pointer/hand when hovering actionable UI (links, buttons, map controls) */
a, button, input[type="button"], input[type="submit"], .btn, .nav-links a, .menu-root > a,
.maplibregl-ctrl button, .maplibregl-popup-close-button, .project-item, .gallery-item,
.project-hover, .gallery-grid .gallery-item {
    cursor: url('/assets/images/brushclick.svg') 12 12, url('/assets/images/brushclick.png') 12 12, pointer;
}

/* Strong override for MapLibre canvas/markers/controls which sometimes set inline cursors via JS
   Using !important ensures the custom brush cursor replaces the default hand/pointer when hovering
   over interactive map UI. We avoid touching form inputs. */
#travel-map, #travel-map *,
.maplibregl-canvas, .maplibregl-marker, .maplibregl-ctrl button, .maplibregl-popup-close-button, .travel-marker {
    cursor: url('/assets/images/brushclick.svg') 12 12, url('/assets/images/brushclick.png') 12 12, pointer !important;
}

/* Broader rule: apply brushclick cursor to all common interactive/clickable elements
   This aims to replace the default hand/pointer on any element that is typically clickable.
   Includes role-based controls, elements with onclick, summary, label[for], and elements marked as links/buttons. */
a[href], button, input[type="button"], input[type="submit"], summary, label[for],
[role="button"], [role="link"], [onclick], [data-href],
[tabindex]:not([tabindex="-1"]):not(input):not(textarea):not(select),
.btn, .project-item, .gallery-item, .gallery-item *, .project-hover,
.maplibregl-marker, .maplibregl-marker * {
    cursor: url('/assets/images/brushclick.svg') 12 12, url('/assets/images/brushclick.png') 12 12, pointer !important;
}

/* Clickable elements: use brushclick cursor with PNG fallback for wider support
   Applied to anchors, buttons and the map/control UI so pointer affordance is consistent */
a, button, input[type="button"], input[type="submit"], .btn, .nav-links a, .menu-root > a,
.maplibregl-ctrl button, .maplibregl-popup-close-button, .project-item, .gallery-item,
.project-hover, .gallery-grid .gallery-item {
    cursor: url('/assets/images/brushclick.svg') 12 12, url('/assets/images/brushclick.png') 12 12, pointer;
}

/* Keep native cursors for form fields and editable areas */
input, textarea, select, [contenteditable="true"] { cursor: auto; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--dark-color);
    text-align: center;
}

/* ===================================
   Header & Navigation
   =================================== */
header {
    background-color: rgba(44,24,16,0.88);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    box-shadow: var(--shadow);
    display: block !important;
    visibility: visible !important;
}

nav {
    display: flex !important;
    justify-content: flex-start;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Right-side wrapper to keep Menu and language buttons grouped */
.nav-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Push the right-side controls to the far right of the navbar */
.nav-right {
    margin-left: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem; /* slightly larger gap so subtitle isn't crowded */
    text-decoration: none;
    z-index: 1001;
    position: relative;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem; /* small breathing room between name and subtitle */
    z-index: 1001;
}

.logo-image {
    height: 52px; /* a touch larger for readability */
    width: auto;
    transition: transform 0.3s ease;
    display: block;
    border-radius: 50%;
    object-fit: cover;
    z-index: 1001;
    flex-shrink: 0;
}

.logo-image:hover {
    transform: scale(1.05);
}

.logo h1 {
    color: var(--white);
    font-size: 1.9rem;
    margin: 0;
    padding: 0;
    line-height: 1.05; /* tighten line height but keep spacing with subtitle */
    border: none;
    text-decoration: none;
}

.subtitle {
    color: var(--secondary-color);
    font-size: 0.95rem;
    line-height: 1;
    margin: 0;
    padding: 0;
    border: none;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--secondary-color);
}

/* Dropdown for nested navigation (Excavations) */
.nav-links li {
    position: relative;
}

.nav-links .dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--dark-color);
    padding: 0.4rem 0;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    min-width: 200px;
    z-index: 1000;
}

.nav-links .dropdown li {
    list-style: none;
}

.nav-links .dropdown a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
}

.nav-links .dropdown a:hover {
    background: rgba(255,255,255,0.04);
    color: var(--secondary-color);
}

.nav-links li.has-dropdown > a::after {
    content: " ▾";
    margin-left: 0.25rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
}

.nav-links li:hover .dropdown {
    display: block;
}

/* Style for single 'Menu' root so top bar shows compact only */
.menu-root > a {
    /* Match language toggle visual style but slightly larger */
    display: inline-block;
    background: transparent;
    color: var(--white);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 0.5rem 1rem; /* larger button */
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1;
    transition: all 0.18s ease;
}
.menu-root > a:hover {
    border-color: var(--secondary-color);
    background: rgba(255,255,255,0.03);
    transform: translateY(-1px);
}

.menu-root > a[aria-expanded="true"] {
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

/* Dropdown larger layout to hold many items */
.nav-links .dropdown {
    min-width: 220px;
}

.nav-links .dropdown li a {
    white-space: nowrap;
}

/* When a mobile parent is toggled open */
.nav-links li.open .dropdown {
    display: block;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

/* Language switch buttons in header */
.lang-switch {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.lang-switch .lang-toggle {
    background: transparent;
    color: var(--white);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: all 0.2s ease;
}
.lang-switch .lang-toggle:hover {
    border-color: var(--secondary-color);
    transform: scale(1.1);
}
.lang-switch .lang-toggle[aria-pressed="true"] {
    background: rgba(210, 105, 30, 0.2);
    border-color: var(--secondary-color);
    box-shadow: 0 0 8px rgba(210, 105, 30, 0.3);
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--white);
    transition: 0.3s;
}

/* ===================================
   Hero Section
   =================================== */
.hero {
    background: linear-gradient(rgba(44, 24, 16, 0.7), rgba(44, 24, 16, 0.7)), 
                url('egypt.png') center/contain no-repeat;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-top: var(--header-height);
}

.hero-content {
    color: var(--white);
    max-width: 800px;
    padding: 2rem;
}

/* Stack hero content vertically and center items (keeps CTAs beneath each other) */
.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem; /* spacing between heading, paragraph and buttons */
}

/* No extra vertical offset for the secondary hero CTA; it stacks naturally beneath the primary CTA */
.hero-content .hero-secondary {
    margin-top: 0;
}

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--white);
    animation: fadeInUp 1s ease;
}

.hero-content p {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    animation: fadeInUp 1.2s ease;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background-color: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.3s ease;
    animation: fadeInUp 1.4s ease;
}

.cta-button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .hero {
        height: auto;
        min-height: 60vh;
        padding: 3rem 0;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
}

/* ===================================
   About Section
   =================================== */
.about {
    padding: 5rem 0;
    background-color: var(--white);
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.about-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

.about-image img {
    width: 100%;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

/* ===================================
   Research Section
   =================================== */
.research {
    padding: 5rem 0;
    background-color: var(--light-color);
}

.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.research-card {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.research-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.research-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    white-space: normal;
}

/* ===================================
   Projects Section
   =================================== */
.projects {
    padding: 5rem 0;
    background-color: var(--white);
}

.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: var(--shadow);
    cursor: pointer;
    height: 300px;
}

.project-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.project-name {
    display: block;
    width: 100%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 0.6rem 1rem;
    font-weight: 700;
    text-align: left;
}

.project-hover {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.9);
    color: #111;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.project-item:hover .project-hover {
    opacity: 1;
    transform: translateY(-2px);
}

/* Project status badge */
.project-badge {
    position: absolute;
    top: 12px;
    left: 12px; /* default - will be overridden for project items */
    background: rgba(255,165,0,0.95); /* orange */
    color: #111;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* project badge and logo overlays removed — project cards use background image and name only */

.project-status {
    display: inline-block;
    background: linear-gradient(90deg, #fff3cd, #ffeeba);
    color: #856404;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-weight: 700;
    margin-bottom: 1rem;
    border: 1px solid rgba(0,0,0,0.05);
}

.project-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(44, 24, 16, 0.9), transparent);
    color: var(--white);
    padding: 2rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.project-item:hover img {
    transform: scale(1.1);
}

.project-item:hover .project-overlay {
    transform: translateY(0);
}

.project-overlay h3 {
    margin-bottom: 0.5rem;
}

/* ===================================
   Travel-specific tweaks
   - Subtle hero on the travel index and improved gallery card labels
   =================================== */
.travel-hero{
    margin-top: calc(var(--header-height) + 10px);
    border-radius: 12px;
    height: 240px;
    background-size: cover;
    background-position: center;
    display:flex;
    align-items:center;
    justify-content:center;
    color:var(--white);
    box-shadow: var(--shadow);
    position:relative;
    overflow:hidden;
}
.travel-hero::before{ content: ""; position:absolute; inset:0; background: linear-gradient(180deg, rgba(0,0,0,0.45), rgba(0,0,0,0.15)); }
.travel-hero-inner{ position:relative; z-index:2; text-align:center; padding:2rem; }
.travel-hero .lead{ color: rgba(255,255,255,0.95); margin-bottom:0.75rem; }

/* Slightly tighter, card-like project gallery for travel pages */
.project-gallery.travel-grid{ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap:1.25rem; margin-top:1.25rem; }
.project-item{ border-radius:12px; }
.project-image{ border-radius:12px; }

/* Make project label more prominent and add subtitle */
.project-name{ font-size:1.125rem; font-weight:800; padding:0.7rem 1rem; background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0.45)); color:#fff; }
.project-subtitle{ display:block; padding:0.2rem 1rem 1rem; color: rgba(255,255,255,0.92); font-weight:500; font-size:0.95rem; background: linear-gradient(180deg, rgba(0,0,0,0.15), transparent); }

/* Travel badge: warm ochre styling to contrast photo covers */
.project-badge{ background: linear-gradient(90deg, #ffb347, #ff7e5f); color:#222; box-shadow: 0 4px 10px rgba(0,0,0,0.18); }

/* Ensure hover affordances are visible on travel cards */
.project-item:hover .project-image{ transform: scale(1.03); transition: transform 0.28s ease; }
.project-item .project-hover{ right: 14px; top: 14px; }

@media (max-width: 768px) {
    .travel-hero{ height: 220px; }
    .project-name{ font-size:1rem; }
    .project-subtitle{ font-size:0.9rem; }
}

/* ===================================
   Contact Section
   =================================== */
.contact {
    position: relative; /* needed for divider pseudo element */
    padding: 5rem 0;
    background-color: var(--contact-bg);
    /* rely on the decorative top bar for separation (clean top edge) */
    overflow: visible;
}

/* Decorative centered accent line that sits between sections */
.contact::before {
    /* Full-width divider bar sitting at the very top edge of the contact section */
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    transform: none;
    width: auto;
    height: 8px;
    border-radius: 0;
    background: linear-gradient(90deg, rgba(115,52,14,1), rgba(186,84,30,1));
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    pointer-events: none;
    z-index: 2;
}

@media (max-width: 768px) {
    .contact {
        border-top-width: 5px;
    }
    .contact::before {
        height: 6px;
    }
}

@media (max-width: 480px) {
    .contact {
        border-top-width: 4px;
        padding: 3rem 0;
    }
    .contact::before {
        height: 4px;
    }
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.contact-info h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.contact-details {
    margin-top: 2rem;
}

.contact-details p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* LinkedIn contact card in contact section */
.contact-social {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.linkedin-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #f5f7fb;
    border: 1px solid rgba(10,102,194,0.08);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    width: 100%;
    max-width: 380px;
}
.linkedin-card:hover {
    background: #eef6ff;
}
.social-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
    box-shadow: 0 2px 6px rgba(10,102,194,0.08);
    object-fit: cover;
}
.social-meta strong {
    display: block;
    font-size: 0.95rem;
}
.social-handle {
    font-size: 0.85rem;
    color: #666;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0;
}

.contact-form input,
.contact-form textarea {
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.submit-button {
    padding: 1rem 2rem;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.submit-button:hover {
    background-color: var(--secondary-color);
}

/* ===================================
   Footer
   =================================== */
footer {
    background-color: var(--dark-color);
    color: var(--white);
    text-align: center;
    padding: 2rem 0;
}

/* ===================================
   Animations
   =================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        right: -100%;
        top: 80px;
        flex-direction: column;
        background-color: var(--dark-color);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        padding: 2rem 0;
    }

    /* Ensure mobile nav sits above other content */
    .nav-links {
        z-index: 10002;
        touch-action: manipulation;
    }

    /* Make menu and dropdown items easier to tap */
    .menu-root > a {
        padding: 0.9rem 1.1rem;
        font-size: 1.05rem;
    }

    .nav-links a {
        display: block;
        padding: 0.9rem 1rem;
        font-size: 1.05rem;
    }

    .nav-links .dropdown {
        padding-left: 0.5rem;
    }

    .nav-links .dropdown a {
        padding: 0.9rem 1.25rem;
        text-align: left;
        color: var(--white);
    }

    /* Make the hamburger larger on phones for easy tap */
    .hamburger {
        padding: 0.6rem;
    }

    /* Show dropdowns inside the mobile menu when menu active */
    .nav-links .dropdown {
        position: static;
        display: none;
        background: transparent;
        box-shadow: none;
        padding-left: 1rem;
    }

    .nav-links.active .dropdown {
        display: block;
    }

    .nav-links .dropdown a {
        padding: 0.6rem 0;
    }

    .nav-links.active {
        right: 0;
    }

    .hamburger {
        display: flex;
    }

    nav {
        padding: 1rem 1rem;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .logo-image {
        height: 45px;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .hero {
        margin-top: var(--header-height);
        min-height: 70vh;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1.1rem;
    }

    .hero-content {
        padding: 1.5rem;
    }

    .cta-button {
        padding: 0.9rem 2rem;
        font-size: 0.95rem;
    }

    .about-content,
    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about,
    .research,
    .projects,
    .contact {
        padding: 3rem 0;
    }

    .container {
        padding: 0 15px;
    }

    h2 {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }

    .research-card,
    .project-item {
        padding: 1.5rem;
    }

    .contact-form input,
    .contact-form textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .linkedin-card {
        max-width: 100%;
    }

    .project-gallery {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .project-item {
        height: 250px;
    }

    footer {
        padding: 1.5rem 0;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .hero {
        margin-top: var(--header-height);
    }

    .hero-content h2 {
        font-size: 1.5rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .logo h1 {
        font-size: 1.3rem;
    }

    .logo-image {
        height: 40px;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .research-grid {
        grid-template-columns: 1fr;
    }

    h2 {
        font-size: 1.75rem;
    }

    .research-card h3 {
        font-size: 1.3rem;
    }

    .about-text p,
    .contact-info p {
        font-size: 1rem;
    }

    .cta-button {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .project-item {
        height: 220px;
    }

    nav {
        padding: 0.8rem 0.8rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .cta-button:active,
    .submit-button:active,
    .nav-links a:active {
        transform: scale(0.98);
    }

    .project-item:active {
        transform: scale(0.99);
    }

    /* On touch devices, show gallery captions below images for discoverability */
    .gallery-grid.abu-mena .gallery-item figcaption {
        position: relative;
        opacity: 1;
        transform: none;
        background: transparent;
        color: var(--text-color);
        padding: 0.6rem 0.5rem;
    }

    /* Always show project hover text on touch devices */
    .project-hover {
        opacity: 0.9;
    }

    /* Make touch targets larger */
    .nav-links a {
        padding: 0.8rem 0;
        display: block;
    }

    .hamburger {
        padding: 0.5rem;
    }
}

/* Excavation gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

/* Travel map styles */
#travel-map {
    width: 100%;
    height: 320px;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(16,24,40,0.12);
    overflow: hidden;
    margin: 1.25rem 0;
    border: 1px solid rgba(0,0,0,0.06);
    background: linear-gradient(45deg, #87CEEB, #4682B4, #5B9BD5);
    background-size: 400% 400%;
    animation: skyShift 10s ease-in-out infinite;
    position: relative;
}

/* Fallback / loading message shown inside the map container until Leaflet renders */
#travel-map .map-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    color: rgba(0,0,0,0.6);
    font-weight: 600;
}

/* Small caption overlay used to label/map actions and integrate with hero styling */
.map-caption{
    position: absolute;
    left: 16px;
    top: 14px;
    background: linear-gradient(90deg,#ffb347,#ff7e5f);
    color:#2b1e18;
    padding:0.35rem 0.6rem;
    border-radius:8px;
    font-weight:700;
    box-shadow: 0 6px 18px rgba(16,24,40,0.12);
    z-index: 4;
    pointer-events: none;
}

/* MapLibre popup and marker adjustments to match site palette */
.maplibregl-popup-content {
    /* warm, glassy popup background to match site palette */
    background: linear-gradient(180deg, rgba(255,179,71,0.18), rgba(255,126,95,0.08)) !important;
    color: #2b1e18 !important;
    border-radius: 12px !important;
    padding: 0.8rem 1rem !important;
    font-weight: 700 !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255,126,95,0.12) !important;
    box-shadow: 0 8px 24px rgba(16,24,40,0.12) !important;
}
.maplibregl-popup-tip {
    display: none; /* keep tip hidden for cleaner look */
}
.travel-marker {
    width: 22px;
    height: 22px;
    background: linear-gradient(180deg, #ffb347, #ff7e5f);
    border-radius: 50%;
    box-shadow: 0 6px 18px rgba(16,24,40,0.18);
    border: 2px solid rgba(0,0,0,0.18);
}

/* Controls style tweak so zoom buttons match palette */
/* More specific styling for MapLibre control buttons to ensure warm glassy tint */
.maplibregl-ctrl .maplibregl-ctrl-group button,
.maplibregl-ctrl button {
    background: linear-gradient(90deg, rgba(255,179,71,0.12) 0%, rgba(255,126,95,0.08) 100%) !important;
    color: #2b1e18 !important;
    border: 1px solid rgba(255,126,95,0.12) !important;
    backdrop-filter: blur(6px) !important;
    transition: background 0.18s ease, transform 0.12s ease !important;
    box-shadow: 0 6px 18px rgba(16,24,40,0.06) !important;
}
.maplibregl-ctrl .maplibregl-ctrl-group button:hover,
.maplibregl-ctrl button:hover {
    background: linear-gradient(90deg,#ffb347,#ff7e5f) !important;
    color: #222 !important;
    transform: translateY(-2px) !important;
}

/* Make control groups slightly translucent glass by default */
.maplibregl-ctrl-group {
    /* subtle warm glass panel behind controls */
    background: linear-gradient(180deg, rgba(255,179,71,0.06), rgba(255,126,95,0.04)) !important;
    border: 1px solid rgba(255,126,95,0.08) !important;
    backdrop-filter: blur(8px) !important;
    border-radius: 10px !important;
}

/* Popup close button: glassy, subtle */
.maplibregl-popup-close-button {
    /* larger glassy close button in warm tint; ensure glyph fills the box */
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
    font-size: 26px !important;
    font-weight: 800 !important;
    background: linear-gradient(180deg, rgba(255,179,71,0.24), rgba(255,126,95,0.18)) !important;
    color: #2b1e18 !important;
    border-radius: 10px !important;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18) !important;
    border: 1px solid rgba(255,126,95,0.18) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-indent: 0 !important;
    padding: 0 !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    z-index: 6 !important;
}

/* Make popup inner content fully transparent where possible (avoid white backgrounds)
   Important: only target descendants so the popup container keeps the warm glass background */
.maplibregl-popup-content * {
    /* ensure popup inner elements don't introduce white blocks */
    background: transparent !important;
    background-color: transparent !important;
    color: inherit !important;
}

/* Links inside popups should be visible but not white boxes */
.maplibregl-popup-content a {
    color: #2b1e18 !important;
    background: transparent !important;
    text-decoration: underline !important;
    text-decoration-color: rgba(43,30,24,0.12) !important;
}

/* Force control icons (SVG) to use site accent color so they don't appear as white blocks */
.maplibregl-ctrl button svg, .maplibregl-ctrl button svg path {
    fill: #2b1e18 !important;
    stroke: #2b1e18 !important;
}

/* Specific targeting for zoom control visual wrapper (MapLibre sometimes applies inline backgrounds) */
.maplibregl-ctrl-top-right .maplibregl-ctrl {
    background: transparent !important;
    padding: 6px !important;
}
.maplibregl-ctrl-top-right .maplibregl-ctrl-group {
    background: linear-gradient(180deg, rgba(255,179,71,0.06), rgba(255,126,95,0.04)) !important;
}

/* Ensure buttons don't display default white background on some browsers */
.maplibregl-ctrl button {
    background: linear-gradient(90deg, rgba(255,179,71,0.08), rgba(255,126,95,0.06));
}

@media (max-width: 900px) {
    #travel-map { height: 240px; }
}

@keyframes skyShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Games overview specific styles */
.games-list .project-gallery {
    display: block; /* single-column layout for games list */
}
.games-list .project-item {
    max-width: 880px;
    margin: 0.75rem auto; /* center the card */
    height: 120px; /* compact height for list preview */
    border-radius: 12px;
    overflow: hidden;
}
.games-list .project-image {
    height: 100%;
    display: flex;
    align-items: center;
    padding-left: 1.25rem;
}
.games-list .project-name {
    background: transparent; /* keep name visible but not in a heavy band */
    color: var(--white);
    font-size: 1.25rem;
    padding: 0;
}
.games-list .project-description {
    color: rgba(255,255,255,0.9);
    font-size: 0.95rem;
    margin-left: 1.25rem;
}
.gallery-item {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-item.placeholder {
    color: #666;
    font-weight: 600;
    font-size: 0.95rem;
    background: linear-gradient(180deg, #fafafa, #f5f5f5);
}

/* Gallery captions for travel image grids */
.gallery-item figcaption{
    padding: 0.5rem 0.6rem;
    font-size: 0.95rem;
    color: var(--text-color);
    background: rgba(255,255,255,0.92);
    width:100%;
    box-sizing: border-box;
    text-align: center;
}

/* ===================================
   Excavation / Report page styles
   =================================== */
.excavation-article {
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    color: var(--text-color);
}
.excavation-article .lead {
    font-size: 1.08rem;
    line-height: 1.9;
    color: #222;
    margin-bottom: 1rem;
}
.summary-box {
    background: linear-gradient(180deg, #fbf9f6, #fffaf5);
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}
.meta-list {
    list-style: none;
    padding-left: 0;
}
.meta-list li { margin-bottom: 0.45rem; }
.excavation-article h3 { color: var(--dark-color); margin-top: 1.25rem; margin-bottom: 0.6rem; }
.excavation-article h4 { color: var(--primary-color); margin-top: 0.6rem; margin-bottom: 0.4rem; }
.excavation-article ul { margin-left: 1.25rem; margin-bottom: 1rem; }
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}
.callout {
    background: #fff7e6;
    border: 1px solid rgba(0,0,0,0.04);
    padding: 0.8rem 1rem;
    border-radius: 6px;
    margin: 1rem 0;
}

@media (max-width: 768px) {
    .two-col { grid-template-columns: 1fr; }
}

/* ===================================
   Project & Excavation Detail Layouts
   =================================== */
.project-detail-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 768px) {
    .project-detail-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .project-detail-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Excavation detail wrapper */
.excavation-detail-wrapper {
    width: 100%;
    margin: 0 auto;
}

/* Excavation article/section responsive spacing */
article section {
    margin-bottom: 1.5rem;
}

article section:first-of-type {
    margin-top: 0;
}

article h3 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--dark-color);
}

article h4 {
    font-size: 1.2rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

article ul,
article ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    line-height: 1.8;
}

article li {
    margin-bottom: 0.5rem;
}

article p {
    line-height: 1.8;
    margin-bottom: 1rem;
    font-size: 1rem;
}

article .lead {
    font-size: 1.08rem;
    font-weight: 500;
    color: #222;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    article h3 {
        font-size: 1.3rem;
        margin-top: 1.25rem;
    }

    article h4 {
        font-size: 1.1rem;
        margin-top: 0.8rem;
    }

    article p,
    article li {
        font-size: 1rem;
        line-height: 1.7;
    }

    article ul,
    article ol {
        margin-left: 1.25rem;
    }

    article section {
        margin-bottom: 1.25rem;
    }
}

@media (max-width: 480px) {
    article h3 {
        font-size: 1.15rem;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
    }

    article h4 {
        font-size: 1rem;
        margin-top: 0.7rem;
        margin-bottom: 0.4rem;
    }

    article p,
    article li {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    article ul,
    article ol {
        margin-left: 1rem;
        padding-right: 0.5rem;
    }

    article section {
        margin-bottom: 1rem;
    }

    article .lead {
        font-size: 1rem;
    }
}

/* Excavation hero/cover image */
.excavation-hero {
    position: relative;
    height: 320px;
    border-radius: 10px 10px 6px 6px;
    overflow: hidden;
    margin-bottom: 1rem;
    background-repeat: no-repeat;
    /* slightly zoom in and position lower to focus tents */
    background-size: 150%;
    background-position: center 86%;
}
.excavation-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.25), rgba(0,0,0,0.55));
}
.excavation-hero-inner {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.25rem 1.5rem;
    color: #fff;
}
.excavation-hero .hero-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.excavation-hero .byline {
    margin: 0.25rem 0 0.45rem 0;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.92);
    opacity: 0.95;
}

/* Utility: visually hidden but accessible to screen readers */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
/* -----------------------------------
   Links & Accessibility
   ----------------------------------- */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.18s ease, opacity 0.18s ease;
}
a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Visible focus styles for keyboard users */
:focus {
    outline: none;
}
:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
    box-shadow: 0 0 0 4px rgba(210,105,30,0.14);
    border-radius: 6px;
}

/* Slightly smoother transitions for interactive elements */
.cta-button, .submit-button, .menu-root > a, .lang-switch .lang-toggle {
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    border-radius: var(--radius);
}

.excavation-hero .project-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    /* Use a stronger, opaque overlay for readability */
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 6px;
    padding: 0.35rem 0.8rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    backdrop-filter: none; /* remove blur which reduces legibility */
    border: none;
    font-size: 0.95rem;
    max-width: max-content; /* avoid stretching full-width */
}

/* Completed badge styles (green) */
.project-badge.completed {
    background: linear-gradient(90deg, #28a745, #218838); /* green */
    color: #fff;
}
.project-status.completed {
    /* Make the "Completed" pill high-contrast while keeping a green cue */
    background: linear-gradient(90deg, #218838, #19692c);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(25, 100, 40, 0.35);
}

.project-readme {
    background:#f9f9f9;
    padding:1rem;
    border-radius:6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.project-readme pre {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.4;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.project-readme code {
    font-family: 'Courier New', monospace;
    word-break: break-word;
}

@media (max-width: 768px) {
    .excavation-hero { height: 220px; }
    .excavation-hero .hero-title { font-size: 1.25rem; }

    /* Prevent horizontal overflow on mobile */
    table {
        width: 100%;
        font-size: 0.85rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table td, table th {
        padding: 0.5rem 0.25rem;
    }

    /* Long links should wrap */
    a {
        word-break: break-word;
    }

    /* Improve spacing for touch on mobile list items */
    ul li, ol li {
        margin-bottom: 0.75rem;
        padding-right: 0.5rem;
    }

    .linkedin-card {
        flex-wrap: wrap;
    }

    .social-icon {
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    /* Prevent text from becoming too cramped */
    main {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Extra padding to prevent edge-flush on tiny screens */
    .container {
        padding: 0 12px;
    }

    /* Improve readability of links on very small screens */
    a {
        word-break: break-word;
    }

    /* Ensure code blocks scroll if needed */
    pre, code {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Tighter margins for excavation sections on phones */
    article section {
        margin-bottom: 0.75rem;
    }

    /* Badge and status styling for tiny screens */
    .project-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }

    .project-status {
        font-size: 0.85rem;
        padding: 0.3rem 0.5rem;
    }

    /* Make contact form inputs easier to tap */
    .contact-form input,
    .contact-form textarea {
        min-height: 44px;
        font-size: 16px;
        padding: 0.75rem;
    }

    .submit-button {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }

    .cta-button {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }

    /* Ensure images don't overflow tiny screens */
    img {
        max-width: 100%;
        height: auto;
    }
}

/* Simple lightbox styles */
#lightbox {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    gap: 1rem;
    padding: 2rem;
}
#lightbox[style*="display: flex"] {
    display: flex !important;
}
#lightbox #lb-image-wrap { 
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
#lightbox img { 
    max-width: 100%;
    max-height: 100%;
    display: block;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    object-fit: contain;
    object-position: center center;
}
#lb-close, #lb-next, #lb-prev { 
    position: absolute;
    background: rgba(255,255,255,0.9);
    border: none;
    padding: 0.5rem 0.75rem;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}
#lb-close { 
    top: 20px;
    right: 20px;
    z-index: 10001;
}
#lb-prev { 
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}
#lb-next { 
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}
#lb-close:hover, #lb-next:hover, #lb-prev:hover { 
    background: rgba(255,255,255,1);
    transform: scale(1.05);
}

/* Ensure Abu Mena gallery images show full-size and retain aspect ratio */
.gallery-grid.abu-mena {
    /* Use a flexible, wrap layout so images keep their natural aspect ratio
       and are not forced into equal-height cards which caused white gaps. */
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.gallery-grid.abu-mena .gallery-item {
    flex: 1 1 calc(33.333% - 1rem);
    min-width: 200px;
    align-self: start; /* let each item size to its image */
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.gallery-grid.abu-mena .gallery-item img {
    width: 100%;
    height: auto;
    object-fit: contain; /* preserve full image without cropping */
    display: block;
}

/* Hover caption overlay for Abu Mena gallery (match Grabow style) */
.gallery-grid.abu-mena .gallery-item {
    position: relative; /* needed for absolute caption overlay */
    cursor: pointer;
    transition: transform 0.25s ease;
}

.gallery-grid.abu-mena .gallery-item img {
    transition: transform 0.35s ease;
}

.gallery-grid.abu-mena .gallery-item figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.9rem 0.75rem;
    background: linear-gradient(to top, rgba(0,0,0,0.78), transparent);
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.2;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform: translateY(6px);
}

.gallery-grid.abu-mena .gallery-item:hover img {
    transform: scale(1.04);
}

.gallery-grid.abu-mena .gallery-item:hover figcaption {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 900px) {
    .gallery-grid.abu-mena .gallery-item { flex: 1 1 calc(50% - 1rem); }
}

@media (max-width: 480px) {
    .gallery-grid.abu-mena .gallery-item { flex: 1 1 100%; }
}

/* Project hero layout: square image left, title/text right */
.project-hero {
    display: flex;
    gap: 2rem;
    align-items: center;
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}
.project-hero-image {
    flex: 0 0 200px;
    height: 200px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.project-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.project-hero-text {
    flex: 1;
}
.project-hero-text h2 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    font-size: 2rem;
}
.project-hero-text p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-color);
}
.project-hero-text p strong {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .project-hero {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    .project-hero-image {
        flex: 0 0 150px;
        height: 150px;
    }
    .project-hero-text h2 {
        font-size: 1.5rem;
    }
    .project-hero-text p {
        font-size: 1rem;
    }
}

/* Popup close button: fit the site's smooth rounded control box
   - Use high-specificity selectors and !important to override MapLibre inline styles
   - Center the glyph and match the warm glassy panel used for controls */
.maplibregl-popup .maplibregl-popup-close-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    background: linear-gradient(180deg, rgba(255,210,150,0.16), rgba(255,170,90,0.08)) !important;
    border: 1px solid rgba(0,0,0,0.12) !important;
    box-shadow: inset 0 1px rgba(255,255,255,0.06), 0 8px 18px rgba(16,24,40,0.12) !important;
    color: #28160f !important;
    font-size: 24px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-indent: 0 !important;
    transform: none !important;
    right: 8px !important;
    top: 8px !important;
    z-index: 6 !important;
}

/* Ensure the glyph (text or svg) fills and centers inside the button */
.maplibregl-popup .maplibregl-popup-close-button span,
.maplibregl-popup .maplibregl-popup-close-button svg {
    width: 18px !important;
    height: 18px !important;
    display: block !important;
}

.maplibregl-popup .maplibregl-popup-close-button:focus {
    outline: none !important;
    box-shadow: 0 0 0 4px rgba(255,170,90,0.14) !important;
}

/* Hide any injected pseudo-elements so the button stays visually clean */
.maplibregl-popup .maplibregl-popup-close-button::before,
.maplibregl-popup .maplibregl-popup-close-button::after {
    display: none !important;
}

/* Give the popup a small top padding so the close button sits nicely inside the rounded corner */
.maplibregl-popup {
    padding-top: 8px !important;
}

