/*
Theme Name: Kuma Activity Log
Theme URI: https://kuma130.net
Author: kuma
Description: スキー、バイク、登山などのアクティビティログ用カスタムテーマ。AI発見性を高めるためのSchema.org対応、モダンなデザイン。
Version: 1.4.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kuma-activity-log
Tags: blog, custom-header, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* Base Variables */
:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --accent-hover: #2980b9;
    --text-color: #333;
    --light-text: #fff;
    --bg-color: #f8f9fa;
    --card-bg: #fff;
    --font-main: 'Noto Sans JP', sans-serif;
    --font-english: 'Noto Sans JP', sans-serif;
    --card-radius: 16px;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.12);
    --transition-speed: 0.3s;
    --spacing-container: 1200px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-speed);
}

ul {
    list-style: none;
}

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

/* Container */
/* Container */
.container {
    max-width: var(--spacing-container);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: transparent;
    padding: 20px 0;
    position: absolute;
    width: 100%;
    max-width: 100%;
    top: 0;
    z-index: 100;
    left: 0;
    right: 0;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-english);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--light-text);
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.main-nav ul {
    display: flex;
    gap: 30px;
}

.main-nav a {
    color: var(--light-text);
    font-family: var(--font-english);
    font-size: 1.1rem;
    font-weight: 500;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width var(--transition-speed);
}

.main-nav a:hover::after {
    width: 100%;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    width: 40px;
    height: 40px;
    position: relative;
    z-index: 1001;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--light-text);
    margin: 5px auto;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Hero Section */
.hero {
    height: 80vh;
    min-height: 600px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    background-color: var(--primary-color);
}

/* 背景画像レイヤー */
.hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

/* YouTube動画レイヤー（デスクトップのみ表示） */
.hero-video {
    display: none;
}

.hero--has-video .hero-video {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.hero--has-video .hero-video iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 177.78vh; /* 16:9 ratio */
    min-height: 56.25vw;
    width: 100vw;
    height: 56.25vw;
    border: none;
}

/* デスクトップで動画がある場合、写真を隠す */
@media (min-width: 1025px) {
    .hero--has-video .hero-image {
        display: none;
    }
}

/* タブレット以下では動画を隠し、写真を表示 */
@media (max-width: 1024px) {
    .hero--has-video .hero-video {
        display: none;
    }
    .hero--has-video .hero-image {
        display: block;
    }
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.6));
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: var(--light-text);
    animation: fadeInUp 1s ease-out;
}

.hero-title {
    font-family: var(--font-english);
    font-size: 5rem;
    line-height: 1.1;
    margin-bottom: 20px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Layout Grid */
.layout-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    /* Main content + Sidebar */
    gap: 40px;
    padding-top: 60px;
    padding-bottom: 60px;
    max-width: 100%;
}

/* Main Content & Cards */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 32px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.card-link {
    display: block;
}

.card-image-wrapper {
    position: relative;
    overflow: hidden;
    padding-top: 58%;
    background-color: #f0f0f0;
    width: 100%;
}

.card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .card-image {
    transform: scale(1.06);
}

