/*
Theme Name: Twenty Twenty-Five Child
Theme URI: https://blog.daryledesilva.com
Description: Custom child theme for Tech Notes from the Trenches - Clean, dev-friendly design with dark code blocks
Author: Daryle De Silva
Author URI: https://daryledesilva.com
Template: twentytwentyfive
Version: 1.7.0
Text Domain: twentytwentyfive-child
*/

/* ============================================
   TYPOGRAPHY & READABILITY
   ============================================ */

:root {
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-text-light: #666666;
    --color-accent: #0066cc;
    --color-code-bg: #1e1e1e;
    --color-code-text: #d4d4d4;
    --color-border: #e5e5e5;
    --spacing-unit: 1.5rem;
}

body {
    font-family: var(--font-body);
    line-height: 1.7;
    font-size: 18px;
    color: var(--color-text);
}

/* Better heading hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-top: var(--spacing-unit);
    margin-bottom: calc(var(--spacing-unit) / 2);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; margin-top: 2.5rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

/* Improved paragraph spacing */
p {
    margin-bottom: var(--spacing-unit);
}

/* Article/post content */
.entry-content,
.wp-block-post-content {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   CODE BLOCKS - DARK THEME
   ============================================ */

/* Inline code */
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: #f5f5f5;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    color: #d63384;
}

/* Code blocks - Dark theme */
pre,
.wp-block-code,
pre[class*="language-"] {
    background: var(--color-code-bg) !important;
    border-radius: 8px;
    padding: 1.5rem !important;
    margin: var(--spacing-unit) 0;
    overflow-x: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

pre code,
.wp-block-code code,
pre[class*="language-"] code {
    font-family: var(--font-mono) !important;
    font-size: 15px;
    line-height: 1.6;
    background: transparent !important;
    color: var(--color-code-text);
    padding: 0 !important;
    border-radius: 0;
    text-shadow: none;
}

/* Prism.js code blocks */
code[class*="language-"],
pre[class*="language-"] {
    color: var(--color-code-text);
    background: var(--color-code-bg);
}

/* ============================================
   LINKS
   ============================================ */

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

a:hover {
    color: #004999;
    text-decoration: underline;
}

.entry-content a {
    text-decoration: underline;
    text-decoration-color: rgba(0, 102, 204, 0.3);
    text-underline-offset: 3px;
}

.entry-content a:hover {
    text-decoration-color: rgba(0, 102, 204, 0.8);
}

/* ============================================
   LISTS
   ============================================ */

ul, ol {
    margin: var(--spacing-unit) 0;
    padding-left: 2rem;
}

li {
    margin-bottom: 0.5rem;
}

/* ============================================
   READING TIME
   ============================================ */

.reading-time {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: var(--spacing-unit);
    font-style: italic;
}

/* ============================================
   POST META
   ============================================ */

.entry-meta {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: var(--spacing-unit);
}

/* ============================================
   SPACING IMPROVEMENTS
   ============================================ */

.wp-block-group,
.entry-content > * {
    margin-top: var(--spacing-unit);
    margin-bottom: var(--spacing-unit);
}

/* More breathing room around images */
.wp-block-image {
    margin: 2rem 0;
}

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

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    pre,
    .wp-block-code,
    pre[class*="language-"] {
        padding: 1rem !important;
        border-radius: 4px;
        font-size: 14px;
    }
    
    .entry-content,
    .wp-block-post-content {
        padding: 0 1rem;
    }
}

/* ============================================
   BLOCKQUOTES
   ============================================ */

blockquote {
    border-left: 4px solid var(--color-accent);
    padding-left: 1.5rem;
    margin: var(--spacing-unit) 0;
    font-style: italic;
    color: var(--color-text-light);
}

/* ============================================
   TABLES
   ============================================ */

table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-unit) 0;
}

th, td {
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    text-align: left;
}

th {
    background: #f5f5f5;
    font-weight: 600;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-center {
    text-align: center;
}

.mb-0 { margin-bottom: 0; }
.mt-0 { margin-top: 0; }

/* ============================================
   PHASE 2 & 3: NEW FEATURES STYLES
   ============================================ */

/* Related Posts Section */
.related-posts {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--color-border);
}

