/*
Theme Name: OPTITHEME
Theme URI: https://finkerr.com
Author: Finkerr
Author URI: https://finkerr.com
Description: High-performance WordPress theme optimized for speed, SEO, and AdSense monetization. Built with performance-first approach, focusing on Core Web Vitals and excellent user experience.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: optitheme
Tags: blog, editorial, performance, seo, adsense, responsive, accessibility-ready

This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

html {
    font-family: 'Proxima Nova', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-display: swap;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: #f9f9f9;
    color: #1f2937;
    line-height: 1.75;
    font-size: 16px;
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

.site-header {
    background-color: #1e40af;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    position: relative;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

/* Custom Logo Styles */
.site-logo {
    display: flex;
    align-items: center;
}

.site-logo-link {
    display: inline-block;
    line-height: 0;
}

.site-logo-link img {
    max-height: 45px;
    width: auto;
    height: auto;
    display: block;
}

.site-logo-link h1 {
    margin: 0;
    line-height: 1;
}

.site-logo-link h1 img {
    max-height: 45px;
}

/* Site Title Styles */
.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    margin: 0;
    line-height: 1.2;
}

.site-title a {
    color: inherit;
    text-decoration: none;
    display: inline-block;
}

.site-title:hover,
.site-title a:hover {
    color: rgba(255, 255, 255, 0.9);
}

.site-description {
    display: none;
}

/* Navigation Styles */
.main-navigation {
    flex-shrink: 0;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
    padding: 0;
}

@media (max-width: 767px) {
    /* Hide navigation menu in header on mobile */
    .header-content > .main-navigation:not(.active) {
        display: none !important;
        visibility: hidden !important;
    }
}

.main-navigation li {
    margin: 0;
}

.main-navigation a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 0;
    display: block;
    position: relative;
}

.main-navigation a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #ffffff;
}

.main-navigation a:hover {
    color: #ffffff;
}

.main-navigation a:hover::after {
    width: 100%;
}

.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a {
    color: #ffffff;
}

.main-navigation .current-menu-item > a::after,
.main-navigation .current_page_item > a::after {
    width: 100%;
}

/* Mobile Navigation */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.75rem;
    z-index: 101;
    position: relative;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
}

.menu-toggle-icon {
    display: flex;
    flex-direction: column;
    width: 24px;
    height: 18px;
    justify-content: space-between;
    position: relative;
}

