/* =============================================================================
   Sugimoto Theme — main.css
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS変数
   ----------------------------------------------------------------------------- */
:root {
    /* ベースカラー */
    --color-bg:         #f7fbff;
    --color-surface:    #ffffff;
    --color-border:     #dce7f0;
    --color-border-light: #edf3f9;

    /* テキスト */
    --color-text:       #1a2535;
    --color-text-muted: #6b7a8d;
    --color-text-light: #9aaabb;

    /* タイプカラー */
    --color-works:      #3d5a80;
    --color-works-bg:   #e8edf5;
    --color-exp:        #2d6a4f;
    --color-exp-bg:     #e8f4ef;
    --color-idea:       #c4602a;
    --color-idea-bg:    #fef0e6;
    --color-game:       #6b2d8b;
    --color-game-bg:    #f0e8f5;

    /* レイアウト */
    --container-max:    1100px;
    --container-pad:    clamp(16px, 4vw, 48px);
    --header-h:         80px;
    --gap:              20px;
    --radius:           4px;

    /* タイポグラフィ */
    --font-base:        'Noto Sans JP', 'Hiragino Sans', 'BIZ UDPGothic', sans-serif;
    --font-size-base:   15px;
    --line-height:      1.75;
}

/* -----------------------------------------------------------------------------
   リセット・ベース
   ----------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-base);
    background-color: var(--color-bg);
    background-image:
        linear-gradient(to right, #c8ddef 1px, transparent 1px),
        linear-gradient(to bottom, #c8ddef 1px, transparent 1px);
    /* background-size と background-position は grid-sync.js が動的に制御する */
    background-size: var(--grid-unit, 24px) var(--grid-unit, 24px);
    color: var(--color-text);
    line-height: var(--line-height);
    -webkit-font-smoothing: antialiased;
    padding-top: var(--header-h);
    padding-bottom: 48px;
}

body.single {
    background-image: none;
}

a {
    color: inherit;
    text-decoration: none;
}

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

/* -----------------------------------------------------------------------------
   ヘッダー
   ----------------------------------------------------------------------------- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--header-h);
    background: rgba(247, 251, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-pad);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    position: relative;
}

/* ナビバー（ヘッダー直下の固定段） */
.site-header__nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    z-index: 99;
    background: rgba(247, 251, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
    padding: 4px var(--container-pad);
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-header__logo {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5rem;
    color: var(--color-text);
    white-space: nowrap;
    text-decoration: none;
}


/* ロゴシャッフル */
.logo-shuffle {
    display: inline-flex;
    align-items: baseline;
    gap: 0;
}

.logo-char {
    display: inline-block;
    font-weight: 700;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--color-text);
}

.logo-char.is-emoji {
    font-size: 1.4rem;
    line-height: 1;
    vertical-align: middle;
    font-family: initial !important;
}

/* ナビ */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-menu a {
    display: block;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}

.nav-menu a:hover,
.nav-menu .current-menu-item a {
    color: var(--color-text);
    background: var(--color-border-light);
}

/* ハンバーガーボタン */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}

.hamburger__line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    transition: transform 0.2s ease, opacity 0.2s ease;
    transform-origin: center;
}

.hamburger.is-open .hamburger__line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-open .hamburger__line:nth-child(2) { opacity: 0; }
.hamburger.is-open .hamburger__line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


/* モバイル */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
        position: absolute;
        right: var(--container-pad);
    }

    .site-header__nav {
        display: none;
        padding: 8px var(--container-pad) 16px;
        bottom: 0;
        overflow-y: auto;
    }

    .site-header__nav.is-open {
        display: flex;
        flex-direction: column;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .nav-menu li { border-bottom: 1px solid var(--color-border-light); }

    .nav-menu a {
        padding: 12px 4px;
        font-size: 0.9rem;
        border-radius: 0;
    }


    .nav-footer {
        display: block;
        margin-top: auto;
        padding-top: 12px;
        border-top: 1px solid var(--color-border-light);
        text-align: center;
        font-size: 0.75rem;
        color: var(--color-text-light);
    }
}

