
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&family=Inter:wght@400;600;700&display=swap');

/* =========================================
   CSS Variables
   ========================================= */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --accent: #f59e0b;
    --bg: #f4f6f9;
    --text: #1f2937;
    --text-muted: #6b7280;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --header-bg: #ffffff;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.14);
    --sidebar-width: 300px;
    --max-width: 1180px;
}

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

body {
    font-family: 'Noto Sans JP', 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.8;
    font-size: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* =========================================
   Header
   ========================================= */
.site-header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.site-logo:hover {
    color: var(--primary);
    text-decoration: none;
}

.site-logo .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

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

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

/* =========================================
   Page Layout (2-column)
   ========================================= */
.page-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    flex: 1;
}

.main-content {
    flex: 1;
    min-width: 0;
}

/* =========================================
   Sidebar
   ========================================= */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.sidebar-widget {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.sidebar-widget-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

/* Ad Widget */
.ad-widget {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 1rem;
}

.ad-widget.ad-filled {
    border: none;
    min-height: auto;
    display: block;
    padding: 0;
}

/* Profile Widget */
.profile-widget {
    text-align: center;
}

.profile-widget .profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 0.75rem;
}

.profile-widget h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.profile-widget p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Popular Articles Widget */
.popular-list {
    list-style: none;
    padding: 0;
}

.popular-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.popular-list li:last-child {
    border-bottom: none;
}

.popular-list .rank {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.popular-list li:nth-child(2) .rank { background: #f59e0b; }
.popular-list li:nth-child(3) .rank { background: #cd7c54; }

.popular-list a {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.5;
}

.popular-list a:hover {
    color: var(--primary);
}

/* Category Widget */
.category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-tag {
    background: #eff6ff;
    color: var(--primary);
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.category-tag:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    text-decoration: none;
}

/* =========================================
   Index Page: Article Card Grid
   ========================================= */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.1em;
    background: var(--primary);
    border-radius: 2px;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

/* Article Card */
.article-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.article-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Emoji Thumbnail (Zenn style) */
.card-thumbnail {
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.card-thumbnail::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.04);
}

/* Gradient color variants */
.grad-1 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.grad-2 { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.grad-3 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.grad-4 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.grad-5 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.grad-6 { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.grad-7 { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.grad-8 { background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%); }
.grad-9 { background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%); }

.card-body {
    padding: 1rem 1.1rem 1.1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    background: #eff6ff;
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card:hover .card-title {
    color: var(--primary);
}

/* =========================================
   Hero Banner (Top Page)
   ========================================= */
.hero-banner {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #7c3aed 100%);
    color: white;
    padding: 3rem 1.5rem;
    text-align: center;
    margin-bottom: 0;
}

.hero-banner h1 {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: white;
    line-height: 1.4;
}

.hero-banner p {
    font-size: 1rem;
    opacity: 0.9;
    max-width: 540px;
    margin: 0 auto;
}

/* =========================================
   Article Page Content
   ========================================= */
.article-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
}

.article-content h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
    border-bottom: 2px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.article-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    border-left: 4px solid var(--primary);
    padding-left: 0.75rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.article-content h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.article-content p {
    margin-bottom: 1.25rem;
    font-size: 0.97rem;
    line-height: 1.9;
}

.article-content ul,
.article-content ol {
    padding-left: 1.75rem;
    margin-bottom: 1.25rem;
}

.article-content li {
    margin-bottom: 0.5rem;
    font-size: 0.97rem;
    line-height: 1.8;
}

.article-content strong {
    color: var(--text);
    font-weight: 700;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.article-content th {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
}

.article-content td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
}

.article-content tr:nth-child(even) td {
    background: #f8fafc;
}

/* Affiliate / Note blocks */
.affiliate-link, .note, .info-box {
    background: #eff6ff;
    border-left: 4px solid var(--primary);
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
    font-size: 0.94rem;
}

.affiliate-link h3, .note h3, .info-box h3 {
    margin-top: 0;
    font-size: 1rem;
    color: var(--primary);
}

/* Article Emoji Header */
.article-emoji-header {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius) var(--radius) 0 0;
    margin: -2.5rem -2.5rem 2rem;
    font-size: 4rem;
    line-height: 1;
}

/* =========================================
   Breadcrumb
   ========================================= */
.breadcrumb {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb a {
    color: var(--text-muted);
    font-weight: 400;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb .sep {
    opacity: 0.5;
}

/* =========================================
   Footer
   ========================================= */
.site-footer {
    background: #1e293b;
    color: #94a3b8;
    padding: 2.5rem 0 1.5rem;
    margin-top: auto;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 0.5rem;
}

.footer-desc {
    font-size: 0.82rem;
    max-width: 260px;
    line-height: 1.7;
}

.footer-links h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f1f5f9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

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

.footer-links li {
    margin-bottom: 0.4rem;
}

.footer-links a {
    font-size: 0.82rem;
    color: #94a3b8;
    text-decoration: none;
}

.footer-links a:hover {
    color: #f1f5f9;
    text-decoration: none;
}

.footer-bottom {
    border-top: 1px solid #334155;
    padding-top: 1.25rem;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
}

/* =========================================
   Sticky Sidebar (article page)
   ========================================= */
.sidebar-sticky {
    position: sticky;
    top: 80px;
}

/* TOC Widget */
.toc-widget ol {
    list-style: decimal;
    padding-left: 1.25rem;
    margin: 0;
}

.toc-widget li {
    margin-bottom: 0.4rem;
}

.toc-widget a {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    line-height: 1.5;
}

.toc-widget a:hover {
    color: var(--primary);
    text-decoration: none;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 960px) {
    .page-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .sidebar-sticky {
        position: static;
    }

    .article-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .site-header .header-inner {
        padding: 0 1rem;
    }

    .page-wrapper {
        padding: 1rem;
        gap: 1rem;
    }

    .hero-banner h1 {
        font-size: 1.4rem;
    }

    .article-content {
        padding: 1.5rem;
    }

    .article-emoji-header {
        margin: -1.5rem -1.5rem 1.5rem;
    }

    .article-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .footer-top {
        flex-direction: column;
        gap: 1.5rem;
    }

    .header-nav {
        display: none;
    }
}
