/*
Theme Name: PaperMod WP
Theme URI: https://github.com/31d4r/papermod-wp
Author: Eldar Tutnjic
Author URI: https://eldartutnjic.com
Description: A fast, clean, and responsive WordPress theme inspired by Hugo PaperMod. Features light/dark mode toggle, table of contents, multiple layout modes, and optimized performance.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 7.4
License: MIT
License URI: https://opensource.org/licenses/MIT
Text Domain: papermod-wp
Tags: blog, minimal, clean, dark-mode, responsive, fast, seo-friendly, translation-ready
*/

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --theme: rgb(255, 255, 255);
    --entry: rgb(255, 255, 255);
    --primary: rgb(30, 30, 30);
    --secondary: rgb(108, 108, 108);
    --tertiary: rgb(214, 214, 214);
    --content: rgb(31, 31, 31);
    --code-block-bg: rgb(245, 245, 245);
    --code-bg: rgb(245, 245, 245);
    --border: rgb(238, 238, 238);
    --hljs-bg: rgb(28, 29, 33);
    --link-color: rgb(59, 130, 246);
    --link-hover: rgb(37, 99, 235);
}

[data-theme="dark"] {
    --theme: rgb(29, 32, 33);
    --entry: rgb(46, 46, 51);
    --primary: rgb(218, 218, 219);
    --secondary: rgb(155, 156, 157);
    --tertiary: rgb(65, 66, 68);
    --content: rgb(196, 196, 197);
    --code-block-bg: rgb(46, 46, 51);
    --code-bg: rgb(55, 56, 62);
    --border: rgb(51, 51, 51);
    --hljs-bg: rgb(46, 46, 51);
    --link-color: rgb(96, 165, 250);
    --link-hover: rgb(147, 197, 253);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--content);
    background-color: var(--theme);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background-color: var(--entry);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .site-header {
    background-color: rgba(46, 46, 51, 0.8);
}

.header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-branding {
    display: flex;
    align-items: center;
}

