/* ==========================================================================
   HOMEPAGE SPECIFIC STYLES
   ========================================================================== */

/* ==========================================================================
   HOMEPAGE CONTAINER
   ========================================================================== */

.homepage-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ==========================================================================
   SLIDESHOW & TOP BLOCK
   ========================================================================== */

/* --- Slideshow --- */
.slideshow-a {
    width: calc(100% - 30px);
    margin: 10px 15px 15px;
}

/* --- Top Block Layout --- */
.top-block {
    margin-bottom: 30px;
}

.top-block-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* --- Slider Section --- */
.slider-section {
    flex: 2;
    min-width: 0;
    max-width: 880px;
}

/* ==========================================================================
   POPULAR SECTION
   ========================================================================== */

.popular-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    text-decoration: none;
}

/* --- Popular Item --- */
.popular-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    background-color: #fff;
    transition: background-color 0.3s ease;
}

.popular-item:hover {
    background-color: #f9f9f9;
}

.popular-item img {
    float: left;
    padding-right: 10px;
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    margin: 0;
}

.popular-item-title {
    height: auto;
    text-decoration: none;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 auto;
    color: #1f1d1d;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 1.1rem;
    line-height: 1.8em;
    font-weight: 400;
}

.popular-item-ad {
    min-width: 300px;
    min-height: 250px;
    max-width: 300px;
    max-height: 250px;
    margin: 0 auto;
    padding-bottom: 15px;
}

/* --- Popular Content Section --- */
.popular-content-section.design-image-layout-wrapper {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
    box-sizing: border-box;
}

.popular-content-scroll-wrapper {
    max-height: 550px;
    overflow-y: auto;
}

.no-popular-items {
    padding: 20px;
    text-align: center;
    color: #777;
}

/* ==========================================================================
   DESIGN IMAGE LAYOUT
   ========================================================================== */

.homepage-popular-items-container {
    /* Container styles */
}

/* --- Featured Image --- */
.design-image-featured {
    position: relative;
    line-height: 0;
    margin-bottom: 0;
}

.design-image-featured a {
    display: block;
    text-decoration: none;
}

.design-image-featured .featured-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: cover;
    aspect-ratio: 16 / 9;
    background-color: #e9e9e9;
}

.design-image-featured .default-img {
    /* Default image styles */
}

.design-image-featured .featured-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.7) 50%, transparent 100%);
    padding: 10px 12px;
    box-sizing: border-box;
}

.design-image-featured .featured-title-on-image {
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.35;
    margin: 0;
}

/* --- Image List --- */
.design-image-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.design-image-list .homepage-list-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 14px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
    line-height: 1.45;
transition: background-color 0.3s ease;
}

.design-image-list .homepage-list-item:hover {
    background-color: #f9f9f9;
}

.design-image-list .homepage-list-item:last-child {
    border-bottom: none;
}

.design-image-list .homepage-list-item a {
    text-decoration: none;
    color: #222222;
    display: block;
}

.design-image-list .homepage-list-item a:hover {
    color: #0073aa;
}

.design-image-list .homepage-list-item .list-item-link {
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    color: #222222;
    width: 100%;
}

.design-image-list .homepage-list-item .list-item-link:hover {
    color: #0073aa;
}

.design-image-list .homepage-list-item .list-item-thumbnail-wrapper {
    flex-shrink: 0;
    margin-right: 12px;
}

.design-image-list .homepage-list-item .list-item-thumbnail {
    width: 100px;
    height: 100px;
    object-fit: cover;
    background-color: #e9e9e9;
}

.design-image-list .homepage-list-item .list-item-text-wrapper {
    flex-grow: 1;
    max-height: 100px;
    overflow: hidden;
}

