/*
Theme Name: WP Wikipedia
Description: A Wikipedia-style WordPress theme with customizable colors.
Author: WordPress Theme Builder
Version: 1.0.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wp-wikipedia
Tags: wikipedia, custom-colors, dark-mode, right-sidebar, clean, minimal

The theme WP Wikipedia is licensed under the GNU General Public License v2 or later.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

WP Wikipedia is inspired by Wikipedia's clean, minimalist design.
https://en.wikipedia.org/
*/

html {
    box-sizing: border-box;
    font-size: 100%;
    scroll-behavior: smooth;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: var(--wiki-text-color);
    background-color: var(--wiki-bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Linux Libertine", "Georgia", serif;
    font-weight: 400;
    line-height: 1.3;
    margin: 0 0 0.75em;
    color: var(--wiki-heading-color);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

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

a:hover {
    color: var(--wiki-link-hover-color);
    text-decoration: underline;
}

a:visited {
    color: var(--wiki-link-visited-color);
}

p {
    margin: 0 0 1.25em;
}

ul, ol {
    margin: 0 0 1.25em;
    padding-left: 2em;
}

li {
    margin-bottom: 0.5em;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25em 0;
    font-size: 0.95rem;
}

table th, table td {
    border: 1px solid #b1b1b1;
    padding: 0.75em;
    text-align: left;
}

table th {
    background-color: #f1f1f1;
    font-weight: bold;
}

blockquote {
    margin: 1.25em 0;
    padding-left: 1.5em;
    border-left: 4px solid #c8ccd1;
    color: #555d66;
    font-style: italic;
}

pre, code {
    font-family: "Courier New", Courier, monospace;
    background-color: #f6f8fa;
    border-radius: 3px;
}

pre {
    padding: 1em;
    overflow-x: auto;
    margin: 1.25em 0;
}

code {
    padding: 0.2em 0.4em;
}

hr {
    border: none;
    border-top: 1px solid #c8ccd1;
    margin: 2em 0;
}

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== Header ========== */

.site-header {
    background-color: var(--wiki-header-bg);
    border-bottom: 1px solid #e1e4e8;
    padding: 1.25em 0;
    transition: background-color 0.3s ease;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.25em;
}

.mobile-header {
    display: none;
}

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

.site-title a {
    color: var(--wiki-heading-color);
    text-decoration: none;
    font-weight: bold;
}

.site-description {
    margin: 0.5em 0 0;
    font-size: 0.9rem;
    color: #586069;
}

/* ========== Dark Mode Toggle ========== */

.dark-mode-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0.5em;
    border: none;
    border-radius: 4px;
    background: none;
    transition: background-color 0.2s ease;
}

.dark-mode-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dark-mode-toggle svg {
    width: 22px;
    height: 22px;
    fill: var(--wiki-heading-color);
    transition: fill 0.2s ease;
}

.dark-mode-toggle .sun-icon {
    display: none;
}

.dark-mode-toggle .moon-icon {
    display: block;
}

body.dark-mode .dark-mode-toggle .sun-icon {
    display: block;
}

body.dark-mode .dark-mode-toggle .moon-icon {
    display: none;
}

/* ========== Navigation ========== */

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.25em;
}

.nav-menu li {
    margin: 0;
    position: relative;
}

.nav-menu a {
    color: var(--wiki-menu-text-color);
    font-size: 0.95rem;
    padding: 0.25em 0;
    display: block;
}

.nav-menu a:hover {
    text-decoration: underline;
}

.nav-menu .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--wiki-content-bg);
    border: 1px solid #e1e4e8;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    list-style: none;
    padding: 0.5em 0;
    margin: 0;
    min-width: 200px;
    z-index: 10;
}

.nav-menu li:hover > .sub-menu {
    display: block;
}

.nav-menu .sub-menu li {
    margin: 0;
}

.nav-menu .sub-menu a {
    padding: 0.5em 1.25em;
    white-space: nowrap;
}

.nav-menu .sub-menu .sub-menu {
    top: 0;
    left: 100%;
}

/* ========== Search Form ========== */

.search-form {
    display: flex;
}

.search-form input[type="search"] {
    padding: 0.5em 1em;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: #fff;
    color: var(--wiki-text-color);
    width: 200px;
}

.search-form input[type="search"]:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

/* ========== Layout ========== */

.main-content {
    padding: 2em 0;
    min-height: 400px;
}

.content-area {
    background-color: var(--wiki-content-bg);
    padding: 2em;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease;
}

.entry-header {
    margin-bottom: 1.5em;
}

.entry-meta {
    font-size: 0.9rem;
    color: #586069;
    margin: 0.5em 0 1em;
}

.entry-meta a {
    color: var(--wiki-link-color);
}

.entry-content {
    font-size: 1rem;
    line-height: 1.7;
}

.entry-content h2 {
    border-bottom: 1px solid #e1e4e8;
    padding-bottom: 0.25em;
    margin-top: 1.5em;
}

.entry-content ul,
.entry-content ol {
    padding-left: 2em;
}

.post-thumbnail {
    margin-bottom: 1.5em;
}

.post-thumbnail img {
    border-radius: 4px;
    margin: 0;
}

.read-more {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--wiki-link-color);
}

/* ========== Sidebar ========== */

