/* การแก้ไขเพื่อป้องกันการทับซ้อนขององค์ประกอบต่างๆ */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Custom properties for colors and fonts */
:root {
    --primary-color: #007bff; /* Blue */
    --secondary-color: #6c757d; /* Gray */
    --light-bg-color: #f4f7f9;
    --card-bg-color: #ffffff;
    --text-color: #343a40;
    --link-hover-color: #0056b3;
    --border-color: #e9ecef;
    --gradient-start: #007bff;
    --gradient-end: #0056b3;
}

/* Base Styles */
body {
    font-family: 'Sarabun', sans-serif;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Typography */
.chonburi-regular {
    font-family: 'Chonburi', cursive;
}

.koho-regular {
    font-family: 'KoHo', sans-serif;
}

/* Header */
.header {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2rem 0;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.site-title {
    font-size: 2.5rem;
    color: var(--gradient-end);
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.site-subtitle {
    font-size: 2.5rem;
    color: var(--text-color);
    margin-top: 0.5rem;
}

/* Navigation */
.navbar {
  background-color: var(--gradient-start);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.navbar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

.navbar li a {
  display: block;
  color: #fff;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  transition: background-color 0.3s ease, transform 0.2s ease;
  font-weight: 500;
}

.navbar li a:hover {
  background-color: var(--link-hover-color);
  transform: translateY(-2px);
}

/* Main Content and Card */
.main-content {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem 0;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem; /* กำหนดช่องว่างทั้งแนวนอนและแนวตั้ง */
    justify-items: center;
    align-items: stretch;
}

.announcement-card {
    background-color: var(--card-bg-color);
    border: none;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    padding: 3rem;
    text-align: center;
    width: 100%;
    animation: fadeInScale 0.8s ease-out forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.card-title {
    font-size: 2.5rem;
    color: var(--gradient-end);
    margin-top: 0;
    margin-bottom: 1rem;
}

.card-description {
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin-bottom: 2.5rem;
    font-weight: 300;
}

.btn-primary {
    display: inline-block;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: bold;
    text-decoration: none;
    color: #fff;
    background: var(--gradient-end);
    border-radius: 50px;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
    background: #003d7a;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Footer */
.footer {
    background-color: #212529;
    color: #f8f9fa;
    padding: 1.5rem 0;
    text-align: center;
    margin-top: auto;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .site-title {
        font-size: 2rem;
    }

    .site-subtitle {
        font-size: 2rem;
    }

    .card-title {
        font-size: 2rem;
    }

    .announcement-card {
        padding: 2rem;
    }

    .navbar ul {
        flex-direction: column;
        align-items: center;
    }

    .navbar li a {
        padding: 0.5rem 1rem;
    }
    
    .card-grid {
        grid-template-columns: 1fr; /* บังคับให้เป็น 1 คอลัมน์บนมือถือ */
    }
}