/* * assets/css/pilar-psikologi.css
 * Vibe: Classic Dark Diary, Personal, Marginalia Sticky Sidebar
 * Fitur: 4 Mode Suasana Mental, Laci Instrumen
 */

:root {
    /* 1. TINTA MALAM (Default / Midnight) */
    --psy-bg: #0a0a0c; 
    --psy-text: #d6d3d1; 
    --psy-heading: #eceaeb; 
    --psy-accent: #8c1d18; /* Merah darah kering */
    --psy-border: #27272a;
    --psy-panel: #121214;
    --font-psy: 'Georgia', 'Times New Roman', serif; 
    --font-psy-ui: 'Courier New', Courier, monospace; 
}

/* 2. KERTAS USANG (Parchment) */
html[data-theme="parchment"] {
    --psy-bg: #f5f4f0; 
    --psy-text: #2c2c2c; 
    --psy-heading: #121212;
    --psy-accent: #781d1d; 
    --psy-border: #d4d4d4;
    --psy-panel: #ebe9e1;
}

/* 3. BANGSAL KLINIS (Clinical / Asylum) */
html[data-theme="clinical"] {
    --psy-bg: #f8fafc; /* Putih super steril */
    --psy-text: #334155; /* Abu tajam */
    --psy-heading: #0f172a;
    --psy-accent: #2563eb; /* Biru dingin rumah sakit */
    --psy-border: #e2e8f0;
    --psy-panel: #ffffff;
}

/* 4. PALUNG GELAP (Abyss) */
html[data-theme="abyss"] {
    --psy-bg: #000000; /* Hitam pekat absolut */
    --psy-text: #52525b; /* Abu-abu redup, kontras rendah */
    --psy-heading: #71717a;
    --psy-accent: #3f3f46; /* Aksen mati */
    --psy-border: #18181b;
    --psy-panel: #09090b;
}

/* Variabel Pemicu Perubahan Ukuran & Bentuk Font (Dikontrol JS) */
html[data-psy-font-size="small"] { --psy-font-size: 1.05rem; }
html[data-psy-font-size="medium"] { --psy-font-size: 1.15rem; }
html[data-psy-font-size="large"] { --psy-font-size: 1.35rem; }

