/*
 * Custom Post View — Stylesheet
 * Semua nilai utama dikontrol via CSS custom properties dari Customizer.
 */

/* === RESET & BASE ============================================= */
.cpv-article {
    width: 100%;
}

.cpv-article__inner {
    max-width: var(--cpv-max-width, 760px);
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* === FEATURED IMAGE =========================================== */
.cpv-featured-image {
    margin: 0 0 40px;
    overflow: hidden;
}

.cpv-featured-image__img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Full-width */
.cpv-featured-image--full-width {
    max-width: 100%;
}

/* Contained */
.cpv-featured-image--contained {
    max-width: var(--cpv-max-width, 760px);
    margin-left: auto;
    margin-right: auto;
    border-radius: 8px;
    overflow: hidden;
}

/* Hero */
.cpv-featured-image--hero {
    position: relative;
    height: 75vh;
    min-height: 320px;
}
.cpv-featured-image--hero .cpv-featured-image__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}
.cpv-featured-image__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.65) 100%);
}

/* === ARTICLE HEADER ========================================== */
.cpv-article__header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(0,0,0,.08);
}

.cpv-article__cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.cpv-article__cat-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--cpv-accent, #e63946);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 2px;
    transition: opacity .2s;
}
.cpv-article__cat-badge:hover { opacity: .85; }

.cpv-article__title {
    font-family: var(--cpv-title-font, 'Playfair Display', serif);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 900;
    line-height: 1.2;
    color: #0d0d0d;
    margin: 0 0 20px;
}

/* === META ==================================================== */
.cpv-meta {
    font-size: .82rem;
    color: #666;
    gap: 10px 16px;
}

.cpv-meta--inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.cpv-meta--block {
    display: flex;
    flex-direction: column;
}

