/* ══ REST ══ */
@font-face {
    font-family: 'Angsana New';
    src: url('../Angsana New/Angsana New.woff2') format('woff2'),
        url('../Angsana New/Angsana New.woff') format('woff'),
        url('../Angsana New/Angsana New.ttf') format('truetype'),
        url('../Angsana New/angsana.ttc') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Angsana New', 'Sarabun', 'Inter', -apple-system, sans-serif;
    font-size: 24px;
    /* Increased size for Angsana New readability */
    background-color: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* ══ HERO ══ */
.hero {
    position: relative;
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
    color: white;
    padding: 5rem 1rem 4rem;
    text-align: center;
    overflow: hidden;
}

.back-btn {
    position: absolute;
    top: 1.5rem;
    left: 2rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    backdrop-filter: blur(4px);
    transition: all 0.3s;
    font-weight: 500;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.hero-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 1rem;
    border-radius: 999px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(4px);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.hero h1 span {
    display: block;
    font-size: 1.5rem;
    font-weight: 500;
    opacity: 0.9;
    margin-top: 0.5rem;
}

.subtitle {
    font-size: 1.125rem;
    opacity: 0.8;
    margin-bottom: 2rem;
}

/* Search */
.search-wrap {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-wrap input {
    width: 100%;
    padding: 1rem 1.5rem 1rem 3rem;
    border-radius: 999px;
    border: none;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    outline: none;
    transition: box-shadow 0.3s;
}

.search-wrap input:focus {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

/* Hero Deco */
.hero-deco {
    position: absolute;
    font-size: 8rem;
    color: rgba(255, 255, 255, 0.05);
    user-select: none;
}

.hero-deco:nth-child(2) {
    top: 10%;
    left: 5%;
}

.hero-deco:nth-child(3) {
    top: 50%;
    right: 10%;
    font-size: 10rem;
}

.hero-deco:nth-child(4) {
    bottom: -10%;
    left: 20%;
    transform: rotate(15deg);
}

.hero-deco:nth-child(5) {
    top: 20%;
    right: 25%;
    font-size: 5rem;
}

/* ══ MAIN CONTAINER ══ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
}

.section-heading {
    text-align: center;
    margin-bottom: 3rem;
}

.section-heading h2 {
    font-size: 2rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.section-heading .line {
    width: 60px;
    height: 4px;
    background: #3b82f6;
    margin: 1rem auto 0;
    border-radius: 2px;
}

/* ══ GRID ══ */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

/* Cards */
.topic-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
}

.topic-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.topic-card.hidden {
    display: none !important;
}

.card-icon-wrap {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background-color: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.card-body {
    padding: 1.5rem;
    flex-grow: 1;
    position: relative;
}

.card-num {
    position: absolute;
    top: -1rem;
    right: 1.5rem;
    background: #3b82f6;
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.875rem;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

.card-title-en {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
}

.card-title-th {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 1rem;
}

/* Subtopics */
.card-sub-list {
    margin-top: 1rem;
    border-top: 1px dashed #e2e8f0;
    padding-top: 1rem;
}

.card-sub-list li {
    margin-bottom: 0.75rem;
}

.card-sub-list a {
    display: flex;
    align-items: center;
    color: #475569;
    font-size: 1.2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    background: linear-gradient(145deg, #ffffff, #f4f7f9);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03), inset 0 1px 0 rgba(255, 255, 255, 1);
}

.card-sub-list a::before {
    content: '▶';
    font-size: 0.8rem;
    margin-right: 0.6rem;
    color: #94a3b8;
    transition: all 0.3s;
}

.card-sub-list a:hover {
    background: linear-gradient(145deg, #ffffff, #eff6ff);
    border-color: #93c5fd;
    color: #1d4ed8;
    transform: translateY(-2px) translateX(3px);
    box-shadow: 0 8px 15px rgba(59, 130, 246, 0.12), 0 3px 6px rgba(59, 130, 246, 0.08);
}

.card-sub-list a:hover::before {
    color: #3b82f6;
    transform: scale(1.1);
}

.card-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
}

/* Color variations */
.c-blue .card-icon-wrap {
    background: #e0f2fe;
    color: #0284c7;
}

.c-blue .card-num {
    background: #0284c7;
}

.c-green .card-icon-wrap {
    background: #dcfce7;
    color: #16a34a;
}

.c-green .card-num {
    background: #16a34a;
}

.c-orange .card-icon-wrap {
    background: #ffedd5;
    color: #ea580c;
}

.c-orange .card-num {
    background: #ea580c;
}

.c-purple .card-icon-wrap {
    background: #f3e8ff;
    color: #9333ea;
}

.c-purple .card-num {
    background: #9333ea;
}

.c-teal .card-icon-wrap {
    background: #ccfbf1;
    color: #0d9488;
}

.c-teal .card-num {
    background: #0d9488;
}

.c-red .card-icon-wrap {
    background: #fee2e2;
    color: #dc2626;
}

.c-red .card-num {
    background: #dc2626;
}

/* No Results */
#no-results {
    display: none;
    text-align: center;
    padding: 4rem 1rem;
    font-size: 1.25rem;
    color: #64748b;
}

.no-icon {
    display: block;
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background: #0f172a;
    color: #94a3b8;
    font-size: 0.9rem;
}

footer strong {
    color: #f1f5f9;
}

/* Responsive */
@media (max-width: 640px) {
    .hero h1 {
        font-size: 2.25rem;
    }

    .hero span {
        font-size: 1.25rem;
    }

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