/* ============================================================
   Lab AI — テックツール紹介テーマ
   ============================================================ */

/* --- リセット --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* カラー（AIテーマ: 紫系アクセント） */
    --bg: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-surface: #fafafa;
    --border: #e0e0e0;
    --border-light: #eeeeee;
    --text: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent: #7c3aed;
    --accent-dark: #5b21b6;
    --accent-light: #ede9fe;
    --category: #7c3aed;
    --category-bg: #ede9fe;
    --tag-bg: #f0f0f0;
    --tag-text: #555555;
    --hover-bg: #f8f8f8;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);

    /* タイポグラフィ */
    --font-body: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* スペーシング */
    --sp-xs: 4px;
    --sp-sm: 8px;
    --sp-md: 16px;
    --sp-lg: 24px;
    --sp-xl: 40px;
    --sp-2xl: 64px;

    /* レイアウト */
    --max-w: 1200px;
    --radius: 4px;
    --radius-lg: 8px;
}

/* --- ベース --- */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color .15s;
}

a:hover {
    color: var(--accent-dark);
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--sp-lg);
}

/* --- ヘッダー --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
}

.header-inner {
    border-bottom: 1px solid var(--border);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.site-logo {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: var(--text);
}

.site-logo:hover {
    color: var(--text);
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.logo-sub {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--accent);
}

.site-nav {
    display: flex;
    gap: var(--sp-lg);
}

.site-nav a {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    padding: var(--sp-xs) 0;
    transition: color .15s;
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--text);
}

.header-accent {
    height: 2px;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
}

/* ハンバーガーメニュー */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 28px;
    height: 20px;
    position: relative;
}

.menu-toggle span {
    display: block;
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text);
    transition: all .25s;
}

.menu-toggle span:nth-child(1) { top: 0; }
.menu-toggle span:nth-child(2) { top: 9px; }
.menu-toggle span:nth-child(3) { top: 18px; }

.menu-toggle.open span:nth-child(1) {
    top: 9px;
    transform: rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
    top: 9px;
    transform: rotate(-45deg);
}

/* --- フィーチャードセクション --- */
.featured {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    margin: var(--sp-xl) 0;
}

.featured-main {
    background: var(--bg);
}

.featured-hero {
    padding: var(--sp-xl);
    height: 100%;
}

.featured-hero a {
    color: var(--text);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.featured-hero h2 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.4;
    margin: var(--sp-md) 0;
}

.featured-hero p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    flex: 1;
}

.featured-hero time {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: var(--sp-md);
}

.featured-hero a:hover h2 {
    color: var(--accent);
}

.featured-side {
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.featured-sub {
    padding: var(--sp-lg);
    border-bottom: 1px solid var(--border);
    flex: 1;
    display: flex;
    align-items: stretch;
}

.featured-sub:last-child {
    border-bottom: none;
}

.featured-sub a {
    color: var(--text);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-sub h3 {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.5;
    margin: var(--sp-xs) 0;
}

.featured-sub time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.featured-sub a:hover h3 {
    color: var(--accent);
}

/* --- セクションヘッダー --- */
.section-header {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    margin: var(--sp-xl) 0 var(--sp-lg);
}

.section-header h2 {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    color: var(--text);
}

.section-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* --- カテゴリバッジ --- */
.category-badge {
    display: inline-block;
    background: var(--category-bg);
    color: var(--category);
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.category-badge--sm {
    padding: 2px 8px;
    font-size: 0.7rem;
}

/* --- 記事グリッド --- */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-lg);
    padding-bottom: var(--sp-2xl);
}

.post-card {
    border: 1px solid var(--border-light);
    transition: border-color .15s, box-shadow .15s;
}

.post-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.post-card a {
    display: block;
    padding: var(--sp-lg);
    color: var(--text);
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    margin-bottom: var(--sp-sm);
}

.post-card-meta time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.post-card h3 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: var(--sp-sm);
}

.post-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.post-card a:hover h3 {
    color: var(--accent);
}

.post-card-tags {
    margin-top: var(--sp-sm);
    display: flex;
    gap: var(--sp-xs);
    flex-wrap: wrap;
}

.tag-sm {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--tag-bg);
    padding: 2px 6px;
    border-radius: var(--radius);
}

/* --- 記事詳細 --- */
.article-header {
    max-width: 800px;
    padding: var(--sp-xl) 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--sp-xl);
}

.article-header h1 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.4;
    margin: var(--sp-md) 0;
    letter-spacing: -0.01em;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
}

.article-lead {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: var(--sp-md);
}

.article-date {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: var(--sp-md);
}

.official-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    padding: 4px 12px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    transition: background .15s, color .15s;
}

.official-link:hover {
    background: var(--accent);
    color: #fff;
}

/* 2カラムレイアウト */
.article-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--sp-2xl);
    padding-bottom: var(--sp-2xl);
}

.article-body {
    min-width: 0;
    max-width: 680px;
}

/* ツール概要カード */
.tool-card {
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: var(--sp-md) var(--sp-lg);
    margin-bottom: var(--sp-xl);
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-md) var(--sp-xl);
}

.tool-card-item {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    font-size: 0.9rem;
}

.tool-label {
    font-weight: 600;
    color: var(--accent-dark);
    font-size: 0.8rem;
}

