/*
 * iRunTech Blog - Modern Tech Blog Styles
 * Transforms the Read theme into a TechCrunch/Ars Technica style tech blog
 * Version: 1.1
 *
 * NOTE: Use Python zipfile to create WordPress-compatible ZIP files
 */

/* ============================================
   CSS VARIABLES - Theme Configuration
   ============================================ */
:root {
    /* Primary Colors */
    --primary-accent: #00d4aa;
    --primary-accent-hover: #00b894;
    --secondary-accent: #6c5ce7;

    /* Light Mode Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #6b7280;
    --border-color: #e5e5e0;
    --border-hover: #d0d0c8;

    /* Card Styles (matching dashboard) */
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.06);
    --card-radius: 12px;

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* Layout */
    --header-height: 64px;
    --container-max: 1280px;
    --content-width: 70%;
    --sidebar-width: 280px;
    --content-gap: 2rem;
    --section-padding: 2rem;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #f0f6fc;
    --text-secondary: #c9d1d9;
    --text-muted: #8b949e;
    --border-color: #30363d;
    --border-hover: #484f58;
    --card-bg: #161b22;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ============================================
   GOOGLE FONTS IMPORT
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ============================================
   BASE STYLES
   ============================================ */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Override theme's serif fonts */
html, body, button, input, select, textarea, .toggle h4,
h1, h2, h3, h4, h5, h6, .main-navigation ul li, dt,
h1.site-title, h1.site-title a {
    font-family: var(--font-primary) !important;
}

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

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

h1 a, h2 a, h3 a {
    color: var(--text-primary);
}

h1 a:hover, h2 a:hover, h3 a:hover {
    color: var(--primary-accent);
}

/* ============================================
   LAYOUT - Wider Content, Narrower Sidebar
   ============================================ */
.wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.wrapper > .row,
.wrapper > .row-fluid {
    width: 94%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0;
}

/* Main content layout - wider content, narrower sidebar */
#main.middle > .row-fluid {
    display: flex;
    gap: var(--content-gap);
    align-items: flex-start;
}

/* Primary content - takes most of the space */
#main.middle #primary {
    flex: 1;
    min-width: 0;
    width: auto !important;
    float: none !important;
    margin: 0 !important;
}

/* Sidebar - fixed narrow width */
#main.middle #secondary {
    flex-shrink: 0;
    width: var(--sidebar-width) !important;
    float: none !important;
    margin: 0 !important;
}

/* Remove old grid margins */
.span8, .span9, .span3, .span4 {
    width: auto !important;
    margin-left: 0 !important;
}

/* ============================================
   HEADER - Clean Modern Navigation
   ============================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.site-header > .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height);
    padding: 0;
    gap: 2rem;
}

.site-header hgroup {
    padding: 0;
    flex-shrink: 0;
}

h1.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    line-height: 1;
    letter-spacing: -0.01em;
}

h1.site-title a {
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

h1.site-title a:hover {
    color: var(--text-primary);
}

h1.site-title img {
    max-height: 42px;
    width: auto;
}

.site-description {
    display: none;
}

/* Navigation - centered or right aligned */
.main-navigation {
    border: none;
    flex-grow: 1;
    display: flex;
    justify-content: flex-end;
}

.main-navigation > ul,
.main-navigation > div > ul {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.main-navigation ul li {
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
    font-weight: 500;
    max-height: none;
    line-height: normal;
}

.main-navigation ul li a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all 0.2s ease;
    border: none;
}

.main-navigation ul li a:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
}

.main-navigation ul .current-menu-item > a,
.main-navigation ul .current_page_item > a {
    color: var(--primary-accent);
    background: rgba(0, 212, 170, 0.1);
}

/* Dropdown menus */
.main-navigation ul ul {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-top: 2px solid var(--primary-accent);
    border-radius: 0 0 8px 8px;
    box-shadow: var(--card-shadow-hover);
    top: 100%;
    margin-top: 0;
    padding: 0.5rem 0;
}

.main-navigation ul ul li {
    border: none;
}

.main-navigation ul ul li a {
    padding: 0.6rem 1.2rem;
    color: var(--text-secondary);
    border-radius: 0;
}

