/*
Theme Name: Meridian
Theme URI: https://example.com/meridian
Author: CMC
Author URI: https://example.com
Description: A Josh Comeau inspired personal blog theme with a colored hero band, wave cutout transition, two-column layout, and threaded comments.
Version: 1.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: meridian
*/

/* --- DESIGN SYSTEM CONFIGURATION --- */
:root {
    --bg-color: #ffffff;
    --hero-bg: #d2ecf9;
    --text-color: #1a1a1a;
    --text-muted: #575757;
    --accent-pink: #da127d;
    --pill-bg: #e2f3fc;
    --pill-text: #1d4ed8;
    --border-color: #eaeaea;
    --card-bg: #f8fafc;
    --max-width: 1150px;
    --content-width: 700px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif;
    --transition: all 0.25s ease;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --hero-bg: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --accent-pink: #f472b6;
    --pill-bg: #334155;
    --pill-text: #38bdf8;
    --border-color: #1e293b;
    --card-bg: #1e293b;
}

/* --- GLOBAL BASICS --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-sans);
    line-height: 1.7;
    font-size: 17px;
    transition: var(--transition);
}

a { color: inherit; text-decoration: none; transition: var(--transition); }
a:hover { opacity: 0.85; }

img { max-width: 100%; height: auto; display: block; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 32px;
}

hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 4rem 0;
}

.section-label {
    color: var(--accent-pink);
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 24px;
    display: block;
}

/* --- STICKY MINIMAL NAVIGATION --- */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--hero-bg);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: var(--transition);
}

[data-theme="dark"] header {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 75px;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    color: #1e3a8a;
}
[data-theme="dark"] .logo { color: #f1f5f9; }
.logo span { color: var(--accent-pink); }

nav { display: flex; align-items: center; gap: 24px; }
.nav-links { display: flex; list-style: none; gap: 24px; font-weight: 600; font-size: 15px; }

.search-container input {
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.5);
    color: var(--text-color);
    padding: 8px 14px;
    font-size: 14px;
    border-radius: 20px;
    outline: none;
    width: 140px;
    transition: var(--transition);
}
[data-theme="dark"] .search-container input {
    background: rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.1);
}
.search-container input:focus { width: 180px; border-color: var(--accent-pink); }

.theme-toggle {
    background: none; border: none; cursor: pointer; font-size: 18px; padding: 4px;
}

/* --- HERO WAVE RECREATION --- */
.hero-banner {
    background-color: var(--hero-bg);
    position: relative;
    padding: 40px 0 80px 0;
    transition: var(--transition);
}

.hero-banner h1 {
    font-size: 40px;
    font-weight: 800;
    max-width: var(--content-width);
}

.hero-banner p {
    color: var(--text-muted);
    max-width: var(--content-width);
    margin-top: 12px;
}

.wave-decorator {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background-color: var(--bg-color);
    clip-path: ellipse(60% 100% at 50% 100%);
    transition: var(--transition);
}

/* --- THE TWO-COLUMN STRUCTURAL LAYOUT --- */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 64px;
    margin-top: 3rem;
}

/* LEFT MAIN CONTENT FEED */
.content-feed {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.feed-post {
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
}
.feed-post:last-child { border-bottom: none; }
.feed-post-title { font-size: 24px; font-weight: 800; margin-bottom: 10px; line-height: 1.3; }
.feed-post-title a:hover { color: var(--accent-pink); }
.feed-post-meta { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; }
.feed-post-excerpt { color: var(--text-muted); font-size: 15px; }
.feed-post-readmore { display: inline-block; margin-top: 14px; font-weight: 700; color: var(--accent-pink); font-size: 14px; }

/* ARCHIVE / SEARCH HEADER */
.archive-header { margin-bottom: 40px; }
.archive-title { font-size: 30px; font-weight: 800; margin-top: 4px; }
.archive-title span { color: var(--accent-pink); }
.archive-description { color: var(--text-muted); margin-top: 10px; }

/* RIGHT SIDEBAR MODULES */
.sidebar { display: flex; flex-direction: column; gap: 48px; }

/* Categories List */
.pill-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.category-pill {
    background-color: var(--pill-bg); color: var(--pill-text);
    padding: 6px 12px; font-size: 13px; font-weight: 600; border-radius: 6px;
}

/* Popular Content List */
.popular-list { list-style: none; display: flex; flex-direction: column; gap: 16px; }
.popular-item { display: flex; align-items: flex-start; font-weight: 600; font-size: 15px; }
.popular-item::before { content: "→"; color: var(--accent-pink); margin-right: 8px; font-weight: 700; }
.popular-item a:hover, .sidebar-post-title a:hover { color: var(--accent-pink); }

/* Recently Published Sidebar Styling */
.sidebar-articles-list { display: flex; flex-direction: column; gap: 28px; }
.sidebar-post-entry { border-bottom: 1px solid var(--border-color); padding-bottom: 20px; }
.sidebar-post-entry:last-child { border-bottom: none; padding-bottom: 0; }
.sidebar-post-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; line-height: 1.3; }
.sidebar-post-excerpt { color: var(--text-muted); font-size: 14px; line-height: 1.5; }

