/*
Theme Name: Unleash Media Blog
Theme URI:
Author: Unleash26
Description: サブドメインSEOメディアサイト専用テーマ。マガジン風3カラムグリッド・TOC・関連記事・構造化データ対応。
Version: 1.0.0
Text Domain: media-blog
*/

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&display=swap');

/* ==============================================================================
   Design Tokens
   ============================================================================== */
:root {
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, "Hiragino Sans",
            "Hiragino Kaku Gothic ProN", "YuGothic", sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", Menlo, monospace;

    --bg:        #f7f7fb;
    --card:      #ffffff;
    --text:      #1c1c1e;
    --text-2:    #3a3a3c;
    --text-3:    #8a8a8e;
    --accent:    #0066cc;
    --accent-h:  #0077ed;
    --border:    rgba(0,0,0,0.07);
    --toc-bg:    #f2f2f7;
    --tag-bg:    #ebebf0;

    --r:    18px;
    --r-sm: 10px;
    --max:  1160px;
    --art:  780px;
    --ease: cubic-bezier(0.25,0.1,0.25,1);
    --t:    all 0.25s var(--ease);
    --sh:   0 2px 8px rgba(0,0,0,0.05), 0 0 0 1px rgba(0,0,0,0.04);
    --sh-h: 0 14px 44px rgba(0,0,0,0.11), 0 0 0 1px rgba(0,0,0,0.05);
}

/* ==============================================================================
   Reset
   ============================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.7;
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: var(--t); }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ==============================================================================
   Header
   ============================================================================== */
.mb-header {
    position: sticky; top: 0; z-index: 100;
    height: 56px;
    background: rgba(255,255,255,0.88);
    backdrop-filter: saturate(200%) blur(20px);
    -webkit-backdrop-filter: saturate(200%) blur(20px);
    border-bottom: 1px solid var(--border);
}

.mb-header-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 28px;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.mb-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}
.mb-logo:hover { text-decoration: none; opacity: 0.8; }

.mb-logo-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    animation: logopulse 3s ease-in-out infinite;
}
@keyframes logopulse {
    0%,100% { opacity:1; transform:scale(1); }
    50%      { opacity:.4; transform:scale(.8); }
}

.mb-nav-list {
    display: flex;
    list-style: none;
    gap: 2px;
    flex-wrap: wrap;
    align-items: center;
}
.mb-nav-list a {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
    padding: 5px 14px;
    border-radius: 980px;
    transition: var(--t);
    letter-spacing: -0.01em;
}
.mb-nav-list a:hover {
    background: var(--tag-bg);
    color: var(--text);
    text-decoration: none;
}

/* ==============================================================================
   Hero (blog top / archive)
   ============================================================================== */
.mb-hero {
    background: linear-gradient(140deg, #eef3ff 0%, #f9f4ff 45%, #edfff6 100%);
    border-bottom: 1px solid var(--border);
    padding: 60px 28px 52px;
    text-align: center;
}
.mb-hero-inner { max-width: var(--max); margin: 0 auto; }

.mb-hero-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: rgba(0,102,204,0.08);
    border: 1px solid rgba(0,102,204,0.16);
    padding: 4px 16px;
    border-radius: 980px;
    margin-bottom: 18px;
}

.mb-hero-title {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.12;
    color: var(--text);
    margin-bottom: 12px;
}

