/* ========================================
   OTASUKE AI Blog - Common Styles
   2026 Mobile-First / Dwell Time Optimized
   ======================================== */

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

.blog-page {
    padding-top: 110px;
    font-family: 'Noto Sans JP', sans-serif;
    color: #2F363D;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* --- Reading Progress Bar（滞在時間・スクロール深度シグナル） --- */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #0066CC, #4EAEFF);
    z-index: 10000;
    transition: width 0.1s linear;
    will-change: width;
}

/* --- Reading Time Badge --- */
.reading-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    opacity: 0.8;
}
.reading-time svg {
    width: 14px;
    height: 14px;
}

/* --- Breadcrumb --- */
.blog-breadcrumb {
    background: #F7F9FC;
    padding: 12px 0;
    font-size: 13px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.blog-breadcrumb ul {
    list-style: none;
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0 20px;
    max-width: 900px;
    margin: 0 auto;
    white-space: nowrap;
}
.blog-breadcrumb li::after {
    content: '>';
    margin-left: 8px;
    color: #999;
}
.blog-breadcrumb li:last-child::after {
    content: '';
}
.blog-breadcrumb a {
    color: #0066CC;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.blog-breadcrumb a:hover {
    text-decoration: underline;
}

/* --- Article Hero --- */
.article-hero {
    background: linear-gradient(135deg, #003366 0%, #004d99 100%);
    color: #fff;
    padding: 60px 0 50px;
    text-align: center;
}
.article-hero .container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}
.article-hero .article-category {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}
.article-hero h1 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.5;
    margin: 0 0 16px;
    letter-spacing: 0.02em;
}
.article-hero .article-meta {
    font-size: 13px;
    opacity: 0.85;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* --- Table of Contents（滞在時間UP・ナビゲーション改善） --- */
.toc {
    background: #F7F9FC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 24px 28px;
    margin: 0 0 40px;
}
.toc-title {
    font-size: 15px;
    font-weight: 700;
    color: #003366;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.toc-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: #0066CC;
    border-radius: 2px;
    flex-shrink: 0;
}
.toc-title .toc-toggle {
    margin-left: auto;
    font-size: 12px;
    color: #0066CC;
    transition: transform 0.2s;
}
.toc.collapsed .toc-toggle {
    transform: rotate(-90deg);
}
.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: toc-counter;
}
.toc.collapsed .toc-list {
    display: none;
}
.toc-list li {
    counter-increment: toc-counter;
    margin-bottom: 0;
}
.toc-list a {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 8px 0;
    color: #2F363D;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.5;
    border-bottom: 1px solid #EDF2F7;
    transition: color 0.15s, padding-left 0.15s;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}
.toc-list a::before {
    content: counter(toc-counter);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #E8F0FE;
    color: #0066CC;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.toc-list li:last-child a {
    border-bottom: none;
}
.toc-list a:hover,
.toc-list a:active {
    color: #0066CC;
    padding-left: 4px;
}

/* --- Article Body --- */
.article-body {
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}
.article-body h2 {
    font-size: 22px;
    font-weight: 700;
    color: #003366;
    border-left: 4px solid #0066CC;
    padding-left: 16px;
    margin: 50px 0 20px;
    line-height: 1.5;
    scroll-margin-top: 120px;
}
.article-body h3 {
    font-size: 18px;
    font-weight: 700;
    color: #003366;
    margin: 35px 0 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #E8F0FE;
}
.article-body p {
    margin: 0 0 20px;
    font-size: 15.5px;
    line-height: 1.9;
    word-break: break-word;
    overflow-wrap: break-word;
}
.article-body ul, .article-body ol {
    margin: 0 0 24px;
    padding-left: 24px;
}
.article-body li {
    margin-bottom: 8px;
    font-size: 15.5px;
    line-height: 1.8;
}
.article-body strong {
    color: #1a2a3a;
}

/* --- Info Box --- */
.info-box {
    background: #F0F7FF;
    border: 1px solid #D0E4F7;
    border-radius: 12px;
    padding: 24px 28px;
    margin: 30px 0;
}
.info-box h4 {
    color: #0066CC;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.5;
}
.info-box p {
    margin: 0;
    font-size: 14.5px;
}

/* --- Comparison Table（モバイル横スクロール対応） --- */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 24px -20px 30px;
    padding: 0 20px;
}
.table-wrapper::after {
    content: '';
    display: block;
    width: 1px;
    height: 1px;
}
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0 30px;
    font-size: 14.5px;
    min-width: 480px;
}
.comparison-table th {
    background: #003366;
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
.comparison-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #E8EDF2;
}
.comparison-table tr:nth-child(even) td {
    background: #F7F9FC;
}
.comparison-table .highlight-row td {
    background: #E8F4FD;
    font-weight: 600;
}

