/* 画像ギャラリー */

.gallery-hero {
    padding: 52px 0;
    color: #fff;
    background:
        radial-gradient(circle at 85% 15%, rgba(236, 72, 153, 0.32), transparent 32%),
        radial-gradient(circle at 10% 90%, rgba(99, 91, 255, 0.28), transparent 36%),
        linear-gradient(135deg, #151b2b, #2c3550);
}

.gallery-hero-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.gallery-hero h2 {
    margin: 8px 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
}

.gallery-hero p {
    max-width: 720px;
    margin: 0;
    color: #d9deea;
}

.gallery-category-nav,
.gallery-period-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gallery-category-nav {
    margin-bottom: 28px;
}

.gallery-category-nav a,
.gallery-period-tabs a {
    padding: 8px 13px;
    color: var(--color-muted);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 900;
}

.gallery-category-nav a.is-active,
.gallery-period-tabs a.is-active {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.gallery-ranking-section {
    margin-bottom: 42px;
}

.gallery-ranking-strip {
    padding-bottom: 8px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 190px);
    gap: 12px;
    overflow-x: auto;
}

.gallery-ranking-card {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    color: #fff;
    background: #151b2b;
    border-radius: 16px;
}

.gallery-ranking-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-rank-number {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(19, 25, 40, 0.82);
    border-radius: 50%;
    font-weight: 900;
}

.gallery-rank-stats {
    position: absolute;
    inset: auto 0 0;
    padding: 22px 9px 9px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
    font-size: 0.72rem;
    font-weight: 800;
}

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

.gallery-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
}

.gallery-card-image {
    display: block;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: #edf0f5;
}

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

.gallery-card:hover .gallery-card-image img {
    transform: scale(1.035);
}

.gallery-card-body {
    padding: 12px;
}

.gallery-card-category {
    padding: 4px 7px;
    display: inline-flex;
    color: var(--color-primary-dark);
    background: var(--color-primary-soft);
    border-radius: 999px;
    font-size: 0.67rem;
    font-weight: 900;
}

.gallery-card h3 {
    margin: 8px 0 7px;
    font-size: 0.9rem;
    line-height: 1.45;
}

.gallery-card h3 a {
    color: var(--color-text);
}

.gallery-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--color-muted);
    font-size: 0.7rem;
    font-weight: 800;
}

.gallery-age-container,
.gallery-form-container,
.gallery-detail-container {
    max-width: 980px;
}

.gallery-age-container {
    max-width: 600px;
}