.cpv-meta > span,
.cpv-meta__author,
.cpv-meta__date,
.cpv-meta__read-time,
.cpv-meta__views {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.cpv-meta a {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}
.cpv-meta a:hover { color: var(--cpv-accent, #e63946); }

.cpv-meta__cat-link {
    color: var(--cpv-accent, #e63946) !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: .75rem;
    letter-spacing: .06em;
}

/* === TOC ===================================================== */
.cpv-toc {
    background: #f8f8f8;
    border-left: 3px solid var(--cpv-accent, #e63946);
    border-radius: 0 6px 6px 0;
    padding: 20px 24px;
    margin: 0 0 36px;
}

.cpv-toc__title {
    font-weight: 700;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #333;
    margin: 0 0 12px;
}

.cpv-toc__list {
    margin: 0;
    padding-left: 18px;
}

.cpv-toc__item {
    margin: 6px 0;
    font-size: .88rem;
}

.cpv-toc__item--sub {
    padding-left: 14px;
}

.cpv-toc__item a {
    color: #444;
    text-decoration: none;
    transition: color .2s;
}
.cpv-toc__item a:hover { color: var(--cpv-accent, #e63946); }

/* === ARTICLE CONTENT ========================================= */
.cpv-article__content {
    font-family: var(--cpv-body-font, Georgia, serif);
    font-size: var(--cpv-font-size, 18px);
    line-height: var(--cpv-line-height, 1.8);
    color: var(--cpv-text-color, #1a1a1a);
}

.cpv-article__content p { margin: 0 0 1.6em; }

.cpv-article__content h2,
.cpv-article__content h3,
.cpv-article__content h4 {
    font-family: var(--cpv-title-font, 'Playfair Display', serif);
    font-weight: 700;
    line-height: 1.3;
    margin: 2em 0 .75em;
    color: #0d0d0d;
}

.cpv-article__content h2 { font-size: 1.55em; }
.cpv-article__content h3 { font-size: 1.25em; }
.cpv-article__content h4 { font-size: 1.05em; }

.cpv-article__content a {
    color: var(--cpv-accent, #e63946);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cpv-article__content blockquote {
    border-left: 4px solid var(--cpv-accent, #e63946);
    margin: 1.8em 0;
    padding: 14px 24px;
    background: #fafafa;
    font-style: italic;
    color: #444;
}

.cpv-article__content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1em 0;
}

.cpv-article__content pre,
.cpv-article__content code {
    font-family: 'Fira Code', Consolas, monospace;
    font-size: .88em;
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: 4px;
}

.cpv-article__content pre {
    padding: 16px 20px;
    overflow-x: auto;
    margin: 1.5em 0;
}

.cpv-article__content :not(pre) > code {
    padding: 2px 6px;
    color: var(--cpv-accent, #e63946);
    background: rgba(230,57,70,.08);
}

/* === TAGS ==================================================== */
.cpv-article__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 32px 0 0;
    padding-top: 24px;
    border-top: 1px solid rgba(0,0,0,.07);
}

.cpv-article__tag {
    display: inline-block;
    padding: 5px 12px;
    background: transparent;
    border: 1px solid #ddd;
    color: #555;
    font-size: .78rem;
    text-decoration: none;
    border-radius: 100px;
    transition: all .2s;
}
.cpv-article__tag:hover {
    border-color: var(--cpv-accent, #e63946);
    color: var(--cpv-accent, #e63946);
    background: rgba(230,57,70,.05);
}

/* === SHARE =================================================== */
.cpv-share {
    margin: 40px 0;
    padding: 28px;
    background: #f9f9f9;
    border-radius: 8px;
    text-align: center;
}

.cpv-share__label {
    font-weight: 700;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #888;
    margin: 0 0 16px;
}

.cpv-share__buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.cpv-share__btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
}

.cpv-share__btn:hover { opacity: .9; transform: translateY(-1px); }
.cpv-share__btn--twitter  { background: #000; }
.cpv-share__btn--facebook { background: #1877F2; }
.cpv-share__btn--whatsapp { background: #25D366; }
.cpv-share__btn--telegram { background: #2CA5E0; }
.cpv-share__btn--copy     { background: #555; }
.cpv-share__btn--copy.copied { background: #16a34a; }

/* === AUTHOR BOX ============================================== */
.cpv-author-box {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 28px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin: 0 0 40px;
}

.cpv-author-box__avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
}

.cpv-author-box__name {
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0 0 6px;
}

.cpv-author-box__name a {
    color: #0d0d0d;
    text-decoration: none;
}
.cpv-author-box__name a:hover { color: var(--cpv-accent, #e63946); }

.cpv-author-box__bio {
    font-size: .88rem;
    color: #555;
    margin: 0;
    line-height: 1.6;
}

/* === POST NAVIGATION ========================================= */
.cpv-post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 0 0 40px;
    border-top: 1px solid #eee;
    padding-top: 32px;
}

.cpv-post-nav__item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px;
    background: #f8f8f8;
    border-radius: 8px;
    text-decoration: none;
    transition: background .2s;
}
.cpv-post-nav__item:hover { background: #f0f0f0; }

.cpv-post-nav__item--next {
    text-align: right;
    grid-column: 2;
}

.cpv-post-nav__item--prev:only-child {
    grid-column: 1;
}

.cpv-post-nav__label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--cpv-accent, #e63946);
}

.cpv-post-nav__title {
    font-size: .9rem;
    font-weight: 600;
    color: #222;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === READING PROGRESS BAR ==================================== */
#cpv-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--cpv-accent, #e63946);
    z-index: 9999;
    transition: width .1s linear;
    box-shadow: 0 0 8px rgba(230,57,70,.4);
}

/* === BACK TO TOP ============================================= */
#cpv-back-to-top {
    position: fixed;
    bottom: 32px;
    right: 28px;
    width: 44px;
    height: 44px;
    background: var(--cpv-accent, #e63946);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .3s, visibility .3s, transform .3s;
    z-index: 999;
}

#cpv-back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#cpv-back-to-top:hover { opacity: .88; }

/* === RESPONSIVE ============================================== */
@media ( max-width: 640px ) {
    .cpv-article__inner { padding: 0 16px 40px; }
    .cpv-post-nav { grid-template-columns: 1fr; }
    .cpv-post-nav__item--next { grid-column: 1; text-align: left; }
    .cpv-author-box { flex-direction: column; }
    .cpv-share__buttons { flex-direction: column; align-items: stretch; }
    .cpv-share__btn { justify-content: center; }
}

/* ── View count di post-meta header tema ──────────────── */
.cpv-view-count {
    display: inline-flex;
    align-items: center;
    font-size: inherit;
    color: inherit;
    opacity: .85;
}

.cpv-view-count__number {
    font-weight: 600;
}