.mb-hero-desc {
    font-size: 1rem;
    color: var(--text-2);
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ==============================================================================
   Breadcrumb
   ============================================================================== */
.mb-breadcrumb {
    max-width: var(--max);
    margin: 0 auto;
    padding: 14px 28px;
    font-size: 0.78rem;
    color: var(--text-3);
    line-height: 1.5;
}
.mb-breadcrumb a { color: var(--text-3); }
.mb-breadcrumb a:hover { color: var(--accent); text-decoration: none; }
.mb-breadcrumb-sep { margin: 0 6px; color: var(--border); }

/* ==============================================================================
   Post Grid (magazine 3-col)
   ============================================================================== */
.mb-grid-wrapper {
    max-width: var(--max);
    margin: 0 auto;
    padding: 40px 28px 80px;
}

.mb-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

/* ── Featured (first post, full-width) ── */
.mb-card--featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.mb-card--featured .mb-card-thumb-wrap {
    height: 100%;
    min-height: 280px;
    border-radius: var(--r) 0 0 var(--r);
}

.mb-card--featured .mb-card-body {
    padding: 36px 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mb-card--featured .mb-card-title {
    font-size: 1.7rem;
    line-height: 1.25;
    margin-bottom: 14px;
}

.mb-card--featured .mb-card-excerpt { display: block; }

/* ── Card ── */
.mb-card {
    background: var(--card);
    border-radius: var(--r);
    box-shadow: var(--sh);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--t);
}
.mb-card:hover {
    box-shadow: var(--sh-h);
    transform: translateY(-5px);
}

.mb-card-thumb-wrap {
    display: block;
    width: 100%;
    height: 210px;
    overflow: hidden;
    position: relative;
    background: var(--toc-bg);
    flex-shrink: 0;
}
.mb-card-thumb {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.55s var(--ease);
}
.mb-card:hover .mb-card-thumb { transform: scale(1.08); }

.mb-card-cat-overlay {
    position: absolute;
    bottom: 12px; left: 14px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0,0,0,0.52);
    backdrop-filter: blur(8px);
    padding: 3px 10px;
    border-radius: 980px;
}

.mb-card-body {
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.mb-card-cat {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--accent);
    background: rgba(0,102,204,0.08);
    padding: 3px 10px;
    border-radius: 980px;
    margin-bottom: 10px;
    width: fit-content;
    transition: var(--t);
}
.mb-card-cat:hover { background: rgba(0,102,204,0.14); text-decoration: none; }

.mb-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.45;
    color: var(--text);
    margin-bottom: 10px;
    flex-grow: 1;
    transition: var(--t);
}
.mb-card-title:hover { color: var(--accent); }

.mb-card-excerpt {
    display: none;
    font-size: 0.9rem;
    color: var(--text-2);
    line-height: 1.7;
    margin-bottom: 16px;
}

.mb-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-3);
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* ── No posts ── */
.mb-no-posts {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-3);
    font-size: 1rem;
}

/* ==============================================================================
   Pagination
   ============================================================================== */
