/*
Theme Name: LIM HORNG
Theme URI: https://familystoryblog.com/
Author: LIM HORNG
Description: Vintage Old Book & Lifestyle Blog Theme for WordPress
Version: 3.0
Text Domain: neonwave
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    /* Old Book Palette */
    --bg-color: #fcfbf6; /* Very light, almost white paper */
    --surface-color: #ffffff; /* Pure white page elements */
    --surface-color-hover: #f3ead3;
    --surface-border: #d5c4a1; /* Stained border */
    --text-primary: #2b251e; /* Deep dark brown ink */
    --text-secondary: #5e5140; /* Faded ink */
    --accent-color: #8c3626; /* Vintage faded red */
    --accent-secondary: #3b5068; /* Vintage faded blue */
    
    --header-bg: rgba(244, 235, 216, 0.95);
    
    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
    
    /* Effects */
    --transition: all 0.3s ease;
    --shadow-soft: 0 4px 15px rgba(60, 50, 40, 0.08);
    --shadow-book: 5px 5px 15px rgba(0,0,0,0.1), -5px -5px 15px rgba(255,255,255,0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    
    /* Layered textures for an old, stained book look */
    background-image: 
        radial-gradient(circle at center, transparent 40%, rgba(139, 115, 85, 0.15) 100%), /* Vignette for page edge */
        url("https://www.transparenttextures.com/patterns/aged-paper.png"),
        url("https://www.transparenttextures.com/patterns/crumpled-paper.png");
    
    color: var(--text-primary);
    font-size: 18px; /* Good reading size */
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-secondary);
}

img {
    max-width: 100%;
    height: auto;
    border-radius: 4px; /* Less rounded for vintage look */
    filter: sepia(0.2) contrast(0.95); /* Slight vintage photo effect */
}

.container {
    max-width: 1000px; /* Slightly narrower like a book page */
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================================
   Header (Vintage Book Binding)
   ========================================= */
.header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 8px 0; /* Made thinner */
    background: #2b251e; /* Dark vintage brown */
    background-image: url("https://www.transparenttextures.com/patterns/aged-paper.png");
    border-bottom: 3px solid var(--accent-color); /* Vintage red strip */
    transition: var(--transition);
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    font-family: var(--font-serif);
    font-size: 26px; /* Slightly smaller for thinner header */
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #f4ebd8; /* Light paper color */
    display: inline-block;
}

.logo span {
    color: #d17565; /* Vintage faded red */
    font-style: italic;
}

.icon-btn {
    background: transparent;
    border: 1px solid #5e5140; /* Darker faded border */
    color: #f4ebd8; /* Light paper color */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px; /* Slightly smaller padding */
    border-radius: 4px;
    transition: var(--transition);
}

.icon-btn:hover {
    background: #3e362d;
    color: #f4ebd8;
    border-color: #8c3626;
    transform: translateY(-2px);
}

.icon-btn svg {
    width: 20px; /* Slightly smaller icon */
    height: 20px;
}

/* =========================================
   Sidebar Menu
   ========================================= */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(43, 37, 30, 0.6);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100%;
    background: var(--bg-color);
    background-image: url("https://www.transparenttextures.com/patterns/aged-paper.png");
    border-left: 2px solid var(--surface-border);
    color: var(--text-primary);
    z-index: 1002;
    transition: right 0.4s ease;
    overflow-y: auto;
    box-shadow: -5px 0 20px rgba(0,0,0,0.1);
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px dashed var(--surface-border);
}

.sidebar-header h3 {
    font-family: var(--font-serif);
    font-size: 22px;
    font-style: italic;
}

.sidebar-search {
    padding: 24px;
    border-bottom: 1px dashed var(--surface-border);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--surface-color);
    border-radius: 4px;
    padding: 10px 16px;
    border: 1px solid var(--surface-border);
}

.search-box svg {
    color: var(--text-secondary);
    margin-right: 12px;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 16px;
    outline: none;
    font-family: var(--font-sans);
}

.search-box input::placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    gap: 16px;
    transition: var(--transition);
}

.sidebar-menu li a svg {
    color: var(--text-secondary);
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(140, 54, 38, 0.05);
    color: var(--accent-color);
}

.sidebar-menu li a:hover svg,
.sidebar-menu li a.active svg {
    color: var(--accent-color);
}

/* =========================================
   Category Tags (Pills)
   ========================================= */
.pill-categories {
    padding: 70px 0 5px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.pill-categories::-webkit-scrollbar {
    display: none;
}

.pills-wrapper {
    display: flex;
    gap: 10px;
    padding: 0 20px;
}

.pill {
    background: var(--surface-color);
    color: var(--text-primary);
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--surface-border);
}

.pill:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: var(--bg-color);
}

.pill.active {
    background: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
}

/* =========================================
   Main Content & Article Cards
   ========================================= */
main {
    min-height: calc(100vh - 250px);
}

.articles-section {
    padding-top: 5px;
    padding-bottom: 60px;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

/* Article Card Book Design */
.article-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: var(--transition);
    background: var(--surface-color);
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.03);
    position: relative;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft);
    border-color: var(--accent-secondary);
}

.card-img {
    height: 220px;
    overflow: hidden;
    position: relative;
    display: block;
    border-bottom: 1px solid var(--surface-border);
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.article-card:hover .card-img img {
    transform: scale(1.05);
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-sans);
}

.card-category {
    color: var(--accent-color);
    font-weight: 700;
}

.card-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.4;
    color: var(--text-primary);
}

.article-card:hover .card-title {
    color: var(--accent-color);
}

.card-excerpt {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
    flex-grow: 1;
}

/* =========================================
   Article Detail Page
   ========================================= */
.article-detail-container {
    padding-top: 100px;
}