.related-posts-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.related-post-card {
    background: #f9f9f9;
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.related-post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.related-post-card h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.related-post-card h4 a {
    color: var(--color-text);
    text-decoration: none;
}

.related-post-card h4 a:hover {
    color: var(--color-accent);
}

.related-post-card p {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}

.related-post-meta {
    font-size: 0.85rem;
    color: var(--color-text-light);
    font-style: italic;
}

/* Author Card */
.author-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    margin-top: 3rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.author-card-name {
    margin-top: 0;
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
    color: #ffffff;
}

.author-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.author-card-bio {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    opacity: 0.95;
}

.author-card-social {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.author-card-social .social-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: background 0.2s ease;
}

.author-card-social .social-link:hover {
    background: rgba(255, 255, 255, 0.3);
    text-decoration: none;
}

/* Share Buttons */
.share-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2rem;
    padding: 1rem 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.share-label {
    font-weight: 600;
    color: var(--color-text-light);
    font-size: 0.9rem;
}

.share-btn {
    padding: 0.5rem 1rem;
    background: var(--color-accent);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.share-btn:hover {
    background: #004999;
    transform: translateY(-2px);
    text-decoration: none;
}

.share-copy {
    background: #10b981;
}

.share-copy:hover {
    background: #059669;
}

.share-copy.copied {
    background: #059669;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    background: #ffffff;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Dark Mode Styles */
.dark-mode {
    --color-bg: #1a1a1a;
    --color-text: #e5e5e5;
    --color-text-light: #a0a0a0;
    --color-border: #333333;
}

.dark-mode body {
    background: var(--color-bg);
    color: var(--color-text);
}

.dark-mode .dark-mode-toggle {
    background: #2a2a2a;
    border-color: #444444;
}

.dark-mode .related-post-card {
    background: #252525;
    border-color: #333333;
}

.dark-mode .related-post-card h4 a {
    color: var(--color-text);
}

.dark-mode code:not([class*="language-"]) {
    background: #2a2a2a;
    color: #e5e5e5;
}

/* Keep code blocks dark in light mode and dark mode */
.dark-mode pre,
.dark-mode .wp-block-code,
.dark-mode pre[class*="language-"] {
    background: var(--color-code-bg) !important;
}

/* Table of Contents */
.table-of-contents {
    background: #f9f9f9;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.dark-mode .table-of-contents {
    background: #252525;
}

.toc-title {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--color-text);
    padding: 0.25rem 0.5rem;
}

.toc-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list li.toc-subitem {
    padding-left: 1.5rem;
    font-size: 0.9rem;
}

.toc-list a {
    color: var(--color-accent);
    text-decoration: none;
}

.toc-list a:hover {
    text-decoration: underline;
}

/* Mobile Responsiveness for New Features */
@media (max-width: 768px) {
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .share-buttons {
        flex-wrap: wrap;
    }
    
    .dark-mode-toggle {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .author-card {
        padding: 1.5rem;
    }
    
    .author-card-social {
        flex-wrap: wrap;
    }
}

/* ============================================
   COMPREHENSIVE DARK MODE (System Default)
   ============================================ */

/* Apply dark mode to ALL WordPress elements */
.dark-mode,
.dark-mode body,
.dark-mode .wp-site-blocks {
    background-color: #0d1117 !important;
    color: #c9d1d9 !important;
}

.dark-mode a:where(:not(.wp-element-button)) {
    color: #58a6ff !important;
}

.dark-mode a:where(:not(.wp-element-button)):hover {
    color: #79c0ff !important;
}

/* Header */
.dark-mode header,
.dark-mode .wp-block-template-part {
    background-color: #0d1117 !important;
    color: #c9d1d9 !important;
}

/* Post content area */
.dark-mode .wp-block-post-content,
.dark-mode .entry-content,
.dark-mode article {
    color: #c9d1d9 !important;
}

.dark-mode h1, .dark-mode h2, .dark-mode h3,
.dark-mode h4, .dark-mode h5, .dark-mode h6 {
    color: #e6edf3 !important;
}

.dark-mode p, .dark-mode li, .dark-mode span:not(.token) {
    color: #c9d1d9 !important;
}

.dark-mode strong, .dark-mode b {
    color: #e6edf3 !important;
}

/* Code blocks — already dark, reinforce */
.dark-mode pre,
.dark-mode .wp-block-code,
.dark-mode pre[class*="language-"],
.dark-mode code[class*="language-"] {
    background: #161b22 !important;
    /* color: removed - let Prism handle token colors */
    border-color: #30363d !important;
}

/* Inline code */
.dark-mode code:not([class*="language-"]):not(pre code) {
    background: #161b22 !important;
    color: #ff7b72 !important;
    border: 1px solid #30363d;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Category navigation */
.dark-mode .category-navigation {
    background: #161b22 !important;
    border-color: #30363d !important;
}

.dark-mode .category-item a {
    background: #21262d !important;
    color: #c9d1d9 !important;
    border-color: #30363d !important;
}

.dark-mode .category-item a:hover {
    background: #30363d !important;
    color: #58a6ff !important;
}

/* Author card */
.dark-mode .author-card {
    background: linear-gradient(135deg, #161b22 0%, #1c2333 100%) !important;
    border: 1px solid #30363d !important;
}

.dark-mode .author-card-name,
.dark-mode .author-card-title,
.dark-mode .author-card-bio {
    color: #c9d1d9 !important;
}

.dark-mode .social-link {
    color: #58a6ff !important;
}

/* Share buttons */
.dark-mode .share-buttons {
    border-color: #30363d !important;
}

.dark-mode .share-btn {
    background: #21262d !important;
    color: #c9d1d9 !important;
    border-color: #30363d !important;
}

.dark-mode .share-btn:hover {
    background: #30363d !important;
    color: #58a6ff !important;
}

/* Related posts */
.dark-mode .related-posts {
    border-color: #30363d !important;
}

.dark-mode .related-post-card {
    background: #161b22 !important;
    border-color: #30363d !important;
}

.dark-mode .related-post-card h4 a {
    color: #58a6ff !important;
}

.dark-mode .related-post-card p,
.dark-mode .related-post-meta {
    color: #8b949e !important;
}

/* Table of contents */
.dark-mode .table-of-contents {
    background: #161b22 !important;
    border-color: #30363d !important;
}

.dark-mode .toc-list a {
    color: #58a6ff !important;
}

/* Reading time */
.dark-mode .reading-time {
    color: #8b949e !important;
}

/* Footer */
.dark-mode footer,
.dark-mode footer p,
.dark-mode footer a {
    background-color: #0d1117 !important;
    color: #8b949e !important;
}

/* Featured image caption */
.dark-mode figcaption {
    color: #8b949e !important;
}

/* Post metadata */
.dark-mode .wp-block-post-date,
.dark-mode .wp-block-post-author-name {
    color: #8b949e !important;
}

/* Blockquotes */
.dark-mode blockquote {
    border-left-color: #58a6ff !important;
    background: #161b22 !important;
    color: #c9d1d9 !important;
}

/* Input/forms (comments) */
.dark-mode input,
.dark-mode textarea {
    background: #161b22 !important;
    color: #c9d1d9 !important;
    border-color: #30363d !important;
}

/* Dark mode toggle refinement */
.dark-mode .dark-mode-toggle {
    background: #21262d !important;
    border-color: #30363d !important;
}

/* Navigation links */
.dark-mode .wp-block-navigation a,
.dark-mode .wp-block-navigation-item a {
    color: #c9d1d9 !important;
}

/* Post title link */
.dark-mode .wp-block-post-title a {
    color: #e6edf3 !important;
}

/* Horizontal rules */
.dark-mode hr {
    border-color: #30363d !important;
}

/* WordPress block separators */
.dark-mode .wp-block-separator {
    border-color: #30363d !important;
}

/* ============================================
   VISUAL POLISH v2 (Feb 17, 2026)
   ============================================ */

/* Homepage post list - card style with dividers */
.wp-block-post-template .wp-block-post {
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

.wp-block-post-template .wp-block-post:last-child {
    border-bottom: none;
}

/* Post titles on listing pages */
.wp-block-post-template .wp-block-post-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.wp-block-post-template .wp-block-post-title a {
    text-decoration: none;
    color: var(--color-text);
    transition: color 0.2s ease;
}

.wp-block-post-template .wp-block-post-title a:hover {
    color: var(--color-accent);
}

/* Post excerpts on listing - trim and clean */
.wp-block-post-template .wp-block-post-excerpt {
    font-size: 0.95rem;
    color: var(--color-text-light);
    line-height: 1.6;
}

.wp-block-post-template .wp-block-post-excerpt__more-text {
    margin-top: 0.75rem;
}

.wp-block-post-template .wp-block-post-excerpt__more-link {
    color: var(--color-accent);
    font-weight: 600;
    text-decoration: none;
}

.wp-block-post-template .wp-block-post-excerpt__more-link:hover {
    text-decoration: underline;
}

/* Featured image on listing - constrained and rounded */
.wp-block-post-template .wp-block-post-featured-image {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
}

.wp-block-post-template .wp-block-post-featured-image img {
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.wp-block-post-template .wp-block-post:hover .wp-block-post-featured-image img {
    transform: scale(1.02);
}

/* Post date on listing */
.wp-block-post-template .wp-block-post-date {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}

/* Category nav bar - sleeker horizontal style */
.category-navigation {
    background: transparent !important;
    border: none !important;
    padding: 0.75rem 0 !important;
    margin: 0 auto 1rem !important;
    border-bottom: 1px solid var(--color-border) !important;
    border-radius: 0 !important;
}

.category-nav-title {
    display: none !important;
}

.category-list {
    justify-content: center !important;
}

.category-item a {
    border: none !important;
    background: transparent !important;
    color: var(--color-text-light) !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    padding: 0.4rem 0.75rem !important;
    border-radius: 20px !important;
    transition: all 0.2s ease !important;
}

.category-item a:hover {
    background: var(--color-accent) !important;
    color: #ffffff !important;
    transform: none !important;
}

.category-item.current-category a {
    background: var(--color-accent) !important;
    color: #ffffff !important;
}

.category-count {
    display: none !important;
}

/* Single post header - tighter spacing */
.wp-block-post-title.has-xx-large-font-size,
.wp-block-post-title {
    margin-bottom: 0.5rem !important;
}

/* Featured image on single posts */
.is-layout-constrained > .wp-block-post-featured-image {
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
}

.is-layout-constrained > .wp-block-post-featured-image img {
    border-radius: 8px;
}

/* Header area - tighter */
.wp-block-site-title {
    font-size: 1.25rem !important;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Blog page title */
.wp-block-query-title {
    font-size: 2rem !important;
    margin-bottom: 1rem !important;
}

/* Code block copy button hint (top right) */
pre {
    position: relative;
}

/* Smoother scrollbar for code */
pre::-webkit-scrollbar {
    height: 6px;
}

pre::-webkit-scrollbar-track {
    background: transparent;
}

pre::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Dark mode polish */
.dark-mode .wp-block-post-template .wp-block-post {
    border-bottom-color: #30363d !important;
}

.dark-mode .wp-block-post-template .wp-block-post-title a {
    color: #e6edf3 !important;
}

.dark-mode .wp-block-post-template .wp-block-post-title a:hover {
    color: #58a6ff !important;
}

.dark-mode .category-navigation {
    border-bottom-color: #30363d !important;
}

.dark-mode .category-item a {
    color: #8b949e !important;
}

.dark-mode .category-item a:hover {
    background: #58a6ff !important;
    color: #ffffff !important;
}

.dark-mode .category-item.current-category a {
    background: #58a6ff !important;
    color: #ffffff !important;
}

/* Navigation cleanup */
.wp-block-navigation {
    font-size: 0.9rem;
}

/* Pagination styling */
.wp-block-query-pagination {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.dark-mode .wp-block-query-pagination {
    border-top-color: #30363d;
}

/* ============================================
   ALIGNMENT FIX (Feb 17, 2026)
   Title/Body alignment - content container needs
   auto margins and no extra padding since parent
   already has global-padding
   ============================================ */

.entry-content.alignfull.wp-block-post-content.has-global-padding {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
}
