@charset "UTF-8";

/* ==========================================================================
   CSS Variables (Light & Dark Theme)
   ========================================================================== */
:root {
    /* デフォルト：ライトモード */
    --bg-body: #f4f5f7;
    --bg-header: #ffffff;
    --bg-subnav: #eaeaea;
    --bg-widget: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f0f2f5;
    --bg-hover: #f8f9fa;
    --bg-footer: #ffffff;
    
    --text-main: #222222;
    --text-muted: #555555;
    --text-sub: #888888;
    --text-inverse: #ffffff;
    
    --border-color: #e2e8f0;
    --border-header: #e2e8f0;
    
    --accent-color: #ff2a4b;
    --accent-hover: #d91e3d;

    /* トグルスイッチ用カラー */
    --switch-bg: #cbd5e1;
    --switch-thumb: #ffffff;
}

[data-theme="dark"] {
    /* ダークモード */
    --bg-body: #121212;
    --bg-header: #1f1f1f;
    --bg-subnav: #181818;
    --bg-widget: #1f1f1f;
    --bg-card: #1f1f1f;
    --bg-input: #2a2a2a;
    --bg-hover: #252525;
    --bg-footer: #181818;
    
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    --text-sub: #888888;
    --text-inverse: #ffffff;
    
    --border-color: #2a2a2a;
    --border-header: #333333;
    
    --accent-color: #ff2a4b;
    --accent-hover: #d91e3d;

    /* トグルスイッチ用カラー */
    --switch-bg: #ff2a4b;
    --switch-thumb: #ffffff;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

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

a:hover {
    text-decoration: underline;
}

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

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-header);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.header-logo {
    display: flex;
    align-items: center;
}

.header-logo a {
    display: inline-block;
}

.header-logo img {
    height: auto;
    max-height: 50px;
    width: auto;
    max-width: 100%;
}

.header-nav {
    margin-left: auto;
}

.header-nav ul {
    display: flex;
    list-style: none;
    gap: 15px;
    align-items: center;
}

.header-nav a {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    color: var(--text-main);
}

.header-nav a:hover {
    color: var(--accent-color);
    text-decoration: none;
}

.header-search {
    flex-shrink: 0;
}

.header-search form {
    display: flex;
    gap: 5px;
}

.header-search input[type="text"] {
    padding: 8px 12px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-main);
    width: 240px;
    outline: none;
}

.header-search input[type="text"]:focus {
    border-color: var(--accent-color);
}

.header-search button {
    padding: 8px 16px;
    background-color: var(--accent-color);
    border: none;
    border-radius: 4px;
    color: var(--text-inverse);
    font-weight: bold;
    cursor: pointer;
}

.header-search button:hover {
    background-color: var(--accent-hover);
}

/* アンテナカテゴリナビゲーション用のスタイル */
.header-nav-sub {
    background-color: var(--bg-subnav);
    border-top: 1px solid var(--border-color);
    padding: 10px 0;
}

.header-nav-sub ul {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
}

.header-nav-sub li a {
    display: block;
    padding: 6px 14px;
    background-color: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 4px;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
}

.header-nav-sub li a:hover,
.header-nav-sub li a.active {
    background-color: var(--accent-color);
    color: var(--text-inverse);
    text-decoration: none;
}

/* ==========================================================================
   Toggle Switch Styles
   ========================================================================== */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--switch-bg);
    transition: 0.3s;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
}

.slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--switch-thumb);
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.slider .icon-sun,
.slider .icon-moon {
    font-size: 11px;
    line-height: 1;
    user-select: none;
}

input:checked + .slider::before {
    transform: translateX(22px);
}

/* ==========================================================================
   Layout (3 Columns: Left Sidebar, Main Content, Right Sidebar)
   ========================================================================== */
.site-container {
    max-width: 1600px;
    margin: 20px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    gap: 24px;
    align-items: start;
}

.sidebar-left,
.main-content,
.sidebar-right {
    min-width: 0;
}

/* ==========================================================================
   Main Content & Card Grid
   ========================================================================== */
.section-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent-color);
    color: var(--text-main);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.article-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.article-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
}

.article-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
    position: relative;
    overflow: hidden;
    display: block;
}

.article-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-input);
    color: var(--text-sub);
    font-weight: bold;
    font-size: 0.85rem;
}

.article-card-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.article-card-title {
    font-size: 0.9rem;
    font-weight: bold;
    line-height: 1.4;
    color: var(--text-main);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.article-card-title a {
    color: var(--text-main);
    text-decoration: none;
}

.article-card-title a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.article-card-meta {
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--text-sub);
    display: flex;
    justify-content: space-between;
}

/* ==========================================================================
   Article Detail Page (article.php)
   ========================================================================== */
.article-detail {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
}

.article-detail-title {
    font-size: 1.4rem;
    color: var(--text-main);
    margin-bottom: 15px;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.article-detail-meta {
    font-size: 0.85rem;
    color: var(--text-sub);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 15px;
}

.article-detail-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.article-detail-meta .btn-fav {
    margin-left: auto;
    flex-shrink: 0;
}

.article-detail-thumb {
    max-width: 640px;
    margin: 0 auto 20px auto;
    background-color: #000;
    border-radius: 6px;
    overflow: hidden;
}

.article-detail-thumb img {
    width: 100%;
    height: auto;
    display: block;
}

.article-detail-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 25px;
    white-space: pre-wrap;
}

.article-detail-action {
    text-align: center;
    margin: 30px 0 10px 0;
}

