/* =========================================================
   Patonapost Entrance 詳細カード
   - 公開表示とadminプレビューで同じカード寸法・文字組みを使う
   - カード全体は固定し、詳細本文だけ必要時に内部スクロールさせる
   ========================================================= */



.entrance-detail-trigger {
    position: absolute;
    right: 14px;
    top: 14px;
    z-index: 8;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.90);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.62);
    color: #684b5a;
    box-shadow: 0 8px 24px rgba(87, 55, 72, 0.14);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    font-size: 17px;
    font-weight: 900;
    line-height: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}



.entrance-detail-trigger:hover,
.entrance-detail-trigger:focus-visible {
    transform: translateY(-3px) scale(1.06);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 12px 30px rgba(87, 55, 72, 0.22);
    outline: none;
}



.mobile-panel .entrance-detail-trigger {
    right: 8px;
    top: 8px;
    width: 31px;
    height: 31px;
    font-size: 15px;
}



.entrance-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147482000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2vw, 28px);
    background: rgba(35, 24, 31, 0.22);
    backdrop-filter: blur(5px) saturate(1.06);
    -webkit-backdrop-filter: blur(5px) saturate(1.06);
}



.entrance-detail-overlay.is-open {
    display: flex;
}



/* =========================================================
   詳細カード本体
   - PCは16:9、スマホは9:16でadminプレビューと同一比率にする
   - haze幅は%値をcqwへ変換し、box-shadowで無効なpercentageを使わない
   ========================================================= */
.entrance-detail-card {
    --entrance-radius: 28px;
    --entrance-haze-color: #ffffff;
    --entrance-haze-opacity: 0.82;
    --entrance-haze-blur: 20px;
    --entrance-haze-width-pct: 3.5;
    position: relative;
    width: min(1040px, 94vw, calc(88dvh * 16 / 9));
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 88dvh;
    overflow: hidden;
    border-radius: var(--entrance-radius);
    isolation: isolate;
    container-type: inline-size;
    background: rgba(60, 46, 54, 0.88);
    box-shadow:
        0 30px 100px rgba(35, 20, 30, 0.28),
        0 0 calc(var(--entrance-haze-blur) * 1.2)
            calc(var(--entrance-haze-width-pct) * 0.25cqw)
            color-mix(in srgb, var(--entrance-haze-color) calc(var(--entrance-haze-opacity) * 100%), transparent);
    animation: entranceCardIn 0.32s cubic-bezier(0.2, 0.82, 0.22, 1);
}



@keyframes entranceCardIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
        filter: blur(4px);
    }

    to {
        opacity: 1;
        transform: none;
        filter: none;
    }
}



.entrance-detail-card::after {
    content: "";
    position: absolute;
    z-index: 9;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow:
        inset 0 0 var(--entrance-haze-blur)
            calc(var(--entrance-haze-width-pct) * 1cqw)
            color-mix(in srgb, var(--entrance-haze-color) calc(var(--entrance-haze-opacity) * 100%), transparent);
}



.entrance-detail-background {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #d4b9c5, #75616a);
}



.entrance-detail-bg-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity var(--entrance-bg-fade, 1600ms) ease, transform 0.5s ease;
}



.entrance-detail-bg-slide.is-active {
    opacity: 1;
}



.entrance-detail-membrane {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    backdrop-filter: blur(var(--entrance-overlay-blur, 0px));
    -webkit-backdrop-filter: blur(var(--entrance-overlay-blur, 0px));
}



.entrance-detail-content {
    position: absolute;
    inset: 0;
    z-index: 4;
}



.entrance-detail-close {
    position: absolute;
    z-index: 15;
    right: max(12px, env(safe-area-inset-right));
    top: max(12px, env(safe-area-inset-top));
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.86);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.65);
    color: #543f49;
    box-shadow: 0 7px 22px rgba(38, 23, 31, 0.16);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}



.entrance-detail-tabs {
    position: absolute;
    z-index: 12;
    left: 50%;
    top: max(12px, env(safe-area-inset-top));
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    max-width: calc(100% - 130px);
    padding: 5px;
    overflow: hidden;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.48);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}



