/* ========================================
   ブログ フロントエンド CSS
   far-inc.co.jp デザインに準拠
   ======================================== */

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

:root {
    --bg: #fafafa;
    --bg-alt: #f2f3f5;
    --surface: #ffffff;
    --border: #e0e2e6;
    --text: #222222;
    --text-muted: #717680;
    --accent: #333333;
    --accent-light: #555555;
    --accent-dark: #111111;
    --accent-glow: rgba(50, 50, 50, 0.06);
    --gradient: linear-gradient(135deg, #333333, #555555);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-sans: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

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

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

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

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ========== Navigation (far-inc.co.jp 準拠) ========== */
.nav {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 20px 0;
    transition: var(--transition);
}
.nav.scrolled {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    box-shadow: var(--shadow-sm);
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    display: flex;
    align-items: center;
}
.nav-logo-img {
    height: 40px;
    width: auto;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
}
.nav-links a {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
    letter-spacing: 0.02em;
}
.nav-links a:hover,
.nav-links a.nav-active {
    color: var(--text);
}
.nav-cta {
    background: var(--gradient);
    color: #fff !important;
    padding: 8px 20px;
    border-radius: 100px;
    font-weight: 600 !important;
}
.nav-cta:hover {
    opacity: 0.9;
}
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: var(--transition);
}

/* Blog Sub Header */
.blog-subheader {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}
.subheader-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.blog-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.blog-title:hover {
    color: var(--accent-light);
}

/* Search Form */
.search-form {
    display: flex;
    gap: 0;
}
.search-form input[type="search"] {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-size: 0.8125rem;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    width: 200px;
    transition: border-color var(--transition);
}
.search-form input[type="search"]:focus {
    outline: none;
    border-color: var(--accent);
}
.search-form button {
    padding: 8px 16px;
    background: var(--gradient);
    color: #fff;
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: var(--font-sans);
    transition: opacity var(--transition);
}
.search-form button:hover { opacity: 0.85; }

.search-form-large {
    margin-bottom: 24px;
}
.search-form-large input[type="search"] {
    width: 100%;
    font-size: 1rem;
    padding: 12px 16px;
}

/* ========== Main Layout ========== */
.site-main {
    padding: 40px 0;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
}

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

/* Page Title */
.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent);
    color: var(--text);
    letter-spacing: -0.01em;
}
.result-count {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ========== Post Card ========== */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    transition: box-shadow var(--transition), transform var(--transition);
    border: 1px solid var(--border);
}
.post-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.post-card .post-thumbnail {
    flex-shrink: 0;
    width: 260px;
    overflow: hidden;
}
.post-card .post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}
.post-card:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-card-body {
    padding: 20px 24px;
    flex: 1;
    min-width: 0;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.post-category {
    background: var(--accent-glow);
    color: var(--accent);
    padding: 3px 12px;
    border-radius: 100px;
    font-size: 0.6875rem;
    font-weight: 600;
    border: 1px solid rgba(50, 50, 50, 0.1);
    letter-spacing: 0.02em;
}
.post-category:hover {
    background: var(--accent);
    color: #fff;
}

.post-card .post-title {
    font-size: 1.0625rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.5;
    letter-spacing: -0.01em;
}
.post-card .post-title a { color: var(--text); }
.post-card .post-title a:hover { color: var(--accent-light); }

.post-excerpt {
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.7;
    margin-bottom: 8px;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag-link {
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 100px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    transition: all var(--transition);
}
.tag-link:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ========== Post Detail ========== */
.post-detail {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.breadcrumb ol {
    display: flex;
    list-style: none;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    letter-spacing: 0.02em;
}
.breadcrumb li:not(:last-child)::after {
    content: '>';
    margin-left: 8px;
    color: var(--border);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

.post-detail .post-header {
    margin-bottom: 28px;
}

.post-detail .post-title {
    font-size: 1.75rem;
    font-weight: 900;
    line-height: 1.4;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    color: var(--text);
}

.post-detail .post-categories {
    margin-bottom: 8px;
}

.post-author {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.reading-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.post-featured-image {
    margin-bottom: 28px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.post-featured-image img {
    width: 100%;
}

.updated-date {
    color: var(--text-muted);
    font-size: 0.6875rem;
}

/* Post Content */
.post-content {
    line-height: 2;
    font-size: 1rem;
    margin-bottom: 32px;
    color: var(--text);
}
.post-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2em 0 0.8em;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
    letter-spacing: -0.01em;
}
.post-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 1.5em 0 0.6em;
}
.post-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.2em 0 0.5em;
}
.post-content p {
    margin-bottom: 1.2em;
}
.post-content ul, .post-content ol {
    padding-left: 1.5em;
    margin-bottom: 1.2em;
}
.post-content li {
    margin-bottom: 0.4em;
}
.post-content blockquote {
    border-left: 4px solid var(--accent);
    padding: 12px 20px;
    margin: 1.5em 0;
    background: var(--bg-alt);
    color: var(--accent-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.post-content pre {
    background: var(--accent-dark);
    color: #e5e7eb;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 1.5em 0;
    font-size: 0.875rem;
}
.post-content code {
    background: var(--bg-alt);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.post-content pre code {
    background: none;
    padding: 0;
}
.post-content img {
    border-radius: var(--radius-sm);
    margin: 1em auto;
}
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
}
.post-content th, .post-content td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
}
.post-content th {
    background: var(--bg-alt);
    font-weight: 600;
}

/* ========== Share Buttons ========== */
.share-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
    flex-wrap: wrap;
}
.share-top { border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.share-bottom { border-top: 1px solid var(--border); margin-top: 24px; }

.share-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 600;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff !important;
    transition: opacity var(--transition), transform var(--transition);
}
.share-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
    color: #fff;
}
.share-twitter { background: var(--accent-dark); }
.share-facebook { background: #1877f2; }
.share-line { background: #06c755; }
.share-hatena { background: #00a4de; }
.share-pocket { background: #ef4056; }

/* ========== Related Posts ========== */
.related-posts {
    margin-top: 40px;
}
.related-posts h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.post-list-small {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.post-card-small {
    flex-direction: column;
}
.post-card-small .post-thumbnail {
    width: 100%;
    height: 140px;
}
.post-card-small .post-card-body {
    padding: 12px 16px;
}
.post-card-small h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.5;
}
.post-card-small time {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* ========== Sidebar ========== */
.sidebar {
    position: sticky;
    top: 84px;
    align-self: start;
}

.sidebar-widget {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.widget-title {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
    letter-spacing: 0.02em;
    color: var(--text);
}

.category-list {
    list-style: none;
}
.category-list li {
    border-bottom: 1px solid var(--bg-alt);
}
.category-list li:last-child { border-bottom: none; }
.category-list a {
    display: flex;
    justify-content: space-between;
    padding: 9px 0;
    color: var(--text);
    font-size: 0.8125rem;
    transition: color var(--transition);
}
.category-list a:hover { color: var(--accent-light); }
.category-list .count {
    color: var(--text-muted);
    font-size: 0.6875rem;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.recommended-list {
    list-style: none;
}
.recommended-list li {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bg-alt);
}
.recommended-list li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.recommended-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 0.8125rem;
    line-height: 1.4;
    transition: color var(--transition);
}
.recommended-list a:hover { color: var(--accent-light); }
.recommended-list img {
    width: 80px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

/* ========== Pagination ========== */
.pagination {
    margin-top: 32px;
    text-align: center;
}
.pagination ul {
    display: inline-flex;
    list-style: none;
    gap: 4px;
}
.pagination li a,
.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text);
    transition: all var(--transition);
}
.pagination li a:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.pagination li.active span {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.pagination li.dots span {
    border: none;
    color: var(--text-muted);
}

/* ========== Error Page ========== */
.error-page {
    text-align: center;
    padding: 80px 0;
}
.error-page h2 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}
.error-page p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    background: var(--gradient);
    color: #fff;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.02em;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    color: #fff;
}

.no-posts {
    color: var(--text-muted);
    text-align: center;
    padding: 40px 0;
}

.category-description {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.875rem;
}

/* ========== Footer (far-inc.co.jp 準拠) ========== */
.footer {
    padding: 48px 0 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}
.footer-logo-img {
    height: 36px;
    width: auto;
}
.footer-brand p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.footer-links {
    display: flex;
    gap: 24px;
}
.footer-links a {
    font-size: 0.8125rem;
    color: var(--text-muted);
    transition: var(--transition);
}
.footer-links a:hover {
    color: var(--text);
}
.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.footer-bottom p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--surface);
        flex-direction: column;
        padding: 80px 32px 32px;
        gap: 24px;
        transition: var(--transition);
        border-left: 1px solid var(--border);
        box-shadow: -10px 0 40px rgba(0,0,0,0.1);
        z-index: 1001;
    }
    .nav-links.open {
        right: 0;
    }

    .subheader-inner {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .post-card {
        flex-direction: column;
    }
    .post-card .post-thumbnail {
        width: 100%;
        height: 200px;
    }

    .post-detail {
        padding: 24px;
    }
    .post-detail .post-title {
        font-size: 1.35rem;
    }

    .sidebar {
        position: static;
    }

    .share-buttons {
        justify-content: center;
    }

    .post-list-small {
        grid-template-columns: 1fr 1fr;
    }

    .search-form input[type="search"] {
        width: 160px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 24px;
        text-align: center;
    }
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .post-list-small {
        grid-template-columns: 1fr;
    }
}
