@charset "utf-8";

/* =========================================
   カラー変数
========================================= */

/* ライトモード（デフォルト） */
:root {
    --bg: #ffffff;
    --text: #000000;
    --text-muted: #888888;
    --text-faint: #cccccc;
    --border: #e0e0e0;
    --highlight-bg: #f0f0f0;
    --notice-bg: #fafafa;
    --drawer-bg: #ffffff;
    --overlay-bg: rgba(0, 0, 0, 0.3);
}

/* ダークモード（手動切り替え） */
:root[data-theme="dark"] {
    --bg: #262626;
    --text: #fafafa;
    --text-muted: #919191;
    --text-faint: #4d4d4d;
    --border: #727272;
    --highlight-bg: #5f5f5f;
    --notice-bg: #353535;
    --drawer-bg: #262626;
    --overlay-bg: rgba(0, 0, 0, 0.5);
}

/* ダークモード（OS設定に追従・手動上書きがない場合のみ） */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #262626;
        --text: #fafafa;
        --text-muted: #919191;
        --text-faint: #4d4d4d;
        --border: #727272;
        --highlight-bg: #5f5f5f;
        --notice-bg: #353535;
        --drawer-bg: #262626;
        --overlay-bg: rgba(0, 0, 0, 0.5);
    }
}

/* =========================================
   リセット・基本設定
========================================= */

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

body {
    text-align: center;
    background-color: var(--bg);
    color: var(--text);
    font-family: 'EB Garamond', 'Zen Old Mincho', serif;
    font-size: 16px;
    font-weight: normal;
    line-height: 1.7;
    letter-spacing: 0.1em;
}

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

ul {
    padding-left: 1.5em;
}

li {
    margin-bottom: 10px;
}

/* =========================================
   レイアウト
========================================= */

.container {
    margin: 2em auto;
    width: 80%;
    max-width: 500px;
}

/* =========================================
   ヘッダー
========================================= */

.header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: baseline;
    column-gap: 1em;
}

.site-title {
    grid-column: 1;
    grid-row: 1;
    text-align: start;
    font-family: 'EB Garamond', serif;
    font-size: 1.2em;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.site-title a {
    color: var(--text);
    text-decoration: none;
}

.header-controls {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 0.8em;
}

/* =========================================
   テーマ切り替えボタン
========================================= */

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1em;
    color: var(--text);
    padding: 0;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.theme-toggle:hover {
    opacity: 1;
}

/* =========================================
   更新履歴
========================================= */

.update {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: start;
    color: var(--text-muted);
    font-size: 0.8em;
    padding-left: 10px;
    border-left: 1px solid var(--border);
    line-height: 1.4;
    margin-top: 6px;
}

.update::first-line {
    color: var(--text-faint);
    font-size: 0.9em;
}

.update-highlight {
    background: linear-gradient(transparent 70%, var(--highlight-bg) 70%);
    color: var(--text);
    padding: 0 2px;
}

/* =========================================
   メニュー（PC）
========================================= */

.menu {
    text-align: end;
}

/* =========================================
   トップ画像
========================================= */

.topsize {
    width: 100%;
    max-width: 450px;
    height: 450px;
    object-fit: scale-down;
    object-position: 50% 50%;
    margin-top: 25px;
}

/* =========================================
   イベント告知スペース
========================================= */

.event-notice {
    margin: 25px 0 5px 0;
    padding: 10px 5px;
    border-top: 3px double var(--border);
    border-bottom: 3px double var(--border);
    border-left: none;
    border-right: none;
    border-radius: 0;
    background-color: var(--notice-bg);
    font-size: 0.8em;
    text-align: center;
}

.event-notice a {
    display: inline-block;
    color: var(--text-muted);
    position: relative;
    padding-bottom: 2px;
}

.event-notice a::before {
    content: "Notice";
    display: block;
    font-family: 'EB Garamond', serif;
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #999;
    margin-bottom: 5px;
}

.event-notice a:hover {
    opacity: 0.7;
    transform: translateY(-1px);
}

/* =========================================
   個別ページ
========================================= */

.sub-content {
    text-align: left;
    font-size: 0.75em;
    margin-top: 40px;
}

.sub-content p {
    margin-bottom: 40px;
}

.sub-content h2 {
    text-decoration: underline;
    margin-bottom: 40px;
}

.size {
    width: 200px;
    height: 40px;
    object-fit: cover;
}

/* =========================================
   ジャンルタイトル
========================================= */

.genre-title {
    text-align: left;
    font-size: 1.17em;
    margin-top: 50px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

/* =========================================
   イラストギャラリー
========================================= */

.gallery-calm {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.calm-item {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    position: relative;
}

.calm-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.calm-item a:hover img {
    transform: scale(1.05);
}

/* 奇数個のとき最初の1枚を横幅いっぱいにする */
.gallery-calm .calm-item:first-child:nth-last-child(odd) {
    grid-column: 1 / -1;
    aspect-ratio: 1 / 1;
}

/* =========================================
   NEWバッジ
========================================= */

.new-mark {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: #333333;
    color: #ffffff;
    font-size: 11px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 3px;
    z-index: 10;
    letter-spacing: 0;
}

/* =========================================
   ライトボックス
========================================= */

#lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(20, 18, 15, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-sizing: border-box;
    cursor: zoom-out;
}

#lightbox-overlay.is-open {
    display: flex;
    animation: lb-fade-in 0.25s ease both;
}

@keyframes lb-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#lightbox-box {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: min(90vw, 820px);
    cursor: default;
    animation: lb-slide-up 0.28s cubic-bezier(.22, .68, 0, 1.2) both;
}

