/*
Theme Name: GajeWell Theme Pro
Theme URI: https://gajewell.jp/
Author: GajeWell Dev
Description: Modern tech blog theme. Optimized for Mobile & Ad display.
Version: 1.10.7
License: GNU General Public License v2 or later
Text Domain: gajewell
*/

:root {
    --color-primary: #0056b3;
    --color-primary-dark: #004494;
    --color-accent: #e63946;
    --color-text-main: #333333;
    --color-text-sub: #666666;
    --color-text-light: #999999;
    --color-bg-body: #f4f7f6;
    --color-bg-card: #ffffff;
    --color-border: #e0e0e0;
    --container-width: 1200px;
    --header-height: 70px;
    --sidebar-width: 340px;
    --border-radius-m: 12px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 20px rgba(0,0,0,0.08);
    --transition-base: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden; 
    font-family: "Helvetica Neue", Arial, sans-serif;
    background-color: var(--color-bg-body);
    color: var(--color-text-main);
    line-height: 1.8;
    font-size: 16px;
}
body {
    padding-top: var(--header-height);
}

a { color: inherit; text-decoration: none; transition: var(--transition-base); }
a:hover { color: var(--color-primary); }
img { max-width: 100%; height: auto; vertical-align: bottom; }
ul { list-style: none; }
.container { max-width: var(--container-width); margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    height: var(--header-height);
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid rgba(0,0,0,0.03);
    width: 100%;
}
.site-header .container { height: 100%; display: flex; justify-content: space-between; align-items: center; }
.site-branding { display: flex; align-items: center; }
.site-branding img, .custom-logo { max-height: 40px; width: auto; object-fit: contain; }
.main-navigation ul { display: flex; gap: 30px; }
.main-navigation a { font-weight: 600; color: var(--color-text-sub); position: relative; padding: 8px 0; }
.main-navigation a:hover { color: var(--color-primary); }
@media (max-width: 768px) { .main-navigation { display: none; } }

/* Hero Section */
.hero-section { margin: 30px 0 50px; animation: fadeInDown 0.8s ease forwards; }
.hero-grid { display: grid; grid-template-columns: 1.6fr 1fr; grid-template-rows: 280px 280px; gap: 20px; height: 580px; }
.hero-item-main { grid-row: 1 / 3; grid-column: 1 / 2; }
.hero-item-sub { grid-column: 2 / 3; }
.hero-card { position: relative; width: 100%; height: 100%; border-radius: var(--border-radius-m); overflow: hidden; box-shadow: var(--shadow-md); cursor: pointer; }
.hero-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.hero-card:hover img { transform: scale(1.08); }
.hero-overlay {
    position: absolute; bottom: 0; left: 0; right: 0; padding: 30px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
    color: #fff; display: flex; flex-direction: column; justify-content: flex-end; height: 60%; transition: padding-bottom 0.3s ease;
}
.hero-card:hover .hero-overlay { padding-bottom: 40px; }
.hero-cat { background: var(--color-accent); color: #fff; font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; margin-bottom: 10px; align-self: flex-start; }
.hero-title { font-size: 1.8rem; font-weight: 700; line-height: 1.3; margin: 0; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.hero-item-sub .hero-title { font-size: 1.2rem; }
@media (max-width: 768px) {
    .hero-grid { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; }
    .hero-item-main, .hero-item-sub { grid-column: 1 / -1; height: 300px; }
}

/* Featured Section */
.featured-grid { display: flex; flex-direction: column; gap: 20px; }
.featured-card { display: flex; background: var(--color-bg-card); border-radius: var(--border-radius-m); overflow: hidden; box-shadow: var(--shadow-md); border: 1px solid rgba(0,0,0,0.02); transition: var(--transition-base); }
.featured-card:hover { transform: translateY(-4px); }
.featured-thumb { width: 45%; min-height: 220px; position: relative; overflow: hidden; }
.featured-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.featured-card:hover .featured-thumb img { transform: scale(1.05); }
.featured-body { width: 55%; padding: 25px; display: flex; flex-direction: column; justify-content: center; }
.featured-label { display: inline-block; background: var(--color-accent); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; margin-bottom: 10px; align-self: flex-start; }
.featured-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 10px; line-height: 1.4; }
.featured-excerpt { font-size: 0.9rem; color: var(--color-text-sub); margin-bottom: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.featured-link { font-weight: 700; color: var(--color-primary); font-size: 0.9rem; }
@media (max-width: 600px) { .featured-card { flex-direction: column; } .featured-thumb, .featured-body { width: 100%; } .featured-thumb { height: 200px; min-height: auto; } }

/* Content & Grid */
.grid-wrapper { display: grid; grid-template-columns: 1fr var(--sidebar-width); gap: 40px; padding-bottom: 60px; }
@media (max-width: 992px) { .grid-wrapper { grid-template-columns: 1fr; } }
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 30px; }

/* Post Card (Archive/Index) */
.post-card { background: var(--color-bg-card); border-radius: var(--border-radius-m); overflow: hidden; box-shadow: var(--shadow-sm); transition: var(--transition-base); border: 1px solid rgba(0,0,0,0.02); display: flex; flex-direction: column; }
.post-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.post-thumb { overflow: hidden; aspect-ratio: 16 / 9; }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.post-card:hover .post-thumb img { transform: scale(1.1); }
.post-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.post-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; line-height: 1.5; }