.widget-area {
    background-color: var(--wiki-sidebar-bg);
    padding: 1.5em;
    border-radius: 4px;
    margin-bottom: 1.5em;
    transition: background-color 0.3s ease;
}

.widget {
    margin-bottom: 1.5em;
}

.widget:last-child {
    margin-bottom: 0;
}

.widget h2, .widget h3 {
    font-size: 1.25rem;
    margin-top: 0;
    margin-bottom: 0.75em;
    color: var(--wiki-heading-color);
    border-bottom: 1px solid #e1e4e8;
    padding-bottom: 0.5em;
}

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

.widget ul li {
    margin-bottom: 0.5em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #e1e4e8;
}

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

.widget ul li a {
    color: var(--wiki-menu-text-color);
    font-size: 0.95rem;
}

.widget ul li a:hover {
    text-decoration: underline;
}

/* ========== Post Navigation ========== */

.navigation.posts-navigation,
.navigation.post-navigation {
    margin: 2em 0;
}

.nav-links {
    display: flex;
    justify-content: space-between;
    gap: 1em;
}

.nav-previous a,
.nav-next a {
    color: var(--wiki-link-color);
    font-size: 0.95rem;
}

/* ========== Comments ========== */

.comments-area {
    margin-top: 2em;
    padding-top: 2em;
    border-top: 1px solid #e1e4e8;
}

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

.comment {
    margin-bottom: 1.5em;
    padding: 1em;
    background: rgba(0,0,0,0.02);
    border-radius: 4px;
}

.comment-meta {
    font-size: 0.9rem;
    margin-bottom: 0.75em;
}

.comment-author {
    font-weight: 600;
}

.comment-author img {
    display: inline;
    margin: 0 0.5em 0 0;
    vertical-align: middle;
    border-radius: 50%;
}

#commentform textarea {
    width: 100%;
    padding: 0.75em;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

#commentform textarea:focus {
    outline: none;
    border-color: #0366d6;
}

#submit {
    display: inline-block;
    padding: 0.5em 1.5em;
    background: var(--wiki-link-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

#submit:hover {
    opacity: 0.9;
}

/* ========== Footer ========== */

.site-footer {
    background-color: var(--wiki-header-bg);
    border-top: 1px solid #e1e4e8;
    padding: 2em 0;
    text-align: center;
    margin-top: 2em;
    transition: background-color 0.3s ease;
}

.site-info {
    font-size: 0.9rem;
    color: #586069;
}

.site-info a {
    color: var(--wiki-link-color);
}

/* ========== Utility ========== */

.alignleft {
    float: left;
    margin: 0.5em 1.5em 0.5em 0;
}

.alignright {
    float: right;
    margin: 0.5em 0 0.5em 1.5em;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.page-links {
    margin: 1.5em 0;
    font-size: 0.95rem;
}

.page-links span {
    padding: 0.25em 0.5em;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    margin: 0 0.25em;
}

.edit-link a {
    font-size: 0.9rem;
    color: var(--wiki-link-color);
}

/* ========== Menu Toggle (Mobile) ========== */

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5em;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--wiki-heading-color);
    margin: 5px 0;
    transition: transform 0.2s;
}

/* ========== Desktop Layout ========== */

@media (min-width: 768px) {
    .site-header {
        display: block;
    }

    .mobile-header {
        display: none;
    }

    .wrapper {
        display: grid;
        grid-template-columns: 1fr 300px;
        gap: 2em;
    }

    .wrapper-full-width {
        grid-template-columns: 1fr;
    }

    .full-width .content-area {
        max-width: 800px;
        margin: 0 auto;
    }

    .main-content-area {
        min-width: 0;
    }

    .sidebar {
        min-width: 0;
    }
}

/* ========== Mobile Layout ========== */

@media (max-width: 767px) {
    .site-header {
        display: none;
    }

    .mobile-header {
        display: block;
        position: sticky;
        top: 0;
        z-index: 100;
        background-color: var(--wiki-header-bg);
        border-bottom: 1px solid #e1e4e8;
        padding: 0.75em 0;
        backdrop-filter: blur(5px);
    }

    .mobile-header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .menu-toggle {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0.5em;
    }

    .search-form input[type="search"] {
        width: 100%;
    }

    .wrapper {
        display: flex;
        flex-direction: column;
    }

    .wrapper .sidebar {
        order: -1;
    }

    #primary-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--wiki-content-bg);
        border-bottom: 1px solid #e1e4e8;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        flex-direction: column;
        padding: 1em;
        z-index: 99;
    }

    #primary-menu.show {
        display: flex;
    }

    #primary-menu li {
        margin: 0;
    }

    #primary-menu a {
        padding: 0.75em 0;
        border-bottom: 1px solid #e1e4e8;
        font-size: 1rem;
    }

    #primary-menu li:last-child a {
        border-bottom: none;
    }

    #primary-menu .sub-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 1.25em;
        background: none;
    }

    #primary-menu .sub-menu a {
        font-size: 0.9rem;
        padding: 0.5em 0;
    }

    .header-right {
        flex-direction: column;
        gap: 0.75em;
        width: 100%;
    }

    .dark-mode-toggle {
        padding: 0.25em;
    }

    .content-area {
        padding: 1.25em;
    }

    .site-title {
        font-size: 1.25rem;
    }

    .mobile-logo img {
        max-height: 40px;
        width: auto;
        margin: 0;
    }

    .post-thumbnail img {
        margin: 0;
    }
}
