/*
Theme Name: My Core Theme v1.2

Author: Patrick

Description: A flexible multi-layout WordPress news theme
Version: 2.1.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: my-core-theme
Tags: news, blog, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ── CSS Variables – layout/spacing only (colors injected by PHP via wp_add_inline_style) ── */
:root {
    --radius:    8px;
    --shadow-sm: 0 1px 4px rgba(0,0,0,.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

    /* Color fallbacks – overridden by PHP inline style */
    --color-primary:          #e63946;
    --color-secondary:        #1a1a2e;
    --color-accent:           #f0a500;
    --color-bg:               #f4f4f6;
    --color-surface:          #ffffff;
    --color-text:             #2d2d2d;
    --color-muted:            #6b7280;
    --color-border:           #e5e7eb;
    --color-nav-bg:           #1a1a2e;
    --color-nav-text:         #ffffff;
    --color-nav-hover:        #e63946;
    --color-breaking-bg:      #e63946;
    --color-breaking-text:    #ffffff;
    --color-footer-bg:        #0f0f1a;
    --color-footer-text:      rgba(255,255,255,0.65);
    --color-footer-heading:   #ffffff;
    --color-footer-border:    rgba(255,255,255,0.08);
    --color-footer-link:      rgba(255,255,255,0.6);
    --color-footer-link-hover:#ffffff;
    --color-badge-bg:         #e63946;
    --color-badge-text:       #ffffff;
    --color-btn-bg:           #e63946;
    --color-btn-text:         #ffffff;
    --color-btn-hover-bg:     #c1121f;
    --color-link:             #e63946;
    --color-link-hover:       #c1121f;
    --color-primary-dark:     #c1121f;
    --color-primary-light:    #f08080;
    --color-primary-subtle:   #fde8e9;
    --color-primary-alpha:    rgba(230,57,70,0.12);
    --color-section-border:   #e63946;
    --gradient-brand:         linear-gradient(135deg, #e63946 0%, #f0a500 100%);
    --gradient-dark:          linear-gradient(135deg, #1a1a2e 0%, #0d0d1a 100%);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── Base ── */
body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-link-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { padding-left: 1.5em; }
button { font-family: inherit; }

/* ── Container ── */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Layout ── */
.site-content-wrapper { padding: 32px 0 48px; }
.site-content { display: flex; gap: 32px; align-items: flex-start; }
.main-content { flex: 1; min-width: 0; }
.sidebar { width: 320px; flex-shrink: 0; }

/* ── Full-width layout (homepage body layouts) ── */
/* Dùng body.is-fullwidth-layout để override toàn bộ container chain */
body.is-fullwidth-layout .site-content-wrapper {
    padding: 0;
}
body.is-fullwidth-layout .site-content-wrapper > .container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}
body.is-fullwidth-layout .site-content {
    display: block !important;
    gap: 0 !important;
}
body.is-fullwidth-layout .sidebar {
    display: none !important;
}
body.is-fullwidth-layout .main-content {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden;
    padding: 0;
}

/* ── Sidebar widgets ── */
.widget {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}
.widget-title {
    font-size: .8rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .08em; color: var(--color-secondary);
    margin-bottom: 16px; padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary);
}
.widget ul { list-style: none; padding: 0; }
.widget ul li { padding: 7px 0; border-bottom: 1px solid var(--color-border); font-size: .875rem; }
.widget ul li:last-child { border-bottom: none; }
.widget a { color: var(--color-text); }
.widget a:hover { color: var(--color-primary); }

/* ── Single post content ── */
.entry-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--color-text);
}
.entry-content p { margin-bottom: 1.4em; }
.entry-content h2 { font-size: 1.5rem; margin: 2em 0 .75em; color: var(--color-secondary); }
.entry-content h3 { font-size: 1.25rem; margin: 1.75em 0 .6em; color: var(--color-secondary); }
.entry-content ul, .entry-content ol { margin-bottom: 1.4em; }
.entry-content li { margin-bottom: .4em; }
.entry-content blockquote {
    border-left: 4px solid var(--color-primary); margin: 2em 0;
    padding: 16px 24px; background: var(--color-primary-subtle); border-radius: 0 6px 6px 0;
    font-style: italic; color: var(--color-muted);
}
.entry-content img { border-radius: 6px; margin: 1.5em 0; }
.entry-content a { color: var(--color-primary); text-decoration: underline; }
.entry-content code {
    background: var(--color-bg); padding: 2px 6px; border-radius: 3px;
    font-size: .9em; color: var(--color-primary);
}
.entry-content pre {
    background: var(--color-secondary); color: var(--color-nav-text); padding: 20px; border-radius: 8px;
    overflow-x: auto; margin-bottom: 1.4em; font-size: .9rem;
}