.design-image-list .homepage-list-item .list-item-text {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   LATEST SECTION
   ========================================================================== */

.latest-section {
    flex: 1;
    background: #fff;
    border-radius: 8px;
}

/* ==========================================================================
   CATEGORY ITEMS
   ========================================================================== */

.category-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.category-item {
    text-align: center;
    transition: transform 0.3s ease;
}

.category-item:hover {
    transform: translateY(-5px);
}

.category-img {
    width: 100%;
    object-fit: cover;
    margin-bottom: 10px;
    border-radius: 8px;
}

.category-title {
    height: auto;
    text-decoration: none;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 auto;
    color: #1f1d1d;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 1.1rem;
    line-height: 1.8em;
    font-weight: 400;
}

.more-articles {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
}

/* ==========================================================================
   HOMEPAGE TABS
   ========================================================================== */

.tab-wrap {
    width: 100%;
    margin: 0 auto;
    margin-bottom: 40px;
}

.tab-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
}

.tab {
    display: inline-block;
    flex-grow: 1;
    margin: 0 auto;
    padding: 10px 0;
    color: #000;
    font-weight: 700;
    text-align: center;
    vertical-align: bottom;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab:hover {
    background-color: #f0f0f0;
}

.tab h3,
.tab h4,
.tab h5,
.tab h6 {
    margin: 0;
}

.tab h3 {
    font-size: 1.1rem;
}

.tab.is-active {
    position: relative;
    background: #0273aa;
    color: #fff;
}

.tab.is-active::after {
    opacity: 1;
    position: absolute;
    bottom: -8px;
    left: 50%;
    width: 0;
    height: 0;
    margin-left: -8px;
    border-top: 8px solid #0273aa;
    border-right: 8px solid transparent;
    border-left: 8px solid transparent;
    content: "";
}

.panel-group {
    min-height: 100px;
}

.panel {
    display: none;
}

.panel.is-show {
    display: block;
    padding-top: 20px;
}

/* --- Tabs Block --- */
.tabs-block {
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 0;
}

.tabs-block a {
    text-decoration: none;
}

.tabs-section {
    flex: 3;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: height 0.3s ease;
}

/* --- Tabs Header --- */
.tabs-header-container {
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: #f7f7f7;
    border-bottom: 1px solid #ddd;
    padding: 10px;
}

.tabs-header {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.tabs-header::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 0 0 auto;
    padding: 10px 15px;
    cursor: pointer;
    border: none;
    background: #ddd;
    font-size: 14px;
    font-weight: 700;
    color: #333;
    text-align: center;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: #ccc;
}

.tab-btn.active {
    background-color: #0073aa;
    color: #fff;
}

.tabs-content {
    padding-top: 20px;
}

.tabs-content.hidden {
    display: none;
}

/* --- Scroll Buttons --- */
.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #333;
    transition: all 0.3s ease;
}

.scroll-btn.left {
    left: 5px;
}

.scroll-btn.right {
    right: 5px;
}

