/**
 * TWB Post Widgets – Frontend Styles
 * Lightweight CSS cho 5 Post Widgets: Post Title, Post Content,
 * Post Excerpt, Post Info, Featured Image.
 *
 * Không dùng !important trừ khi thật sự cần thiết.
 * Không đặt style mặc định cứng – chỉ base reset nhẹ.
 */

/* ─── POST TITLE ──────────────────────────────────────────────────────────── */

.twb-post-title-wrap {
    line-height: 1;
}

.twb-post-title {
    margin: 0;
    padding: 0;
    line-height: inherit;
}

.twb-post-title a {
    text-decoration: none;
    color: inherit;
}

/* Gradient text */
.twb-title-gradient {
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    display: inline-block;
}

.twb-title-prefix,
.twb-title-suffix {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

/* ─── POST CONTENT ────────────────────────────────────────────────────────── */

.twb-post-content-wrap {
    position: relative;
}

.twb-post-content {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Drop Cap */
.twb-post-content.has-drop-cap > p:first-child::first-letter {
    float: left;
    font-size: 4em;
    line-height: 0.7;
    margin-right: 0.1em;
    margin-top: 0.1em;
    font-weight: bold;
}

/* Blockquote base */
.twb-post-content blockquote {
    border-left: 4px solid currentColor;
    margin: 1.5em 0;
    padding: 1em 1.5em;
    font-style: italic;
}

/* Height limit + read-more */
.twb-post-content-inner {
    overflow: hidden;
    position: relative;
}

.twb-post-content-inner.is-expanded {
    max-height: none !important;
    overflow: visible;
}

.twb-content-readmore-wrap {
    text-align: center;
    margin-top: 1em;
}

.twb-content-readmore {
    display: inline-block;
    cursor: pointer;
    border: none;
    padding: 8px 20px;
    font-size: 14px;
    line-height: 1.4;
    transition: background-color 0.25s ease, color 0.25s ease;
    border-radius: 4px;
}

/* ─── POST EXCERPT ────────────────────────────────────────────────────────── */

.twb-post-excerpt-wrap {
    /* container only */
}

.twb-post-excerpt {
    margin: 0 0 0.75em;
    word-break: break-word;
}

.twb-post-excerpt.twb-excerpt-blockquote {
    border-left: 4px solid currentColor;
    padding: 0.75em 1.25em;
    margin: 0 0 0.75em;
    font-style: italic;
}

.twb-excerpt-readmore {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: inherit;
    transition: color 0.25s ease, background-color 0.25s ease;
    line-height: 1.4;
}

.twb-excerpt-readmore svg,
.twb-excerpt-readmore i {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

/* ─── POST INFO ───────────────────────────────────────────────────────────── */

.twb-post-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 0.875em;
    line-height: 1.4;
}

.twb-post-info-inline {
    flex-direction: row;
}

.twb-post-info-stacked {
    flex-direction: column;
    align-items: flex-start;
}

.twb-post-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.twb-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    color: inherit;
}

.twb-meta-item a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.twb-meta-item a:hover {
    text-decoration: underline;
}

.twb-meta-item i,
.twb-meta-item svg {
    flex-shrink: 0;
    display: inline-flex;
}

.twb-meta-label {
    font-weight: 600;
}

.twb-meta-sep {
    opacity: 0.5;
    flex-shrink: 0;
}

.twb-author-avatar {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 4px;
}

/* ─── FEATURED IMAGE ──────────────────────────────────────────────────────── */

.twb-featured-image-wrap {
    display: block;
    margin: 0;
    padding: 0;
    position: relative;
    overflow: hidden;
    line-height: 0;
}

.twb-featured-image-wrap a {
    display: block;
    line-height: 0;
}

.twb-featured-img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.35s ease, filter 0.35s ease;
    object-fit: cover;
    object-position: center center;
}

/* Aspect ratio box */
.twb-featured-image-ratio {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* When aspect-ratio inline style is set (modern browsers) */
.twb-featured-image-ratio[style*="aspect-ratio"] .twb-featured-img {
    inset: 0;
    width: 100%;
    height: 100%;
}

.twb-featured-image-ratio .twb-featured-img {
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Hover Animations */
.twb-featured-image-wrap.twb-img-hover-zoom_in:hover .twb-featured-img {
    transform: scale(1.06);
}

.twb-featured-image-wrap.twb-img-hover-zoom_out .twb-featured-img {
    transform: scale(1.06);
}
.twb-featured-image-wrap.twb-img-hover-zoom_out:hover .twb-featured-img {
    transform: scale(1);
}

.twb-featured-image-wrap.twb-img-hover-move_up:hover .twb-featured-img {
    transform: translateY(-5%);
}

.twb-featured-image-wrap.twb-img-hover-move_left:hover .twb-featured-img {
    transform: translateX(-5%);
}

/* Overlay */
.twb-featured-image-wrap.twb-img-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.twb-featured-image-wrap.twb-img-overlay:hover::after {
    opacity: 1;
}

/* Caption */
.twb-image-caption {
    display: block;
    font-size: 0.875em;
    line-height: 1.4;
    padding: 6px 10px;
}

.twb-image-caption.twb-caption-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
}

/* Placeholder */
.twb-img-placeholder {
    opacity: 0.5;
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .twb-post-info-grid {
        grid-template-columns: 1fr;
    }

    .twb-post-info-inline {
        gap: 8px;
    }
}
