:root {
    --primary-green: #2d6a4f;
    --dark-green: #1b4332;
    --accent-orange: #d28b5c;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Sarabun', sans-serif;
}

body {
    background-color: #0f172a;
    color: white;
    overflow-x: hidden;
}

.landing-container {
    height: 100vh;
    width: 100%;
    background: linear-gradient(rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.85)), 
                url('/data/landing_bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 2vh 20px;
    overflow: hidden; /* Ensure no scrollbars */
}

.header-section {
    text-align: center;
    margin-bottom: 1vh;
    animation: fadeInDown 0.8s ease-out;
}

.doae-logo {
    width: clamp(80px, 15vh, 160px);
    margin-bottom: 0.5vh;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

.main-title {
    font-size: clamp(1.2rem, 4vh, 2.2rem);
    font-weight: 800;
    margin-bottom: 2px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.sub-title {
    font-size: clamp(0.7rem, 1.8vh, 1rem);
    font-weight: 400;
    color: #94a3b8;
    max-width: 700px;
    margin: 0 auto;
}

/* Card Grid */
.hazard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    grid-auto-rows: 1fr; /* Force all rows to take equal available space */
    gap: 20px;
    width: 100%;
    max-width: 1400px;
    flex: 1;
    padding: 10px 20px;
    margin-bottom: 1vh;
    min-height: 0; /* Allow grid to shrink */
}

.hazard-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    cursor: default;
    user-select: none;
    outline: none;
    min-height: 0; /* Important for flex/grid shrinking */
}

.hazard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.4s;
}

.hazard-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.08);
}

.hazard-card:hover::before {
    opacity: 1;
}

.hazard-icon {
    font-size: clamp(2rem, 5vh, 4rem); /* Responsive font size based on height */
    margin-bottom: 1vh;
}

.hazard-name {
    font-size: clamp(1rem, 2.2vh, 1.4rem);
    font-weight: 700;
    margin-bottom: 8px;
    white-space: nowrap;
}

.hazard-desc {
    font-size: clamp(0.7rem, 1.5vh, 1rem);
    color: #cbd5e1;
    margin-bottom: 0;
    line-height: 1.3;
    max-width: 90%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-fire {
    cursor: pointer;
}

.hazard-card.disabled {
    cursor: pointer;
    opacity: 0.9;
}

/* Watermark: อยู่ระหว่างพัฒนา */
.hazard-card.disabled::after {
    content: "อยู่ระหว่างพัฒนา";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 3rem; /* Enlarged to match */
    font-weight: 800;
    color: rgba(239, 68, 68, 0.3);
    white-space: nowrap;
    pointer-events: none;
    z-index: 5;
    text-transform: uppercase;
    letter-spacing: 4px;
    border: 4px solid rgba(239, 68, 68, 0.2);
    padding: 10px 30px;
    border-radius: 12px;
}


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

.landing-footer {
    width: 100%;
    padding: 1.5vh 0;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(5px);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    color: #94a3b8;
}

.footer-dept {
    font-size: 0.95rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 5px;
}

.footer-address {
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.footer-contact {
    font-size: 0.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.separator {
    color: #475569;
}

@media (max-width: 768px) {
    .landing-container { padding: 25px 10px; }
    .main-title { font-size: 1rem; margin-top: 5px; line-height: 1.4; }
    .sub-title { font-size: 0.75rem; padding: 0 15px; margin-bottom: 15px; }
    .doae-logo { width: 100px; }

    .hazard-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px;
        padding: 0 5px;
    }
    
    .hazard-card { padding: 12px 8px; border-radius: 12px; }
    .hazard-icon { font-size: 2.2rem; margin-bottom: 8px; }
    .hazard-name { font-size: 1rem; margin-bottom: 5px; }
    .hazard-desc { font-size: 0.65rem; line-height: 1.2; opacity: 0.9; }

    /* Footer adjustment */
    .footer-dept { font-size: 0.8rem; }
    .footer-address { font-size: 0.7rem; }
    .footer-contact { font-size: 0.65rem; gap: 8px; }

    /* Adjust watermark for mobile */
    .hazard-card.disabled::after {
        font-size: 1rem;
        padding: 4px 8px;
        border-width: 1.5px;
    }
}

/* Extra tight screens (Short Viewport) */
@media (max-height: 700px) {
    .hazard-grid { gap: 10px; }
    .hazard-card { padding: 10px; }
    .hazard-name { margin-bottom: 2px; }
}