.scroll-btn:hover {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* ==========================================================================
   HOMEPAGE POST LIST ITEMS
   ========================================================================== */

.changeCard ul {
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 17px;
    margin-top: 20px;
}

li.changeItem.grid {
    width: 32%;
    margin-bottom: 5px;
}

li.changeItem.grid a {
    height: 100%;
    flex-direction: column;
    display: flex;
    text-decoration: none;
    transition: transform 0.3s ease;
}

li.changeItem.grid a:hover {
    transform: translateY(-5px);
}

.changeItemTxt .itemTitle {
    font-size: 1.1rem;
    line-height: 1.8em;
    font-weight: 400;
}

p.itemCat {
    position: absolute;
    left: 22px;
    top: 22px;
    background: #6bb6ff;
    color: #FFF;
    border-radius: 9999px;
    font-size: 0.7rem;
    padding: 4px 12px;
}

/* --- Postcard (Homepage Version) --- */
.postcard {
    margin: 0 0 1em;
}

.postcard a {
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    padding: 0;
    border: 1px solid #eee;
    background: #fff;
    text-decoration: none;
    transition: all 0.3s ease;
}

.postcard a:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.postcard_thumbnail {
    width: 38%;
    height: auto;
    margin-right: 3%;
    display: flex;
}

.postcard_thumbnail img {
    width: 100%;
    object-fit: cover;
}

.postcard_content {
    display: flex;
    flex-direction: column;
    justify-content: start;
    width: 56%;
}

.postcard_title h3 {
    display: -webkit-box;
    opacity: 0.9;
    padding-top: 0;
    padding-bottom: 7px;
    overflow: hidden;
    color: #1f1d1d;
    font-weight: 900;
    font-size: 1.3rem;
    line-height: 1.5;
    letter-spacing: 2px;
    text-decoration: none;
    text-align: left;
    text-overflow: ellipsis;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.postcard_description p {
    color: #565656;
    font-size: 90%;
}

.postcard_meta {
    color: #333;
    font-size: 12px;
    text-align: right;
}

/* ==========================================================================
   RESPONSIVE DESIGN - HOMEPAGE
   ========================================================================== */

/* --- Tablet Landscape (820px and below) --- */
@media (max-width: 820px) {
    .popular-content-section.design-image-layout-wrapper {
        display: none;
    }

    .top-block-container {
        flex-direction: column;
    }

    .slider-section {
        flex-basis: auto;
        width: 100%;
    }
}

/* --- Tablet Portrait (767px and below) --- */
@media screen and (max-width: 767px) {
    /* Article List Items */
    li.changeItem.grid {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    /* Postcard */
    .postcard {
        padding: 15px 0;
        margin: 0;
        border-bottom: 1px solid #eee;
    }

    .postcard a {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-content: center;
        padding: 0;
        border-radius: 2px;
        background: #fff;
        text-decoration: none;
        cursor: pointer;
        border: none;
    }

    .postcard_content {
        flex-direction: unset !important;
        width: 56% !important;
    }

    .postcard_title h3 {
        padding-left: 0;
        padding-right: 0;
        height: auto;
        text-decoration: none;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        margin: 0 auto;
        color: #666;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        font-size: 1rem;
        line-height: 1.8em;
        font-weight: 400;
    }

    .postcard_description p,
    .postcard_meta {
        display: none;
    }

    /* Latest Section */
    .latest-section {
        display: none;
    }

    .latest-img {
        margin-bottom: 0;
    }

    .latest-info {
        width: 100%;
    }

    /* Popular Buttons */
    .popular-buttons {
        flex-wrap: wrap;
        gap: 10px;
    }

    .popular-buttons a {
        flex: 1 1 calc(50% - 10px);
        text-align: center;
    }

    /* Block Layout */
    .slider-section,
    .popular-section {
        flex: 1 1 100%;
    }

    .popular-section {
        display: none;
    }

    .tabs-section {
        flex: unset;
    }

    /* Category Items */
    .category-items {
        grid-template-columns: 1fr;
    }

    .category-item {
        display: flex;
        gap: 15px;
        align-items: center;
        text-align: left;
        background-color: #fff;
        padding: 10px;
        border-radius: 8px;
    }

    .category-img {
        float: left;
        padding-right: 10px;
        width: 120px;
        height: 120px;
        object-fit: cover;
        margin: 0;
    }

    .category-title {
        padding-left: 0;
        padding-right: 0;
        height: auto;
        text-decoration: none;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        margin: 0 auto;
        color: #666;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        font-size: 1rem;
        line-height: 1.8em;
        font-weight: 400;
    }

    .popular-item {
        padding: 0;
        padding-top: 15px;
    }
}

/* --- Mobile Small (479px and below) --- */
@media (max-width: 479px) {
    li.changeItem.grid {
        width: 100%;
    }

    .slideshow-a {
        margin: 10px 0 15px;
        width: 100%;
    }
}

/* --- Mobile Medium (480px - 767px) --- */
@media (min-width: 480px) and (max-width: 767px) {
    li.changeItem.grid {
        width: 48%;
    }
}