/* ==========================================================================
   広告モーダル（js/ad-modal.js と対で使用）
   既存スタイルとの競合を避けるため、すべて site-ad-modal- プレフィックス付き
   ========================================================================== */

/* 表示中は背景スクロールを禁止（style-v8.css の html { overflow-y: scroll } を上書き） */
html.site-ad-modal-is-locked,
html.site-ad-modal-is-locked body {
    overflow: hidden;
}

.site-ad-modal-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100000; /* .ham-container (9999) より前面 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overscroll-behavior: contain;
    -webkit-tap-highlight-color: transparent;
}

.site-ad-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* 白背景のパネル（見出し＋ロゴ） */
.site-ad-modal-content {
    position: relative;
    width: 480px;
    max-width: 100%;
    min-width: 0; /* flex アイテムがロゴの元サイズで横にはみ出すのを防止 */
    padding: 32px 40px 40px;
    box-sizing: border-box;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    text-align: center;
    transform: scale(0.96);
    transition: transform 0.3s ease;
}

.site-ad-modal-overlay.is-open .site-ad-modal-content {
    transform: scale(1);
}

/* 見出し「協賛企業」（左右に罫線） */
.site-ad-modal-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 24px;
    font-family: "Shippori Mincho B1", serif;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.15em;
    color: #07583D;
}

.site-ad-modal-label::before,
.site-ad-modal-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: #07583D;
    opacity: 0.4;
}

.site-ad-modal-link {
    display: block;
    line-height: 0;
}

.site-ad-modal-link:hover {
    opacity: 0.8;
}

/* 縦横比を維持したままパネル内に収める */
.site-ad-modal-image {
    display: block;
    width: 100%;
    max-width: 360px;
    height: auto;
    max-height: calc(100vh - 200px);
    margin: 0 auto;
    object-fit: contain;
    border: 0;
}

@supports (height: 100dvh) {
    .site-ad-modal-image {
        max-height: calc(100dvh - 200px);
    }
}

@media (max-width: 480px) {
    .site-ad-modal-content {
        padding: 28px 24px 32px;
    }

    .site-ad-modal-label {
        margin-bottom: 20px;
        font-size: 16px;
    }
}

/* 閉じるボタン（44px 以上のタップ領域を確保） */
.site-ad-modal-close {
    position: absolute;
    top: -18px;
    right: -18px;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 2px solid #07583D;
    border-radius: 50%;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.site-ad-modal-close::before,
.site-ad-modal-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    background-color: #07583D;
}

.site-ad-modal-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.site-ad-modal-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.site-ad-modal-close:hover {
    background-color: #f5f5f5;
}

.site-ad-modal-close:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .site-ad-modal-overlay,
    .site-ad-modal-content {
        transition: none;
    }
}