.main-navigation ul ul li a:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Theme Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-left: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 1rem;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.middle {
    padding: var(--section-padding) 0;
    background: var(--bg-secondary);
    min-height: calc(100vh - var(--header-height) - 100px);
}

#primary {
    background: transparent;
}

/* ============================================
   BLOG POSTS - Dashboard-Style Cards
   ============================================ */
.blog-posts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

/* Post Cards - Dashboard Style */
.blog-posts .hentry,
.hentry {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 0;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
}

.blog-posts .hentry:hover,
.hentry:hover {
    border-color: var(--border-hover);
    box-shadow: var(--card-shadow-hover);
}

/* Remove post format icons */
.hentry:before,
.hentry.sticky:before {
    display: none !important;
}

/* Featured Image */
.featured-image {
    margin: 0;
    overflow: hidden;
}

.featured-image a {
    display: block;
}

.featured-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.hentry:hover .featured-image img {
    transform: scale(1.02);
}

/* Entry Header */
.entry-header {
    padding: 1.25rem 1.25rem 0;
    text-align: left;
}

.blog-posts .entry-title,
.entry-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.01em;
}

.entry-title a {
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.entry-title a:hover {
    color: var(--primary-accent);
}

/* Entry Meta - at bottom like dashboard cards */
.entry-meta {
    padding: 0.75rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0;
    text-align: left;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    border-top: 1px solid var(--border-color);
    margin-top: 0.75rem;
    background: var(--bg-secondary);
}

.entry-meta a {
    color: var(--text-muted);
    border: none;
    transition: color 0.2s ease;
}

.entry-meta a:hover {
    color: var(--primary-accent);
    background: none;
}

/* Category Badge */
.entry-meta .post-category a,
.entry-meta a[rel="category tag"] {
    display: inline-block;
    background: var(--primary-accent);
    color: #fff !important;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.entry-meta .post-category a:hover,
.entry-meta a[rel="category tag"]:hover {
    background: var(--primary-accent-hover);
    color: #fff !important;
}

/* Entry Content/Excerpt */
.entry-content {
    padding: 0 1.25rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.entry-content p {
    margin: 0.5rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Read More Link */
.entry-content a.more-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.75rem 0 0;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.entry-content a.more-link:hover {
    background: var(--primary-accent);
    border-color: var(--primary-accent);
    color: #fff;
}

/* ============================================
   SINGLE POST STYLES
   ============================================ */
.blog-single .hentry {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.blog-single .hentry:hover {
    box-shadow: var(--card-shadow);
    transform: none;
}

.blog-single .entry-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: left;
    margin-bottom: 1rem;
}

.blog-single .entry-meta {
    text-align: left;
    padding: 1rem 0;
    margin: 0 0 1.5rem 0;
    border-top: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}

.blog-single .entry-content {
    padding: 0;
}

.blog-single .entry-content p {
    display: block;
    -webkit-line-clamp: unset;
    font-size: 1.05rem;
    line-height: 1.8;
    margin: 1rem 0;
}

.blog-single .entry-content h2 {
    margin-top: 2rem;
    font-size: 1.4rem;
    color: var(--text-primary);
}

.blog-single .entry-content h3 {
    margin-top: 1.5rem;
    font-size: 1.2rem;
}

/* Code blocks */
code {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: none;
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    color: var(--secondary-accent);
}

pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-primary);
}

/* Blockquotes */
blockquote {
    background: var(--bg-secondary);
    border-left: 3px solid var(--primary-accent);
    border-radius: 0 8px 8px 0;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    text-align: left;
}

blockquote:before {
    display: none;
}

blockquote p {
    font-size: 1rem;
    font-style: italic;
    margin: 0;
}

/* ============================================
   SIDEBAR - Compact Cards
   ============================================ */
#secondary {
    padding: 0;
}

#secondary .widget {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}

.widget-title,
#secondary .widget-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 1rem 0;
    padding: 0 0 0.75rem 0;
    border-bottom: 2px solid var(--primary-accent);
}

#secondary .widget ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

#secondary .widget ul li {
    font-size: 0.85rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.4;
}

#secondary .widget ul li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

