/*
Theme Name: Master Modern Light
Theme URI:
Author: MASTER Team
Description: AppleライクなクリーンでモダンなSEO特化型・超軽量WordPressテーマ v2.0。目次・パンくず・関連記事・OGP・Schema.org構造化データ搭載。
Version: 2.0.0
Text Domain: master-modern
*/

/* ==============================================================================
   Design Tokens
   ============================================================================== */
:root {
    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Hiragino Sans",
                   "Hiragino Kaku Gothic ProN", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Colors - Apple-inspired neutral palette */
    --bg-color: #fbfbfd;
    --card-bg: #ffffff;
    --text-main: #1d1d1f;
    --text-secondary: #424245;
    --text-muted: #86868b;
    --accent-blue: #0066cc;
    --accent-hover: #0077ed;
    --border-color: #e5e5ea;
    --toc-bg: #f5f5f7;
    --tag-bg: #f0f0f3;
    --tag-hover: #e5e5ea;
    --green-cta: #34c759;

    /* Spacing & Sizes */
    --max-width: 780px;
    --max-width-wide: 1100px;
    --border-radius: 16px;
    --border-radius-sm: 10px;
    --transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "palt";
}

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

a:hover {
    text-decoration: underline;
}

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

/* ==============================================================================
   Header
   ============================================================================== */
.site-header {
    background-color: rgba(255, 255, 255, 0.82);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.site-header-container {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.site-title {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.site-title a {
    color: var(--text-main);
}

.site-title a:hover {
    text-decoration: none;
}

/* Navigation */
.site-nav .nav-list {
    display: flex;
    list-style: none;
    gap: 6px;
    flex-wrap: wrap;
}

.site-nav .nav-list li a {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: 20px;
    transition: var(--transition);
}

.site-nav .nav-list li a:hover {
    background-color: var(--tag-bg);
    color: var(--text-main);
    text-decoration: none;
}

/* ==============================================================================
   Breadcrumb
   ============================================================================== */
.breadcrumb {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    line-height: 1.5;
}

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

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

.breadcrumb-sep {
    margin: 0 6px;
    color: var(--border-color);
}

.breadcrumb-current {
    color: var(--text-secondary);
}

/* ==============================================================================
   Main Content
   ============================================================================== */
.site-main {
    max-width: var(--max-width);
    margin: 40px auto;
    padding: 0 24px;
    min-height: calc(100vh - 200px);
}

/* ==============================================================================
   Post Card Grid (Index / Archive)
   ============================================================================== */
.archive-header {
    margin-bottom: 40px;
}

.archive-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.archive-description {
    color: var(--text-muted);
    font-size: 1rem;
}

.post-list {
    display: grid;
    gap: 28px;
    grid-template-columns: 1fr;
}

.post-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0,0,0,0.03);
    transition: var(--transition);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.07);
}

.post-thumbnail-link {
    display: block;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.post-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-thumbnail {
    transform: scale(1.04);
}

.post-card-content {
    padding: 24px 28px 28px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.post-card-category {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-blue);
    background: rgba(0, 102, 204, 0.08);
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
    width: fit-content;
}

.post-card-category:hover {
    text-decoration: none;
    background: rgba(0, 102, 204, 0.14);
}

.post-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.post-card-title a {
    color: var(--text-main);
}

.post-card-title a:hover {
    text-decoration: none;
    color: var(--accent-blue);
}

.post-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 500;
}

.post-excerpt {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ==============================================================================
   Pagination
   ============================================================================== */
.pagination {
    grid-column: 1 / -1;
    margin-top: 20px;
}

.pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.pagination .page-numbers:hover {
    background: var(--toc-bg);
    text-decoration: none;
}

.pagination .page-numbers.current {
    background: var(--text-main);
    color: white;
    border-color: var(--text-main);
}

/* ==============================================================================
   Single Post
   ============================================================================== */
.single-post-category-badge {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-blue);
    background: rgba(0, 102, 204, 0.08);
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
}

.single-post-category-badge:hover {
    text-decoration: none;
    background: rgba(0, 102, 204, 0.14);
}

.single-post-title {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.3;
    margin-bottom: 16px;
}

.single-post-meta {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 36px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.reading-time {
    color: var(--text-muted);
}

/* ==============================================================================
   Table of Contents (TOC)
   ============================================================================== */
.toc-box {
    background: var(--toc-bg);
    border-radius: var(--border-radius);
    padding: 28px 32px;
    margin-bottom: 40px;
    border: 1px solid var(--border-color);
}

.toc-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-main);
}

.toc-list {
    list-style: none;
    counter-reset: toc-counter;
    padding: 0;
    margin: 0;
}

.toc-item {
    counter-increment: toc-counter;
    margin-bottom: 6px;
}

