@charset "utf-8";

/* メインコンテナ */
.protected-content {
    position: relative;
    margin-bottom: 2em;
}

/* 可視部分のスタイル */
.content-visible {
    margin-bottom: 2em;
    line-height: 1.8;
}

/* プレビュー部分のスタイル（グラデーションフェード方式） */
.content-preview-blur {
    position: relative;
    padding: 1.5em 0;
    margin-bottom: 2em;
    max-height: 500px;
    overflow: hidden;
    color: rgba(0, 0, 0, 0.15);
    line-height: 1.8;
    user-select: none;
    -webkit-user-select: none;
}

/* グラデーションマスク */
.content-preview-blur::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(247, 242, 232, 0) 0%,
        rgba(247, 242, 232, 0.6) 50%,
        rgba(247, 242, 232, 1) 100%
    );
    pointer-events: none;
}

/* 残りコンテンツ情報のスタイル */
.c-remaining {
    text-align: center;
    margin: 2em 0;
    padding: 1em;
}

.c-remaining__title {
    font-size: 1.2em;
    font-weight: 700;
    position: relative;
    display: inline-block;
    margin-bottom: 1em;
    padding: 0 3em;
}

.c-remaining__title::before,
.c-remaining__title::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 2em;
    height: 1px;
    background: rgba(8,19,26,0.66);
}

.c-remaining__title::before {
    left: 0;
}

.c-remaining__title::after {
    right: 0;
}

.c-remaining__count {
    font-size: 0.75rem;
    color: rgba(8,19,26,0.66);
}

/* パスワードフォームのスタイル */
.p-passwordForm {
    margin-top: 3em;
    padding: 2em;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* ブログパーツエリア */
.password-form-blog-parts {
    margin: 2em 0;
    padding: 1em;
    background: #fff;
    border-radius: 4px;
}

.password-form-blog-parts:first-child {
    margin-top: 0;
}

.password-form-blog-parts:last-child {
    margin-bottom: 0;
}

/* パスワードフォーム要素 */
.c-pw__title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 1.5em;
    text-align: center;
    color: #333;
}

.c-pw__form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
}

.c-pw__input {
    width: 100%;
    max-width: 400px;
}