/* Widget fallback styling (default WP widgets dropped into sidebar) */
.sidebar .widget { display: flex; flex-direction: column; gap: 16px; }
.sidebar .widget-title { color: var(--accent-pink); text-transform: uppercase; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; margin-bottom: 8px; }
.sidebar .widget ul { list-style: none; display: flex; flex-direction: column; gap: 12px; }

/* --- SINGLE ARTICLE VIEW --- */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    width: 0%;
    background-color: var(--accent-pink);
    z-index: 2000;
    transition: width 0.1s ease-out;
}

.single-article { max-width: var(--content-width); margin: 0 auto; padding: 60px 0; }
.single-article-title { font-size: 36px; font-weight: 800; margin-bottom: 16px; line-height: 1.25; }
.single-article-meta { color: var(--text-muted); font-size: 14px; margin-bottom: 40px; }
.single-article-body { font-size: 18px; }
.single-article-body p { margin-bottom: 24px; }
.single-article-body h2 { font-size: 26px; font-weight: 800; margin: 40px 0 16px; }
.single-article-body h3 { font-size: 21px; font-weight: 700; margin: 32px 0 12px; }
.single-article-body img { border-radius: 8px; margin: 24px 0; }
.single-article-body blockquote {
    border-left: 3px solid var(--accent-pink);
    padding-left: 20px;
    color: var(--text-muted);
    font-style: italic;
    margin: 24px 0;
}
.single-article-body code {
    background: var(--card-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 15px;
}
.single-article-body pre {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 24px 0;
}

/* --- FULL-WIDTH EXTENSION ELEMENTS --- */
.extended-footer-content {
    max-width: var(--content-width);
    margin: 4rem auto 100px auto;
}

/* AUTHOR PROFILE SECTION */
.author-box { display: flex; gap: 32px; align-items: center; }
.author-avatar {
    width: 90px; height: 90px; border-radius: 50%;
    background: var(--hero-bg); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 14px; color: var(--text-muted);
    overflow: hidden;
}
.author-avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-box h2 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.author-bio { color: var(--text-muted); font-size: 15px; margin-bottom: 12px; }
.social-links { display: flex; gap: 16px; list-style: none; font-size: 14px; font-weight: 600; }

/* NEWSLETTER COMPONENT */
.newsletter-block {
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 40px; text-align: center;
}
.newsletter-block h3 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.newsletter-block p { color: var(--text-muted); font-size: 15px; margin-bottom: 20px; }
.newsletter-form { display: flex; max-width: 440px; margin: 0 auto; gap: 12px; }
.newsletter-input {
    flex-grow: 1; padding: 12px 16px; border: 1px solid var(--border-color);
    background: var(--bg-color); color: var(--text-color); border-radius: 6px; outline: none;
}
.newsletter-btn {
    background-color: var(--text-color); color: var(--bg-color);
    border: none; padding: 12px 20px; font-weight: 700; border-radius: 6px; cursor: pointer;
}

/* DISCUSSION / COMMENTS ENGINE */
.comment-list { list-style: none; margin-top: 20px; }
.comment-item { padding: 20px 0; border-top: 1px solid var(--border-color); }
.comment-item .children { list-style: none; margin-left: 32px; margin-top: 12px; }
.comment-header { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.comment-date { font-weight: 400; color: var(--text-muted); font-size: 12px; margin-left: 6px; }
.comment-body { font-size: 15px; color: var(--text-muted); }
.comment-reply-link { font-size: 13px; font-weight: 700; color: var(--accent-pink); margin-top: 6px; display: inline-block; }
.comment-respond { margin-top: 32px; }
.comment-respond input[type="text"],
.comment-respond input[type="email"],
.comment-respond textarea {
    width: 100%; padding: 12px 16px; border: 1px solid var(--border-color);
    background: var(--bg-color); color: var(--text-color); border-radius: 6px;
    outline: none; margin-bottom: 12px; font-family: inherit;
}
.comment-respond .form-submit input {
    background-color: var(--text-color); color: var(--bg-color);
    border: none; padding: 12px 20px; font-weight: 700; border-radius: 6px; cursor: pointer;
}

/* PAGINATION */
.pagination { display: flex; gap: 12px; margin-top: 20px; font-weight: 600; }
.pagination a, .pagination span { padding: 8px 14px; border-radius: 6px; background: var(--card-bg); }
.pagination .current { background: var(--accent-pink); color: #fff; }

/* --- RESPONSIVE MEDIA BREAKPOINTS --- */
@media (max-width: 960px) {
    .main-grid { grid-template-columns: 1fr; gap: 48px; }
    .sidebar { border-top: 1px solid var(--border-color); padding-top: 48px; }
    .nav-links { display: none; }
}
@media (max-width: 600px) {
    .newsletter-form { flex-direction: column; }
    .author-box { flex-direction: column; text-align: center; }
}
