/* ============================
   ポートフォリオ一覧
============================ */
.portfolio-archive {
    padding-bottom: clamp(3.75rem, 2.5rem + 6.25vw, 7.5rem);
}

/* 見出しは非表示にするが、レイアウト上の占有スペース（margin-bottom含む）はそのまま残す */
.portfolio-archive .section-heading {
    visibility: hidden;
}

.portfolio-archive__desc {
    display: none; /* 一時的に非表示 */
    font-size: var(--fs-body, 1rem);
    line-height: 1.8;
    color: var(--color-body, #414141);
    margin: 0 0 2rem 0;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(0.5rem, 0.3vw + 0.4rem, 1rem);
}

.portfolio-item {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    overflow: hidden;
}

.portfolio-item__thumb {
    width: 100%;
    height: 100%;
}

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

.portfolio-item:hover .portfolio-item__thumb img {
    transform: scale(1.05);
}

@media screen and (max-width: 768px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================
   ポートフォリオ モーダル
============================ */
/* ヘッダー(z-index: 9999)よりも上に暗幕を、さらにその上にモーダル本体を表示する */
.portfolio-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.portfolio-modal.is-open {
    opacity: 1;
    visibility: visible;
}

/* 暗幕：ヘッダーより上 */
.portfolio-modal__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(0, 0, 0, 0.6);
}

/* モーダル本体：暗幕よりさらに上。1920px時点で幅1183pxになるよう画面幅に比例させ、
   （1183 / 1920 × 100 = 61.6146vw）、1920px超は1183pxで頭打ちにする。
   高さはビューポート高の90%を上限とし、スクロールさせない。 */
.portfolio-modal__inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    width: min(61.6146vw, 1183px);
    height: 90vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.portfolio-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

/* 画像エリア：残りスペースいっぱいに表示し、入りきらない場合はここが縮む */
/* width/min-widthを明示しないと、Swiperがコンテナ幅を測定→スライド幅を設定→
   それによりコンテナが content サイズで膨張→再測定…というフィードバックループが発生し、
   スライドがモーダル外に大きくはみ出すバグが起きるため、幅を固定して抑止する */
.portfolio-modal__image {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f5f5f5;
}

.portfolio-modal__image .swiper-wrapper,
.portfolio-modal__image .swiper-slide {
    height: 100%;
}

.portfolio-modal__image .swiper-wrapper {
    width: 100%;
    min-width: 0;
}

.portfolio-modal__image .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
}

.portfolio-modal__image .swiper-slide img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ナビゲーション矢印 */
.portfolio-modal__image .swiper-button-prev,
.portfolio-modal__image .swiper-button-next {
    width: 2.25rem;
    height: 2.25rem;
    margin-top: -1.125rem;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    color: #414141;
}

.portfolio-modal__image .swiper-button-prev::after,
.portfolio-modal__image .swiper-button-next::after {
    font-size: 1rem;
}

/* ページネーション */
.portfolio-modal__image .swiper-pagination {
    bottom: 0.75rem;
}

.portfolio-modal__image .swiper-pagination-bullet {
    background: #fff;
    opacity: 0.7;
}

.portfolio-modal__image .swiper-pagination-bullet-active {
    opacity: 1;
    background: #3172FF;
}

/* 画像が1枚のみの場合はナビゲーション・ページネーションを非表示 */
.portfolio-modal__image.is-single .swiper-button-prev,
.portfolio-modal__image.is-single .swiper-button-next,
.portfolio-modal__image.is-single .swiper-pagination {
    display: none;
}

/* テキストエリア：画面下側に固定表示（縮まない） */
.portfolio-modal__body {
    flex: 0 0 auto;
    padding: clamp(1.25rem, 1vw + 1rem, 2rem);
}

.portfolio-modal__date {
    font-size: 0.875rem;
    color: #888;
    margin: 0 0 0.4rem 0;
}

.portfolio-modal__title {
    font-size: clamp(1.25rem, 1vw + 1rem, 1.75rem);
    margin: 0 0 1rem 0;
}

.portfolio-modal__desc {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #414141;
}

.portfolio-modal__desc p {
    margin: 0 0 1em 0;
}

.portfolio-modal__desc p:last-child {
    margin-bottom: 0;
}

/* 意図的な空の段落(空行)も1行分の高さを確保して表示する */
.portfolio-modal__desc p:empty {
    min-height: 1.8em;
}

@media screen and (max-width: 768px) {
    .portfolio-modal__inner {
        width: min(92vw, 500px);
    }
}