html[data-psy-font-family="serif"] { --font-psy: 'Georgia', 'Times New Roman', serif; }
html[data-psy-font-family="sans"] { --font-psy: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

/* KUNCI FIX STICKY: Bunuh overflow global biar sidebar ngambang */
html, body {
    overflow-x: visible !important; 
}

body {
    background-color: var(--psy-bg) !important;
    color: var(--psy-text) !important;
    font-family: var(--font-psy) !important;
    line-height: 1.9;
    transition: background-color 1s ease, color 1s ease;
}

.psiko-wrapper {
    margin: 0;
    padding: 0;
    position: relative;
    overflow: visible !important; 
}

/* =========================================
   LAYOUT GRID UTAMA (76 / 4 / 20)
   ========================================= */
.psiko-layout-grid {
    max-width: 100%;
    margin: 0 auto;
}

/* Base Mobile */
.psiko-container {
    max-width: 600px; 
    margin: 0 auto;
    padding: 6rem 1.5rem; 
}

.psiko-sidebar-col {
    padding: 0 1.5rem 5rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Desktop Monitor Gaban */
@media (min-width: 1024px) {
    .psiko-layout-grid {
        display: grid;
        grid-template-columns: 7.6fr 2fr; 
        gap: 4%;
        max-width: 1600px; 
        width: 95%;
        padding: 6rem 2rem;
        margin: 0 auto;
    }

    .psiko-container {
        max-width: 100%;
        padding: 0;
    }

    .psiko-sidebar-col {
        padding: 0;
        max-width: 100%;
    }

    .psiko-header,
    .psiko-content p,
    .psiko-content blockquote {
        max-width: 100%;
        margin-left: 0; 
        margin-right: 0;
    }

    .psiko-panel-sticky {
        position: -webkit-sticky; 
        position: sticky;
        top: 6rem; 
        max-height: calc(100vh - 8rem);
        overflow-y: auto;
    }

    .psiko-panel-sticky::-webkit-scrollbar { width: 0px; background: transparent; }
}

/* =========================================
   HEADER & TYPOGRAPHY JURNAL
   ========================================= */
.psiko-header {
    margin-bottom: 3.5rem;
    text-align: left; 
}

@media (max-width: 1023px) {
    .psiko-header { text-align: center; } 
    .psy-divider { margin: 0 auto 3rem; }
}

.psiko-meta {
    font-family: var(--font-psy-ui);
    font-size: 0.8rem;
    color: var(--psy-accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
    display: block;
    opacity: 0.8;
}

.psiko-title {
    font-size: 3.5rem;
    line-height: 1.2;
    margin: 0 0 2rem 0;
    font-family: var(--font-psy);
    font-weight: normal;
    color: var(--psy-heading);
    font-style: italic; 
}

.psy-divider {
    border: none;
    height: 1px;
    background-color: var(--psy-border);
    width: 40%;
    margin: 0 0 3rem 0; 
    position: relative;
}

@media (max-width: 1023px) {
    .psy-divider { margin: 0 auto 3rem; } 
}

.psy-divider::after {
    content: '♦';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--psy-accent);
    font-size: 0.8rem;
    background-color: var(--psy-bg);
    padding: 0 10px;
    transition: background-color 1s ease;
}

.psiko-content p {
    font-size: var(--psy-font-size, 1.15rem); 
    margin-bottom: 2rem;
    text-align: left; /* Berubah dari justify ke left */
    hyphens: auto;
    -webkit-hyphens: auto;
    overflow-wrap: anywhere;
    opacity: 0.9;
    transition: font-size 0.3s ease;
}

.psiko-content > p:first-of-type::first-letter {
    float: left;
    font-size: 4.5rem;
    line-height: 0.8;
    padding-top: 4px;
    padding-right: 12px;
    padding-left: 0;
    font-family: var(--font-psy);
    color: var(--psy-accent);
}

.psiko-content blockquote {
    margin: 3rem 0; 
    padding: 0 0 0 1.5rem;
    border-left: 2px solid var(--psy-accent);
    font-style: italic;
    opacity: 0.85;
}

.psiko-content blockquote p {
    font-size: calc(var(--psy-font-size, 1.15rem) + 0.1rem);
    line-height: 1.7;
    margin: 0;
}

/* =========================================
   PANEL TERKAIT (MARGINALIA STYLE)
   ========================================= */
.psy-related-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right; 
}

.psy-sidebar-heading {
    font-family: var(--font-psy-ui);
    font-size: 0.85rem; 
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--psy-accent);
    border-bottom: 1px solid var(--psy-border);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
    opacity: 0.8;
}

.psy-related-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; 
    width: 100%;
}

.psy-related-item {
    text-decoration: none;
    color: inherit;
    border-right: 2px solid transparent; 
    padding-right: 1rem;
    transition: all 0.4s ease;
    opacity: 0.6;
}

.psy-related-item:hover {
    opacity: 1;
    border-right-color: var(--psy-accent); 
    transform: translateX(-3px); 
}

/* KUNCI FIX VISUAL: Highlight sesi yang lagi dibaca sekarang */
.psy-related-item.is-active {
    opacity: 1;
    border-right-color: var(--psy-accent); 
    transform: translateX(-3px); 
}

.psy-related-item.is-active .psy-related-title {
    color: var(--psy-accent);
    text-shadow: 0 0 10px rgba(140, 29, 24, 0.2);
}

/* Biar shadow-nya cocok di Mode Clinical juga */
html[data-theme="clinical"] .psy-related-item.is-active .psy-related-title { text-shadow: 0 0 10px rgba(37, 99, 235, 0.2); }
html[data-theme="lucid"] .psy-related-item.is-active .psy-related-title { text-shadow: none; font-weight: bold; }

.psy-related-meta {
    display: block;
    font-family: var(--font-psy-ui);
    font-size: 0.8rem; 
    letter-spacing: 2px;
    margin-bottom: 0.4rem;
    color: var(--psy-accent);
}

.psy-related-title {
    margin: 0;
    font-family: var(--font-psy);
    font-size: 1.3rem; 
    font-weight: normal;
    line-height: 1.4;
    font-style: italic;
}

.btn-psy-archive {
    margin-top: 3rem;
    display: inline-block;
    padding: 0.8rem 1.2rem;
    font-family: var(--font-psy-ui);
    font-size: 0.8rem; 
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--psy-text);
    border: 1px dashed var(--psy-border);
    text-decoration: none;
    transition: all 0.3s ease;
    opacity: 0.5;
}

.btn-psy-archive:hover {
    opacity: 1;
    border-color: var(--psy-accent);
    color: var(--psy-accent);
}

/* =========================================
   INDIKATOR KEDALAMAN MENTAL
   ========================================= */
