*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0;
    padding: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    background: #f7f7f7;
    overflow-x: hidden;
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f7f7f7;
    background-image: linear-gradient(rgba(200, 200, 200, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(200, 200, 200, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: -1;
}

/* Language Toast */
.lang-toast {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff385c;
    color: #fff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 0.95rem;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.lang-toast a {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
}

.lang-toast button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

/* Navigation */
.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ff385c;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: #555;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.nav-links a:hover {
    background: #ff385c;
    color: #fff;
}

/* Page Layout */
.page-wrapper {
    display: flex;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding-bottom: 30px;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
    display: none;
}

@media (min-width: 1024px) {
    .sidebar {
        display: block;
    }
}

h1 {
    padding: 0;
    margin: 0;
}

/* Page Title */
.page-title {
    font-size: 1.1rem;
    text-align: left;
    color: #2c3e50;
    padding: 8px 0;
    margin: 10px 0;
}

.section-title {
    font-size: 1.4rem;
    color: #2c3e50;
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ff385c;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

@media (max-width: 640px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 641px) and (max-width: 1023px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Event Card */
.event-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid #eee;
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.card-image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #eee;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.4s ease;
}

.card-image-wrapper img.feed-image {
    opacity: 0;
}

.card-image-wrapper img.feed-image.loaded {
    opacity: 1;
}

.card-body {
    padding: 16px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 10px;
    line-height: 1.4;
}

.card-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-tag {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
}

.type-tag {
    color: #ff385c;
    font-weight: 500;
}

/* Ad Slots */
.ad-slot {
    margin: 24px 0;
    text-align: center;
    min-height: 90px;
    background: #f0f0f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ad-slot::before {
    content: "Advertisement";
    font-size: 0.75rem;
    color: #aaa;
    position: absolute;
}

.header-ad {
    max-width: 1400px;
    margin: 16px auto;
    min-height: 90px;
}

.sidebar-ad {
    position: sticky;
    top: 80px;
    min-height: 250px;
}

.footer-ad {
    max-width: 1400px;
    margin: 24px auto;
}

/* Events Section */
.events-section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ff385c;
}

.section-header .section-title {
    margin: 0;
    padding: 0;
    border: none;
}

.section-more {
    font-size: 0.9rem;
    color: #ff385c;
    text-decoration: none;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 4px;
    transition: background 0.2s;
}

.section-more:hover {
    background: #ff385c;
    color: #fff;
}

/* Feed Grid */
.feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    place-items: center;
}

@media (max-width: 768px) {
    .feed-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
        place-items: center;
    }
}

/* Horizontal Scroll Row */
.scroll-row {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ff385c #f0f0f0;
}

.scroll-row::-webkit-scrollbar {
    height: 6px;
}

.scroll-row::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.scroll-row::-webkit-scrollbar-thumb {
    background: #ff385c;
    border-radius: 3px;
}

.scroll-card {
    flex: 0 0 auto;
    width: 220px;
    scroll-snap-align: start;
}

.scroll-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.scroll-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 12px;
    overflow: hidden;
    background: #eee;
}

.scroll-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.scroll-card:hover .scroll-card-image img {
    transform: scale(1.05);
}

.scroll-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 12px 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 100%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.scroll-card:hover .scroll-card-overlay {
    opacity: 1;
}

.overlay-tag {
    font-size: 0.78rem;
    color: #fff;
    line-height: 1.3;
}

.overlay-tag.type-tag {
    font-weight: 600;
    color: #ffafbe;
}

@media (max-width: 768px) {
    .scroll-card {
        width: 160px;
    }

    .section-header {
        margin: 24px 0 12px;
    }

    .section-more {
        font-size: 0.8rem;
    }
}

/* Feed List (legacy article style) */
.feed-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    place-items: center;
}

.feed-list article {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    border: 2px solid #ffafbe;
}

.feed-list article>header {
    color: #ffffff;
    background-color: #ff385c;
}

.feed-list .feed-tags {
    padding: 0.5rem 1rem;
    border-bottom: 1px dashed #ff385c;
}

.feed-list .feed-tag {
    text-align: justify;
    font-size: 0.85rem;
    color: #313131;
    display: block;
}

.feed-list .feed-image {
    width: 100%;
    height: 0;
    display: block;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out, height 0.5s ease-in-out;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.feed-list .feed-image.loaded {
    visibility: visible;
    opacity: 1;
    animation: slide-in 0.5s ease-in-out;
    height: auto;
}

@keyframes slide-in {
    0% {
        transform: translateY(5px);
    }

    100% {
        transform: translateY(0);
    }
}

.feed-list .feed-title {
    margin: 0;
    padding: 1rem;
    font-size: 1rem;
    font-weight: bold;
    color: #f7f7f7;
    text-decoration: none;
}

.feed-list .feed-content {
    padding: 0.5rem 1rem;
    text-align: justify;
    font-size: 0.85rem;
    color: #313131;
}

.feed-list article>footer {
    color: #313131;
    padding: 0.5rem;
}

/* Detail Page */
.detail-container {
    max-width: 800px;
    margin: 10px auto;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    color: #ff385c;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.back-link:hover {
    text-decoration: underline;
}

.detail-header h1 {
    font-size: 2rem;
    color: #2c3e50;
    margin: 0 0 20px;
    line-height: 1.3;
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
    padding: 20px;
    background: #f8f8f8;
    border-radius: 10px;
}

.detail-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 0.8rem;
    color: #888;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-value {
    font-size: 0.95rem;
    color: #333;
    font-weight: 500;
}

.detail-content {
    line-height: 1.8;
    font-size: 1rem;
    color: #444;
    margin-bottom: 28px;
    white-space: pre-line;
}

.detail-image-wrapper {
    text-align: center;
    margin: 24px 0;
}

.detail-image-wrapper img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 32px 0;
}

.pagination a {
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    background: #ff385c;
    color: #fff;
    font-weight: 500;
    transition: background 0.2s;
}

.pagination a:hover {
    background: #e02e4f;
}

.pagination span.current {
    padding: 10px 16px;
    background: #eee;
    color: #333;
    border-radius: 6px;
    font-weight: 500;
}

/* Site Footer */
.site-footer {
    text-align: center;
    padding: 24px;
    color: #888;
    font-size: 0.85rem;
    border-top: 1px solid #e0e0e0;
    margin-top: 24px;
}

.site-footer .langs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #676767;
}

a {
    text-decoration: none;
    color: #676767;
    cursor: pointer;
    transition: color 0.3s ease-in-out;
}
a:hover {
    color: #0469c8;
}
/* Mobile Adjustments */
@media (max-width: 768px) {
    .site-nav {
        padding: 10px 16px;
    }

    .nav-brand a {
        font-size: 1.1rem;
    }

    .nav-links {
        gap: 12px;
    }

    .nav-links a {
        font-size: 0.8rem;
        padding: 3px 6px;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .page-wrapper {
        gap: 14px;
        padding: 10px;
    }


    .section-title {
        font-size: 1.15rem;
    }

    .card-grid {
        gap: 16px;
    }

    .card-body {
        padding: 12px;
    }

    .card-title {
        font-size: 0.95rem;
    }

    .ad-slot {
        margin: 16px 0;
    }
}