.entrance-detail-tab {
    border: 0;
    border-radius: 999px;
    background: transparent;
    padding: 7px 13px;
    color: #59434d;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}



.entrance-detail-tab.is-active {
    background: rgba(255, 255, 255, 0.90);
    box-shadow: 0 4px 14px rgba(77, 53, 65, 0.10);
}



/* =========================================================
   詳細カード文字
   - cqwを使い、カード幅に対する比率を公開/previewで一致させる
   - rich HTMLの改行はbr基準。旧p/divもmargin 0で吸収する
   ========================================================= */
.entrance-detail-textbox {
    position: absolute;
    z-index: 6;
    overflow: hidden;
    box-sizing: border-box;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.62);
    background: var(--entrance-band-bg, transparent);
    border: var(--entrance-band-border-width, 0px) solid var(--entrance-band-border, transparent);
    border-radius: var(--entrance-band-radius, 0px);
    padding:
        var(--entrance-band-padding-y, 0px)
        var(--entrance-band-padding-x, 0px);
    backdrop-filter: var(--entrance-band-filter, none);
    -webkit-backdrop-filter: var(--entrance-band-filter, none);
    pointer-events: none;
}



.entrance-detail-textbox[data-kind="kicker"] {
    font-size: clamp(9px, 1.55cqw, 14px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.09em;
}



.entrance-detail-textbox[data-kind="title"] {
    /* PC詳細見出しだけ旧4.25cqw基準に残らないよう、メインPCのh2と同じ表示階層へ揃える。 */
    font-size: clamp(20px, 6.25cqw, 48px);
    line-height: 1.20;
    /* メイン見出しと同じ基準で、まず標準字間を読みやすく整える。 */
    font-feature-settings: "palt" 0;
    letter-spacing: 0.02em;
    font-weight: 800;
}



.entrance-detail-textbox[data-kind="body"] {
    /* 本文だけをスクロール領域にし、見出し・タブ・ページ送り・カード比率は固定する。 */
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    pointer-events: auto;
    font-size: clamp(10px, 1.65cqw, 17px);
    line-height: 1.55;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.62) transparent;
}


/* =========================================================
   詳細本文専用スクロールバー
   - 本文が収まる場合は表示されず、他オブジェクトの寸法へ影響させない
   ========================================================= */
.entrance-detail-textbox[data-kind="body"]::-webkit-scrollbar {
    width: 6px;
}



.entrance-detail-textbox[data-kind="body"]::-webkit-scrollbar-track {
    background: transparent;
}



.entrance-detail-textbox[data-kind="body"]::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
}



.entrance-detail-textbox[data-kind="body"]::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.82);
}



.entrance-detail-textbox p,
.entrance-detail-textbox div {
    margin: 0;
    padding: 0;
}


.entrance-detail-textbox span {
    line-height: inherit;
}



.entrance-detail-page-nav {
    position: absolute;
    z-index: 13;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    color: #533d48;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}



.entrance-detail-page-nav button {
    width: 34px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: inherit;
    cursor: pointer;
}



.entrance-detail-page-nav button:disabled {
    opacity: 0.35;
    cursor: default;
}



.entrance-detail-page-indicator {
    min-width: 54px;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
}



.entrance-preview-badge {
    position: fixed;
    z-index: 2147482500;
    left: 12px;
    bottom: 12px;
    padding: 7px 10px;
    border-radius: 999px;
    background: #493945;
    color: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.20);
    font-size: 11px;
}



@media (max-width: 860px) {
    .entrance-detail-overlay {
        padding: 6px;
    }

    .entrance-detail-card {
        width: min(94vw, 520px, calc(84dvh * 9 / 16));
        height: auto;
        aspect-ratio: 9 / 16;
        max-height: 84dvh;
        border-radius: var(--entrance-radius);
    }

    .entrance-detail-tabs {
        top: 10px;
        max-width: calc(100% - 96px);
        flex-wrap: wrap;
        justify-content: center;
        overflow: hidden;
    }

    .entrance-detail-tab {
        padding: 6px 9px;
        font-size: 10px;
    }

    .entrance-detail-close {
        top: 9px;
        right: 9px;
        width: 35px;
        height: 35px;
        font-size: 19px;
    }

    .entrance-detail-textbox[data-kind="kicker"] {
        font-size: clamp(8px, 3.2cqw, 12px);
    }

    .entrance-detail-textbox[data-kind="title"] {
        font-size: clamp(16px, 7.6cqw, 30px);
    }

    .entrance-detail-textbox[data-kind="body"] {
        font-size: clamp(9px, 3.8cqw, 15px);
        line-height: 1.46;
    }

    .entrance-detail-page-nav {
        bottom: 9px;
    }
}



@media (prefers-reduced-motion: reduce) {
    .entrance-detail-card {
        animation: none;
    }

    .entrance-detail-bg-slide,
    .entrance-detail-trigger {
        transition: none !important;
    }
}