/* Front Page Content */
.front-page-content {
    background: #fff; padding: 40px; border-radius: var(--border-radius-m); margin-bottom: 50px; box-shadow: var(--shadow-sm);
}
@media (max-width: 768px) { .front-page-content { padding: 20px; } }
.front-page-content img { max-width: 100%; height: auto; display: block; margin: 0 auto; }

/* Single Post (Clean Style) */
.single-article-clean {
    background: transparent; box-shadow: none; border-radius: 0; padding: 0; margin-bottom: 60px;
}
.single-article-clean .entry-header { margin-bottom: 40px; padding-bottom: 20px; border-bottom: 1px solid var(--color-border); }
.single-article-clean h1 { font-size: 2.2rem; font-weight: 800; line-height: 1.4; color: var(--color-text-main); }
.single-post-thumb { border-radius: var(--border-radius-m); overflow: hidden; margin-bottom: 40px; box-shadow: var(--shadow-sm); }

/* Sidebar, Widgets */
.widget { background: var(--color-bg-card); padding: 30px; border-radius: var(--border-radius-m); margin-bottom: 30px; box-shadow: var(--shadow-sm); }
.widget-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; border-left: 4px solid var(--color-primary); padding-left: 12px; }
.author-avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; }
.widget ul li { border-bottom: 1px solid var(--color-border); padding: 12px 0; }
.widget ul li:last-child { border-bottom: none; }
.widget ul li a { display: block; color: var(--color-text-sub); }
.widget ul li a:hover { color: var(--color-primary); padding-left: 5px; }

/* Sponsor Widget */
.widget_sponsor { text-align: center; padding: 20px; position: relative; }
.widget_sponsor::before { content: 'SPONSOR'; display: block; font-size: 0.7rem; color: #aaa; letter-spacing: 1px; margin-bottom: 10px; font-weight: 700; text-align: center; }
.widget_sponsor img { max-width: 100%; width: auto; height: auto; margin: 0 auto; box-shadow: none; }
.widget_sponsor iframe { max-width: 100%; margin: 0 auto; display: block; }

/* Recent Posts Widget */
.gajewell-recent-posts li { display: flex !important; align-items: center; gap: 15px; border-bottom: 1px dashed var(--color-border) !important; padding: 15px 0 !important; }
.gajewell-recent-posts li:last-child { border-bottom: none !important; }
.gajewell-recent-posts a { display: flex; align-items: center; gap: 15px; width: 100%; }
.gw-thumb { flex-shrink: 0; width: 70px; height: 70px; border-radius: 6px; overflow: hidden; background: #eee; }
.gw-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gw-text { display: flex; flex-direction: column; justify-content: center; }
.gw-title { font-size: 0.9rem; font-weight: 700; line-height: 1.4; margin-bottom: 4px; color: var(--color-text-main); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gw-date { font-size: 0.75rem; color: var(--color-text-light); }
.gajewell-recent-posts a:hover .gw-title { color: var(--color-primary); }

/* Footer */
.site-footer { background: #fff; border-top: 1px solid var(--color-border); padding: 60px 0 30px; margin-top: 60px; width: 100%; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; }
.copyright { text-align: center; margin-top: 40px; padding-top: 30px; border-top: 1px solid var(--color-border); font-size: 0.85rem; color: var(--color-text-light); }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.fade-in-up { animation: fadeInUp 0.8s ease forwards; opacity: 0; }
.delay-200 { animation-delay: 0.2s; }

/* ==============================================================================
   【Mobile Optimization】Max 768px (記事・ウィジェット完全統一)
   ============================================================================== */
@media (max-width: 768px) {
    .container { padding-left: 20px; padding-right: 20px; }
    .posts-grid { gap: 20px; }
    
    /* 1. 記事カード (一覧) & ピックアップ */
    .post-card, .featured-card {
        background: transparent; box-shadow: none; border-radius: 0; 
        
        /* 全幅設定: コンテナ余白を相殺 */
        margin-left: -20px; margin-right: -20px; width: auto;
        
        /* 内部余白: 20pxに戻してテキスト位置を揃える */
        padding-left: 20px; padding-right: 20px;
        
        margin-bottom: 25px; padding-bottom: 25px;
        border: none; border-bottom: 1px solid var(--color-border);
    }
    .post-card:hover, .featured-card:hover { transform: none; box-shadow: none; }
    .post-body, .featured-body { padding: 15px 0 0 0; }

    /* 2. シングルページ見出し (全幅化) */
    .single-article-clean .entry-header {
        margin-left: -20px; margin-right: -20px; width: auto;
        padding-left: 20px; padding-right: 20px;
        margin-bottom: 30px; padding-bottom: 20px;
        border-bottom: 1px solid var(--color-border);
    }

    /* 3. ウィジェット (全幅化) */
    .widget {
        margin-left: -20px; margin-right: -20px; width: auto;
        padding-left: 20px; padding-right: 20px;
        
        border-radius: 0; box-shadow: none;
        border-bottom: 1px solid var(--color-border);
        box-sizing: border-box;
    }
    .widget-area { width: 100%; }
}