/*
Theme Name: GearSync
Theme URI: http://example.com/gearsync
Author: Antigravity AI
Description: A premium Japanese gadget blog theme with sleek dark UI.
Version: 1.1
*/

:root {
    --bg-color: #f6f8fa;
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --accent-blue: #0969da;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: #d0d7de;
    --card-bg: #ffffff;
}

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

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 15px;
}

a { color: var(--text-primary); text-decoration: none; }
a:hover { color: var(--accent-blue); }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.glass-header {
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 80px;
    padding: 10px 0;
}
.logo-link { 
    display: flex; 
    align-items: center; 
    text-decoration: none; 
}
.site-logo { 
    max-height: 55px;
    width: auto;
    display: block;
}
.nav-links { display: flex; align-items: center; }
.nav-links a { margin-left: 1.5rem; font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); }
.nav-links a:hover { color: var(--text-primary); }

/* Layout: Main + Sidebar */
.layout-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 2.5rem 0;
}
.main-content { flex: 1; min-width: 0; }
.sidebar { width: 300px; }

/* Mobile Optimizations (Smartphones) */
@media (max-width: 768px) {
    .container { padding: 0 1rem; }
    .layout-wrapper { padding: 1.5rem 0; gap: 1.5rem; }
    .sidebar { width: 100%; }
    
    /* Header optimization */
    .header-container { flex-direction: column; min-height: auto; padding: 10px 0; gap: 10px; }
    .site-logo { max-height: 45px; }
    
    /* Horizontal scrollable nav for mobile */
    .nav-links { 
        width: 100%; 
        overflow-x: auto; 
        white-space: nowrap; 
        padding-bottom: 5px; 
        -webkit-overflow-scrolling: touch; 
        justify-content: flex-start;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links a { margin: 0 1rem 0 0; font-size: 0.85rem; }
}

/* Section Title */
.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--glass-border);
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;
}
.section-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 1.2rem;
    background-color: var(--accent-blue);
    margin-right: 10px;
}

