/*
 * D2 Post Index – Frontend Styles
 * Version: 1.0.0
 * Brand: Digital2 ApS — #292929 | #fc8902 | Montserrat Bold
 *
 * Override af DIVI's generiske layout — pluginets styles har
 * meget høj specificitet for at sikre korrekt visning.
 */

/* =========================================================
   RESET & WRAPPER
   ========================================================= */

#d2pi-wrapper,
#d2pi-wrapper * {
    box-sizing: border-box;
}

#d2pi-wrapper {
    width: 100%;
    background: #ffffff;
    padding: 0;
    margin: 0;
    font-family: 'Open Sans', Arial, sans-serif;
    color: #292929;
}

/* Fjern DIVI-specifik padding/margin fra outer row */
#d2pi-wrapper .et_pb_section,
#d2pi-wrapper .et_pb_row,
#d2pi-wrapper .et_pb_column {
    padding: 0 !important;
    margin: 0 !important;
}

.d2pi-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

/* =========================================================
   HEADER
   ========================================================= */

.d2pi-list-header {
    margin-bottom: 36px;
    border-bottom: 2px solid #fc8902;
    padding-bottom: 16px;
}

.d2pi-list-header__title {
    font-family: 'Montserrat', 'Open Sans', Arial, sans-serif;
    font-weight: 700;
    font-size: 28px;
    color: #292929;
    margin: 0 0 8px 0;
    padding: 0;
    line-height: 1.2;
}

.d2pi-list-header__desc {
    color: #666;
    font-size: 15px;
    margin: 0;
    line-height: 1.5;
}

/* =========================================================
   LISTE
   ========================================================= */

.d2pi-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* =========================================================
   LISTEELEMENT
   ========================================================= */

.d2pi-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
    padding: 28px 0;
    border-bottom: 1px solid #e8e8e8;
    text-decoration: none;
    transition: background 0.15s ease;
}

.d2pi-item:first-child {
    border-top: 1px solid #e8e8e8;
}

/* ─── Thumbnail ─── */

.d2pi-item__thumb {
    flex: 0 0 160px;
    width: 160px;
    height: 120px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.d2pi-item__thumb a {
    display: block;
    width: 100%;
    height: 100%;
}

.d2pi-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    transition: opacity 0.2s ease;
}

.d2pi-item__thumb--empty {
    /* Placeholder når ingen thumbnail */
    background: #f0f0f0;
    position: relative;
}

.d2pi-item__thumb--empty::after {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    background: #ddd;
    border-radius: 4px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ─── Body ─── */

.d2pi-item__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ─── Titel ─── */

.d2pi-item__title {
    font-family: 'Montserrat', 'Open Sans', Arial, sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: #292929;
    margin: 0;
    padding: 0;
    line-height: 1.25;
}

.d2pi-item__title a {
    color: #292929;
    text-decoration: none;
    transition: color 0.15s ease;
}

.d2pi-item__title a:hover {
    color: #fc8902;
}

/* ─── Excerpt ─── */

.d2pi-item__excerpt {
    font-size: 14px;
    line-height: 1.65;
    color: #555;
    margin: 0;
}

.d2pi-item__excerpt p {
    margin: 0;
}

/* ─── Læs mere ─── */

.d2pi-item__read-more {
    display: inline-block;
    color: #fc8902;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 4px;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

.d2pi-item__read-more:hover {
    color: #d97200;
    text-decoration: underline;
}

/* =========================================================
   INGEN INDLÆG
   ========================================================= */

.d2pi-no-posts {
    padding: 40px 0;
    color: #888;
    font-size: 15px;
    text-align: center;
}

/* =========================================================
   PAGINATION
   ========================================================= */

.d2pi-pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}

.d2pi-pagination .page-numbers {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.d2pi-pagination .page-numbers li {
    margin: 0;
    padding: 0;
}

.d2pi-pagination .page-numbers a,
.d2pi-pagination .page-numbers span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #292929;
    background: #fff;
    text-decoration: none;
    transition: all 0.15s ease;
}

.d2pi-pagination .page-numbers a:hover {
    border-color: #fc8902;
    color: #fc8902;
    background: #fff8f0;
}

.d2pi-pagination .page-numbers .current {
    background: #fc8902;
    border-color: #fc8902;
    color: #fff;
}

.d2pi-pagination .page-numbers .dots {
    border-color: transparent;
    background: transparent;
    color: #888;
}

/* =========================================================
   TAXONOMY CLOUD — /tag/ og /category/
   ========================================================= */

.d2pi-taxonomy-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.d2pi-taxonomy-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    color: #292929;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.d2pi-taxonomy-pill:hover {
    background: #fc8902;
    border-color: #fc8902;
    color: #fff;
}

.d2pi-taxonomy-pill:hover .d2pi-taxonomy-pill__count {
    background: rgba(255,255,255,0.3);
    color: #fff;
}

.d2pi-taxonomy-pill__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: #e0e0e0;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: #555;
    transition: all 0.15s ease;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media ( max-width: 640px ) {
    .d2pi-container {
        padding: 24px 16px 40px;
    }

    .d2pi-item {
        flex-direction: column;
        gap: 16px;
        padding: 20px 0;
    }

    .d2pi-item__thumb {
        flex: 0 0 auto;
        width: 100%;
        height: 180px;
    }

    .d2pi-item__thumb img {
        object-fit: cover;
    }

    .d2pi-list-header__title {
        font-size: 22px;
    }

    .d2pi-item__title {
        font-size: 17px;
    }
}

@media ( max-width: 480px ) {
    .d2pi-item__thumb {
        height: 140px;
    }
}

/* =========================================================
   DIVI OVERRIDE — FJERN UNØDIG SPACING
   Targets DIVI's typiske wrappers når de er parent til #d2pi-wrapper
   ========================================================= */

.et_pb_section:has( #d2pi-wrapper ),
.et_pb_row:has( #d2pi-wrapper ),
.et_pb_column:has( #d2pi-wrapper ) {
    padding: 0 !important;
    margin: 0 !important;
}

/* Fjern standard WP/DIVI single-post styling på liste-sider */
body.d2pi-active .et_post_meta_wrapper,
body.d2pi-active .entry-header,
body.d2pi-active .post-header,
body.d2pi-active .entry-content > *:not( #d2pi-wrapper ) {
    display: none !important;
}