/* 目次 */
.toc {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--sp-md) var(--sp-lg);
    margin-bottom: var(--sp-xl);
}

.toc summary {
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text);
    margin-bottom: var(--sp-sm);
}

.toc nav ul {
    padding-left: var(--sp-lg);
}

.toc nav li {
    margin: var(--sp-xs) 0;
}

.toc nav a {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.toc nav a:hover {
    color: var(--accent);
}

/* 記事本文 */
.article-content {
    line-height: 1.9;
}

.article-content h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: var(--sp-xl) 0 var(--sp-md);
    padding-left: var(--sp-md);
    border-left: 4px solid var(--accent);
}

.article-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: var(--sp-lg) 0 var(--sp-sm);
    color: var(--accent-dark);
}

.article-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: var(--sp-lg) 0 var(--sp-sm);
}

.article-content p {
    margin-bottom: var(--sp-md);
}

.article-content ul,
.article-content ol {
    padding-left: var(--sp-lg);
    margin-bottom: var(--sp-md);
}

.article-content li {
    margin-bottom: var(--sp-xs);
}

.article-content blockquote {
    border-left: 3px solid var(--accent);
    padding: var(--sp-md) var(--sp-lg);
    background: var(--accent-light);
    margin: var(--sp-md) 0;
    color: var(--text-secondary);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.article-content pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: var(--sp-md);
    overflow-x: auto;
    margin-bottom: var(--sp-md);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.article-content code {
    font-family: var(--font-mono);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: var(--radius);
    font-size: 0.85em;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--sp-md);
    font-size: 0.9rem;
}

.article-content th,
.article-content td {
    border: 1px solid var(--border);
    padding: var(--sp-sm) var(--sp-md);
    text-align: left;
}

.article-content th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.article-content tr:nth-child(even) td {
    background: var(--bg-surface);
}

.article-content strong {
    font-weight: 600;
}

/* タグ */
.article-tags {
    margin: var(--sp-xl) 0;
    display: flex;
    gap: var(--sp-sm);
    flex-wrap: wrap;
}

.tag {
    color: var(--tag-text);
    background: var(--tag-bg);
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    transition: background .15s;
}

.tag:hover {
    background: var(--border);
    color: var(--text);
}

/* 免責事項 */
.disclaimer {
    background: var(--bg-secondary);
    border-left: 3px solid var(--text-muted);
    padding: var(--sp-md) var(--sp-lg);
    margin-top: var(--sp-xl);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.disclaimer strong {
    color: var(--text-secondary);
}

/* --- サイドバー --- */
.sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
}

.sidebar-section {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--sp-lg);
    margin-bottom: var(--sp-lg);
}

.sidebar-section h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--sp-md);
    padding-bottom: var(--sp-sm);
    border-bottom: 2px solid var(--accent);
}

.sidebar-posts {
    list-style: none;
}

.sidebar-posts li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--sp-sm);
    padding: var(--sp-sm) 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}

.sidebar-posts li:last-child {
    border-bottom: none;
}

.sidebar-posts a {
    color: var(--text);
    line-height: 1.4;
}

.sidebar-posts a:hover {
    color: var(--accent);
}

.sidebar-posts time {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* サイドバーカテゴリ */
.sidebar-categories {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-xs);
}

.sidebar-cat {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 4px 10px;
    border-radius: var(--radius);
    transition: background .15s;
}

.sidebar-cat:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.sidebar-cat span {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* 広告ユニット */
.ad-unit {
    margin: var(--sp-lg) 0;
}

/* --- フッター --- */
.site-footer {
    margin-top: auto;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: var(--sp-xl) 0;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: var(--sp-md);
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.footer-links a:hover {
    color: var(--text);
}

/* --- レスポンシブ --- */

@media (max-width: 1200px) {
    .featured {
        grid-template-columns: 1fr;
    }

    .featured-side {
        flex-direction: row;
    }

    .featured-sub {
        border-bottom: none;
        border-right: 1px solid var(--border);
    }

    .featured-sub:last-child {
        border-right: none;
    }
}

@media (max-width: 768px) {
    .header-container {
        height: 48px;
    }

    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: var(--sp-md) var(--sp-lg);
        box-shadow: var(--shadow-md);
    }

    .site-nav.open {
        display: flex;
    }

    .site-nav a {
        padding: var(--sp-sm) 0;
    }

    .menu-toggle {
        display: block;
    }

    .featured {
        grid-template-columns: 1fr;
        margin: var(--sp-lg) 0;
    }

    .featured-hero {
        padding: var(--sp-lg);
    }

    .featured-hero h2 {
        font-size: 1.3rem;
    }

    .featured-side {
        flex-direction: column;
    }

    .featured-sub {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .article-layout {
        grid-template-columns: 1fr;
        gap: var(--sp-xl);
    }

    .sidebar {
        position: static;
    }

    .article-header h1 {
        font-size: 1.5rem;
    }

    .footer-inner {
        flex-direction: column;
        gap: var(--sp-md);
        text-align: center;
    }

    .tool-card {
        flex-direction: column;
        gap: var(--sp-sm);
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--sp-md);
    }

    .featured-hero h2 {
        font-size: 1.15rem;
    }

    .article-header h1 {
        font-size: 1.3rem;
    }

    .article-content h2 {
        font-size: 1.15rem;
    }
}
