/* Animations */
@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.8s ease-out forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.8s ease-out forwards;
}

.animate-delay-1 { animation-delay: 0.2s; opacity: 0; }
.animate-delay-2 { animation-delay: 0.4s; opacity: 0; }
.animate-delay-3 { animation-delay: 0.6s; opacity: 0; }
.animate-delay-4 { animation-delay: 0.8s; opacity: 0; }
.animate-delay-5 { animation-delay: 1.0s; opacity: 0; }
.animate-delay-6 { animation-delay: 1.2s; opacity: 0; }

/* Hover effects */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

main {
    width: 1000px;
    margin: 4rem auto 0;
    padding: 30px;
    background: #ffffff;
    color: #1a1a1a;
    line-height: 1.55;
}

/***************************************** breadcrumbs section ******************************************/
.breadcrumbs {
    font-size: 14px;
    margin: 20px 0;
    padding-bottom: 18px;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(to right, #2563eb, #60a5fa, #2563eb) 1;
    color: #555;
}

.breadcrumbs a {
    color: #0b3d91;
    text-decoration: none;
    margin: 0 6px;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs span {
    color: #333;
    margin-left: 5px;
    cursor: default;
}

/***************************************** Introduction section ******************************************/
.intro-section {
    text-align: center;
    margin-bottom: 1rem;
}

.intro-section h1 {
    font-size: 30px;
    margin-bottom: 12px;
    font-weight: 700;
    color: #0b3d91;
}

.intro-section p {
    color: #333;
    font-size: 16px;
    margin: 0 auto;
    max-width: 750px;
    line-height: 1.6;
}

/***************************************** Topbar section ******************************************/
.topbar-section {
    position: relative;
    background: #eef6ff;
    border: 1px solid #dce7f9;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-bottom: 1.2rem;
    box-shadow: 0 6px 20px rgba(11,61,145,0.04);
    transition: all 0.2s ease;
}

.topbar-section::before {
    content: "";
    display: block;
    width: 60%;
    height: 3px;
    margin: 0 auto 16px;
    background: linear-gradient(to right, #2563eb, #60a5fa, #2563eb);
    border-radius: 50px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #0b3d91;
}

.stats .stat { 
    display: flex; 
    align-items: center; 
    gap: 6px; 
}

.stats i { 
    width: 16px; 
    height: 16px; 
}

.tagline {
    font-size: 14px;
    font-style: italic;
    color: #0b3d91;
    margin: 0;
}

/***************************************** Filters section ******************************************/
.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 28px 0 22px;
    gap: 10px;
}

.sort, .card-views {
    padding: 8px 12px;
    border-radius: 12px;
    background: #eef6ff;
    border: 1px solid #c7daf9;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.sort:hover, .card-views:hover{
    background: #dce7f9;
}

.sort select, .card-views select{
    background: transparent;
    border: 0;
    color: #0b3d91;
    font-size: 14px;
    padding: 4px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 7px 12px;
    border-radius: 18px;
    background: #eef6ff;
    border: 1px solid #c7daf9;
    color: #0b3d91;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip:hover {
    background: #dce7f9;
}

.chip input {
    display: none;
}

.chip:has(input:checked) {
    background: #0b3d91;
    border-color: #0b3d91;
    color: #fff;
}

select:focus,
input:focus {
    outline: none;   /* ตัดเส้นดำๆออก */
    box-shadow: none; /* กันไม่ให้มีเงารอบๆ */
}

/***************************************** Card section ******************************************/
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 20px;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.card header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.title-wrap {
    flex: 1;
    min-width: 0;
    margin-right: 8px;
}

.title {
    display: -webkit-box; 
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical; 
    overflow: hidden;
}

.title a{
    text-decoration: none;
    color: #0b3d91; 
    font-size: 16px;
    font-weight: 700;
}

.title a:hover{
    text-decoration: underline;
}

.fav-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.2s ease;
}

.fav-btn:hover { 
    background: #fef3c7;
    border-color: #fbbf24;
    color: #d97706;
}

.meta {
    display: flex;
    gap: 8px;
    color: #6b7280;
    font-size: 13px;
    margin-top: 5px;
}

.meta span {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.desc {
    color: #555; 
    font-size: 14px; 
    line-height: 1.45; 
    margin-top: 6px;
    display: -webkit-box;
    -webkit-box-orient: vertical; 
    overflow: hidden; 
    text-overflow: ellipsis;
}

/* ถ้าชื่อการ์ด 2 บรรทัด */
.desc.clamp-4 {
    -webkit-line-clamp: 4;
    line-clamp: 4;
}

/* ถ้าชื่อการ์ด 1 บรรทัด */
.desc.clamp-5 {
    -webkit-line-clamp: 5;
    line-clamp: 5;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: -3px;
}

.foot {
    margin-top: auto;
}

.badge {
    padding: 5px 10px;
    border-radius: 50px;
    background: #eef6ff;
    border: 1px solid #c7daf9;
    font-size: 12px;
    color: #0b3d91;
    text-decoration: none;
    cursor: default;
    transition: all 0.2s ease;
}

.badge:hover{
    background: #dce7f9;
}

/***************************************** Pagination section ******************************************/
.pager {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
}

.pager a {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid #c7daf9;
    background: #e0ecffce;
    color: #0b3d91;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pager a:hover { 
    background: #dce7f9;
}

.pager a.active {
    background: #0b3d91;
    border-color: #0b3d91;
    color: #fff;
}