/*
Theme Name: Epochal Journal
Theme URI: https://epochalstock.com/journal
Author: Epochal Stock
Author URI: https://epochalstock.com
Description: Dark premium blog theme for Epochal Stock Journal. Matches the main site design with Playfair Display, gold accents, and grid layouts.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: epochal-journal
*/

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

:root {
    --bg: #0a0a0a;
    --surface: #141414;
    --border: #222;
    --text: #e8e8e8;
    --text-muted: #888;
    --gold: #c9a84c;
    --gold-light: #f4d675;
    --blue: #4a90d9;
    --blue-light: #67b8f4;
    --green: #27ae60;
    --green-light: #2ecc71;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold-light); }

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

.container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* ========================================================================
   HEADER — matches main site exactly
   ======================================================================== */

.site-header {
    background: linear-gradient(180deg, #111 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.logo img { height: 40px; width: 40px; border-radius: 8px; }
.logo .logo-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}
.logo .logo-text span { color: var(--gold); }
.header-nav { display: flex; gap: 24px; align-items: center; }
.header-nav a { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
.header-nav a:hover { color: var(--gold); }
.header-nav a.active { color: var(--gold); }

/* ========================================================================
   BLOG GRID
   ======================================================================== */

.blog-main {
    padding: 60px 0 80px;
}

.page-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 40px;
}

.posts-grid {
    column-count: 3;
    column-gap: 24px;
    margin-bottom: 48px;
}
.post-card {
    display: inline-block;
    width: 100%;
    break-inside: avoid;
    margin: 0 0 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: rgba(201, 168, 76, 0.3);
}

.post-card-image {
    display: block;
    position: relative;
    overflow: hidden;
    background: #111;
}
.post-card-image img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.5s ease;
}
.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

.post-card-body {
    padding: 20px;
}

.post-card-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.post-card-category {
    background: rgba(201, 168, 76, 0.12);
    color: var(--gold);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-card-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.35;
    margin-bottom: 10px;
}
.post-card-title a { color: #fff; }
.post-card-title a:hover { color: var(--gold); }

.post-card-excerpt {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

.post-card-read-more {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gold);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.post-card-read-more:hover { color: var(--gold-light); }
.post-card-read-more svg { transition: transform 0.2s; }
.post-card-read-more:hover svg { transform: translateX(3px); }

/* No thumbnail fallback */
.post-card-no-image {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--surface) 0%, #1a1a1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border);
    font-size: 3rem;
}

/* ========================================================================
   PAGINATION
   ======================================================================== */

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

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s;
}

.pagination a {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.pagination a:hover {
    background: rgba(201, 168, 76, 0.1);
    border-color: rgba(201, 168, 76, 0.3);
    color: var(--gold);
}

.pagination .current {
    background: var(--gold);
    color: #0a0a0a;
    font-weight: 700;
    border: 1px solid var(--gold);
}

/* ========================================================================
   SINGLE POST
   ======================================================================== */

.single-post-header {
    padding: 60px 0 0;
}

.single-post-featured-wrap {
    margin-bottom: 32px;
    text-align: center;
}

.single-post-featured {
    width: 100%;
    border-radius: var(--radius);
    object-fit: cover;
}

/* Portrait / Pinterest-format images: don't stretch full width */
.single-post-featured-wrap.is-portrait {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}
.single-post-featured-wrap.is-portrait .single-post-featured {
    width: 100%;
    max-height: none;
    object-fit: contain;
}

.single-post-meta {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.single-post-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 32px;
}

.single-post-content {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 80px;
}

.single-post-content h1,
.single-post-content h2,
.single-post-content h3,
.single-post-content h4 {
    font-family: 'Playfair Display', Georgia, serif;
    color: #fff;
    margin: 32px 0 16px;
}
.single-post-content h2 { font-size: 1.6rem; }
.single-post-content h3 { font-size: 1.3rem; }

.single-post-content p {
    margin-bottom: 20px;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text);
}

.single-post-content ul,
.single-post-content ol {
    margin: 0 0 20px 24px;
    color: var(--text);
}
.single-post-content li { margin-bottom: 8px; }

.single-post-content blockquote {
    border-left: 3px solid var(--gold);
    padding: 16px 24px;
    margin: 24px 0;
    background: var(--surface);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-muted);
    font-style: italic;
}

.single-post-content pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    overflow-x: auto;
    margin: 24px 0;
    font-size: 0.9rem;
}

.single-post-content code {
    background: rgba(201, 168, 76, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--gold);
}

