/* -------------------------------------------
    Blog
        1. Base Style
        2. Post Media
        3. Post Date
        4. Post Details
        5. Post Title
        6. Post Content
        7. Post Meta
        8. Post Cats
        9. Post Calendar
        10. Post Type
            - Default Type
            - Classic Type
            - Modern Type
            - Categorized Type
            - List Type
            - Widget Type
            - Boxed Type
            - Border Type
            - Mask Type
            - Intro Type
---------------------------------------------- */

@import '../../../assets/sass/config';
@import '../../../assets/sass/direction';
@import '../../../assets/sass/mixins';

%post-shadow {
    box-shadow: 0 5px 20px rgba(0, 0, 0, .07);
}

%post-media-radius-inherit {
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

// 1. Base Style
.posts {
    .wp-video-shortcode {
        max-width: 100%;
        height: auto;
    }

    .post-meta {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        margin-bottom: .4rem;
    }
}

.post {
    &.sticky .post-title::after {
        content: 'Sticky';
    }

    &.format-video .post-title::after {
        content: 'Video';
    }

    &.sticky,
    &.format-video {
        .post-title::after {
            position: relative;
            top: -10px;
            padding: 0 4px;
            margin-#{$left}: 5px;
            border-radius: 2px;
            color: var(--alpha-white-color);
            background-color: var(--alpha-primary-color);
            font-size: .5em;
            font-weight: 400;
            letter-spacing: 0;
        }
    }
}

.single-post .main-content-wrap.row {
    margin-top: calc(-1 * var(--alpha-gap) - 1.8rem);
}

.post-wrap {
    >article {
        position: relative;
        background-color: var(--alpha-change-color-light-1);
    }

    // .post-meta {
    //     > a {
    //         font-size: 1.3rem;
    //     }
    // }
    .post-author {
        margin-#{$right}: auto;

        a {
            margin-#{$left}: 5px;
            text-transform: capitalize;
            color: var(--alpha-change-color-dark-1);
        }

        figure {
            display: inline-block;
            margin-#{$right}: .7rem !important;

            &:after {
                display: none;
            }
        }
    }

    .post .post-author {
        display: inline-flex;
        align-items: center;
    }

    .post-widget .post-author a {
        margin-#{$left}: 2px;
    }

    .vote-link {
        margin-#{$right}: 1.5rem;
    }

    .vote-link,
    .comments-link {
        color: var(--alpha-change-color-dark-1);
    }

    .post-calendar {
        min-width: 4.7rem;
    }

    .post-cats {
        position: absolute;
        #{$right}: 2rem;
        top: 2rem;
        z-index: 1;

        >a {
            display: inline-block;
            padding: 3px 10px;
            color: $white-color;
            background: rgba(red($dark-color), green($dark-color), blue($dark-color), .8);
            transition: background-color .3s, color .3s;

            +a {
                margin-#{$left}: 5px;
            }

            &:hover,
            &:focus {
                color: $white-color;
                background: var(--alpha-primary-color-hover);
            }
        }
    }

    .sidebar & .post-cats>a {
        color: $white-color;

        &:hover {
            color: $white-color;
        }
    }
}

.post-details> :last-child,
.post-content> :last-child,
.author-content> :last-child {
    margin-bottom: 0;
}

// 2. Post Media
.post-media,
.post-media>a,
.post-media img {
    border-radius: inherit;
}

.post-media {
    position: relative;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;

    img {
        display: block;
        width: 100%;
    }

    .slider-pagination {
        bottom: 2.5rem;

        .slider-pagination-bullet {
            span {
                border-color: var(--alpha-white-color);
                background-color: transparent;
            }

            &:hover span {
                border-color: var(--alpha-white-color);
                background-color: var(--alpha-white-color);
            }
        }
    }
}

// 3. Post Date
.post-date {
    display: inline-block;
    margin-bottom: .5rem;
    color: var(--alpha-body-color);
    font-size: 1.2rem;
}

// 4. Post Details
.post-details {
    padding: 2.1rem 3rem 2.9rem;
}

// 5. Post Title
.post-title {
    overflow: hidden;
    margin-bottom: 1.1rem;
    font-size: 1.8rem;
    line-height: 1.3;
    word-wrap: break-word;
    text-transform: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;

    a:hover,
    a:focus {
        color: var(--alpha-primary-color);
    }
}

// 6. Post Content
.post-content {
    margin-bottom: 1.1rem;
    line-height: 1.86;
}

// 7. Post Meta
.post-meta {
    color: var(--alpha-grey-color-light);

    .avatar {
        width: 3rem;
        height: 3rem;
        border-radius: 50%;
        object-fit: cover;
    }

    .comments-link,
    .vote-link {
        font-weight: 600;
        transition: color .3s, transform .3s;
    }

    .comments-link::before {
        content: '\e92e';
    }

    .vote-link {

        &.like::before {
            content: '\e936';
        }

        &.dislike::before {
            content: '\e902';
            color: var(--alpha-primary-color);
        }

        &:hover:before,
        &:focus:before {
            transform: rotateY(180deg);
        }
    }

    .comments-link:before,
    .vote-link::before {
        display: inline-block;
        margin-#{$right}: .8rem;
        vertical-align: middle;
        color: inherit;
        font-family: $framework-font;
        font-size: 1.16em;
        font-weight: 400;
        line-height: 1;
        margin-top: -2px;
        transition: transform .3s;
    }

    .post-author a:before {
        content: "\e9ac";
        display: inline-block;
        margin-#{$right}: .8rem;
        vertical-align: middle;
        font-family: $theme-font;
        line-height: 1;
        margin-top: -2px;
    }
}

.comments-link mark {
    background: none;
    color: inherit;
}

// 8. Post Cats
.post-cats {
    font-size: 1.2rem;
    line-height: 1.5;
    margin-bottom: .6rem;

    >a {
        color: var(--alpha-primary-color);

        &:hover {
            color: var(--alpha-primary-color-hover);
        }
    }
}

// 9. Post Calendar
.post-calendar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-flow: column;
    color: var(--alpha-change-color-dark-1);
    background: var(--alpha-change-color-light-1);
    line-height: 1;
    text-transform: uppercase;
    padding: 1rem;
    z-index: 1;

    .post-day {
        display: block;
        font-size: 1.8rem;
        font-weight: 600;
    }

    .post-month {
        font-size: 1.2rem;
        font-weight: 400;
    }
}

