:root {
    --color-bg: #f2f2f2;
    --color-surface: #fff;
    --color-text: #222;
    --color-sidebar: #d9645c;
    --color-sidebar-text: #fff;
    --color-brand: #9c2b2b;
    --color-brand-dark: #7c2020;
    --color-navy: #1b2a45;
    --color-border: #e2e2e2;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    /* 改行やスペースの無い長い文字列（URL等）でもカード幅を超えて折り返す。継承されるため
       投稿本文に限らずタイトル・タグ名・お問い合わせ本文等にも効く。 */
    overflow-wrap: break-word;
}

a {
    color: var(--color-brand);
}

.app-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
    max-width: 1280px;
    margin-inline: auto;
}

.sidebar {
    width: 220px;
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    background-color: var(--color-sidebar);
}

/* スマホ幅でのみ表示するハンバーガーボタン（画面左上に固定表示）。
   デスクトップ幅では常時非表示（@media (max-width: 700px)で表示に切り替える）。 */
.mobile-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 6px;
    background-color: var(--color-sidebar);
    color: var(--color-sidebar-text);
    font-size: 1.4em;
    line-height: 1;
    cursor: pointer;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background-color: var(--color-sidebar);
    text-decoration: none;
}

.sidebar-logo img {
    width: 100%;
    max-width: 170px;
    height: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-nav a {
    display: block;
    padding: 14px 20px;
    color: var(--color-sidebar-text);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 0.95em;
}

.sidebar-nav a:hover {
    background-color: rgba(0, 0, 0, 0.12);
}

/* ログイン時のメニューをプルダウン化（会員ページのプロフィール折りたたみと同じdetails/summary方式）。
   .sidebar-nav a はdetails内のaにも及ぶため、リンク自体の見た目（padding・色・区切り線）は
   共通スタイルを流用し、ここではsummaryの見た目と開閉アイコンのみを個別に定義する。 */
.sidebar-account-menu summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    color: var(--color-sidebar-text);
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 0.95em;
    list-style: none;
}

.sidebar-account-menu summary::-webkit-details-marker {
    display: none;
}

.sidebar-account-menu summary::after {
    content: "▾";
    font-size: 0.8em;
    transition: transform 0.15s ease;
}

.sidebar-account-menu[open] summary::after {
    transform: rotate(180deg);
}

.sidebar-account-menu summary:hover {
    background-color: rgba(0, 0, 0, 0.12);
}

.sidebar-account-menu a {
    padding-left: 32px;
    background-color: rgba(0, 0, 0, 0.08);
}

.content {
    flex: 1;
    /* フレックスアイテムの既定のmin-width:autoを解除し、中身（折り返せない長い文字列）に
       引っ張られてカードごとmax-widthを超えて押し広がるのを防ぐ。 */
    min-width: 0;
    margin: 24px auto;
    padding: 32px;
    max-width: 480px;
    background-color: var(--color-surface);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.content-wide {
    max-width: 960px;
}

.content h1 {
    margin-top: 0;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--color-brand);
}

/* トップページ上部のバナー画像（ロゴ＋サイト説明文＋活動写真の一体画像）。
   デザインサイズ900x300pxに対し実ファイルは2倍解像度（1800x600px）で高DPI画面にも対応。
   .content-wideの内側幅（最大896px）いっぱいに表示する。 */
.home-hero {
    margin: 0 0 24px;
    padding-bottom: 0;
    border-bottom: none;
}

.home-hero img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
}

.content h2 {
    margin: 24px 0 12px;
    padding: 10px 16px;
    background-color: var(--color-navy);
    color: #fff;
    font-size: 1.1em;
    border-radius: 4px;
}

.form-row {
    margin-bottom: 16px;
}

.form-row label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
}

.form-row input[type="text"],
.form-row input[type="password"],
.form-row textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.form-row textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    margin-top: 24px;
    display: flex;
    gap: 8px;
}

button,
.button {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    background-color: var(--color-brand);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
}

button:hover,
.button:hover {
    background-color: var(--color-brand-dark);
}

.error-list {
    color: #b00020;
    margin-bottom: 16px;
}

.notice {
    color: #1a7a30;
    margin-bottom: 16px;
}

.hint {
    color: #666;
    font-size: 0.85em;
}

/* ボット対策のハニーポット。画面外へ追い出し、通常の利用者には見えないようにする。 */
.honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.link-list {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
}

.link-list li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.link-list .hint {
    display: block;
    margin-top: 2px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 12px;
    margin-bottom: 4px;
    font-weight: normal;
}

.logo-adjust-list {
    margin-top: 12px;
}

.logo-adjust-block {
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background-color: var(--color-bg);
}

.logo-adjust-filename {
    margin: 0 0 8px;
    font-weight: bold;
    font-size: 0.9em;
    word-break: break-all;
}

.logo-adjust-row {
    margin-bottom: 6px;
}

.logo-adjust-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    font-size: 0.9em;
}

.logo-adjust-row input[type="range"] {
    flex: 1;
}