.site-branding .custom-logo {
    max-height: 60px;
    width: auto;
    height: auto;
    max-width: 200px;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.site-title a {
    color: var(--primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

.site-title a:hover {
    opacity: 0.8;
}

/* Navigation */
.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.main-navigation a {
    color: var(--content);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.main-navigation a:hover {
    color: var(--link-color);
}

/* Dark Mode Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--content);
    font-size: 1.2rem;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.theme-toggle:hover {
    transform: scale(1.1);
    background-color: var(--tertiary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* Main Content */
.site-main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Posts */
.post {
    background-color: var(--entry);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    transition: box-shadow 0.3s;
}

.post:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.post-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.post-title a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.post-title a:hover {
    color: var(--link-color);
}

.post-meta {
    color: var(--secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.post-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.post-meta a,
.post-meta .posted-on a,
.post-meta .byline a,
.post-meta .categories a {
    color: var(--primary) !important;
    font-weight: 600 !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.2s;
}

.post-meta a:hover,
.post-meta .posted-on a:hover,
.post-meta .byline a:hover,
.post-meta .categories a:hover {
    opacity: 0.8;
}

.post-content {
    color: var(--content);
    line-height: 1.8;
}

.post-content p {
    margin-bottom: 1rem;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--primary);
    font-weight: 600;
    line-height: 1.3;
}

.post-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.post-content h3 {
    font-size: 1.3rem;
}

.post-content a {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-content a:hover {
    color: var(--link-hover);
}

.read-more {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.2s;
}

.read-more:hover {
    opacity: 0.8;
}

.post-content code {
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
}

.post-content pre {
    background-color: var(--code-block-bg);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--border);
}

.post-content pre code {
    background: none;
    padding: 0;
}

.post-content blockquote {
    border-left: 4px solid var(--link-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--secondary);
    font-style: italic;
}

.post-content ul,
.post-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-thumbnail {
    margin: 1.5rem 0;
    overflow: hidden;
    border-radius: 6px;
}

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

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1.5rem 0;
}

/* Ensure all images respect container bounds */
img {
    max-width: 100%;
    height: auto;
}

/* Table of Contents */
.toc {
    background-color: var(--entry);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.toc-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary);
}

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

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

.toc a {
    color: var(--content);
    text-decoration: none;
    transition: color 0.2s;
    display: block;
    padding: 0.3rem 0;
}

.toc a:hover,
.toc a.active {
    color: var(--link-color);
}

.toc ul ul {
    margin-left: 1rem;
    margin-top: 0.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 3rem 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    background-color: var(--entry);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--content);
    text-decoration: none;
    transition: all 0.2s;
}

.pagination a:hover {
    background-color: var(--link-color);
    color: white;
    border-color: var(--link-color);
}

.pagination .current {
    background-color: var(--link-color);
    color: white;
    border-color: var(--link-color);
}

/* Footer */
.site-footer {
    background-color: var(--entry);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
    color: var(--secondary);
}

.site-footer p {
    margin: 0.5rem 0;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.social-links a {
    color: var(--content);
    font-size: 1.2rem;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--tertiary);
}

.social-links a i {
    font-size: 1.1rem;
    line-height: 1;
}

.social-links a:hover {
    color: var(--link-color);
    transform: scale(1.1);
    background-color: var(--border);
}

/* Archive Page */
.archive-header {
    margin-bottom: 2rem;
}

.archive-title {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.archive-description {
    color: var(--secondary);
}

/* Search Form */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin: 2rem 0;
}

.search-form input[type="search"] {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background-color: var(--entry);
    color: var(--content);
    font-size: 1rem;
}

.search-form input[type="submit"] {
    padding: 0.75rem 1.5rem;
    background-color: var(--link-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-form input[type="submit"]:hover {
    background-color: var(--link-hover);
}

/* 404 Page */
.error-404 {
    text-align: center;
    padding: 4rem 2rem;
}

.error-404 h1 {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.error-404 p {
    color: var(--secondary);
    margin-bottom: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-wrapper {
        flex-direction: column;
        gap: 1rem;
    }

    .main-navigation ul {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .post {
        padding: 1.5rem;
    }

    .post-title {
        font-size: 1.5rem;
    }

    .content-wrapper {
        padding: 0 15px;
    }
}

/* Home Info Mode */
.home-info {
    text-align: center;
    padding: 4rem 2rem;
}

.home-info .avatar {
    width: 120px;
    height: 120px;
    max-width: 120px;
    max-height: 120px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: block;
    border: 3px solid var(--border);
    object-fit: cover;
}

.home-info h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.home-info p {
    font-size: 1.1rem;
    color: var(--content);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.8;
}

/* Profile Mode */
.profile-mode {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.profile-avatar {
    flex-shrink: 0;
}

.profile-avatar img {
    width: 150px;
    height: 150px;
    max-width: 150px;
    max-height: 150px;
    border-radius: 50%;
    border: 3px solid var(--border);
    object-fit: cover;
}

.profile-content {
    flex: 1;
}

@media (max-width: 768px) {
    .profile-mode {
        flex-direction: column;
        text-align: center;
    }
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--link-color);
    z-index: 1000;
    transition: width 0.1s;
}

/* Copy Code Button */
.code-block-wrapper {
    position: relative;
}

.copy-code-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--content);
    transition: all 0.2s;
}

.copy-code-button:hover {
    background: var(--link-color);
    color: white;
}

/* Breadcrumbs */
.breadcrumbs {
    color: var(--secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.breadcrumbs a {
    color: var(--link-color);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs span {
    margin: 0 0.5rem;
}

/* Post Navigation */
.post-navigation {
    margin: 3rem 0;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.post-navigation .nav-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-navigation .nav-previous,
.post-navigation .nav-next {
    display: block;
}

.post-navigation .nav-subtitle {
    color: var(--secondary);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.3rem;
}

.post-navigation .nav-title {
    display: block;
}

.post-navigation a {
    color: var(--primary) !important;
    font-weight: 600 !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.2s;
    display: inline-block;
}

.post-navigation a:hover {
    opacity: 0.8;
}

/* Comments */
.comments-area {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

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

.comment {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--entry);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.comment-author {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.comment-meta {
    color: var(--secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.comment-content {
    color: var(--content);
    line-height: 1.6;
}

/* Tags */
.post-tags {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.post-tags a {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    margin: 0.3rem 0.3rem 0.3rem 0;
    background-color: var(--tertiary);
    color: var(--content);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.post-tags a:hover {
    background-color: var(--link-color);
    color: white;
}