.post-cats-date {
    max-width: max-content;
    padding: .5rem 1.4rem;
    margin: 0 auto 2rem;
    border-radius: 3px;
    color: #fff;
    background: var(--alpha-primary-color);
    font-size: 1.2rem;

    .post & a {
        color: inherit;

        &:hover,
        &:focus {
            text-decoration: underline;
        }
    }
}

.post {
    .mejs-overlay-button {
        margin-top: -19px;
        background: none;
        border: 2px solid var(--alpha-white-color);
        border-radius: 50%;
        font-family: 'Font Awesome 5 Free';
        font-size: 1.8rem;
        font-weight: 600;
        color: var(--alpha-white-color);
        text-align: center;
        transition: background .3s, color .3s, box-shadow .3s, opacity .3s;

        &:hover {
            box-shadow: 0px 0px 0px 15px rgba(255, 255, 255, .2);
            background: var(--alpha-white-color);
            color: var(--alpha-primary-color);
        }

        &::before {
            content: '\f04b';
            margin-#{$left}: 4px;
        }

        .posts & {
            width: 5.6rem;
            height: 5.6rem;
            line-height: 5.2rem;
        }
    }

    .mejs-overlay-button,
    &.post-full .mejs-overlay-button {
        width: 6.8rem;
        height: 6.8rem;
        line-height: 6.4rem;
    }

    .post-wrap & .post-author a:before {
        content: none;
    }
}

// 10. Post Type

// Default Type
.post-default {
    @extend %post-shadow;
}

// Classic Type
.post-classic {
    .post-wrap & {
        background-color: transparent;
    }

    .post-details {
        padding: 2.5rem 0;
    }
}