.logo-adjust-value {
    min-width: 2.5em;
    text-align: right;
    color: #666;
    font-size: 0.9em;
}

.logo-preview-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    margin-bottom: 6px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background-color: #fff;
    touch-action: none;
    cursor: move;
}

.tag-more {
    display: block;
    margin-top: 8px;
}

.tag-more summary {
    cursor: pointer;
    color: var(--color-brand);
    font-size: 0.9em;
}

.tag-more[open] summary {
    margin-bottom: 8px;
}

.button-secondary {
    background-color: #fff;
    color: var(--color-brand);
    border: 1px solid var(--color-brand);
}

.button-secondary:hover {
    background-color: #fbecea;
}

.post-list {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
}

.post-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.post-list-title {
    flex: 1;
    min-width: 0;
}

.post-list-actions a {
    margin-left: 8px;
}

.tag-manage-item {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.tag-manage-name {
    font-weight: bold;
    margin-bottom: 6px;
}

.tag-manage-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.tag-manage-actions .inline-form {
    margin: 0;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    background-color: #f1f1f1;
    color: #555;
    text-decoration: none;
}

a.status-badge:hover {
    background-color: #e2e2e2;
}

.status-draft {
    background-color: #eee;
    color: #555;
}

.status-published {
    background-color: #d9f0dd;
    color: #1a7a30;
}

.status-blog {
    background-color: var(--color-navy);
    color: #fff;
}

.image-list {
    margin: 4px 0 0;
    padding-left: 20px;
    font-size: 0.85em;
    color: #555;
}

.existing-image-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 160px;
}

.existing-image-item .post-image {
    max-height: 160px;
}

.account-card {
    margin-top: 24px;
    padding: 16px;
    border: 1px solid #eee;
    border-radius: 6px;
}

.button-danger {
    background-color: #b00020;
}

.button-danger:hover {
    background-color: #870018;
}

.inline-form {
    margin: 8px 0;
}

.profile-note-section {
    margin: 8px 0 24px;
    padding-bottom: 16px;
    border-bottom: 3px solid var(--color-brand);
}

.profile-note {
    white-space: pre-line;
    line-height: 1.6;
    margin: 0;
}

.profile-note-fold summary {
    cursor: pointer;
    color: var(--color-brand);
    font-size: 0.9em;
}

.profile-note-fold[open] summary {
    margin-bottom: 8px;
}

.post-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.post-card {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
}

.post-card-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 6px;
    background-color: #eee;
}

.post-card-thumb-empty {
    display: block;
}

.post-card-title {
    margin-top: 8px;
    font-weight: bold;
}

.post-card-meta {
    color: #666;
    font-size: 0.85em;
}

.post-image-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.post-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 6px;
}

.post-body {
    margin: 16px 0;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* 本文中の[image:N]プレースホルダーから差し込まれる画像（ブログ形式表示）。 */
.post-inline-image {
    display: block;
    margin: 16px auto;
}

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

/* カード一覧共通のページ分割ナビゲーション（FR-29）。 */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 24px 0 0;
}

.pagination a,
.pagination-current {
    display: inline-block;
    min-width: 1.6em;
    padding: 4px 10px;
    border-radius: 4px;
    text-align: center;
    text-decoration: none;
    font-size: 0.9em;
}

.pagination a {
    color: var(--color-brand);
    border: 1px solid var(--color-border);
}

.pagination a:hover {
    background-color: #fbecea;
}

.pagination-current {
    background-color: var(--color-brand);
    color: #fff;
    font-weight: bold;
}

.site-footer {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 24px 24px;
    text-align: center;
}

.site-footer p {
    margin: 0;
    color: #888;
    font-size: 0.8em;
}

@media (max-width: 700px) {
    .app-shell {
        flex-direction: column;
    }

    /* サイドバー全体を通常のレイアウトから外し、画面左上に固定したハンバーガーボタン＋
       その直下に開くドロップダウンパネルに変える（スクロールにも追従する）。
       開閉はmobile-nav.jsが.sidebarへ付け外しする.nav-openクラスで行う。 */
    .sidebar {
        position: fixed;
        top: 12px;
        left: 12px;
        width: auto;
        flex: none;
        z-index: 100;
        background-color: transparent;
    }

    .mobile-nav-toggle {
        display: flex;
    }

    .sidebar-logo {
        display: none;
    }

    .sidebar-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        min-width: 220px;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        background-color: var(--color-sidebar);
        border-radius: 6px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }

    .sidebar.nav-open .sidebar-nav {
        display: flex;
    }

    .content {
        margin: 16px;
        margin-top: 64px;
        padding: 16px;
        max-width: none;
    }

    /* カード一覧（作品ギャラリー・公式ブログ・タグ絞り込み・会員ページ）はスマホ幅では
       auto-fillだと1列になり縦に間延びするため、2列固定に切り替えてカードを縮小する。 */
    .post-card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .post-card-title {
        font-size: 0.9em;
    }

    .post-card-meta {
        font-size: 0.75em;
    }
}