/* ── Post header (single) ── */
.entry-header { margin-bottom: 28px; }
.entry-header .entry-title { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 800; line-height: 1.25; color: var(--color-secondary); margin-bottom: 14px; }
.entry-meta { display: flex; align-items: center; gap: 12px; font-size: .85rem; color: var(--color-muted); flex-wrap: wrap; }
.entry-meta a { color: var(--color-muted); }
.entry-meta a:hover { color: var(--color-primary); }
.entry-meta .cat-badge {
    display: inline-block; padding: 3px 10px; background: var(--color-primary);
    color: #fff; font-size: .72rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .06em; border-radius: 3px;
}
.post-thumbnail { margin-bottom: 28px; border-radius: var(--radius); overflow: hidden; }
.post-thumbnail img { width: 100%; }

/* ── Pagination ── */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 40px; flex-wrap: wrap; }
.pagination .page-numbers {
    display: flex; align-items: center; justify-content: center;
    min-width: 40px; height: 40px; padding: 0 12px;
    border: 1px solid var(--color-border); border-radius: 6px;
    color: var(--color-text); background: var(--color-surface); font-size: .875rem; font-weight: 500;
    transition: all .2s;
}
.pagination .page-numbers.current,
.pagination .page-numbers:hover {
    background: var(--color-primary); color: #fff; border-color: var(--color-primary); text-decoration: none;
}

/* ── Post navigation ── */
.post-navigation { display: flex; gap: 16px; margin-top: 40px; }
.post-navigation .nav-previous,
.post-navigation .nav-next {
    flex: 1; padding: 16px 20px; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius);
    font-size: .875rem; transition: border-color .2s;
}
.post-navigation .nav-next { text-align: right; }
.post-navigation a { color: var(--color-text); font-weight: 600; }
.post-navigation a:hover { color: var(--color-primary); text-decoration: none; }

/* ── Comments ── */
.comments-area { margin-top: 48px; }
.comments-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 24px; }
.comment-list { list-style: none; padding: 0; }
.comment { padding: 20px 0; border-bottom: 1px solid var(--color-border); }
.comment-author .fn { font-weight: 700; }
.comment-metadata { font-size: .8rem; color: var(--color-muted); margin-bottom: 8px; }
.comment-content { font-size: .9rem; }
.comment-reply-link { font-size: .8rem; color: var(--color-primary); font-weight: 600; }

/* ── 404 ── */
.error-404 { text-align: center; padding: 80px 20px; }
.error-404 .error-code { font-size: 8rem; font-weight: 900; color: var(--color-border); line-height: 1; }
.error-404 h2 { font-size: 1.5rem; margin-bottom: 12px; color: var(--color-secondary); }
.error-404 p { color: var(--color-muted); margin-bottom: 24px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 11px 24px; border-radius: 6px; font-weight: 700; font-size: .9rem; cursor: pointer; transition: all .2s; border: 2px solid transparent; text-decoration: none; }
.btn--primary { background: var(--color-btn-bg); color: var(--color-btn-text); border-color: var(--color-btn-bg); }
.btn--primary:hover { background: var(--color-btn-hover-bg); border-color: var(--color-btn-hover-bg); color: var(--color-btn-text); text-decoration: none; }
.btn--outline { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn--outline:hover { background: var(--color-primary); color: var(--color-btn-text); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn--ghost:hover { border-color: var(--color-primary); color: var(--color-primary); text-decoration: none; }

/* ── Utility ── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.text-muted { color: var(--color-muted); }

/* ── Responsive ── */
@media (max-width: 1024px) {
    .sidebar { width: 280px; }
}
@media (max-width: 768px) {
    .site-content { flex-direction: column; }
    .sidebar { width: 100%; }
    .post-navigation { flex-direction: column; }
}
@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .site-content-wrapper { padding: 20px 0 32px; }
}