.category-tag {
    position: absolute;
    top: 14px;
    left: 14px;
    padding: 5px 14px;
    background: rgba(255, 255, 255, 0.92);
    color: #333;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    border-radius: 20px;
    z-index: 2;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.category-tag.ski {
    color: #fff;
    background: rgba(52, 152, 219, 0.88);
}

.category-tag.motorcycle {
    color: #fff;
    background: rgba(230, 126, 34, 0.88);
}

.category-tag.mountain {
    color: #fff;
    background: rgba(39, 174, 96, 0.88);
}

.category-tag.bicycle {
    color: #fff;
    background: rgba(142, 68, 173, 0.88);
}

.card-body {
    padding: 22px 24px 26px;
}

.card-meta {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 10px;
    font-weight: 400;
    letter-spacing: 0.04em;
}

.card-title {
    font-size: 1.15rem;
    margin-bottom: 12px;
    line-height: 1.5;
    font-weight: 700;
    color: var(--text-color);
}

.card-excerpt {
    font-size: 0.88rem;
    color: #777;
    margin-bottom: 0;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

/* Sidebar */
.sidebar .widget {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.widget-title {
    font-family: var(--font-english);
    font-size: 1.2rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: inline-block;
}

.profile-content {
    text-align: center;
}

.profile-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 15px;
    border: 3px solid var(--bg-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.popular-list li {
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

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

.popular-list a {
    font-weight: 500;
    color: #444;
}

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

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

.tag-cloud a {
    font-size: 0.85rem;
    background: #f1f2f6;
    padding: 5px 10px;
    border-radius: 20px;
    color: #666;
    transition: all 0.2s;
}

.tag-cloud a:hover {
    background: var(--accent-color);
    color: #fff;
}

/* Footer */
.site-footer {
    background: #222;
    color: #fff;
    padding: 60px 0 30px;
    margin-top: 60px;
}

.footer-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-logo {
    font-family: var(--font-english);
    font-size: 2rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.footer-nav {
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
}

.footer-nav a {
    color: #aaa;
}

.footer-nav a:hover {
    color: #fff;
}

.copyright {
    color: #666;
    font-size: 0.8rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   Responsive Design
   ========================================= */

/* Force text wrap to prevent overflow */
p,
h1,
h2,
h3,
h4,
h5,
h6,
li,
blockquote,
dd,
dt {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Tablet Layout (max-width: 1024px) */
@media (max-width: 1024px) {
    .container {
        width: 100%;
        max-width: 100%;
        padding: 0 20px;
        box-sizing: border-box;
    }

    /* Layout: Force 1 Column */
    .layout-grid {
        display: block;
        padding-top: 40px;
    }

    .main-content,
    .sidebar {
        width: 100%;
        margin: 0;
    }

    /* Sidebar Styling */
    .sidebar {
        margin-top: 40px;
        padding-top: 40px;
        border-top: 1px solid #ddd;
    }

    .sidebar .widget {
        background: #f8f9fa;
        padding: 20px;
        margin-bottom: 20px;
        border-radius: 8px;
    }

    /* Hero */
    .hero {
        height: 50vh;
        min-height: 350px;
    }

    .hero-title {
        font-size: clamp(2rem, 5vw, 3.5rem);
        padding: 0 20px;
    }

    /* Cards: 3 Columns on Tablet */
    .posts-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .card-image-wrapper {
        padding-top: 60%;
    }

    .card-body {
        padding: 18px;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .card-excerpt {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    /* Header & Nav for Tablet */
    .mobile-menu-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(44, 62, 80, 0.98);
        z-index: 1000;
        padding-top: 80px;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 25px;
        align-items: center;
    }

    .main-nav a {
        font-size: 1.3rem;
        color: #fff;
    }

    /* Post Hero for Tablet */
    .post-hero {
        height: 45vh;
        min-height: 300px;
    }

    .post-title.h1-override {
        font-size: 2rem;
    }

    .post-hero-content {
        padding: 0 20px 40px;
    }

    /* TOC */
    .toc {
        min-width: auto;
        width: 100%;
        display: block;
    }
}

/* Mobile Layout (max-width: 768px) */
@media (max-width: 768px) {

    /* Container */
    .container {
        padding: 0 16px;
    }

    /* Header & Nav */
    .site-header {
        padding: 15px 0;
    }

    .logo {
        font-size: 1.4rem;
    }

    .main-nav a {
        font-size: 1.2rem;
    }

    /* Hero Optimization */
    .hero {
        height: 40vh;
        min-height: 280px;
    }

    /* Fix Hero Title Overflow */
    .hero-title {
        word-break: keep-all;
        overflow-wrap: break-word;
        max-width: 100%;
        padding: 0 16px;
        margin-bottom: 15px;
        font-size: 1.5rem;
        line-height: 1.4;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        padding: 0 20px;
    }

    /* Cards: 2 Columns on Mobile */
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Image Aspect Ratio */
    .card-image-wrapper {
        padding-top: 56.25%;
    }

    .card-body {
        padding: 14px;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-excerpt {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    /* Post Hero for Mobile */
    .post-hero {
        height: 35vh;
        min-height: 250px;
    }

    .post-title.h1-override {
        font-size: 1.5rem;
        line-height: 1.4;
    }

    .post-hero-content {
        padding: 0 16px 30px;
    }

    .post-meta {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Content Typography */
    .single-article {
        padding: 20px 16px;
        font-size: 1rem;
    }

    .single-article h2 {
        font-size: 1.3rem;
        margin: 35px 0 18px;
    }

    .single-article h3 {
        font-size: 1.2rem;
        margin: 25px 0 15px;
    }

    /* テーブルのスクロール対応 */
    .single-article table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* iframe/embed のオーバーフロー防止 */
    .single-article iframe,
    .single-article embed,
    .single-article video {
        max-width: 100%;
        height: auto;
    }

    /* TOC */
    .toc {
        min-width: auto;
        width: 100%;
        display: block;
        padding: 15px;
    }

    /* シェアボタン */
    .share-area {
        margin-top: 30px;
        padding-top: 20px;
    }

    .share-btn {
        display: block;
        margin-right: 0;
        margin-bottom: 10px;
        text-align: center;
    }

    /* Related Posts */
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .related-card img {
        height: 100px;
    }

    .related-card h4 {
        font-size: 0.85rem;
        padding: 8px;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
    }

    .pagination a,
    .pagination span {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    /* Footer */
    .site-footer {
        padding: 40px 0 20px;
        margin-top: 40px;
    }

    .footer-logo {
        font-size: 1.5rem;
    }

    .footer-nav {
        flex-direction: column;
        gap: 12px;
    }

    /* Sidebar Mobile */
    .sidebar .widget {
        padding: 18px;
    }

    /* Ad Widget Mobile */
    .ad-widget {
        padding: 15px;
        margin: 20px 0;
    }
}

/* Small Mobile (max-width: 375px) */
@media (max-width: 375px) {
    .hero-title {
        font-size: 1.3rem;
    }

    .post-title.h1-override {
        font-size: 1.3rem;
    }

    .posts-grid {
        gap: 20px;
    }

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

/* --- Single Post Styles --- */

/* Scrolled Header (Background addition) */
.site-header.scrolled {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
}

/* Post Hero */
.post-hero {
    position: relative;
    height: 60vh;
    min-height: 400px;
    overflow: hidden;
}

.post-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-hero-content {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    padding: 0 20px 60px;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    max-width: var(--spacing-container);
}

.post-meta {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.post-title.h1-override {
    font-size: 2.5rem;
    /* Larger for H1 */
    line-height: 1.3;
    font-weight: 700;
}

/* Article Typography (Readability Focus) */
.single-article {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    font-size: 1.05rem;
    /* Slightly larger text */
    line-height: 1.8;
}

.article-lead {
    font-weight: 700;
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 40px;
    border-left: 5px solid var(--accent-color);
    padding-left: 20px;
}

.single-article h2 {
    font-size: 1.8rem;
    margin: 50px 0 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
    color: var(--primary-color);
}

.single-article h3 {
    font-size: 1.5rem;
    margin: 40px 0 20px;
    border-left: 5px solid var(--accent-color);
    padding-left: 15px;
}

.single-article p {
    margin-bottom: 25px;
    color: #444;
}

.single-article img {
    max-width: 600px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px auto;
    display: block;
}

/* WordPress alignment classes */
.single-article .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.single-article .alignleft,
.single-article .alignright {
    max-width: 600px;
    width: 100%;
    float: none;
    margin: 20px auto;
}

.single-article .wp-block-image {
    margin: 20px 0;
    text-align: center;
}

.single-article .wp-block-image img {
    max-width: 600px;
    width: 100%;
}

/* 記事内の動画埋め込み（YouTube等）は幅いっぱいに表示 */
.single-article iframe,
.single-article embed,
.single-article video {
    width: 100%;
    max-width: 100%;
    border-radius: 8px;
}

.single-article iframe {
    aspect-ratio: 16 / 9;
    height: auto;
}

/* WordPress embed wrapper */
.single-article .wp-block-embed,
.single-article .wp-block-embed__wrapper {
    max-width: 100%;
    margin: 20px 0;
}

.single-article .wp-block-embed__wrapper iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
}

.single-article figure {
    margin: 0 0 30px;
}

.single-article figcaption {
    font-size: 0.9rem;
    color: #888;
    text-align: center;
    margin-top: 10px;
}

.single-article blockquote {
    background: #f1f2f6;
    padding: 20px;
    border-left: 5px solid #bbb;
    margin: 30px 0;
    color: #666;
    font-style: italic;
}

/* Table of Contents */
.toc {
    background: #f8f9fa;
    border: 1px solid #eee;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 40px;
    display: inline-block;
    min-width: 300px;
}

.toc-title {
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

.toc ul {
    list-style: none;
}

.toc li {
    margin-bottom: 10px;
}

.toc a:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

/* Share Buttons */
.share-area {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.share-area p {
    font-weight: 700;
    margin-bottom: 15px;
}

.share-btn {
    display: inline-block;
    padding: 10px 20px;
    margin-right: 10px;
    border-radius: 5px;
    color: #fff;
    font-weight: 500;
    transition: opacity 0.3s;
}

.share-btn:hover {
    opacity: 0.8;
}

.share-btn.x-twitter {
    background: #000;
}

.share-btn.facebook {
    background: #1877f2;
}

/* Related Posts */
.related-posts {
    margin-top: 60px;
}

.section-title {
    font-family: var(--font-english);
    font-size: 1.5rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.related-card {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.related-card:hover {
    transform: translateY(-3px);
}

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

.related-card h4 {
    padding: 10px;
    font-size: 0.95rem;
    color: var(--text-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.pagination a,
.pagination span {
    padding: 10px 15px;
    background: #fff;
    border-radius: 5px;
    color: var(--text-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.pagination .current {
    background: var(--accent-color);
    color: #fff;
}

.pagination a:hover {
    background: var(--accent-hover);
    color: #fff;
}

/* Ad Widget Styles */
.ad-widget {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.ad-before-content {
    margin-top: 0;
    margin-bottom: 30px;
}

.ad-after-content {
    margin-top: 30px;
    margin-bottom: 0;
}

.ad-in-content {
    margin: 40px 0;
}

.ad-title {
    font-size: 0.8rem;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.sidebar .ad-widget {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}