// Modern Type
.post-modern {
    .post-wrap & {
        background-color: transparent;
    }

    figure {
        @extend %post-media-radius-inherit;
    }

    .post-details {
        position: relative;
        margin-left: 3rem;
        margin-right: 3rem;
        margin-top: -7rem;
        padding: side-values(2.5rem 3rem 2.2rem);
        background: var(--alpha-white-color);
        text-align: center;
        box-shadow: 1px 4px 2rem rgba(0, 0, 0, .05);
        border-radius: inherit;
        z-index: 1;
    }

    .post-title {
        margin-bottom: 1.7rem;
    }

    .post-date {
        margin: 0;
    }

    .post-date,
    .comments-link mark {
        color: var(--alpha-body-color);
        transition: color .3s;
    }

    .post-date:#{$after} {
        content: '|';
        margin: 0 .8rem;
        color: var(--alpha-body-color);
    }

    .post-meta {
        justify-content: center;
    }

    .post-meta>:not(:last-child):after {
        height: 1em;
    }

    .comments-link {
        color: var(--alpha-body-color);
        font-weight: 400;

        &:hover mark,
        &:focus mark {
            color: var(--alpha-primary-color);
        }

        &:before {
            content: none;
        }
    }
}

// Categorized Type
.post-categorized {
    @extend %post-shadow;

    .post-calendar {
        position: absolute;
        top: 2rem;
        #{$left}: 2rem;
    }
}

// List Type
.post-list {
    .post-calendar {
        position: absolute;
        top: 3.5rem;
        #{$left}: 3.5rem;
        color: $white-color;
        background: rgba(0, 0, 0, .5);
        transition: background .3s;

        &:hover {
            background: var(--alpha-primary-color);
        }
    }

    figure {
        display: flex;
        align-self: stretch;
        margin: 1.5rem;
        border-radius: 0;

        >a {
            width: 100%;
        }
    }

    img {
        object-fit: cover;
        height: 100%;
        min-height: 100%;
    }
}

@include mq(sm) {
    .post-list {
        display: flex;
        align-items: center;

        figure {
            flex: 0 0 50%;
        }

        .post-details {
            max-width: calc(50% - 4.5rem);
            padding: 2.5rem 1.5rem 1.5rem;
        }
    }
}

@include mq(sm, max) {
    .post-list {
        &.post {
            padding-top: 1.5rem;
        }

        figure {
            margin: 0 1.5rem;
        }
    }
}

// Widget Type
.post-widget {
    display: flex;
    align-items: center;

    .widget-posts & {
        margin-bottom: 3rem;

        figure {
            width: 9rem;
            flex: 0 0 9rem;

            @include mq(lg, max) {
                margin-#{$right}: 2rem;
            }
        }

        .post-details {
            width: calc(100% - 12rem);

            @include mq(lg, max) {
                width: calc(100% - 11rem);
            }
        }
    }

    .custom-footer & {
        figure {
            width: 6rem;
            flex: 0 0 6rem;
            height: 6rem;
            margin-#{$right}: 1.5rem;
        }

        .post-details {
            width: calc(100% - 7.5rem);
        }

        .post-author {
            display: none;
        }

        .post-title {
            font-size: 1.6rem;
            line-height: 1.2;
            margin-bottom: 4px;
        }
    }

    .post-wrap>& {
        background-color: transparent;
    }

    figure {
        border-radius: 0;
        width: 14rem;
        flex: 0 0 14rem;
        height: 9rem;
        margin-#{$right}: 3rem;
    }

    img {
        height: 100%;
        object-fit: cover;
    }

    .post-details {
        padding: 0;
        width: calc(100% - 17rem);
    }

    .post-date {
        margin-bottom: .3rem;
        font-size: 1.3rem;
        line-height: 1.4;
    }

    .post-title {
        margin-bottom: .3rem;
        font-size: 1.4rem;
        line-height: 1.6;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        white-space: normal;
        text-align: #{$left};
    }

    .post-author {
        font-size: 1.3rem;

        a {
            font-weight: 400;
        }
    }
}

