/* ===== GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: rgba(255,209,102,0.3); /* For mobile tap feedback */
}

body {
    font-family: 'Arial', Helvetica, sans-serif;
    background: linear-gradient(135deg, #667b8d 0%, #4a6b8a 100%);
    color: #ffffff;
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scroll */
    width: 100%;
    -webkit-font-smoothing: antialiased; /* Better font rendering on Safari */
    -moz-osx-font-smoothing: grayscale; /* Better font rendering on Firefox */
}

h1, h2, h3, h4 {
    margin-bottom: 15px;
    font-weight: 600;
}

h1 {
    font-size: clamp(1.8rem, 5vw, 3.2rem); /* Responsive font size */
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    text-align: center;
    margin-bottom: 30px;
    color: #ffffff;
    position: relative;
    padding-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

h2:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(80px, 20vw); /* Responsive width */
    height: 4px;
    background: #ffd166;
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

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

/* ===== HEADER ===== */
header {
    background: linear-gradient(135deg, #1a3b5c 0%, #0f2c44 100%);
    padding: 12px 40px;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #ffd166;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    flex-wrap: wrap; /* Allow wrapping on mobile */
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.logo-image {
    height: clamp(50px, 8vw, 70px);
    width: auto;
    border-radius: 10px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
    border: none;
    transition: transform 0.3s;
}

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

.logo-text {
    font-size: clamp(18px, 4vw, 26px);
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

nav a {
    color: #ffffff;
    text-decoration: none;
    margin-left: 30px;
    font-weight: bold;
    transition: all 0.3s;
    padding: 8px 16px;
    border-radius: 30px;
    white-space: nowrap; /* Prevent text wrapping in nav */
}

nav a:hover {
    background: #ffd166;
    color: #1a3b5c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255,209,102,0.4);
}

nav a:active {
    background: #ffc233; /* For mobile tap */
    transform: translateY(0);
}

/* ===== SECTION OFFSET FOR FIXED HEADER ===== */
section {
    scroll-margin-top: 100px;
}

/* ===== BACK BUTTON ===== */
.back-button {
    text-align: center;
    margin: 30px 0 20px;
    padding-top: 20px;
}

.back-button a {
    display: inline-block;
    padding: 12px 30px;
    background: #ffd166;
    color: #1a3b5c;
    font-weight: bold;
    border-radius: 30px;
    text-decoration: none;
    transition: all 0.3s;
    border: 2px solid #ffd166;
    -webkit-tap-highlight-color: transparent; /* Remove default tap highlight */
}

.back-button a:hover {
    background: #ffc233;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255,209,102,0.4);
    border-color: #ffffff;
}

.back-button a:active {
    background: #ffb300; /* Darker yellow for tap feedback */
    transform: translateY(0);
}

/* ===== HERO ===== */
.hero {
    min-height: auto;
    padding: 40px 20px 50px;
    background: linear-gradient(135deg, rgba(26,59,92,0.85) 0%, rgba(15,44,68,0.9) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-top: 70px; /* Add space below fixed header */
    width: 100%;
}

.training-hero {
    margin-top: 20px; /* Adjusted because back button is now above */
}

.hero-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 15px;
}

.hero .button {
    display: inline-block;
    padding: 16px 45px;
    background: #ffd166;
    color: #1a3b5c;
    font-weight: bold;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s;
    font-size: clamp(1rem, 3vw, 1.2rem);
    box-shadow: 0 8px 20px rgba(255,209,102,0.3);
    border: 2px solid #ffd166;
}

.hero .button:hover {
    background: #ffc233;
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(255,209,102,0.5);
    border-color: #ffffff;
}

.hero .button:active {
    transform: translateY(-2px);
}

/* ===== ABOUT US ===== */
.about-us {
    padding: 50px 0 30px;
    background: linear-gradient(135deg, #2c4b6e 0%, #1e3b59 100%);
}

.badge {
    text-align: center;
    margin-bottom: 20px;
}

.badge-item {
    display: inline-block;
    padding: 10px 20px;
    margin: 0 20px;
}

.badge-item p {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    font-weight: bold;
    color: #e6eef5;
    margin-top: 5px;
}

/* ===== CLIMATE RISK IMAGE SECTION ===== */
.climate-risk-image {
    padding: 10px 0 30px;
    background: linear-gradient(135deg, #2c4b6e 0%, #1e3b59 100%);
}

.climate-risk-image .image-wrapper {
    text-align: center;
    margin: 0 auto;
    max-width: 1200px;
}

.climate-risk-image img {
    width: 100%;
    max-width: 1100px;
    height: auto;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    border: 4px solid #ffd166;
    transition: transform 0.5s;
}

.climate-risk-image img:hover {
    transform: scale(1.02);
}

/* ===== SERVICES ===== */
.services {
    padding: 40px 0 50px;
    background: linear-gradient(135deg, #1e3b59 0%, #12304b 100%);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.service-card {
    background: linear-gradient(135deg, #ffffff 0%, #f5f9ff 100%);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s;
    border: 2px solid #ffd166;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 45px rgba(255,209,102,0.4);
    border-color: #ffffff;
}

.card-image-container {
    width: 100%;
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a3b5c;
    border-bottom: 4px solid #ffd166;
}

.card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.6s;
}

.service-card:hover .card-image-container img {
    transform: scale(1.1);
}

.card-content {
    padding: 25px;
    flex-grow: 1;
    background: linear-gradient(135deg, #ffffff 0%, #f5f9ff 100%);
}

.card-content h3 {
    color: #1a3b5c;
    font-size: clamp(1.2rem, 3vw, 1.4rem);
    margin-bottom: 15px;
    border-left: 4px solid #ffd166;
    padding-left: 15px;
}

.card-content p {
    color: #2c4b6e;
    line-height: 1.6;
    font-size: clamp(0.9rem, 2.5vw, 0.95rem);
}

/* ===== CONTACT SECTION ===== */
.contact {
    padding: 50px 0;
    text-align: center;
    background: linear-gradient(135deg, #2c4b6e 0%, #1e3b59 100%);
}

.contact-info {
    max-width: 700px;
    margin: 0 auto;
    background: linear-gradient(135deg, #3a6085 0%, #2a4a70 100%);
    padding: clamp(30px, 5vw, 50px);
    border-radius: 30px;
    border: 3px solid #ffd166;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.contact-info p {
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    margin: 15px 0;
    color: #ffffff;
    word-break: break-word; /* Prevent overflow on mobile */
}

.contact-info .email, .contact-info .web {
    color: #ffd166;
    font-weight: bold;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
}

/* ===== BOTTOM BRAND ===== */
.bottom-brand {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #0a1f30 0%, #051525 100%);
    border-top: 4px solid #ffd166;
}

.bottom-brand img {
    max-width: min(400px, 90%);
    width: 100%;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border: 3px solid #ffd166;
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 20px;
    background: #030c14;
    color: #b0c9e0;
    font-size: clamp(0.8rem, 2.5vw, 0.95rem);
    border-top: 1px solid #ffd166;
    word-break: break-word;
}

/* ===== CLIMATE PAGE SPECIFIC ===== */
.climate-hero {
    background: linear-gradient(135deg, rgba(26,59,92,0.85) 0%, rgba(15,44,68,0.9) 100%), url('https://images.unsplash.com/photo-1536242918817-d9008cc5ec9a?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: scroll; /* Fixed to scroll for mobile performance */
}

.climate-section {
    padding: 50px 0;
    background: linear-gradient(135deg, #1e3b59 0%, #12304b 100%);
}

.climate-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-top: 30px;
}

.climate-card {
    background: linear-gradient(135deg, #3a6085 0%, #2a4a70 100%);
    border-radius: 20px;
    padding: 30px;
    border: 2px solid #ffd166;
    transition: transform 0.3s;
}

.climate-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 30px rgba(255,209,102,0.3);
}

.climate-card h3 {
    color: #ffd166;
    font-size: clamp(1.3rem, 4vw, 1.6rem);
    margin-bottom: 20px;
    border-bottom: 2px solid #ffd166;
    padding-bottom: 10px;
}

.climate-card p {
    color: #ffffff;
    line-height: 1.7;
    margin-bottom: 15px;
    font-size: clamp(0.95rem, 2.5vw, 1rem);
}

.un-quote {
    background: rgba(255,255,255,0.1);
    border-left: 4px solid #ffd166;
    padding: 20px;
    margin: 20px 0;
    font-style: italic;
    border-radius: 0 10px 10px 0;
}

.un-quote p {
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    color: #ffffff;
}

.un-quote p:last-child {
    color: #ffd166;
    margin-top: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: rgba(255,209,102,0.1);
    border-radius: 10px;
}

.stat-number {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: bold;
    color: #ffd166;
}

.stat-label {
    color: #ffffff;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
}

/* ===== TRAINING GRID ===== */
.training {
    padding: 50px 0;
    background: linear-gradient(135deg, #2c4b6e 0%, #1e3b59 100%);
}

.training-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
}

.training-card {
    background: linear-gradient(135deg, #ffffff 0%, #f5f9ff 100%);
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid #ffd166;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.training-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 30px rgba(255,209,102,0.3);
    border-color: #ffffff;
}

.training-image {
    width: 100%;
    height: 140px;
    overflow: hidden;
    border-bottom: 3px solid #ffd166;
}

.training-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s;
}

.training-card:hover .training-image img {
    transform: scale(1.1);
}

.training-title {
    padding: 15px 10px;
    text-align: center;
    background: #ffffff;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.training-title h4 {
    color: #1a3b5c;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== AUDIENCE GRID ===== */
.audience {
    padding: 50px 0;
    background: linear-gradient(135deg, #1e3b59 0%, #12304b 100%);
}

.audience-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
}

.audience-item {
    background: linear-gradient(135deg, #3a6085 0%, #2a4a70 100%);
    padding: 30px 20px;
    text-align: center;
    border-radius: 20px;
    border: 2px solid #ffd166;
    transition: all 0.3s;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.audience-item:hover {
    border-color: #ffffff;
    transform: translateY(-10px);
    box-shadow: 0 20px 30px rgba(255,209,102,0.3);
}

.audience-icon {
    font-size: clamp(2rem, 6vw, 3rem);
    margin-bottom: 15px;
    background: #ffd166;
    color: #1a3b5c;
    width: clamp(60px, 15vw, 80px);
    height: clamp(60px, 15vw, 80px);
    line-height: clamp(60px, 15vw, 80px);
    border-radius: 50%;
    margin: 0 auto 20px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.audience-item h4 {
    color: #ffd166;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
}

/* ===== FIREFOX, SAFARI, CHROME CROSS-BROWSER FIXES ===== */
@-moz-document url-prefix() {
    /* Firefox-specific fixes */
    .hero {
        padding-top: 40px;
        padding-bottom: 50px;
    }
    
    .training-card {
        /* Fix for Firefox card heights */
        height: 100%;
    }
}

/* Safari-specific fixes */
@media not all and (min-resolution:.001dpcm) { 
    @supports (-webkit-appearance:none) {
        .training-card {
            -webkit-transform: translateZ(0); /* Fix for Safari rendering */
        }
    }
}

/* Chrome-specific fixes */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    /* Chrome 29+ */
    .service-card {
        -webkit-backface-visibility: hidden;
    }
}

/* ===== RESPONSIVE MEDIA QUERIES ===== */
/* Tablets and small desktops */
@media (max-width: 1024px) {
    .training-grid,
    .audience-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .cards-grid,
    .climate-grid,
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .training-grid,
    .audience-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .logo-image {
        height: 60px;
    }
}

/* Mobile landscape and small tablets */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        padding: 10px 20px;
    }
    
    .logo-container {
        justify-content: center;
        gap: 10px;
    }
    
    nav {
        justify-content: center;
        width: 100%;
    }
    
    nav a {
        margin: 0 8px;
        padding: 6px 10px;
        font-size: 0.9rem;
    }
    
    .hero {
        margin-top: 110px;
    }
    
    .training-hero {
        margin-top: 60px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .climate-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile portrait */
@media (max-width: 600px) {
    .cards-grid,
    .training-grid,
    .audience-grid,
    .climate-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    header {
        position: relative; /* Changed from fixed for very small screens */
        margin-bottom: 10px;
    }
    
    .hero {
        margin-top: 0; /* Reset since header is now relative */
        padding: 30px 15px;
    }
    
    .training-hero {
        margin-top: 0;
    }
    
    .logo-container {
        margin-bottom: 5px;
    }
    
    .logo-image {
        height: 50px;
    }
    
    nav {
        flex-wrap: wrap;
    }
    
    nav a {
        margin: 5px;
        padding: 8px 12px;
        font-size: 0.9rem;
        background: rgba(255,255,255,0.1);
    }
    
    .badge-item {
        display: block;
        margin: 10px auto;
        max-width: 300px;
    }
    
    .climate-card {
        padding: 20px;
    }
    
    .un-quote p {
        font-size: 1.1rem;
    }
    
    .contact-info {
        padding: 30px 15px;
    }
    
    .contact-info .email,
    .contact-info .web {
        font-size: 1.2rem;
        word-break: break-all;
    }
    
    .back-button a {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    
    /* Improve touch targets on mobile */
    .service-card,
    .climate-card,
    .training-card,
    .audience-item,
    nav a,
    .back-button a,
    .button {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(255,209,102,0.3);
    }
}

/* Very small mobile devices */
@media (max-width: 380px) {
    h2 {
        font-size: 1.5rem;
    }
    
    .logo-text {
        font-size: 16px;
    }
    
    .logo-image {
        height: 40px;
    }
    
    nav a {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .contact-info .email,
    .contact-info .web {
        font-size: 1rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .service-card:hover,
    .climate-card:hover,
    .training-card:hover,
    .audience-item:hover {
        transform: none;
    }
    
    .service-card:active,
    .climate-card:active,
    .training-card:active,
    .audience-item:active {
        transform: scale(0.98);
    }
    
    nav a:active {
        background: #ffd166;
        color: #1a3b5c;
    }
}

/* High-resolution screens */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }
    
    h2 {
        font-size: 2.5rem;
    }
}

/* Print styles */
@media print {
    header,
    .back-button,
    .hero,
    .contact,
    .bottom-brand,
    footer {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .container {
        max-width: 100%;
    }
}

/* Smooth scrolling for all browsers */
html {
    scroll-padding-top: 100px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}