/*
Theme Name: Simple Gallery Theme
Theme URI: https://example.com/
Author: OpenAI
Description: WordPress用のシンプルなレスポンシブ画像ギャラリーテーマ。カテゴリ絞り込みとLightboxに対応。
Version: 1.0.1
License: GPL v2 or later
Text Domain: simple-gallery-theme
*/

:root {
    --text: #222;
    --muted: #666;
    --line: #ddd;
    --bg: #fff;
    --accent: #111;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP",
        "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
    line-height: 1.7;
}

a { color: inherit; }

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

.site-header {
    border-bottom: 1px solid #eee;
    padding: 22px 20px;
}

.site-header-inner {
    width: min(1400px, 100%);
    margin: 0 auto;
}

.site-logo {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.site-logo a { text-decoration: none; }

.site-main { min-height: 60vh; }

.site-footer {
    border-top: 1px solid #eee;
    margin-top: 80px;
    padding: 30px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.gallery-page {
    width: 100%;
    padding: 80px 20px;
}

.gallery-inner {
    width: min(1400px, 100%);
    margin: 0 auto;
}

.gallery-header {
    margin-bottom: 45px;
    text-align: center;
}

.gallery-title {
    margin: 0;
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.4;
}

.gallery-lead {
    margin: 15px auto 0;
    max-width: 760px;
    color: var(--muted);
}

.gallery-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 45px;
}

.gallery-filter-btn {
    appearance: none;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    padding: 9px 22px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    transition: .25s ease;
}

.gallery-filter-btn:hover,
.gallery-filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 45px 25px;
}

.gallery-item { min-width: 0; }

.gallery-image-link {
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #f3f3f3;
    cursor: zoom-in;
}

.gallery-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}

.gallery-image-link:hover .gallery-image {
    transform: scale(1.05);
}

.gallery-item-info { padding-top: 15px; }

.gallery-item-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.5;
}

.gallery-item-description {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.gallery-item-category {
    margin: 8px 0 0;
    font-size: 12px;
    color: #888;
}

.gallery-item.is-hidden { display: none; }

.gallery-empty {
    grid-column: 1 / -1;
    padding: 90px 20px;
    text-align: center;
    color: var(--muted);
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 70px 60px;
    background: rgba(0,0,0,.9);
}

.gallery-lightbox.is-open { display: flex; }

.gallery-lightbox-content {
    width: min(1200px, 100%);
    max-height: 90vh;
    text-align: center;
}

.gallery-lightbox-content img {
    display: block;
    max-width: 100%;
    max-height: 78vh;
    width: auto;
    height: auto;
    margin: 0 auto;
}

.gallery-lightbox-content p {
    margin: 15px 0 0;
    color: #fff;
    font-size: 16px;
}

.gallery-lightbox-close,
.gallery-lightbox-prev,
.gallery-lightbox-next {
    position: absolute;
    z-index: 2;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    line-height: 1;
}

.gallery-lightbox-close {
    top: 18px;
    right: 22px;
    font-size: 44px;
}

.gallery-lightbox-prev,
.gallery-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    font-size: 55px;
    padding: 20px;
}

.gallery-lightbox-prev { left: 10px; }
.gallery-lightbox-next { right: 10px; }

.gallery-lightbox-counter {
    margin-top: 6px;
    color: #bbb;
    font-size: 12px;
}

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

@media (max-width: 600px) {
    .gallery-page { padding: 50px 15px; }
    .gallery-grid { gap: 28px 12px; }
    .gallery-item-title { font-size: 15px; }
    .gallery-item-description { font-size: 12px; }
    .gallery-filter { justify-content: flex-start; margin-bottom: 30px; }
    .gallery-filter-btn { padding: 8px 15px; font-size: 13px; }
    .gallery-lightbox { padding: 65px 35px; }
    .gallery-lightbox-prev,
    .gallery-lightbox-next { font-size: 38px; padding: 10px; }
}