.c-pw__pwd {
    width: 100%;
    padding: 0.8em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.c-pw__pwd:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.c-pw__btn {
    padding: 0.8em 2em;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.c-pw__btn:hover {
    background: #357abd;
    transform: translateY(-1px);
}

.c-pw__btn:active {
    transform: translateY(0);
}

.c-pw__btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.c-pw__error {
    color: #dc3545;
    text-align: center;
    margin-top: 1em;
    padding: 0.5em;
    font-size: 0.9em;
    animation: fadeIn 0.3s ease-in-out;
}

/* アニメーション */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* レスポンシブ対応 */
@media screen and (max-width: 767px) {
    .p-passwordForm {
        padding: 1.5em;
        margin: 2em -1em 0;
        border-radius: 0;
    }

    .c-pw__input {
        width: 100%;
        max-width: 100%;
    }

    .c-pw__btn {
        width: 100%;
    }

    .password-form-blog-parts {
        margin: 1.5em 0;
        padding: 0.8em;
    }
}

/* 印刷時の対応 */
@media print {
    .protected-content,
    .p-passwordForm,
    .password-form-blog-parts {
        display: none !important;
    }
}

/* ================================================
   購入ステータスバルーン（note.comスタイル）
   ================================================ */

.cpp-purchase-balloon {
    display: flex;
    justify-content: center;
    margin: 16px 0 8px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.cpp-purchase-balloon[hidden] {
    display: none;
}

.cpp-purchase-balloon.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.cpp-purchase-balloon.is-leaving {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cpp-purchase-balloon__body {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #FFFFFF;
    border: 1px solid #E8E8E8;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    cursor: default;
    white-space: nowrap;
}

.cpp-purchase-balloon__content {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cpp-purchase-balloon__icon {
    color: #4A4A4A;
    flex-shrink: 0;
}

.cpp-purchase-balloon__text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    line-height: 18px;
}

.cpp-purchase-balloon__label {
    color: #1A1A1A;
}

.cpp-purchase-balloon__divider {
    display: block;
    width: 1px;
    height: 12px;
    background: #D0D0D0;
}

.cpp-purchase-balloon__period {
    color: #6B6B6B;
}

.cpp-purchase-balloon__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: #6B6B6B;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.cpp-purchase-balloon__close:hover {
    background: #F0F0F0;
    color: #1A1A1A;
}

.cpp-purchase-balloon__close:focus-visible {
    outline: 2px solid #2D5A27;
    outline-offset: 2px;
}

@media screen and (max-width: 767px) {
    .cpp-purchase-balloon {
        margin: 12px 0 4px;
    }

    .cpp-purchase-balloon__body {
        padding: 6px 10px;
        gap: 8px;
    }

    .cpp-purchase-balloon__text {
        font-size: 11px;
        gap: 6px;
    }
}

@media print {
    .cpp-purchase-balloon {
        display: none !important;
    }
}

/* NOTE: .cpp-auth-gate のデフォルト非表示はこのCSSファイルではなく、
 * class-frontend.php の enqueue_auth_gate() が wp_add_inline_style で全ページに出力する。
 * （auth-gate.js はグローバル読み込みのため、このファイルへの記述は不要）
 *
 * NOTE: .cpp-freshness-notice / .cpp-staleness-notice のスタイルも
 * enqueue_auth_gate() のインラインCSSで全ページに適用される。
 * （staleness-notice は保護ページ以外にも表示されるため style.css より優先）
 */

/* ================================================
 * v3.1: リッチプレビュー / note型ペイウォール
 * ================================================ */

/* --- 可視部末尾のフェードグラデーション --- */
.cpp-rich .cpp-rich-visible {
    position: relative;
}

.cpp-rich .cpp-rich-visible::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 160px;
    pointer-events: none;
    background: linear-gradient(
        0deg,
        rgb(247, 242, 232) 0%,
        rgba(247, 242, 232, 0.85) 35%,
        rgba(247, 242, 232, 0) 100%
    );
}

/* --- ペイウォールヘッダー（ここから先は ＋ 残量） --- */
.cpp-paywall {
    margin: 0 0 48px;
}

.cpp-paywall__header {
    margin-bottom: 24px;
    text-align: center;
}

.cpp-paywall__lead {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 1.05em;
    font-weight: 700;
    color: #1A1A1A;
}

.cpp-paywall__lead::before,
.cpp-paywall__lead::after {
    content: "";
    flex: 1;
    border-top: 1px dashed #C9C9C9;
}

.cpp-paywall__meta {
    margin-top: 8px;
    font-size: 13px;
    color: #4A4A4A;
}

/* --- アコーディオン（<details>ベース・JS不要） --- */
.cpp-paywall__item {
    background: #FFFFFF;
    border: 1px solid #E3E3E3;
    border-radius: 8px;
    overflow: hidden;
}

.cpp-paywall__item + .cpp-paywall__item {
    margin-top: 12px;
}

.cpp-paywall__item--primary {
    border-color: #2D5A27;
}

.cpp-paywall__itemHeader {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    transition: background-color 0.2s ease;
}

.cpp-paywall__itemHeader::-webkit-details-marker {
    display: none;
}

.cpp-paywall__itemHeader:hover {
    background: #F7F7F5;
}

.cpp-paywall__itemTitle {
    flex: 1;
    font-size: 1em;
    font-weight: 600;
    color: #1A1A1A;
}

.cpp-paywall__itemPrice {
    display: flex;
    align-items: baseline;
    gap: 2px;
    white-space: nowrap;
}

.cpp-paywall__yen,
.cpp-paywall__per {
    font-size: 13px;
    color: #4A4A4A;
}

.cpp-paywall__amount {
    font-size: 24px;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1;
}

.cpp-paywall__chev {
    flex-shrink: 0;
    color: #6B6B6B;
    transition: transform 0.2s ease;
}

.cpp-paywall__item[open] .cpp-paywall__chev {
    transform: rotate(180deg);
}

.cpp-paywall__itemBody {
    padding: 4px 20px 20px;
    border-top: 1px solid #F0F0F0;
}

/* details は height をCSSアニメーションできないため、
 * 展開時のフェードインでnote風の柔らかさを出す */
.cpp-paywall__item[open] .cpp-paywall__itemBody {
    animation: cpp-paywall-open 0.25s ease;
}

@keyframes cpp-paywall-open {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cpp-paywall__desc {
    margin: 12px 0 0;
    font-size: 0.9em;
    line-height: 1.8;
    color: #4A4A4A;
}

.cpp-paywall__desc p {
    margin: 0 0 0.5em;
}

.cpp-paywall__desc p:last-child {
    margin-bottom: 0;
}

/* --- CTA（アイテム2: 買い切りリンク） --- */
.cpp-paywall__cta {
    display: block;
    margin-top: 16px;
    padding: 12px 16px;
    text-align: center;
    background: #2D5A27;
    color: #FFFFFF;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.cpp-paywall__cta:hover {
    background: #24481F;
    color: #FFFFFF;
}

/* --- noteメンバーシップ導線リンク --- */
.cpp-paywall__noteLink {
    margin: 0 0 1em;
    text-align: center;
    font-size: 0.9em;
}

.cpp-paywall__noteLink a {
    color: #2D5A27;
    text-decoration: underline;
}

/* --- アコーディオン内のパスワードフォームのカード様式を中和
 *（card-in-card 回避。モバイルの負マージンも上書き） --- */
.cpp-paywall .p-passwordForm {
    margin: 16px 0 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

/* --- レスポンシブ --- */
@media screen and (max-width: 767px) {
    .cpp-rich .cpp-rich-visible::after {
        height: 96px;
    }

    .cpp-paywall__itemHeader {
        padding: 12px 14px;
        gap: 8px;
    }

    .cpp-paywall__itemBody {
        padding: 4px 14px 16px;
    }

    .cpp-paywall__amount {
        font-size: 20px;
    }

    .cpp-paywall .p-passwordForm {
        margin: 16px 0 0;
        border-radius: 0;
    }
}

/* --- 印刷時は非表示（.protected-content 全体は既存ルールで非表示だが明示） --- */
@media print {
    .cpp-paywall {
        display: none !important;
    }
}

/* --- SWELL の .post_content > * 余白ルールのミラー（v3.1.1）
 * リッチ可視部はラッパー（.protected-content > .cpp-rich-visible）で包まれるため、
 * テーマの子セレクタ .post_content>*{clear:both;margin-bottom:var(--swl-block-margin,2em)}
 * が本文ブロックに届かず、段落・画像間の余白が消失する。
 * 同一のCSS変数を参照して再供給する（テーマのカスタマイザー設定値に自動追随。
 * 非SWELL環境ではフォールバック値 2em / 0 で成立）。 --- */
.cpp-rich .cpp-rich-visible > * {
    clear: both;
    margin-bottom: var(--swl-block-margin, 2em);
}

.cpp-rich .cpp-rich-visible > :first-child {
    margin-top: 0 !important;
}

.cpp-rich .cpp-rich-visible > h2 {
    margin-left: var(--swl-h2-margin--x, 0);
    margin-right: var(--swl-h2-margin--x, 0);
}

/* ===================================================================
 * v3.2: 目次内のロック項目（秘匿部分の見出し）
 *
 * SWELL が組んだ <li> と行の高さ・字下げを揃えるため、レイアウトには触れず
 * 色と鍵アイコンだけを足す。アイコンは ::after の擬似要素なので、
 * リンクテキスト（= 見出し本文）のコピーや読み上げを汚さない。
 * =================================================================== */
.p-toc__list .cpp-toc-locked > .p-toc__link {
    opacity: 0.72;
}

/* v3.3.3: 鍵は絵文字ではなく data URI の SVG で描く。
 * 絵文字は OS/フォントで字形も余白も変わり、環境によっては豆腐になる。
 * data URI なら外部リクエストが一切発生せず、どの環境でも同じに出る。
 * （`#` は %23、`<` `>` は %3C %3E に必ずエンコードすること。生のままだと
 *   `#` 以降がフラグメント扱いになりURLが壊れるブラウザがある） */
:root {
    --cpp-lock-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23555'%3E%3Cpath d='M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6z'/%3E%3C/svg%3E");
}

/* 既定は背景画像として描画する。万一 data URI が読めなくても
 * 「何も出ない」だけで済み、レイアウトも崩れない。 */
.p-toc__list .cpp-toc-locked > .p-toc__link::after {
    content: "";
    display: inline-block;
    width: 0.78em;
    height: 0.78em;
    margin-left: 0.4em;
    vertical-align: -0.06em;
    opacity: 0.7;
    background: var(--cpp-lock-icon) no-repeat center / contain;
}

/* mask が使える環境ではリンク色に追随させる（ダークテーマでも潰れない）。
 * background-color を @supports の外に置くと、mask 非対応環境で
 * 塗りつぶしの四角が出てしまうため、必ずこのブロックの中で指定する。 */
@supports ((-webkit-mask-image: none) or (mask-image: none)) {
    .p-toc__list .cpp-toc-locked > .p-toc__link::after {
        background: currentColor;
        -webkit-mask: var(--cpp-lock-icon) no-repeat center / contain;
        mask: var(--cpp-lock-icon) no-repeat center / contain;
    }
}

/* ペイウォールへスクロールした際に固定ヘッダーへ潜り込まないようにする */
.cpp-paywall,
#preview-protector-form {
    scroll-margin-top: var(--cpp-scroll-offset, 80px);
}