#secondary .widget ul li:first-child {
    padding-top: 0;
}

#secondary .widget ul li:before {
    display: none;
}

#secondary .widget a {
    color: var(--text-secondary);
}

#secondary .widget a:hover {
    color: var(--primary-accent);
}

/* Search Widget */
#secondary .widget input[type=text],
#secondary .widget input[type=search] {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

#secondary .widget input[type=text]:focus,
#secondary .widget input[type=search]:focus {
    border-color: var(--primary-accent);
    outline: none;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
}

.site-footer > .row {
    border: none;
}

.site-footer .site-info {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.site-footer .site-info a {
    color: var(--text-secondary);
}

.site-footer .site-info a:hover {
    color: var(--primary-accent);
}

/* ============================================
   PAGINATION
   ============================================ */
.post-pagination {
    padding: 1.5rem 0;
}

.post-pagination ul {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.post-pagination li a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0.5rem 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.post-pagination li a:hover {
    border-color: var(--primary-accent);
    color: var(--primary-accent);
}

.post-pagination li.current a {
    background: var(--primary-accent);
    border-color: var(--primary-accent);
    color: #fff;
}

/* ============================================
   COMMENTS
   ============================================ */
.comments-area {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
}

.comments-title {
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
}

.comments-area article {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-accent);
    border-radius: 0 8px 8px 0;
    padding: 1rem;
    margin-bottom: 1rem;
}

.comment-meta .fn {
    font-weight: 600;
    color: var(--text-primary);
}

#respond {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

#respond input:not([type=submit]),
#respond textarea {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.6rem 0.75rem;
}

#respond input:focus,
#respond textarea:focus {
    border-color: var(--primary-accent);
    outline: none;
}

/* ============================================
   BUTTONS
   ============================================ */
input[type=submit],
input[type=button],
button:not(.theme-toggle):not(.mobile-menu-toggle),
a.button {
    background: var(--primary-accent);
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-shadow: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type=submit]:hover,
input[type=button]:hover,
button:not(.theme-toggle):not(.mobile-menu-toggle):hover,
a.button:hover {
    background: var(--primary-accent-hover);
}

/* ============================================
   FORMS
   ============================================ */
input:not([type=submit]):not([type=button]):not([type=file]):not([type=radio]):not([type=checkbox]),
textarea,
select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-accent);
    outline: none;
}

/* ============================================
   404 PAGE
   ============================================ */
.not-found {
    text-align: center;
    padding: 3rem 2rem;
}

.not-found h1 {
    font-size: 5rem;
    color: var(--primary-accent);
    text-shadow: none;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */
@media (max-width: 991px) {
    :root {
        --sidebar-width: 260px;
        --content-gap: 1.5rem;
    }

    .site-header > .row {
        flex-wrap: wrap;
    }

    .blog-single .entry-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 767px) {
    :root {
        --section-padding: 1.5rem;
    }

    /* Stack layout on mobile */
    #main.middle > .row-fluid {
        flex-direction: column;
    }

    #main.middle #primary,
    #main.middle #secondary {
        width: 100% !important;
    }

    .site-header > .row {
        padding: 0.5rem 0;
        gap: 1rem;
    }

    h1.site-title {
        font-size: 1.1rem;
    }

    h1.site-title img {
        max-height: 36px;
    }

    .main-navigation {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        display: none;
        padding: 1rem;
    }

    .main-navigation.active {
        display: block;
    }

    .main-navigation > ul,
    .main-navigation > div > ul {
        flex-direction: column;
        width: 100%;
    }

    .main-navigation ul li {
        width: 100%;
    }

    .main-navigation ul li a {
        padding: 0.75rem 1rem;
    }

    .blog-posts .entry-title {
        font-size: 1rem;
    }

    .featured-image img {
        height: 160px;
    }

    .blog-single .entry-title {
        font-size: 1.4rem;
    }

    .blog-single .hentry {
        padding: 1.25rem;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hentry {
    animation: fadeIn 0.3s ease forwards;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-accent { color: var(--primary-accent); }
.bg-accent { background: var(--primary-accent); }
.text-muted { color: var(--text-muted); }

.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;
}