.gallery-age-card,
.gallery-form-card,
.gallery-detail-card,
.gallery-comments-section,
.gallery-related-section {
    padding: 28px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.gallery-age-card h2,
.gallery-form-card h2 {
    margin: 7px 0 10px;
}

.gallery-age-card form {
    margin-top: 20px;
    display: grid;
    gap: 16px;
}

.gallery-confirm-check,
.gallery-rules-checks label {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 0.84rem;
}

.gallery-age-back {
    margin-top: 14px;
    display: inline-flex;
    font-size: 0.8rem;
}

.gallery-form-grid {
    display: grid;
    gap: 16px;
}

.gallery-form-row {
    display: grid;
    gap: 7px;
}

.gallery-form-row label {
    font-size: 0.82rem;
    font-weight: 900;
}

.gallery-form-row input,
.gallery-form-row select,
.gallery-form-row textarea,
.gallery-comment-form input,
.gallery-comment-form textarea {
    width: 100%;
    padding: 11px 12px;
    color: var(--color-text);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    font: inherit;
}

.gallery-form-row textarea,
.gallery-comment-form textarea {
    min-height: 120px;
    resize: vertical;
}

.gallery-form-row small {
    color: var(--color-muted);
    font-size: 0.72rem;
}

.gallery-rules-checks {
    margin: 20px 0;
    padding: 15px;
    display: grid;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: 12px;
}

.gallery-form-error,
.gallery-form-success {
    margin: 15px 0;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 800;
}

.gallery-form-error {
    color: #a62727;
    background: #fff0f0;
}

.gallery-form-success {
    color: #087b50;
    background: #eafaf3;
}

.gallery-complete-card {
    text-align: center;
}

.gallery-detail-section {
    padding-top: 34px;
}

.gallery-detail-container {
    display: grid;
    gap: 22px;
}

.gallery-detail-header {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.gallery-detail-header h2 {
    margin: 10px 0 0;
    font-size: clamp(1.5rem, 4vw, 2.4rem);
}

.gallery-detail-header time {
    color: var(--color-muted);
    font-size: 0.78rem;
}

.gallery-detail-images {
    display: grid;
    gap: 12px;
}

.gallery-detail-images a {
    overflow: hidden;
    background: #111827;
    border-radius: 15px;
}

.gallery-detail-images img {
    width: 100%;
    max-height: 1000px;
    display: block;
    object-fit: contain;
}

.gallery-detail-body {
    margin-top: 20px;
    line-height: 1.85;
}

.gallery-engagement-bar {
    margin-top: 22px;
    padding-top: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.gallery-like-button,
.gallery-share-open {
    padding: 8px 12px;
    color: var(--color-muted);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-weight: 900;
    cursor: pointer;
}

.gallery-like-button.is-liked {
    color: #d73363;
    background: #fff0f5;
    border-color: #f5bfd0;
}

.gallery-share-panel {
    margin-top: 14px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: 12px;
}

.gallery-share-buttons {
    margin-top: 9px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.gallery-share-buttons a,
.gallery-share-buttons button {
    padding: 7px 10px;
    color: var(--color-text);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 900;
    cursor: pointer;
}

.gallery-moderation-links {
    margin-top: 14px;
    display: flex;
    gap: 14px;
    font-size: 0.75rem;
}

.gallery-comments-section,
.gallery-related-section {
    padding: 24px;
}

.gallery-comment-form {
    margin-bottom: 20px;
    display: grid;
    gap: 10px;
}

.gallery-comment-list {
    display: grid;
    gap: 10px;
}

.gallery-comment {
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: 11px;
}

.gallery-comment header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.gallery-comment time,
.gallery-comment > a {
    color: var(--color-muted);
    font-size: 0.7rem;
}

.gallery-comment p {
    margin: 9px 0;
    line-height: 1.7;
}

.gallery-delete-section + .gallery-delete-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.gallery-related-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

@media (max-width: 720px) {
    .gallery-hero-inner,
    .gallery-detail-header {
        align-items: stretch;
        flex-direction: column;
    }

    .gallery-grid,
    .gallery-related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .gallery-card-body {
        padding: 9px;
    }

    .gallery-age-card,
    .gallery-form-card,
    .gallery-detail-card,
    .gallery-comments-section,
    .gallery-related-section {
        padding: 17px;
        border-radius: 16px;
    }
}

@media (max-width: 390px) {
    .gallery-card-stats {
        gap: 5px;
        font-size: 0.63rem;
    }
}


/* =========================================================
   画像詳細：Lightbox前提のコンパクト画像一覧
   ========================================================= */

.gallery-detail-images {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
}

.gallery-detail-images a {
    width: calc(25% - 8px);
    aspect-ratio: 1 / 1;
    display: block;
    overflow: hidden;
    background: #111827;
    border-radius: 12px;
}

.gallery-detail-images img {
    width: 100%;
    height: 100%;
    max-height: none;
    display: block;
    object-fit: cover;
    transition: transform 0.22s ease;
}

.gallery-detail-images a:hover img {
    transform: scale(1.035);
}

@media (max-width: 720px) {
    .gallery-detail-images {
        gap: 7px;
    }

    .gallery-detail-images a {
        width: calc(33.333% - 5px);
        border-radius: 9px;
    }
}

@media (max-width: 420px) {
    .gallery-detail-images a {
        width: calc(50% - 4px);
    }
}


/* =========================================================
   トップページ：画像の新着投稿
   ========================================================= */

.home-gallery-latest {
    overflow: hidden;
}

.home-gallery-scroll {
    padding-bottom: 10px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(190px, 240px);
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
}

.home-gallery-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
    scroll-snap-align: start;
}

.home-gallery-card-image {
    position: relative;
    aspect-ratio: 4 / 5;
    display: block;
    overflow: hidden;
    background: #edf0f5;
}

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

.home-gallery-card:hover .home-gallery-card-image img {
    transform: scale(1.035);
}

.home-gallery-category {
    position: absolute;
    left: 9px;
    bottom: 9px;
    padding: 5px 8px;
    color: #fff;
    background: rgba(19, 25, 40, 0.82);
    border-radius: 999px;
    font-size: 0.67rem;
    font-weight: 900;
    backdrop-filter: blur(5px);
}

.home-gallery-card-body {
    padding: 12px;
}

.home-gallery-card-body h3 {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
}

.home-gallery-card-body h3 a {
    color: var(--color-text);
}

.home-gallery-card-body p {
    margin: 7px 0 0;
    color: var(--color-muted);
    font-size: 0.74rem;
    line-height: 1.65;
}

.home-gallery-card-footer {
    margin-top: 10px;
    padding-top: 9px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--color-muted);
    border-top: 1px solid var(--color-border);
    font-size: 0.68rem;
    font-weight: 800;
}

@media (max-width: 720px) {
    .home-gallery-scroll {
        grid-auto-columns: minmax(155px, 185px);
        gap: 9px;
    }

    .home-gallery-card-body {
        padding: 9px;
    }

    .home-gallery-card-footer {
        gap: 5px;
        font-size: 0.62rem;
    }
}