/* -----------------------------------------------------------------------------
   コンテナ
   ----------------------------------------------------------------------------- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 40px var(--container-pad) 80px;
}

.container--single {
    max-width: 760px;
}

/* -----------------------------------------------------------------------------
   フィルターバー（トップページ・ゲームアーカイブ）
   ----------------------------------------------------------------------------- */
.filter-bar {
    display: flex;
    gap: calc(var(--grid-unit, 24px) * 1);
    flex-wrap: wrap;
    margin-bottom: calc(var(--grid-unit, 24px) * 2);
}

.filter-bar__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: calc(var(--grid-unit, 24px) * 2);
    padding: 0 calc(var(--grid-unit, 24px) * 0.75);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    border: 1px solid var(--color-border);
    border-radius: 100px;
    color: var(--color-text-muted);
    background: var(--color-surface);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.filter-bar__item:hover {
    border-color: var(--color-text-muted);
    color: var(--color-text);
}

.filter-bar__item.is-active {
    background: var(--color-text);
    border-color: var(--color-text);
    color: #fff;
}

/* -----------------------------------------------------------------------------
   フィルターフォーム（アーカイブページ）
   ----------------------------------------------------------------------------- */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--grid-unit, 24px) * 0.5);
    align-items: center;
    margin-bottom: calc(var(--grid-unit, 24px) * 2);
    padding: calc(var(--grid-unit, 24px) * 0.5) calc(var(--grid-unit, 24px) * 0.75);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.filter-form__group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-form__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.filter-form select {
    font-family: var(--font-base);
    font-size: 0.8rem;
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
}

.filter-form__reset {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    text-decoration: underline;
    cursor: pointer;
}

/* -----------------------------------------------------------------------------
   カードグリッド
   ----------------------------------------------------------------------------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
    margin-bottom: 40px;
}

.card-grid--compact {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (max-width: 900px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .card-grid,
    .card-grid--compact {
        grid-template-columns: 1fr;
    }
}

/* -----------------------------------------------------------------------------
   カード
   ----------------------------------------------------------------------------- */
.card {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    aspect-ratio: 1 / 1;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.card__link {
    position: absolute;
    inset: 0;
    color: inherit;
}

.card__thumb {
    position: absolute;
    inset: 0;
    background: var(--color-border-light);
    overflow: hidden;
    border-radius: var(--radius);
}

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

.card__body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
    z-index: 3;
}

.card__body > *:not(.type-badge) {
    background: #fff;
    width: fit-content;
}

.card__title {
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--color-text);
}

.card__date {
    font-size: 0.7rem;
    color: var(--color-text-light);
    letter-spacing: 0.04em;
}

.card__hook,
.card__core-idea {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    line-height: 1.55;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.card__source {
    font-size: 0.7rem;
    color: var(--color-exp);
}

.card__idea-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-idea);
    margin-top: auto;
}

.card__status {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-top: auto;
}

.card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