.psy-depth-tracker {
    position: fixed;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-psy-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    transform-origin: center;
    transition: all 0.5s ease;
    z-index: 10;
    pointer-events: none;
}

.depth-text {
    transition: all 0.8s ease;
    white-space: nowrap;
}

/* =========================================
   LACI INSTRUMEN PSIKOLOGI (PENGATURAN BACA)
   ========================================= */
.psy-settings-trigger {
    position: fixed;
    right: 0;
    top: 20%; 
    transform: translateY(-50%);
    width: 35px; 
    height: 60px;
    background-color: var(--psy-bg);
    border: 1px solid var(--psy-border);
    border-right: none;
    border-radius: 4px 0 0 4px;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--psy-accent);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    opacity: 0.6;
}

.psy-settings-trigger::after {
    content: '⚿'; /* Ikon mata kunci pembuka pikiran */
}

.psy-settings-trigger:hover {
    width: 45px;
    opacity: 1;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
}

.psy-settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background-color: var(--psy-panel);
    border-left: 1px solid var(--psy-border);
    transform: translateX(100%);
    z-index: 9999;
    transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.5s ease;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
}

.psy-settings-panel.active {
    transform: translateX(0); 
    box-shadow: -10px 0 40px rgba(0,0,0,0.2); 
}

.psy-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    border-bottom: 1px dashed var(--psy-border);
    padding-bottom: 1rem;
}

.psy-panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: normal;
    font-family: var(--font-psy-ui);
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--psy-accent);
}

.psy-close-panel {
    background: transparent;
    border: none;
    color: var(--psy-text);
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.3s;
    line-height: 1;
    padding: 0;
}

.psy-close-panel:hover { opacity: 1; color: var(--psy-accent); }

.psy-setting-group { margin-bottom: 2.5rem; }