.article-header {
    margin: 0 auto 30px;
    max-width: 800px;
    text-align: left;
}

.article-header h1 {
    font-size: 28px;
    margin: 15px 0;
    line-height: 1.4;
    font-weight: 700;
    color: var(--text-primary);
}

.article-meta-large {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 15px;
    font-family: var(--font-sans);
}

.article-featured-img {
    margin: 0 auto 40px;
    max-width: 800px;
    border: 8px solid var(--surface-color);
    box-shadow: var(--shadow-soft);
}

.article-featured-img img {
    width: 100%;
    display: block;
}

.article-body {
    max-width: 700px;
    margin: 0 auto;
    font-size: 20px;
    color: var(--text-primary);
    line-height: 1.9;
    font-weight: 500;
}

.article-body p {
    margin-bottom: 25px;
}

.article-body h2 {
    font-family: var(--font-serif);
    font-size: 28px;
    margin: 40px 0 20px;
    color: var(--text-primary);
    text-align: center;
    border-bottom: 1px solid var(--surface-border);
    padding-bottom: 10px;
}

/* =========================================
   Footer
   ========================================= */
.footer {
    background-color: #2b251e; /* Dark vintage brown */
    color: #e5dcc5;
    padding: 60px 0 30px;
    background-image: url("https://www.transparenttextures.com/patterns/aged-paper.png");
    border-top: 4px solid var(--accent-color);
}

.footer-top {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand {
    padding-right: 20px;
}

.footer-brand .logo {
    color: #f4ebd8;
}
.footer-brand .logo span {
    color: #d17565;
}

.footer-desc {
    color: #b5a995;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.btn-privacy {
    background: transparent;
    border: 1px solid #756a58;
    color: #e5dcc5;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-family: var(--font-serif);
    cursor: pointer;
    transition: var(--transition);
}

.btn-privacy:hover {
    background: #3e362d;
    border-color: #e5dcc5;
}

.footer-col h4 {
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #f4ebd8;
    letter-spacing: 1px;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: #b5a995;
    font-size: 15px;
    transition: var(--transition);
}

.footer-links a:hover {
    color: #d17565;
}

.footer-bottom-wrapper {
    border-top: 1px dashed #4a4135;
    padding-top: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.footer-copyright {
    color: #8c806e;
    font-size: 14px;
    font-family: var(--font-sans);
    font-style: normal;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.back-to-top {
    position: absolute;
    right: 0;
    background: var(--accent-color);
    color: #f4ebd8;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.back-to-top svg {
    width: 20px;
    height: 20px;
}

.back-to-top:hover {
    background: #a84635;
}

/* =========================================
   Home Layout & Sidebar Layout
   ========================================= */
.home-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    align-items: start;
    margin-top: 20px;
}

.home-sidebar {
    position: sticky;
    top: 90px;
}

.sidebar-widget {
    margin-bottom: 40px;
    background: var(--surface-color);
    padding: 25px;
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.02);
}

.widget-title {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--accent-color);
    display: inline-block;
    padding-bottom: 5px;
}

/* Sidebar Search Widget */
.sidebar-search-form {
    display: flex;
}

.sidebar-search-form .search-field {
    flex: 1;
    padding: 12px 14px;
    background: var(--bg-color);
    border: 1px solid var(--surface-border);
    border-right: none;
    font-size: 14px;
    font-family: var(--font-serif);
    font-style: italic;
    outline: none;
}

.sidebar-search-form .search-submit {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 12px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-search-form .search-submit:hover {
    background: var(--accent-secondary);
}

/* About Widget */
.about-widget p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    font-family: var(--font-serif);
}

/* Tabs Widget */
.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--surface-border);
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px;
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Sidebar Post List */
.sidebar-post-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-post-list li {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--surface-border);
}

.sidebar-post-list li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.sidebar-post-img {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border: 1px solid var(--surface-border);
    padding: 2px;
    background: #fff;
}

.sidebar-post-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-post-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.sidebar-post-title {
    font-family: var(--font-serif);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    transition: var(--transition);
}

.sidebar-post-title:hover {
    color: var(--accent-color);
}

.sidebar-post-date {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-sans);
}

/* Tag Cloud */
.tag-link {
    display: inline-block;
    padding: 5px 12px;
    background-color: var(--bg-color);
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font-serif);
    text-decoration: none;
    margin: 0 5px 8px 0;
    transition: var(--transition);
}

.tag-link:hover {
    background-color: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

/* Responsive */
@media (max-width: 900px) {
    .home-layout {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Pagination
   ========================================= */
.pagination-wrapper {
    text-align: center;
    margin: 50px 0 30px;
    width: 100%;
}

.pagination {
    display: inline-block;
    width: 100%;
}

.pagination .nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination .page-numbers {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    background-color: var(--surface-color);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 15px;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.pagination .page-numbers:hover {
    background-color: var(--surface-color-hover);
    color: var(--accent-color);
    border-color: #cbb493;
    transform: translateY(-2px);
}

.pagination .page-numbers.current {
    background-color: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(140, 54, 38, 0.2);
}

.pagination .page-numbers.dots {
    background-color: transparent;
    border: none;
    box-shadow: none;
    pointer-events: none;
    min-width: auto;
}

@media (max-width: 768px) {
    .articles-grid {
        grid-template-columns: 1fr;
    }
    .footer-top {
        grid-template-columns: 1fr;
    }
}

/* Fix for Adskeeper / MGID Widgets on Mobile */
@media (max-width: 768px) {
    .entry-content .mgline { display: block !important; }
    .entry-content .mgbox { width: 100% !important; max-width: 100% !important; margin-bottom: 20px !important; display: block !important; }
    .entry-content iframe, .entry-content ins { max-width: 100% !important; }
}