.single-post-content pre code {
    background: none;
    padding: 0;
    color: var(--text);
}

.single-post-content img {
    border-radius: var(--radius);
    margin: 24px 0;
}

.single-post-content a { text-decoration: underline; text-underline-offset: 3px; }
.single-post-content a:hover { text-decoration-color: var(--gold-light); }

/* Post navigation */
.post-navigation {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 32px 0;
    border-top: 1px solid var(--border);
    margin-top: 48px;
}
.post-navigation a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 45%;
}
.post-navigation .nav-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.post-navigation .nav-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1rem;
    color: #fff;
}
.post-navigation a:hover .nav-title { color: var(--gold); }
.post-navigation .nav-next { text-align: right; margin-left: auto; }

/* Tags */
.post-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.post-tags a {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.post-tags a:hover {
    border-color: rgba(201, 168, 76, 0.3);
    color: var(--gold);
}

/* ========================================================================
   PAGE TEMPLATE
   ======================================================================== */

.page-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 0 80px;
}

.page-content h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 32px;
}

/* ========================================================================
   ARCHIVE HEADER
   ======================================================================== */

.archive-header {
    padding: 48px 0 0;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 24px;
}

.archive-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 8px;
}

.archive-description {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ========================================================================
   SEARCH
   ======================================================================== */

.search-header {
    padding: 48px 0 0;
    margin-bottom: 40px;
}

.search-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 8px;
}

.search-form-inline {
    display: flex;
    gap: 8px;
    max-width: 500px;
    margin-top: 16px;
}

.search-form-inline input[type="search"] {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
}
.search-form-inline input[type="search"]:focus {
    outline: none;
    border-color: rgba(201, 168, 76, 0.4);
}

.search-form-inline button {
    background: var(--gold);
    color: #0a0a0a;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.2s;
}
.search-form-inline button:hover { background: var(--gold-light); }

/* ========================================================================
   404
   ======================================================================== */

.error-404 {
    text-align: center;
    padding: 120px 24px;
}

.error-404 h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 6rem;
    color: var(--gold);
    line-height: 1;
    margin-bottom: 16px;
}

.error-404 p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 32px;
}

.btn-gold {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--gold);
    color: #0a0a0a;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s;
}
.btn-gold:hover { background: var(--gold-light); color: #0a0a0a; }

/* ========================================================================
   FOOTER — matches main site exactly
   ======================================================================== */

.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 48px 0 24px;
    margin-top: 60px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    margin-bottom: 32px;
}
.footer-col h4 {
    font-family: 'Playfair Display', Georgia, serif;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 16px;
}
.footer-col a {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 8px;
}
.footer-col a:hover { color: var(--gold); }
.footer-col p {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
}
.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */

@media (max-width: 900px) {
    .posts-grid { column-count: 2; }
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .header-nav { gap: 16px; }
    .header-nav a { font-size: 0.82rem; }
    .single-post-title { font-size: 1.8rem; }
    .page-title { font-size: 1.5rem; }
}

@media (max-width: 600px) {
    .posts-grid { column-count: 1; }
    .header-inner { flex-wrap: wrap; gap: 12px; }
    .header-nav { width: 100%; justify-content: center; }
    .footer-grid { grid-template-columns: 1fr; }
    .post-navigation { flex-direction: column; }
    .post-navigation .nav-next { text-align: left; }
    .single-post-content p { font-size: 0.95rem; }
}

/* ========================================================================
   WORDPRESS DEFAULTS
   ======================================================================== */

.wp-caption { max-width: 100%; margin: 24px 0; }
.wp-caption img { border-radius: var(--radius); }
.wp-caption-text { color: var(--text-muted); font-size: 0.85rem; margin-top: 8px; text-align: center; }

.alignleft { float: left; margin: 0 24px 16px 0; }
.alignright { float: right; margin: 0 0 16px 24px; }
.aligncenter { display: block; margin: 24px auto; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 24px 0; }
.gallery-item { margin: 0; }
.gallery-item img { border-radius: 8px; }

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* Related articles */
.related-posts {
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}
.related-posts h2 {
    font-family: 'Playfair Display', Georgia, serif;
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 20px;
}
.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}
.related-post-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.related-post-card a {
    display: block;
    color: #fff;
}
.related-post-card img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
}
.related-post-card span {
    display: block;
    padding: 14px;
    font-family: 'Playfair Display', Georgia, serif;
    line-height: 1.35;
}
.related-post-card a:hover span { color: var(--gold); }

@media (max-width: 760px) {
    .related-posts-grid { grid-template-columns: 1fr; }
}