/* Post List (Japanese Blog Style) */
.posts-list { display: flex; flex-direction: column; gap: 1rem; }
.post-item {
    display: flex;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    overflow: hidden;
    transition: background 0.2s, transform 0.2s;
}
.post-item:hover { background: #f0f3f6; transform: translateY(-2px); }

/* Alternating Layout for Desktop */
.post-item:nth-child(even) {
    flex-direction: row-reverse;
}

.post-item-img { width: 220px; height: 130px; object-fit: cover; }
.post-item-content { padding: 1rem; display: flex; flex-direction: column; justify-content: space-between; flex: 1; }
.post-item-title { font-size: 1.05rem; font-weight: 700; line-height: 1.4; margin-bottom: 0.5rem; }
.post-item-meta { font-size: 0.8rem; color: var(--text-secondary); display: flex; gap: 1rem; align-items: center; }
.badge-longterm { background: var(--accent-blue); color: white; padding: 2px 8px; border-radius: 4px; font-weight: bold; }
.badge-desktour { background: #ff5722; color: white; padding: 2px 8px; border-radius: 4px; font-weight: bold; }

@media (max-width: 600px) {
    .post-item, .post-item:nth-child(even) { flex-direction: column; }
    .post-item-img { width: 100%; height: auto; aspect-ratio: 16/9; }
    .post-item-content { padding: 1rem 0.8rem; }
    .post-item-title { font-size: 1rem; }
}

/* Sidebar Widgets */
.widget {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.widget-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--glass-border); }
.widget p { font-size: 0.9rem; color: var(--text-secondary); }
.widget ul { list-style: none; }
.widget li { margin-bottom: 0.5rem; font-size: 0.9rem; border-bottom: 1px dashed var(--glass-border); padding-bottom: 0.5rem; }

/* Single Page / Post */
.single-post-wrapper {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 2rem;
}
.single-header { margin-bottom: 2rem; border-bottom: 1px solid var(--glass-border); padding-bottom: 1.5rem; }
.single-title { font-size: 1.8rem; font-weight: 700; line-height: 1.4; margin-bottom: 1rem; }
.single-meta { font-size: 0.9rem; color: var(--text-secondary); }
.single-content { font-size: 1rem; line-height: 1.8; color: #3b434b; }
.single-content h1, .single-content h2 {
    color: var(--text-primary);
    font-size: 1.3rem;
    border-left: 5px solid var(--accent-blue);
    background: rgba(9, 105, 218, 0.05);
    padding: 0.8rem 1rem;
    margin: 2.5rem 0 1.5rem;
}
.single-content h3 { font-size: 1.15rem; border-bottom: 1px solid var(--glass-border); padding-bottom: 0.3rem; margin: 2rem 0 1rem; }
.single-content p { margin-bottom: 1.5rem; }
.single-content img { max-width: 100%; height: auto; border-radius: 6px; margin: 1.5rem 0; display: block; border: 1px solid var(--glass-border); }

@media (max-width: 768px) {
    .single-post-wrapper { padding: 1.5rem 1rem; border-radius: 0; border-left: none; border-right: none; }
    .single-title { font-size: 1.4rem; }
    .single-content h1, .single-content h2 { font-size: 1.2rem; padding: 0.6rem 0.8rem; }
    .single-content h3 { font-size: 1.1rem; }
}

footer {
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 2rem;
}

/* Table of Contents Customization */
#toc_container {
    margin: 2.5rem auto 2rem auto !important;
    display: table;
    max-width: 95%;
    border-radius: 8px;
    background-color: #f8f9fa !important;
    border: 1px solid var(--glass-border) !important;
}
p.toc_title {
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Scroll to Top Button */
#scrollToTopBtn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 55px;
    height: 55px;
    background-color: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(9, 105, 218, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
}
#scrollToTopBtn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#scrollToTopBtn:hover {
    background-color: #0056b3;
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(9, 105, 218, 0.6);
}
@media (max-width: 768px) {
    #scrollToTopBtn {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* Sidebar Search Widget */
.search-form { display: flex; gap: 0.5rem; }
.search-field { flex: 1; padding: 0.6rem; border: 1px solid var(--glass-border); border-radius: 4px; font-size: 0.9rem; }
.search-submit { padding: 0.6rem 1rem; background: var(--accent-blue); color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; transition: background 0.2s; }
.search-submit:hover { background: #0056b3; }

/* Sidebar Popular Ranking Widget */
.sidebar-ranking-posts { list-style: none; padding: 0; margin: 0; }
.sidebar-ranking-posts li { border-bottom: none !important; padding: 0.5rem 0 !important; }
.ranking-item { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--text-primary); transition: background 0.2s; padding: 5px; border-radius: 4px; }
.ranking-item:hover { background: #f0f3f6; }
.ranking-thumb-wrapper { position: relative; width: 70px; height: 50px; flex-shrink: 0; }
.ranking-thumb-wrapper .sidebar-thumb { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.ranking-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 22px;
    height: 22px;
    background: #555;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 2;
}
/* Gold, Silver, Bronze */
.rank-1 { background: #ffca28; color: #b71c1c; }
.rank-2 { background: #e0e0e0; color: #424242; }
.rank-3 { background: #ff8a65; color: #3e2723; }

/* Related Articles Grid */
.related-articles { margin-top: 4rem; padding-top: 2rem; border-top: 2px solid var(--glass-border); }
.related-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.5rem; text-align: center; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.related-item { display: block; background: var(--card-bg); border: 1px solid var(--glass-border); border-radius: 6px; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; text-decoration: none; }
.related-item:hover { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.related-thumb { width: 100%; height: 120px; object-fit: cover; }
.related-post-title { font-size: 0.95rem; font-weight: 700; padding: 1rem; line-height: 1.4; color: var(--text-primary); margin: 0; }

@media (max-width: 768px) {
    .related-grid { grid-template-columns: 1fr; }
    .related-thumb { height: 160px; }
}