// Boxed Type
.post-boxed {
    @extend %post-shadow;

    figure {
        border-radius: 0;
    }

    .posts .post-wrap &.post figure {
        margin: 0 1.5rem;
    }

    &.post {
        padding-top: 1.5rem;
    }

    .post-cats {
        position: absolute;
        top: 3.5rem;
        right: 3.5rem;
    }
}

// Border Type
.post-bordered {
    .post-details {
        border: 1px solid var(--alpha-change-border-color-light);
        border-radius: inherit;
    }

    .post-details:not(:first-child) {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-top: 0;
    }
}

// Mask Type
.post-mask {
    position: relative;

    figure {
        @extend %post-media-radius-inherit;
    }

    &::before {
        content: '';
        display: block;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 50%;
        background: linear-gradient(to bottom, rgba(125, 185, 232, 0) 0%, #000 100%);
        border-radius: inherit;
        opacity: .75;
        transition: all 0.3s;
        pointer-events: none;
        z-index: 1;
    }

    .post-details {
        position: absolute;
        padding: 0;
        left: 4rem;
        right: 4rem;
        bottom: 2.1rem;
        z-index: 2;

        a {
            color: var(--alpha-white-color);

            &:hover {
                color: var(--alpha-primary-color);
            }
        }
    }

    .post-meta {
        color: var(--alpha-white-color);
    }

    .post-meta a:hover {
        text-decoration: none;
    }

    .post-calendar {
        z-index: 3;
    }

    .post-title {
        white-space: normal;
        color: var(--alpha-white-color);
    }

    &:hover {
        .post-media a::before {
            opacity: .1;
        }
    }

    mark,
    .comments-link:hover mark {
        color: var(--alpha-white-color);
    }

    .post-details {
        transform: translateY(100%);
        will-change: transform;
        transition: transform .3s;
    }

    .post-meta-visible {
        position: absolute;
        bottom: 100%;
    }

    .post-meta {
        opacity: 0;
        transition: opacity .3s;
    }

    &:hover {
        .post-details {
            transform: translateY(0);
        }

        .post-meta:last-child {
            opacity: 1;
        }
    }
}

// Intro Type
.post-intro {
    @extend %post-shadow;
    text-align: center;

    .cols-lg-1 & {
        margin-bottom: 2rem;

        &:last-child {
            margin-bottom: 0;
        }
    }

    .post-cats-date {
        position: relative;
        transform: translateY(-1.5rem);
        margin-bottom: -1rem;
        z-index: 1;
    }

    .post-meta {
        display: block;
        margin-bottom: 1.6rem;
    }

    .post-title {
        margin-bottom: .6rem;
        letter-spacing: -.01em;
    }

    >.post-details {
        padding-bottom: 5.2rem;

        >.btn {
            display: block;
            max-width: max-content;
            margin: auto;
        }
    }

    .post-content {
        margin-bottom: 2.9rem;
    }

    &.post .post-author a:before {
        content: "\e9ac";
        display: inline-block;
        margin-#{$right}: .8rem;
        vertical-align: middle;
        font-family: $theme-font;
        line-height: 1;
        margin-top: -2px;
    }
}

.post-intro,
.post-single {

    .comments-link,
    .vote-link,
    .post-author a {
        font-weight: inherit;
        color: inherit;
        white-space: nowrap;
    }

    .post-meta {
        > :after {
            content: none;
        }

        > :not(:last-child) {
            margin-#{$right}: 2rem;
        }
    }
}

.post-list,
.post-categorized {
    .post-cats {
        position: static;

        >a {
            background-color: transparent;
            padding: 0;
            color: var(--alpha-primary-color);

            &:hover {
                background-color: transparent;
                color: var(--alpha-primary-color-hover);
            }
        }
    }
}

// Hover, Focus Style
.post-author a:hover,
.post-author a:focus,
.post-meta a:hover,
.post-meta a:focus {
    color: var(--alpha-primary-color);
}

// Recent comments sidebar widget
.sidebar {
    .wp-block-latest-comments {
        margin-bottom: -.8rem;
    }

    .wp-block-latest-comments__comment {
        margin-bottom: 1.3rem;
    }

    .wp-block-latest-comments__comment-link {
        display: block;
        margin-top: .8rem;
        color: var(--alpha-dark-color);
        font-weight: var(--alpha-heading-font-weight, 600);
        letter-spacing: -.01em;
        line-height: 1.3;
    }
}

// in grid item
.posts.grid:not(.masonry) {
    .post-wrap {
        margin-bottom: 0;
    }

    .post {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .post-media {
        flex: 1;
        height: 0;

        >a {
            display: block;
            height: 100%;
        }

        img {
            height: 100%;
        }
    }
}

.post-media-carousel .slider-pagination {
    bottom: 2.5rem;
}

// sidebar posts widget
.posts-col .post-wrap {
    margin-bottom: 3rem;
}

.thumbnail-caption {
    display: none;
}

// Tag Cloud
.post-tags {
    label {
        margin-#{$right}: 1rem;
        color: var(--alpha-dark-color);
        font-weight: 600;
        text-transform: uppercase;
    }
}

.sidebar div.tagcloud>a {
    color: var(--alpha-body-color);
    font-size: 1.2rem !important;
}

// Timeline Blog Layout
.posts-timeline {
    position: relative;
    padding: 5rem 0;

    .timeline {
        width: 100%;
        margin: 0;
        position: relative;
        overflow: hidden;

        &::after {
            background: var(--alpha-change-color-light-2);
            content: '';
            display: block;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            margin: auto;
            width: 4px;
            z-index: 0;
        }
    }

    .timeline-box,
    .timeline-date {
        position: relative;
        z-index: 1;
    }

    .timeline-date {
        display: block;
        clear: both;
        width: 180px;
        height: 47px;
        padding: 5px;
        margin: 0 auto 20px;
        background: var(--alpha-change-color-light-2);
        text-shadow: 0 1px 1px #fff;

        h3 {
            display: block;
            text-align: center;
            text-transform: capitalize;
            color: var(--alpha-dark-color);
            font-size: 1.6rem;
            font-weight: 600;
            line-height: 37px;
        }
    }

    .timeline-box {
        margin: 20px 0 40px;
        padding: 15px;
        width: calc(50% - 44px);
        float: $left;
        border: 2px solid var(--alpha-change-border-color-light);
        background: var(--alpha-white-color);

        &::before {
            position: absolute;
            content: "";
            border-radius: 50%;
            height: 10px;
            width: 10px;
            background: var(--alpha-white-color);
            box-shadow: 0 0 0 0 #fff, 0 0 0 5px #ffd0a6;
            transition: background .4s;
        }

        &::after {
            position: absolute;
            content: "";
            width: 20px;
            height: 20px;
            background: var(--alpha-white-color);
            border-right: 2px solid var(--alpha-change-border-color-light);
            border-top: 2px solid var(--alpha-change-border-color-light);
            z-index: 0;
        }

        &.left {
            clear: both;

            &::before {
                #{$right}: -51px;
                top: 113px;
            }

            &::after {
                transform: rotate(45deg);
                #{$right}: -12px;
                top: 107px;
            }
        }

        &.right {
            clear: $right;
            float: $right;
            margin-top: 40px;

            &::before {
                #{$left}: -51px;
                top: 123px;
            }

            &::after {
                transform: rotate(-135deg);
                #{$left}: -11px;
                top: 117px;
            }
        }

        &:hover {
            &::before {
                background: var(--alpha-primary-color, #fd7800);
            }
        }

        .post {
            border-radius: 0;
        }
    }
}

@include mq('lg') {
    .posts-timeline {
        width: calc(66.66667% + 30px);
        margin-left: auto;
        margin-right: auto;
    }
}

@include mq('md', 'max') {
    .posts-timeline {

        .timeline-box,
        .timeline-box.right {
            float: none;
            max-width: 80%;
            width: auto;
            left: auto;
            right: auto;
            margin: 35px auto;

            &::before,
            &::after {
                content: none;
            }
        }
    }
}

@include mq('sm', 'max') {
    .posts-timeline {

        .timeline-box,
        .timeline-box.right {
            max-width: 100%;
        }
    }
}