.mb-pagination {
    margin-top: 48px;
    grid-column: 1 / -1;
}
.mb-pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.mb-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px; height: 40px;
    padding: 0 14px;
    border-radius: var(--r-sm);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-2);
    background: var(--card);
    border: 1px solid var(--border);
    transition: var(--t);
}
.mb-pagination .page-numbers:hover { background: var(--toc-bg); text-decoration: none; }
.mb-pagination .page-numbers.current { background: var(--text); color: #fff; border-color: var(--text); }

/* ==============================================================================
   Single Post
   ============================================================================== */
.mb-single-wrap {
    max-width: var(--art);
    margin: 0 auto;
    padding: 0 24px 80px;
}

.mb-post-header { margin-bottom: 32px; }

.mb-post-cat {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(0,102,204,0.08);
    padding: 4px 14px;
    border-radius: 980px;
    margin-bottom: 16px;
}
.mb-post-cat:hover { background: rgba(0,102,204,0.14); text-decoration: none; }

.mb-post-title {
    font-size: clamp(1.6rem, 4vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.3;
    margin-bottom: 16px;
    color: var(--text);
}

.mb-post-meta {
    font-size: 0.84rem;
    color: var(--text-3);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

/* ==============================================================================
   TOC
   ============================================================================== */
.mb-toc {
    background: var(--toc-bg);
    border-radius: var(--r);
    padding: 24px 28px;
    margin: 32px 0 36px;
    border: 1px solid var(--border);
}
.mb-toc-title {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text);
}
.mb-toc ol {
    list-style: none;
    counter-reset: toc;
    padding: 0; margin: 0;
}
.mb-toc li {
    counter-increment: toc;
    margin-bottom: 5px;
}
.mb-toc li a {
    display: block;
    font-size: 0.88rem;
    color: var(--text-2);
    padding: 5px 10px;
    border-radius: 7px;
    transition: var(--t);
}
.mb-toc li a::before {
    content: counter(toc) ". ";
    font-weight: 700;
    color: var(--text-3);
}
.mb-toc li a:hover {
    background: rgba(0,0,0,0.04);
    color: var(--accent);
    text-decoration: none;
}

/* ==============================================================================
   Post Content
   ============================================================================== */
.mb-post-content {
    font-size: 1.04rem;
    line-height: 1.88;
    color: var(--text);
}
.mb-post-content h2 {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin: 52px 0 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}
.mb-post-content h3 {
    font-size: 1.18rem;
    font-weight: 700;
    margin: 38px 0 12px;
    line-height: 1.4;
}
.mb-post-content p { margin-bottom: 22px; }
.mb-post-content ul, .mb-post-content ol { margin: 0 0 22px 24px; }
.mb-post-content li { margin-bottom: 7px; line-height: 1.75; }
.mb-post-content strong { font-weight: 700; }
.mb-post-content img { border-radius: var(--r-sm); margin: 24px 0; }
.mb-post-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 12px 20px;
    margin: 24px 0;
    background: var(--toc-bg);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    color: var(--text-2);
}
.mb-post-content hr { border: none; height: 1px; background: var(--border); margin: 44px 0; }

/* Code */
.mb-post-content code {
    font-family: var(--font-mono);
    font-size: 0.84em;
    background: var(--toc-bg);
    padding: 2px 6px;
    border-radius: 5px;
    color: #d73a49;
    word-break: break-word;
}
.mb-post-content pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 22px 24px;
    border-radius: var(--r-sm);
    overflow-x: auto;
    margin: 24px 0;
    font-size: 0.87rem;
    line-height: 1.65;
    border: 1px solid rgba(255,255,255,0.05);
}
.mb-post-content pre code { background: none; color: inherit; padding: 0; border-radius: 0; font-size: inherit; }

/* Table */
.mb-post-content table {
    width: 100%; border-collapse: collapse;
    margin: 24px 0; font-size: 0.9rem;
    border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden;
}
.mb-post-content thead { background: var(--toc-bg); }
.mb-post-content th { font-weight: 600; text-align: left; padding: 11px 14px; border-bottom: 2px solid var(--border); font-size: 0.82rem; }
.mb-post-content td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.mb-post-content tbody tr:last-child td { border-bottom: none; }
.mb-post-content tbody tr:hover { background: rgba(0,0,0,0.015); }

/* ==============================================================================
   App Download CTA
   ============================================================================== */
.mb-app-cta {
    background: var(--toc-bg);
    border-radius: var(--r);
    padding: 36px 36px 32px;
    text-align: center;
    margin: 44px 0;
    border: 1px solid var(--border);
}
.mb-app-cta-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}
.mb-app-cta-desc {
    font-size: 0.92rem;
    color: var(--text-2);
    margin-bottom: 22px;
    line-height: 1.7;
}
.mb-app-cta-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; align-items: center; }
.mb-store-btn {
    display: inline-block;
    line-height: 0;
    border-radius: 8px;
    overflow: hidden;
    transition: var(--t);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.mb-store-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    text-decoration: none;
}

/* 記事本文内のインライン置換バッジ */
.mb-inline-store-badges {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 24px 0;
}
.mb-store-btn-inline {
    display: inline-block;
    line-height: 0;
    border-radius: 8px;
    overflow: hidden;
    transition: var(--t);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.mb-store-btn-inline:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    text-decoration: none;
}

/* ==============================================================================
   Post Tags
   ============================================================================== */
.mb-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 36px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}
.mb-post-tag {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-2);
    background: var(--tag-bg);
    padding: 5px 14px;
    border-radius: 980px;
    transition: var(--t);
}
.mb-post-tag:hover { background: var(--border); color: var(--text); text-decoration: none; }

/* ==============================================================================
   Related Posts
   ============================================================================== */