.toc-item a {
    display: block;
    font-size: 0.92rem;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    transition: var(--transition);
    line-height: 1.5;
}

.toc-item a::before {
    content: counter(toc-counter) ". ";
    font-weight: 600;
    color: var(--text-muted);
}

.toc-item a:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--accent-blue);
    text-decoration: none;
}

.toc-h3 {
    margin-left: 20px;
}

.toc-h3 a {
    font-size: 0.85rem;
}

/* ==============================================================================
   Post Content (Article Body)
   ============================================================================== */
.post-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text-main);
}

.post-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 56px 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    letter-spacing: -0.015em;
    line-height: 1.3;
}

.post-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 40px 0 14px;
    line-height: 1.4;
}

.post-content p {
    margin-bottom: 24px;
}

.post-content img {
    border-radius: 12px;
    margin: 28px 0;
}

.post-content ul, .post-content ol {
    margin: 0 0 24px 24px;
}

.post-content li {
    margin-bottom: 8px;
    line-height: 1.75;
}

.post-content strong {
    font-weight: 600;
    color: var(--text-main);
}

.post-content blockquote {
    border-left: 3px solid var(--accent-blue);
    padding: 12px 20px;
    margin: 24px 0;
    background: var(--toc-bg);
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    color: var(--text-secondary);
    font-size: 0.98rem;
}

/* ==============================================================================
   Tables
   ============================================================================== */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 28px 0;
    font-size: 0.92rem;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.post-content thead {
    background: var(--toc-bg);
}

.post-content th {
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.post-content td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    line-height: 1.6;
}

.post-content tbody tr:last-child td {
    border-bottom: none;
}

.post-content tbody tr:hover {
    background: rgba(0, 0, 0, 0.015);
}

/* Table responsive wrapper */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 28px 0;
}

/* ==============================================================================
   Code Blocks
   ============================================================================== */
.post-content code {
    font-family: "SF Mono", "Fira Code", "JetBrains Mono", Menlo, Monaco, monospace;
    font-size: 0.85em;
    background: var(--toc-bg);
    padding: 2px 7px;
    border-radius: 5px;
    color: #e45649;
    word-break: break-word;
}

.post-content pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 24px 28px;
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 28px 0;
    line-height: 1.65;
    font-size: 0.88rem;
    border: 1px solid rgba(255,255,255,0.06);
}

.post-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* ==============================================================================
   Horizontal Rule
   ============================================================================== */
.post-content hr {
    border: none;
    height: 1px;
    background: var(--border-color);
    margin: 48px 0;
}

/* ==============================================================================
   Checklist (task list)
   ============================================================================== */
.post-content ul li input[type="checkbox"] {
    margin-right: 8px;
    accent-color: var(--accent-blue);
}

/* ==============================================================================
   App Download CTA Box
   ============================================================================== */
.app-cta-box {
    background: var(--toc-bg);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    margin: 48px 0;
    border: 1px solid var(--border-color);
}

.cta-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 14px;
    line-height: 1.35;
}

.cta-description {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.95rem;
    line-height: 1.7;
    text-align: left;
}

.app-cta-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.app-store-btn {
    display: inline-block;
    background-color: var(--text-main);
    color: white;
    padding: 13px 28px;
    border-radius: 28px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.app-store-btn:hover {
    background-color: #000000;
    transform: scale(1.03);
    text-decoration: none;
    color: white;
}

/* ==============================================================================
   Post Tags
   ============================================================================== */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.post-tag {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--tag-bg);
    padding: 5px 14px;
    border-radius: 20px;
    transition: var(--transition);
}

.post-tag:hover {
    background: var(--tag-hover);
    color: var(--text-main);
    text-decoration: none;
}

/* ==============================================================================
   Related Posts
   ============================================================================== */
.related-posts-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

.related-posts-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 24px;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.related-post-card {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.related-post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    text-decoration: none;
}

.related-post-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.related-post-title {
    display: block;
    padding: 14px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.45;
}

/* ==============================================================================
   Footer
   ============================================================================== */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 48px 24px 40px;
    margin-top: 60px;
    background: var(--card-bg);
}

.site-footer-container {
    max-width: var(--max-width-wide);
    margin: 0 auto;
}

.footer-nav {
    margin-bottom: 24px;
}

.footer-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.footer-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 8px;
}

.footer-categories a {
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--tag-bg);
    transition: var(--transition);
}

.footer-categories a:hover {
    background: var(--tag-hover);
    text-decoration: none;
}