.psy-setting-group label {
    display: block;
    font-family: var(--font-psy-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.6;
    margin-bottom: 1rem;
    color: var(--psy-text);
}

.psy-font-control {
    display: flex;
    gap: 0.5rem;
}

.btn-psy-size, .btn-psy-font {
    flex: 1;
    background-color: transparent;
    color: var(--psy-text);
    border: 1px solid var(--psy-border);
    padding: 0.8rem 0.2rem;
    border-radius: 2px;
    cursor: pointer;
    font-family: var(--font-psy-ui);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    text-align: center;
    opacity: 0.6;
}

.btn-psy-size.active, .btn-psy-font.active {
    background-color: var(--psy-border);
    color: var(--psy-accent);
    border-color: var(--psy-accent);
    opacity: 1;
}

.btn-psy-size:hover, .btn-psy-font:hover {
    opacity: 1;
    border-color: var(--psy-accent);
}

/* Tombol Tema Mutar Berurutan */
.panel-vibe-btn {
    width: 100%;
    background-color: transparent;
    color: var(--psy-text);
    border: 1px solid var(--psy-border);
    padding: 1rem;
    cursor: pointer;
    font-family: var(--font-psy-ui);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    text-align: center;
    border-radius: 2px;
}

.panel-vibe-btn:hover {
    border-color: var(--psy-accent);
    color: var(--psy-accent);
    background-color: rgba(140, 29, 24, 0.05);
}

/* =========================================
   NAVIGASI HALAMAN (PAGINASI) & JURNAL
   ========================================= */
.psiko-page-links {
    margin: 4rem 0;
    text-align: center; 
    font-family: var(--font-psy-ui);
    border-top: 1px dashed var(--psy-border);
    padding-top: 2rem;
    width: 100%; 
}

.psiko-page-links a,
.psiko-page-links > .page-number {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0 0.4rem;
    color: var(--psy-text);
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.psiko-page-links a:hover {
    opacity: 1;
    color: var(--psy-accent);
}

.psiko-page-links > .page-number {
    opacity: 1;
    color: var(--psy-accent);
    border-bottom: 1px solid var(--psy-accent);
}

/* =========================================
   TOMBOL BAGIKAN (SHARE PIKIRAN)
   ========================================= */
.psy-share-wrapper {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 3rem; padding-top: 2rem;
    border-top: 1px solid var(--psy-border);
}
.psy-share-wrapper .share-label {
    font-family: var(--font-psy-ui); font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 2px;
    color: var(--psy-accent); opacity: 0.7;
}
.psy-share-wrapper .share-links { display: flex; gap: 0.6rem; }
.psy-share-wrapper .share-links a,
.psy-share-wrapper .share-links button {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 2px;
    background-color: transparent; border: 1px solid var(--psy-border);
    color: var(--psy-text); opacity: 0.5; cursor: pointer;
    transition: all 0.3s ease; padding: 0;
}
.psy-share-wrapper .share-links svg { width: 16px; height: 16px; }
.psy-share-wrapper .share-links a:hover,
.psy-share-wrapper .share-links button:hover {
    opacity: 1; color: var(--psy-accent);
    border-color: var(--psy-accent); transform: translateY(-2px);
}

@media (max-width: 800px) {
    .psy-share-wrapper { flex-direction: column; gap: 1.5rem; text-align: center; }
}

/* Navigasi Post Sebelumnya & Selanjutnya */
.psiko-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 6rem;
    padding-top: 3rem;
    border-top: 1px solid var(--psy-border);
    width: 100%; 
}

.psiko-navigation a {
    text-decoration: none;
    color: var(--psy-text);
    font-family: var(--font-psy);
    font-size: 1rem;
    font-style: italic;
    opacity: 0.6;
    transition: opacity 0.3s ease, color 0.3s ease;
    max-width: 45%;
}

.psiko-navigation a:hover {
    opacity: 1;
    color: var(--psy-accent);
}

.nav-label {
    display: block;
    font-family: var(--font-psy-ui);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-style: normal;
    margin-bottom: 0.5rem;
}

.nav-next { 
    text-align: right; 
    margin-left: auto; 
}

/* Responsive HP */
@media (max-width: 800px) {
    .psy-depth-tracker { display: none; } 
    .psiko-title { font-size: 2.2rem; }
    .psiko-content blockquote { margin: 2rem auto; }
    .psiko-page-links { text-align: center; margin: 4rem auto; }
    
    .psy-related-wrapper { 
        align-items: center; 
        margin-top: 4rem; 
        text-align: center;
    }
    
    .psy-related-item {
        border-right: none;
        border-bottom: 1px solid transparent;
        padding-right: 0;
        padding-bottom: 0.5rem;
    }
    
    .psy-related-item:hover {
        border-right-color: transparent;
        border-bottom-color: var(--psy-accent);
        transform: translateY(-3px);
    }
}
/* =========================================
   FIX GAMBAR RATA KIRI KANAN & CAPTION
   ========================================= */

/* Bunuh pengaturan kaku bawaan WordPress buat container gambar */
.psiko-content figure, 
.psiko-content .wp-caption {
    max-width: 100%;
    margin-bottom: 2rem !important;
    /* TRIK SAKTI: Jadikan figure sebagai table biar caption ngikutin lebar sempurna */
    display: table !important; 
}

.psiko-content .alignleft,
.psiko-content figure.alignleft {
    float: left !important;
    max-width: 45% !important; 
    margin: 0.5rem 2rem 1rem 0 !important;
}

.psiko-content .alignright,
.psiko-content figure.alignright {
    float: right !important;
    max-width: 45% !important; 
    margin: 0.5rem 0 1rem 2rem !important;
}

.psiko-content .aligncenter,
.psiko-content figure.aligncenter {
    display: table !important; /* Pakai table biar caption kaga melebar melebihi gambar */
    margin: 3rem auto !important;
    text-align: center;
    float: none !important;
}

.psiko-content figure img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* KUNCI FIX CAPTION: Gaya Elegan & Paksa Rata Tengah Murni (Anti Paragraf Bocor) */
.psiko-content figcaption,
.psiko-content .wp-caption-text,
.psiko-content figcaption p,
.psiko-content .wp-caption-text p {
    display: table-caption !important; 
    caption-side: bottom !important;
    text-align: center !important; /* Paksa rata tengah ngalahin rata kiri paragraf */
    font-size: 0.85rem !important;
    font-style: italic !important;
    opacity: 0.7;
    margin-top: 0.8rem !important;
    margin-bottom: 0 !important; /* Buang margin bawah bawaan p */
    line-height: 1.5 !important;
    width: 100% !important; 
    box-sizing: border-box !important;
    word-wrap: break-word !important;
}

@media (max-width: 768px) {
    .psiko-content .alignleft,
    .psiko-content figure.alignleft {
        max-width: 40% !important;
        margin: 0.4rem 1rem 0.5rem 0 !important; 
    }
    .psiko-content .alignright,
    .psiko-content figure.alignright {
        max-width: 40% !important;
        margin: 0.4rem 0 0.5rem 1rem !important;
    }
}