/* --- CTA Section --- */
.article-cta {
    background: linear-gradient(135deg, #003366 0%, #0055AA 100%);
    color: #fff;
    border-radius: 16px;
    padding: 40px;
    margin: 50px 0;
    text-align: center;
}
.article-cta h3 {
    color: #fff;
    font-size: 22px;
    border: none;
    padding: 0;
    margin: 0 0 12px;
    line-height: 1.5;
}
.article-cta p {
    color: rgba(255,255,255,0.9);
    margin-bottom: 24px;
    font-size: 15px;
}
.article-cta .cta-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.article-cta .cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
    touch-action: manipulation;
}
.article-cta .cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.article-cta .cta-btn:active {
    transform: translateY(0);
}
.article-cta .cta-btn-primary {
    background: #FFD700;
    color: #003366;
}
.article-cta .cta-btn-secondary {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.4);
}

/* --- Related Articles --- */
.related-articles {
    background: #F7F9FC;
    padding: 50px 0;
}
.related-articles .container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}
.related-articles h2 {
    font-size: 20px;
    font-weight: 700;
    color: #003366;
    text-align: center;
    margin: 0 0 30px;
    border: none;
    padding: 0;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}
.related-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    text-decoration: none;
    color: #2F363D;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}
.related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.related-card:active {
    transform: translateY(0);
}
.related-card .card-category {
    font-size: 12px;
    color: #0066CC;
    font-weight: 600;
    margin-bottom: 8px;
}
.related-card h3 {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
    margin: 0;
    color: #2F363D;
    border: none;
    padding: 0;
}