/* カードシャタリングエフェクト */
.card__shatter {
    display: none;
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.card__shatter-cell {
    position: absolute;
    background-repeat: no-repeat;
    transition: transform 0.2s ease-in;
    will-change: transform;
}

/* タイプ別ボーダーアクセント */

/* -----------------------------------------------------------------------------
   タイプバッジ
   ----------------------------------------------------------------------------- */
.type-badge {
    display: inline-block;
    width: fit-content;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0;
    line-height: 1.6;
}

.type-badge--post            { background: var(--color-works-bg); color: var(--color-works); }
.type-badge--experience-log  { background: var(--color-exp-bg);   color: var(--color-exp); }
.type-badge--idea-card       { background: var(--color-idea-bg);  color: var(--color-idea); }
.type-badge--browser-game    { background: var(--color-game-bg);  color: var(--color-game); }

/* -----------------------------------------------------------------------------
   タグ
   ----------------------------------------------------------------------------- */
.tag {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    border: 1px solid var(--color-border);
    border-radius: 100px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
}

.tag:hover {
    border-color: var(--color-text-muted);
    color: var(--color-text);
}

.tag--mood     { border-color: #b5c4d8; color: #4a6080; }
.tag--sense    { border-color: #a8d0bb; color: #2d6a4f; }
.tag--material { border-color: #d0b5a8; color: #7a3d20; }
.tag--action   { border-color: #c4a0d0; color: #5a2070; }

/* ステータスバッジ */
.status-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
    background: var(--color-idea-bg);
    color: var(--color-idea);
    border: 1px solid rgba(196, 96, 42, 0.2);
}

/* -----------------------------------------------------------------------------
   アーカイブヘッダー
   ----------------------------------------------------------------------------- */
.archive-header {
    margin-bottom: 28px;
}

.archive-header__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 6px;
}

/* -----------------------------------------------------------------------------
   詳細ページ共通
   ----------------------------------------------------------------------------- */
.single-nav {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.back-link {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    transition: color 0.15s;
}

.back-link:hover { color: var(--color-text); }

.section-label {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-light);
    margin-bottom: 6px;
}

.section-heading {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

/* -----------------------------------------------------------------------------
   体験ログ 詳細
   ----------------------------------------------------------------------------- */
.single-exp__header {
    margin-bottom: 24px;
}

.single-exp__title {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 8px 0 12px;
}

.single-exp__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.meta-item { display: flex; align-items: center; gap: 4px; }
.meta-item--type { font-weight: 600; color: var(--color-exp); }
.meta-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-light); }

.single-exp__thumb {
    margin: 24px 0;
    border-radius: var(--radius);
    overflow: hidden;
}

.single-exp__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
}

.single-exp__hook {
    background: var(--color-exp-bg);
    border-left: 3px solid var(--color-exp);
    padding: 16px 20px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 28px;
}

.single-exp__hook p {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--color-text);
}

.single-exp__content {
    margin-bottom: 40px;
}

.single-exp__ideas {
    margin-top: 48px;
}

/* -----------------------------------------------------------------------------
   企画カード 詳細
   ----------------------------------------------------------------------------- */
.single-idea__header {
    margin-bottom: 20px;
}

.single-idea__title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 8px 0 12px;
}

.single-idea__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.single-idea__core-idea {
    background: var(--color-idea-bg);
    border-left: 3px solid var(--color-idea);
    padding: 16px 20px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 28px;
}

.single-idea__core-idea p {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.65;
    color: var(--color-text);
}

.single-idea__source {
    margin-bottom: 28px;
}

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--color-exp);
    padding: 8px 14px;
    border: 1px solid var(--color-exp-bg);
    border-radius: var(--radius);
    background: var(--color-exp-bg);
    transition: background 0.15s;
}

.source-link:hover { background: #d4eddf; }

.single-idea__details {
    display: grid;
    gap: 16px;
    margin-bottom: 28px;
}

.idea-field {
    padding: 14px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.idea-field__label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-light);
    margin-bottom: 6px;
}

.idea-field__value {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--color-text);
}

.single-idea__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
}

.single-idea__memo {
    padding: 16px;
    background: var(--color-border-light);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.single-idea__memo p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    line-height: 1.7;
}

/* -----------------------------------------------------------------------------
   ブラウザゲーム 詳細
   ----------------------------------------------------------------------------- */
.single-game__header {
    margin-bottom: 20px;
}

.single-game__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 8px 0 12px;
}

.single-game__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.single-game__embed {
    margin: 24px 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--color-border);
}

.single-game__embed iframe {
    display: block;
    width: 100%;
}

.single-game__thumb {
    margin: 24px 0;
    border-radius: var(--radius);
    overflow: hidden;
}

.single-game__play-link {
    margin: 16px 0 28px;
}

.single-game__content {
    margin-bottom: 32px;
}

/* -----------------------------------------------------------------------------
   通常投稿（Works）詳細
   ----------------------------------------------------------------------------- */