.menu-toggle-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: #ffffff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 98;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 767px) {
    .site-header {
        padding: 0.75rem 0;
        position: relative;
    }
    
    .header-content {
        gap: 0;
        justify-content: center;
        position: relative;
    }
    
    .site-branding {
        flex: 1;
        justify-content: center;
        text-align: center;
        margin: 0 auto;
    }
    
    .site-title {
        font-size: 1.25rem;
        text-align: center;
    }
    
    .site-logo-link {
        display: flex;
        justify-content: center;
    }
    
    .site-logo-link img {
        max-height: 40px;
    }
    
    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: absolute;
        left: 1rem;
        top: 50%;
        transform: translateY(-50%);
        z-index: 102;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0.75rem;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Hide default navigation, show as sidebar when active */
    .main-navigation {
        display: block !important;
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background-color: #1e40af;
        z-index: 99;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding: 4rem 0 2rem;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .main-navigation.active {
        left: 0;
    }
    
    .main-navigation ul {
        flex-direction: column;
        gap: 0;
        width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .main-navigation li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .main-navigation a {
        display: block;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        width: 100%;
        color: rgba(255, 255, 255, 0.9);
    }
    
    .main-navigation a::after {
        display: none;
    }
    
    .main-navigation a:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }
    
    .main-navigation .current-menu-item > a,
    .main-navigation .current_page_item > a {
        background-color: rgba(255, 255, 255, 0.15);
        color: #ffffff;
    }
    
    body.menu-open {
        overflow: hidden;
    }
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.site-main {
    min-height: calc(100vh - 300px);
    padding: 2rem 0;
}

.content-area {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

@media (min-width: 1024px) {
    .content-area {
        grid-template-columns: 1fr 300px;
        gap: 0;
    }
    
    .sidebar {
        padding-left: 2rem;
    }
    
    .main-content {
        padding-right: 2rem;
    }
}

.main-content {
    max-width: 100%;
    background-color: transparent;
    padding: 2rem 0;
}

@media (min-width: 768px) {
    .main-content {
        padding: 3rem 0;
    }
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1 {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.25;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #111827;
}

h2 {
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.25;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #111827;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.25;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #111827;
}

h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

p {
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
    font-size: 1.125rem;
    line-height: 1.75;
}

ul, ol {
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
    padding-left: 1.625rem;
}

li {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

a {
    color: #1e40af;
    text-decoration: underline;
    font-weight: 500;
}

a:hover {
    color: #1e3a8a;
}

blockquote {
    border-left: 4px solid #d1d5db;
    padding-left: 1rem;
    font-style: italic;
    margin: 1.5rem 0;
    color: #4b5563;
}

/* ============================================
   POSTS & ARTICLES
   ============================================ */

.post {
    margin-bottom: 4rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.post-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.post-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #111827;
    letter-spacing: -0.02em;
}

@media (min-width: 768px) {
    .post-title {
        font-size: 3rem;
    }
}

.post-title a {
    color: #111827;
    text-decoration: none;
}

.post-title a:hover {
    color: #1e40af;
}

.post-meta {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 0;
    font-weight: 400;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.post-meta .post-author {
    color: #b91c1c;
    font-weight: 500;
}

.post-meta .post-date {
    color: #6b7280;
    font-weight: 400;
}

.post-meta .post-categories {
    color: #6b7280;
}

.post-meta .post-categories a {
    color: #6b7280;
    text-decoration: none;
}

.post-meta .post-categories a:hover {
    color: #1e40af;
    text-decoration: underline;
}

.post-thumbnail {
    margin: 2.5rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
}

.post-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0.5rem;
}

.post-content {
    line-height: 1.8;
    font-size: 1.125rem;
    color: #1f2937;
}

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

.post-content p:first-of-type {
    margin-top: 0;
    font-size: 1.25rem;
    line-height: 1.7;
    color: #374151;
    font-weight: 400;
}

.post-content strong {
    font-weight: 700;
    color: #111827;
}

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

.post-content ul,
.post-content ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.post-content li {
    margin: 0.75rem 0;
    line-height: 1.8;
}

.post-content h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    color: #111827;
    line-height: 1.3;
}

.post-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    color: #111827;
    line-height: 1.3;
}

.post-content blockquote {
    border-left: 4px solid #e5e7eb;
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #4b5563;
    font-size: 1.125rem;
}

.post-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.post-tags {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.post-tags strong {
    color: #6b7280;
    margin-right: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.post-tags a {
    color: #1e40af;
    text-decoration: none;
    margin-right: 0.5rem;
    font-size: 0.875rem;
}

.post-tags a:hover {
    text-decoration: underline;
}

/* ============================================
   FEATURED POSTS SECTION
   ============================================ */

.featured-posts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 3rem;
}

@media (min-width: 768px) {
    .featured-posts {
        grid-template-columns: 2fr 1fr;
        grid-template-rows: repeat(2, 1fr);
        gap: 1rem;
        height: 500px;
    }
}

.featured-post {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    min-height: 300px;
}

@media (min-width: 768px) {
    .featured-post-large {
        grid-row: 1 / 3;
        min-height: 100%;
    }
    
    .featured-post-small {
        min-height: calc((500px - 1rem) / 2);
    }
}

.featured-post-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: #ffffff;
}

.featured-post-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #1e40af;
    position: relative;
    transition: transform 0.3s ease;
    will-change: transform;
}

.featured-post:hover .featured-post-image {
    transform: scale(1.05);
}

.featured-post-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0.7) 100%);
    z-index: 1;
}

.featured-post-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    z-index: 2;
}

.featured-post-large .featured-post-content {
    padding: 2rem;
}