.footer-copy {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* ==============================================================================
   Responsive
   ============================================================================== */
@media (max-width: 768px) {
    .site-header-container {
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
    }

    .site-nav .nav-list {
        justify-content: center;
    }

    .site-main {
        margin: 24px auto;
        padding: 0 16px;
    }

    .breadcrumb {
        margin-bottom: 20px;
    }

    .single-post-title {
        font-size: 1.6rem;
    }

    .post-content h2 {
        font-size: 1.35rem;
        margin-top: 40px;
    }

    .post-content h3 {
        font-size: 1.1rem;
    }

    .post-content {
        font-size: 1rem;
    }

    .toc-box {
        padding: 20px 22px;
    }

    .toc-h3 {
        margin-left: 12px;
    }

    .app-cta-box {
        padding: 28px 20px;
    }

    .related-posts-grid {
        grid-template-columns: 1fr;
    }

    .post-list {
        gap: 20px;
    }

    /* Tables responsive */
    .post-content table {
        font-size: 0.82rem;
    }

    .post-content th,
    .post-content td {
        padding: 8px 10px;
    }

    /* Code blocks responsive */
    .post-content pre {
        padding: 18px 16px;
        font-size: 0.82rem;
        border-radius: 10px;
    }

    /* 404 responsive */
    .error-404-code {
        font-size: 5rem;
    }

    .error-404-title {
        font-size: 1.4rem;
    }

    /* Page title responsive */
    .page-title {
        font-size: 1.6rem;
    }

    /* Search responsive */
    .search-form-inline {
        flex-direction: column;
    }
}

/* ==============================================================================
   404 Page
   ============================================================================== */
.error-404-content {
    text-align: center;
    padding: 80px 20px;
}

.error-404-code {
    font-size: 8rem;
    font-weight: 800;
    color: var(--border-color);
    line-height: 1;
    letter-spacing: -0.04em;
}

.error-404-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 16px 0 12px;
    letter-spacing: -0.02em;
}

.error-404-description {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 480px;
    margin: 0 auto 32px;
    line-height: 1.7;
}

.error-404-btn {
    display: inline-block;
    background: var(--text-main);
    color: white;
    padding: 13px 32px;
    border-radius: 28px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}

.error-404-btn:hover {
    background: #000;
    transform: scale(1.03);
    text-decoration: none;
    color: white;
}

/* ==============================================================================
   Search Page
   ============================================================================== */
.search-header {
    margin-bottom: 36px;
}

.search-title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.search-title-query {
    color: var(--accent-blue);
}

.search-count {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.search-form-inline {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    max-width: 480px;
}

.search-form-inline input[type="search"] {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid var(--border-color);
    border-radius: 28px;
    font-size: 0.95rem;
    font-family: var(--font-family);
    outline: none;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-main);
}

.search-form-inline input[type="search"]:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.search-form-inline button {
    padding: 12px 24px;
    background: var(--text-main);
    color: white;
    border: none;
    border-radius: 28px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
}

.search-form-inline button:hover {
    background: #000;
}

.no-results-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.no-results-message h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.no-results-message p {
    font-size: 1rem;
    line-height: 1.7;
}

/* ==============================================================================
   Static Page
   ============================================================================== */
.page-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text-main);
}

.page-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 48px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    letter-spacing: -0.015em;
}

.page-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 36px 0 12px;
}

.page-content p {
    margin-bottom: 20px;
}

.page-content ul, .page-content ol {
    margin: 0 0 20px 24px;
}

.page-content li {
    margin-bottom: 6px;
    line-height: 1.75;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 32px;
    line-height: 1.3;
}

.page-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 36px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

/* ==============================================================================
   Cross-Link Related Articles (inserted by insert_crosslinks.py)
   ============================================================================== */
.related-articles {
    background: var(--toc-bg);
    border-radius: var(--border-radius);
    padding: 28px 32px;
    margin: 8px 0 32px;
    border: 1px solid var(--border-color);
}

.related-articles h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-main);
}

.related-articles ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.related-articles li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.related-articles li::before {
    content: "→ ";
    color: var(--text-muted);
    font-weight: 500;
}

.related-articles a {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--accent-blue);
    transition: var(--transition);
}

.related-articles a:hover {
    text-decoration: underline;
}

/* ==============================================================================
   Language Badge
   ============================================================================== */
.lang-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.lang-badge-ja {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

.lang-badge-en {
    background: rgba(0, 122, 255, 0.1);
    color: #007aff;
}

/* ==============================================================================
   Smooth Scroll (for TOC links)
   ============================================================================== */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* sticky header分のオフセット */
}

/* ==============================================================================
   Print Styles
   ============================================================================== */
@media print {
    .site-header,
    .site-footer,
    .breadcrumb,
    .toc-box,
    .related-posts-section,
    .post-tags,
    .app-cta-box {
        display: none !important;
    }

    .site-main {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }
}