.single-post__header {
    margin-bottom: 24px;
}

.single-post__title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 8px 0 12px;
}

.single-post__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.single-post__thumb {
    margin: 24px 0;
    border-radius: var(--radius);
    overflow: hidden;
}

.single-post__content {
    margin-bottom: 40px;
}

/* ナビゲーション */
.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.post-nav__prev,
.post-nav__next { transition: color 0.15s; }
.post-nav__prev:hover,
.post-nav__next:hover { color: var(--color-text); }
.post-nav__next { text-align: right; }

/* -----------------------------------------------------------------------------
   本文コンテンツ
   ----------------------------------------------------------------------------- */
.entry-content {
    font-size: 0.92rem;
    line-height: 1.85;
}

.entry-content h2 { font-size: 1.2rem; font-weight: 700; margin: 2em 0 0.8em; }
.entry-content h3 { font-size: 1rem;  font-weight: 700; margin: 1.6em 0 0.6em; }
.entry-content p  { margin-bottom: 1.2em; }
.entry-content ul,
.entry-content ol { padding-left: 1.5em; margin-bottom: 1.2em; }
.entry-content li { margin-bottom: 0.4em; }
.entry-content img {
    border-radius: var(--radius);
    margin: 1.5em 0;
}
.entry-content blockquote {
    border-left: 3px solid var(--color-border);
    padding: 8px 16px;
    color: var(--color-text-muted);
    margin: 1.2em 0;
}
.entry-content a {
    color: var(--color-works);
    text-decoration: underline;
}

/* -----------------------------------------------------------------------------
   ボタン
   ----------------------------------------------------------------------------- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.15s;
}

.btn:hover { background: var(--color-bg); }

.btn--primary {
    background: var(--color-game);
    border-color: var(--color-game);
    color: #fff;
}

.btn--primary:hover { opacity: 0.85; }

/* -----------------------------------------------------------------------------
   ページネーション
   ----------------------------------------------------------------------------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

.pagination .page-numbers {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.82rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text-muted);
    background: var(--color-surface);
    transition: all 0.15s;
}

.pagination .page-numbers:hover,
.pagination .page-numbers.current {
    background: var(--color-text);
    border-color: var(--color-text);
    color: #fff;
}

/* -----------------------------------------------------------------------------
   フッター
   ----------------------------------------------------------------------------- */
@media (min-width: 769px) { .nav-footer { display: none; } }

.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-top: 1px solid var(--color-border);
    padding: 10px var(--container-pad);
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-light);
    background: rgba(247, 251, 255, 0.92);
    backdrop-filter: blur(8px);
}

/* -----------------------------------------------------------------------------
   エラー404
   ----------------------------------------------------------------------------- */
.error-404 {
    text-align: center;
    padding: 80px 0;
}

.error-404 h1 {
    font-size: 5rem;
    font-weight: 700;
    color: var(--color-border);
    margin-bottom: 16px;
}

.error-404 p {
    color: var(--color-text-muted);
    margin-bottom: 32px;
}

/* その他 */
.no-posts {
    text-align: center;
    color: var(--color-text-light);
    padding: 60px 0;
    font-size: 0.88rem;
}

/* -----------------------------------------------------------------------------
   レスポンシブ
   ----------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .site-footer { display: none; }
    .site-header__logo { font-size: 0.78rem; }
    .nav-menu a { padding: 4px 8px; font-size: 0.75rem; }

    .single-exp__title,
    .single-idea__title,
    .single-game__title,
    .single-post__title { font-size: 1.25rem; }

    .single-idea__details { grid-template-columns: 1fr; }

    .post-nav { flex-direction: column; gap: 8px; }
    .post-nav__next { text-align: left; }
}

@media (max-width: 480px) {
    :root { --container-pad: 16px; }
    .filter-bar { gap: 4px; }
    .filter-bar__item { padding: 4px 10px; font-size: 0.72rem; }
    .filter-form { padding: 12px; }
}