.mb-related {
    margin-top: 56px;
    padding-top: 36px;
    border-top: 1px solid var(--border);
}
.mb-related-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 22px;
    letter-spacing: -0.02em;
}
.mb-related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.mb-related-card {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border-radius: var(--r-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--t);
}
.mb-related-card:hover { transform: translateY(-3px); box-shadow: var(--sh-h); text-decoration: none; }
.mb-related-thumb { width: 100%; height: 120px; object-fit: cover; }
.mb-related-card-title {
    display: block;
    padding: 14px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.45;
}

/* ==============================================================================
   Cross-link related articles (inserted by insert_crosslinks.py)
   ============================================================================== */
.related-articles {
    background: var(--toc-bg);
    border-radius: var(--r);
    padding: 22px 26px;
    margin: 6px 0 28px;
    border: 1px solid var(--border);
}
.related-articles h3 {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}
.related-articles ul { list-style: none; padding: 0; margin: 0; }
.related-articles li { margin-bottom: 7px; line-height: 1.5; }
.related-articles li::before { content: "→ "; color: var(--text-3); font-weight: 600; }
.related-articles a { font-size: 0.9rem; font-weight: 500; color: var(--accent); }
.related-articles a:hover { text-decoration: underline; }

/* ==============================================================================
   Footer
   ============================================================================== */
.mb-footer {
    border-top: 1px solid var(--border);
    background: var(--card);
    padding: 36px 28px 30px;
}
.mb-footer-inner {
    max-width: var(--max);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.mb-footer-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.mb-footer-cats-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 4px;
}
.mb-footer-cats a {
    font-size: 0.78rem;
    color: var(--text-2);
    background: var(--tag-bg);
    padding: 4px 12px;
    border-radius: 980px;
    transition: var(--t);
}
.mb-footer-cats a:hover { background: var(--border); text-decoration: none; }
.mb-footer-copy {
    font-size: 0.75rem;
    color: var(--text-3);
    text-align: center;
}

/* ==============================================================================
   404 / Search
   ============================================================================== */
.mb-404 { text-align: center; padding: 80px 20px; }
.mb-404-code { font-size: 7rem; font-weight: 800; color: var(--border); line-height: 1; letter-spacing: -0.04em; }
.mb-404-title { font-size: 1.7rem; font-weight: 700; margin: 12px 0; }
.mb-404-desc { color: var(--text-3); font-size: 1rem; max-width: 460px; margin: 0 auto 28px; line-height: 1.7; }
.mb-404-btn { display: inline-block; background: var(--text); color: #fff; padding: 12px 30px; border-radius: 980px; font-weight: 600; transition: var(--t); }
.mb-404-btn:hover { background: #000; transform: scale(1.03); text-decoration: none; color: #fff; }

/* ==============================================================================
   Responsive
   ============================================================================== */
@media (max-width: 1024px) {
    .mb-grid { grid-template-columns: repeat(2, 1fr); }
    .mb-card--featured {
        grid-column: 1 / -1;
        grid-template-columns: 1fr;
    }
    .mb-card--featured .mb-card-thumb-wrap {
        height: 260px;
        min-height: unset;
        border-radius: var(--r) var(--r) 0 0;
    }
    .mb-card--featured .mb-card-body { padding: 24px 28px 28px; }
}

@media (max-width: 768px) {
    .mb-header-inner { padding: 0 16px; }
    .mb-hero { padding: 44px 16px 36px; }
    .mb-grid-wrapper { padding: 24px 16px 56px; }
    .mb-grid { grid-template-columns: 1fr; }
    .mb-card--featured { grid-column: 1; grid-template-columns: 1fr; }
    .mb-breadcrumb { padding: 12px 16px; }
    .mb-single-wrap { padding: 0 16px 60px; }
    .mb-post-title { font-size: 1.6rem; }
    .mb-post-content h2 { font-size: 1.3rem; }
    .mb-related-grid { grid-template-columns: 1fr; }
    .mb-app-cta { padding: 24px 20px; }
    .mb-footer { padding: 28px 16px 24px; }
}

@media print {
    .mb-header, .mb-footer, .mb-breadcrumb, .mb-toc, .mb-related, .mb-app-cta { display: none !important; }
    body { font-size: 12pt; }
}