.btn-watch {
    display: inline-block;
    padding: 15px 40px;
    background-color: var(--accent-color);
    color: var(--text-inverse);
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 30px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(255, 42, 75, 0.4);
    transition: background-color 0.2s ease;
}

.btn-watch:hover {
    background-color: var(--accent-hover);
    text-decoration: none;
}

.related-articles {
    margin-top: 40px;
}

/* ==========================================================================
   Sidebars & Widgets (Left & Right)
   ========================================================================== */
.sidebar-widget {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    overflow: hidden;
}

.widget-title {
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.widget-list, .vertical-tag-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.widget-list li a, .vertical-tag-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    background-color: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.82rem;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    word-break: break-all;
    text-decoration: none;
}

.widget-list li a:hover, .vertical-tag-list li a:hover {
    background-color: var(--accent-color);
    color: var(--text-inverse);
    text-decoration: none;
}

.tag-count {
    font-size: 0.72rem;
    color: var(--text-sub);
}

.vertical-tag-list li a:hover .tag-count {
    color: var(--text-inverse);
}

/* 注目動画（サイドバー用サムネイル付きリスト） */
.widget-article-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.widget-article-list li a {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-decoration: none;
}

.widget-article-list li a:hover .widget-article-title {
    color: var(--accent-color);
    text-decoration: underline;
}

.widget-thumb {
    width: 80px;
    flex-shrink: 0;
    aspect-ratio: 16 / 9;
    background-color: #000;
    border-radius: 4px;
    overflow: hidden;
}

.widget-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.widget-text {
    flex-grow: 1;
    min-width: 0;
}

.widget-article-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.8rem;
    line-height: 1.3;
    color: var(--text-main);
}

/* ==========================================================================
   Widget Generator Page (widget.php)
   ========================================================================== */
.widget-desc {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 20px;
}

.widget-generator {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 24px;
}

.wg-controls {
    flex: 1 1 280px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 18px;
    border-radius: 6px;
}

.wg-field label {
    display: block;
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 4px;
}

.wg-field select,
.wg-field input[type=text],
.wg-field input[type=number] {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
}

.wg-field select:focus,
.wg-field input[type=text]:focus,
.wg-field input[type=number]:focus {
    border-color: var(--accent-color);
}

.wg-row {
    display: flex;
    gap: 12px;
}

.wg-row > div {
    flex: 1;
}

.wg-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-main);
    font-size: 13px;
}

.wg-grid-total-text {
    font-size: 11px;
    color: var(--text-sub);
    margin-top: 4px;
}

.wg-preview {
    flex: 1 1 340px;
}

.wg-preview-label {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 6px;
}

#wg-preview-frame {
    width: 100%;
    max-width: 340px;
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.wg-code-area {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.wg-code-block {
    flex: 1 1 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 6px;
}

.wg-code-block textarea {
    width: 100%;
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    font-family: monospace;
    font-size: 12px;
    resize: vertical;
    margin-bottom: 8px;
    outline: none;
}

.wg-code-block textarea:focus {
    border-color: var(--accent-color);
}

.wg-copy-btn {
    padding: 6px 14px;
    background: var(--accent-color);
    color: var(--text-inverse);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

.wg-copy-btn:hover {
    background: var(--accent-hover);
}

/* ==========================================================================
   Bottom Navigation & Mobile Overlays
   ========================================================================== */
.bottom-nav {
    display: none;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    padding: 20px;
    overflow-y: auto;
}

.mobile-overlay.active {
    display: block;
}

.mobile-overlay-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

.mobile-search-form {
    display: flex;
    gap: 8px;
    margin-top: 50px;
}

.mobile-search-form input[type="text"] {
    flex-grow: 1;
    padding: 12px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
}

.mobile-search-form button {
    padding: 12px 20px;
    background-color: var(--accent-color);
    border: none;
    border-radius: 4px;
    color: var(--text-inverse);
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
}

/* ==========================================================================
   Favorite Button Style
   ========================================================================== */
.btn-fav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

.btn-fav:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.btn-fav.active {
    background-color: var(--accent-color);
    color: var(--text-inverse);
    border-color: var(--accent-color);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    background-color: var(--bg-footer);
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
    padding: 30px 20px;
    text-align: center;
}

.footer-inner {
    max-width: 1600px;
    margin: 0 auto;
}

.footer-links {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-sub);
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: var(--text-main);
}

.copyright {
    font-size: 0.8rem;
    color: var(--text-sub);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
    body {
        padding-bottom: 60px; /* ボトムメニュー用の余白確保 */
    }

    .site-container {
        grid-template-columns: 1fr;
        padding: 0 12px;
        margin: 15px auto;
    }

    .header-inner {
        justify-content: center;
        padding: 10px 15px;
    }

    .header-logo {
        margin: 0 auto;
        justify-content: center;
    }

    .header-logo img {
        max-height: 40px;
    }

    .header-nav,
    .header-search,
    .header-nav-sub {
        display: none; /* スマホ時はサブナビ等も非表示にしてボトムメニューに委譲 */
    }

    .sidebar-left,
    .sidebar-right {
        display: none !important;
    }

    .main-content {
        width: 100%;
    }

    .article-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 56px;
        background-color: var(--bg-header);
        border-top: 1px solid var(--border-color);
        z-index: 1500;
        justify-content: space-around;
        align-items: center;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        font-size: 0.7rem;
        width: 25%;
        height: 100%;
        background: none;
        border: none;
        cursor: pointer;
    }

    .bottom-nav-item:hover,
    .bottom-nav-item.active {
        color: var(--accent-color);
    }

    .bottom-nav-icon {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }
}