.featured-post-category {
    display: inline-block;
    background-color: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.featured-post-title {
    color: #ffffff;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.featured-post-large .featured-post-title {
    font-size: 1.75rem;
}

@media (min-width: 768px) {
    .featured-post-large .featured-post-title {
        font-size: 2rem;
    }
}

.featured-post-small .featured-post-title {
    font-size: 1.125rem;
}

@media (min-width: 768px) {
    .featured-post-small .featured-post-title {
        font-size: 1.25rem;
    }
}

.featured-post-meta {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
}

.featured-post-meta time {
    color: rgba(255, 255, 255, 0.9);
}

/* Mobile adjustments */
@media (max-width: 767px) {
    .featured-posts {
        margin-bottom: 2rem;
    }
    
    .featured-post {
        min-height: 250px;
    }
    
    .featured-post-content {
        padding: 1.25rem;
    }
    
    .featured-post-large .featured-post-title {
        font-size: 1.5rem;
    }
    
    .featured-post-small .featured-post-title {
        font-size: 1rem;
    }
}

/* ============================================
   POST GRID (ARCHIVE)
   ============================================ */

.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 2rem;
}

.post-card {
    background-color: transparent;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 0;
    overflow: visible;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.post-card:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.post-card:hover {
    opacity: 0.9;
}

.post-card-thumbnail {
    flex-shrink: 0;
    width: 200px;
    min-width: 200px;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background-color: #f3f4f6;
    border-radius: 0.5rem;
}

.post-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0.5rem;
}

.post-card-content {
    flex: 1;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.post-card-header {
    margin-bottom: 0;
}

.post-card-title {
    font-size: 1.25rem;
    font-weight: 900;
    margin-bottom: 0.375rem;
    line-height: 1.35;
    letter-spacing: -0.015em;
}

.post-card-title a {
    color: #1e40af;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-title a:hover {
    color: #1e3a8a;
    text-decoration: underline;
}

.post-card-meta {
    color: #6b7280;
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
}

.post-card-excerpt {
    color: #4b5563;
    font-size: 0.9375rem;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

/* Responsive: Mobile layout */
@media (max-width: 639px) {
    .post-card {
        flex-direction: column;
        border-radius: 0;
        padding-bottom: 1.25rem;
        margin-bottom: 1.25rem;
    }
    
    .post-card-thumbnail {
        width: 100%;
        min-width: 100%;
        aspect-ratio: 4 / 3;
        border-radius: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .post-card-content {
        padding: 0;
    }
    
    .post-card-title {
        font-size: 1.125rem;
    }
    
    .post-card-excerpt {
        -webkit-line-clamp: 3;
        font-size: 0.875rem;
    }
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    background-color: transparent;
    padding: 1.5rem;
    border-left: 1px solid #e5e7eb;
}

.widget {
    margin-bottom: 2rem;
}

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

.widget-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #111827;
}

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

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

.widget a {
    color: #4b5563;
    text-decoration: none;
}

.widget a:hover {
    color: #111827;
}

/* ============================================
   ADSENSE CONTAINERS (CLS Prevention)
   ============================================ */

.ad-container {
    aspect-ratio: 300 / 250;
    min-height: 250px;
    width: 100%;
    background-color: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
    border: 1px solid #e5e7eb;
}

.ad-container-wide {
    aspect-ratio: 728 / 90;
    min-height: 90px;
    width: 100%;
    background-color: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
    border: 1px solid #e5e7eb;
}

.ad-container-square {
    aspect-ratio: 1 / 1;
    min-height: 250px;
    width: 100%;
    background-color: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
    border: 1px solid #e5e7eb;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    background-color: transparent;
    border-top: 1px solid #e5e7eb;
    margin-top: 2rem;
    padding: 1.5rem 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .footer-content {
        grid-template-columns: repeat(3, 1fr);
    }
}

.footer-widget h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #111827;
}

.footer-widget p {
    color: #6b7280;
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

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

.footer-widget li {
    margin-bottom: 0.5rem;
}

.footer-widget a {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
}

.footer-widget a:hover {
    color: #111827;
}

.footer-bottom {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    color: #6b7280;
    font-size: 0.8125rem;
}

/* ============================================
   UTILITIES
   ============================================ */

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

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }

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

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

/* ============================================
   ACCESSIBILITY
   ============================================ */

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

.skip-link {
    position: absolute;
    top: -9999px;
    left: 0;
    z-index: 999999;
    padding: 1rem;
    background-color: #111827;
    color: #ffffff;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .site-header,
    .sidebar,
    .site-footer,
    .ad-container,
    .ad-container-wide,
    .ad-container-square {
        display: none;
    }
    
    .content-area {
        grid-template-columns: 1fr;
    }
}