/* --- Blog Index Page --- */
.blog-hero {
    background: linear-gradient(135deg, #003366 0%, #004d99 100%);
    color: #fff;
    padding: 60px 0;
    text-align: center;
}
.blog-hero .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}
.blog-hero h1 {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 12px;
}
.blog-hero p {
    font-size: 16px;
    opacity: 0.9;
}
.blog-list-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 50px 20px 60px;
}
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}
.blog-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: #2F363D;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
}
.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}
.blog-card:active {
    transform: translateY(0);
}
.blog-card-header {
    background: linear-gradient(135deg, #003366, #0055AA);
    color: #fff;
    padding: 30px 24px;
}
.blog-card-header .card-category {
    font-size: 11px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 3px 12px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 10px;
}
.blog-card-header h2 {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.5;
    margin: 0;
    color: #fff;
    border: none;
    padding: 0;
}
.blog-card-body {
    padding: 20px 24px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.blog-card-body p {
    font-size: 14px;
    line-height: 1.7;
    color: #555;
    flex: 1;
}
.blog-card-body .read-more {
    color: #0066CC;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* --- Footer CTA Bar --- */
.footer-cta-bar {
    background: #003366;
    color: #fff;
    padding: 40px 0;
    text-align: center;
}
.footer-cta-bar .container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}
.footer-cta-bar h3 {
    font-size: 22px;
    margin: 0 0 8px;
    color: #fff;
    border: none;
    padding: 0;
}
.footer-cta-bar p {
    font-size: 14px;
    opacity: 0.85;
    margin: 0 0 20px;
}
.footer-cta-bar .cta-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* --- Sticky Mobile CTA（モバイルCV導線） --- */
.sticky-mobile-cta {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 10px 16px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    z-index: 9998;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}
.sticky-mobile-cta.visible {
    transform: translateY(0);
}
.sticky-mobile-cta .sticky-cta-inner {
    display: flex;
    gap: 8px;
    max-width: 480px;
    margin: 0 auto;
}
.sticky-mobile-cta .sticky-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.sticky-mobile-cta .sticky-btn-primary {
    background: #FFD700;
    color: #003366;
}
.sticky-mobile-cta .sticky-btn-secondary {
    background: #003366;
    color: #fff;
}

/* --- Scroll to Top --- */
.scroll-top {
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: #003366;
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.2s;
    z-index: 9997;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}
.scroll-top:active {
    transform: scale(0.92);
}
.scroll-top svg {
    width: 20px;
    height: 20px;
}

/* =========================================
   RESPONSIVE: Tablet (max-width: 1024px)
   ========================================= */
@media (max-width: 1024px) {
    .blog-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
}

/* =========================================
   RESPONSIVE: Mobile (max-width: 768px)
   ========================================= */
@media (max-width: 768px) {
    .blog-page {
        padding-top: 80px;
        line-height: 1.85;
    }

    /* Hero */
    .article-hero {
        padding: 32px 0 28px;
    }
    .article-hero .container {
        padding: 0 16px;
    }
    .article-hero h1 {
        font-size: 20px;
        line-height: 1.55;
        letter-spacing: 0.01em;
    }
    .article-hero h1 br {
        display: none;
    }
    .article-hero .article-category {
        font-size: 12px;
        padding: 3px 12px;
        margin-bottom: 12px;
    }
    .article-hero .article-meta {
        font-size: 12px;
        gap: 12px;
    }

    /* Breadcrumb */
    .blog-breadcrumb {
        padding: 10px 0;
        font-size: 12px;
    }
    .blog-breadcrumb ul {
        padding: 0 16px;
    }

    /* TOC */
    .toc {
        padding: 18px 16px;
        margin: 0 0 28px;
        border-radius: 10px;
    }
    .toc-title {
        font-size: 14px;
    }
    .toc-list a {
        font-size: 13px;
        padding: 10px 0;
        min-height: 48px;
    }

    /* Article Body - 可読性最適化 */
    .article-body {
        padding: 28px 16px 40px;
    }
    .article-body h2 {
        font-size: 18px;
        margin: 36px 0 16px;
        padding-left: 14px;
        border-left-width: 3px;
        scroll-margin-top: 90px;
    }
    .article-body h3 {
        font-size: 16px;
        margin: 28px 0 12px;
        padding-bottom: 6px;
    }
    .article-body p {
        font-size: 15px;
        line-height: 1.95;
        margin-bottom: 18px;
    }
    .article-body ul, .article-body ol {
        padding-left: 20px;
        margin-bottom: 20px;
    }
    .article-body li {
        font-size: 14.5px;
        margin-bottom: 6px;
        line-height: 1.85;
    }

    /* Info Box */
    .info-box {
        padding: 18px 16px;
        margin: 24px 0;
        border-radius: 10px;
    }
    .info-box h4 {
        font-size: 15px;
    }
    .info-box p {
        font-size: 14px;
    }

    /* Table - モバイル横スクロール */
    .comparison-table {
        margin: 16px 0 24px;
        font-size: 13px;
    }
    .comparison-table th,
    .comparison-table td {
        padding: 10px 12px;
        white-space: nowrap;
    }

    /* CTA */
    .article-cta {
        padding: 28px 16px;
        margin: 36px 0;
        border-radius: 12px;
    }
    .article-cta h3 {
        font-size: 18px;
    }
    .article-cta p {
        font-size: 14px;
        margin-bottom: 20px;
    }
    .article-cta p br {
        display: none;
    }
    .article-cta .cta-buttons {
        flex-direction: column;
        gap: 10px;
    }
    .article-cta .cta-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 14px;
        min-height: 52px;
    }

    /* Related */
    .related-articles {
        padding: 36px 0;
    }
    .related-articles .container {
        padding: 0 16px;
    }
    .related-articles h2 {
        font-size: 18px;
        margin-bottom: 20px;
    }
    .related-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .related-card {
        padding: 18px;
        display: flex;
        align-items: flex-start;
        gap: 0;
        flex-direction: column;
    }
    .related-card h3 {
        font-size: 14px;
    }

    /* Blog Index */
    .blog-hero {
        padding: 36px 0;
    }
    .blog-hero h1 {
        font-size: 22px;
    }
    .blog-hero p {
        font-size: 14px;
    }
    .blog-list-section {
        padding: 30px 16px 40px;
    }
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .blog-card-header {
        padding: 22px 18px;
    }
    .blog-card-header h2 {
        font-size: 15px;
    }
    .blog-card-body {
        padding: 16px 18px 20px;
    }
    .blog-card-body p {
        font-size: 13px;
    }

    /* Footer CTA */
    .footer-cta-bar {
        padding: 32px 0;
        padding-bottom: 80px;
    }
    .footer-cta-bar h3 {
        font-size: 18px;
    }
    .footer-cta-bar .cta-buttons {
        flex-direction: column;
        gap: 8px;
        padding: 0 16px;
    }
    .footer-cta-bar .cta-btn {
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }

    /* Sticky CTA - モバイルのみ表示 */
    .sticky-mobile-cta {
        display: block;
    }

    /* Scroll top position adjustment */
    .scroll-top {
        bottom: 72px;
        right: 12px;
    }
}

/* =========================================
   RESPONSIVE: Small Mobile (max-width: 375px)
   ========================================= */
@media (max-width: 375px) {
    .article-hero h1 {
        font-size: 18px;
    }
    .article-body h2 {
        font-size: 17px;
    }
    .article-body h3 {
        font-size: 15px;
    }
    .article-body p {
        font-size: 14.5px;
    }
    .toc-list a {
        font-size: 12.5px;
    }
}

/* =========================================
   Accessibility & Performance
   ========================================= */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reading-progress { transition: none; }
    .sticky-mobile-cta { transition: none; }
}

/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible {
    outline: 2px solid #0066CC;
    outline-offset: 2px;
}

/* Smooth scroll (CSS level) */
html {
    scroll-behavior: smooth;
}

/* Print styles */
@media print {
    .sticky-mobile-cta,
    .scroll-top,
    .reading-progress,
    .article-cta,
    .footer-cta-bar {
        display: none !important;
    }
    .article-body {
        max-width: 100%;
    }
}