@keyframes lb-slide-up {
    from { opacity: 0; transform: translateY(18px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

#lightbox-img {
    display: block;
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6);
}

#lightbox-caption {
    text-align: center;
    color: rgba(240, 235, 225, 0.9);
    line-height: 1.7;
}

#lightbox-caption .lb-title {
    display: block;
    font-family: 'Zen Old Mincho', serif;
    font-size: 1rem;
    letter-spacing: 0.1em;
}

#lightbox-caption .lb-date {
    display: block;
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 0.82rem;
    color: rgba(200, 190, 175, 0.75);
    margin-top: 0.15rem;
    letter-spacing: 0.05em;
}

#lightbox-close {
    position: absolute;
    top: -2.4rem;
    right: 0;
    background: none;
    border: none;
    color: rgba(220, 210, 195, 0.7);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    transition: color 0.15s, transform 0.15s;
    font-family: 'EB Garamond', serif;
}

#lightbox-close:hover {
    color: #fff;
    transform: scale(1.15);
}

.calm-item a[data-lb] {
    cursor: zoom-in;
}

/* =========================================
   ハンバーガーボタン：PC では非表示
========================================= */
.hamburger {
    display: none;
}

/* 背景オーバーレイ */
.menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: var(--overlay-bg);
}

.menu-overlay.is-open {
    display: block;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 1.5px;
    background-color: var(--text);
    transition: transform 0.25s ease, opacity 0.25s ease;
}


/* =========================================
   スマホ用（480px以下）
========================================= */

@media screen and (max-width: 480px) {

    /* ヘッダー */
    .header {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }

    .site-title {
        grid-column: 1;
        grid-row: 1;
    }

    .header-controls {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        align-items: center;
        gap: 0.8em;
    }

    .update {
        grid-column: 1 / -1;
        grid-row: 2;
        text-align: start;
    }

    /* ハンバーガーボタン */
    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 24px;
        height: 18px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        align-self: center;
    }

    /* ドロワーメニュー */
    .menu {
        position: fixed;
        top: 0;
        right: 0;
        width: 180px;
        height: 100vh;
        background-color: var(--drawer-bg);
        box-shadow: -4px 0 16px rgba(0, 0, 0, 0.08);
        z-index: 1000;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2em;
        font-size: 1em;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .menu.is-open {
        transform: translateX(0);
    }


    /* トップ画像 */
    .topsize {
        height: 400px;
    }

    /* ライトボックス */
    #lightbox-box {
        max-width: 95vw;
    }

    #lightbox-caption .lb-title {
        font-size: 0.9rem;
    }

    /* ギャラリー：スマホでは奇数枚目の特別扱いをなくす */
    .gallery-calm .calm-item:first-child:nth-last-child(odd) {
        grid-column: auto;
        aspect-ratio: 1 / 1;
    }
}
