/* ============================================================
   AP 記事スタイル — 要素別クラス方式
   各要素のスタイルは .ap-h2-{style} / .ap-h3-{style} /
   .ap-ul-{style} / .ap-ol-{style} / .ap-strong-{style} で制御。
   カラーは --ap-h2-color / --ap-h3-color / --ap-ul-color /
   --ap-ol-color / --ap-strong-color の CSS 変数で制御。
   ============================================================ */

/* ── アイキャッチ ────────────────────────────────────────── */
.ap-art-eyecatch {
    margin: 0 0 1.8em;
    border-radius: 8px;
    overflow: hidden;
    line-height: 0;
}
.ap-art-eyecatch img {
    width: 100%;
    height: auto;
    display: block;
}

/* ── 目次 ───────────────────────────────────────────────── */
.ap-art-toc {
    margin: 0 0 2em;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
    border: 1px solid color-mix(in srgb, var(--ap-h2-color, #3b82f6) 22%, #e5e7eb);
    font-size: 0.9em;
}
.ap-art-toc-details { display: block; }

/* ヘッダー (summary) */
.ap-art-toc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    background: linear-gradient(
        125deg,
        var(--ap-h2-color, #3b82f6) 0%,
        color-mix(in srgb, var(--ap-h2-color, #3b82f6) 78%, #6366f1) 100%
    );
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.ap-art-toc-header::-webkit-details-marker { display: none; }

.ap-art-toc-title {
    flex: 1;
    font-weight: 700;
    font-size: 1em;
    color: #fff;
    letter-spacing: .04em;
}

/* シェブロン矢印 */
.ap-art-toc-chevron {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    position: relative;
}
.ap-art-toc-chevron::before,
.ap-art-toc-chevron::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 9px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .2s ease;
}
.ap-art-toc-chevron::before {
    right: 50%;
    transform: translateY(-50%) rotate(-45deg);
    transform-origin: right center;
}
.ap-art-toc-chevron::after {
    left: 50%;
    transform: translateY(-50%) rotate(45deg);
    transform-origin: left center;
}
.ap-art-toc-details[open] .ap-art-toc-chevron::before {
    transform: translateY(-50%) rotate(45deg);
}
.ap-art-toc-details[open] .ap-art-toc-chevron::after {
    transform: translateY(-50%) rotate(-45deg);
}

/* 本文エリア */
.ap-art-toc-body {
    background: #fff;
    padding: 14px 20px;
}
.ap-art-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* H2 アイテム */
.ap-art-toc-h2 {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
}
.ap-art-toc-h2:last-child { border-bottom: none; }

.ap-art-toc-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    background: var(--ap-h2-color, #3b82f6);
    color: #fff;
    font-size: 0.75em;
    font-weight: 700;
    border-radius: 50%;
    margin-top: 2px;
}
.ap-art-toc-h2 > a {
    flex: 1;
    color: #1e293b;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.6;
}
.ap-art-toc-h2 > a:hover {
    color: var(--ap-h2-color, #3b82f6);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* H3 アイテム */
.ap-art-toc-h3 {
    padding: 4px 0 4px 32px;
    position: relative;
}
.ap-art-toc-h3::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--ap-h2-color, #3b82f6) 45%, #94a3b8);
}
.ap-art-toc-h3 > a {
    color: #475569;
    text-decoration: none;
    font-size: 0.92em;
    line-height: 1.6;
}
.ap-art-toc-h3 > a:hover {
    color: var(--ap-h2-color, #3b82f6);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ── Base ───────────────────────────────────────────────── */
.ap-art {
    font-size: var(--ap-font-size, 16px);
    line-height: var(--ap-line-height, 1.9);
}

.ap-art p  { margin: 0.8em 0; }
.ap-art a  { color: var(--ap-h2-color, #3b82f6); text-underline-offset: 3px; }

/* ── Heading defaults ────────────────────────────────────── */
.ap-art h2 { font-size: 1.25em; font-weight: 700; margin: 2.2em 0 1em; }
.ap-art h3 { font-size: 1.05em; font-weight: 700; margin: 1.8em 0 0.8em; }

/* ── List defaults ───────────────────────────────────────── */
.ap-art ul,
.ap-art ol { padding-left: 1.8em; margin: 0.8em 0; }
.ap-art li { margin: 0.4em 0; }

/* ── Table ───────────────────────────────────────────────── */
.ap-art table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.93em;
}
.ap-art table th {
    background: var(--ap-h2-color, #3b82f6);
    color: #fff;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
}
.ap-art table td { padding: 8px 12px; border-bottom: 1px solid #e5e7eb; }
.ap-art table tr:nth-child(even) td {
    background: color-mix(in srgb, var(--ap-h2-color, #3b82f6) 8%, white);
}

/* ── HR ──────────────────────────────────────────────────── */
.ap-art hr { border: none; border-top: 1px solid #e5e7eb; margin: 2em 0; }

/* ── Blockquote ──────────────────────────────────────────── */
.ap-art blockquote {
    margin: 1.5em 0;
    padding: 10px 16px;
    border-left: 4px solid var(--ap-h2-color, #3b82f6);
    background: color-mix(in srgb, var(--ap-h2-color, #3b82f6) 6%, white);
    font-style: italic;
}


/* ══════════════════════════════════════════════════════
   H2 STYLES
   ══════════════════════════════════════════════════════ */

/* H2: line ── 左ボーダー＋下線＋背景色 */
.ap-art.ap-h2-line h2 {
    padding: 10px 16px;
    border-left: 6px solid var(--ap-h2-color, #3b82f6);
    border-bottom: 2px solid var(--ap-h2-color, #3b82f6);
    background: color-mix(in srgb, var(--ap-h2-color, #3b82f6) 8%, white);
}

/* H2: marker ── 上下ボーダー＋背景 */
.ap-art.ap-h2-marker h2 {
    padding: 10px 16px;
    background: color-mix(in srgb, var(--ap-h2-color, #3b82f6) 10%, white);
    border-top: 3px solid var(--ap-h2-color, #3b82f6);
    border-bottom: 3px solid var(--ap-h2-color, #3b82f6);
}

/* H2: slant ── 斜めの背景 */
.ap-art.ap-h2-slant h2 {
    padding: 11px 24px 11px 20px;
    position: relative;
    z-index: 0;
    overflow: hidden;
}
.ap-art.ap-h2-slant h2::before {
    content: '';
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--ap-h2-color, #3b82f6) 12%, white);
    border-left: 5px solid var(--ap-h2-color, #3b82f6);
    transform: skewX(-6deg);
    transform-origin: top left;
    z-index: -1;
}

/* H2: frame ── 枠線＋カラードロップシャドウ */
.ap-art.ap-h2-frame h2 {
    padding: 11px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 4px 4px 0 color-mix(in srgb, var(--ap-h2-color, #3b82f6) 20%, white),
                inset 5px 0 0 var(--ap-h2-color, #3b82f6);
}

/* H2: dot ── 2つのドット装飾 */
.ap-art.ap-h2-dot h2 {
    padding: 8px 16px 8px 44px;
    position: relative;
}
.ap-art.ap-h2-dot h2::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--ap-h2-color, #3b82f6);
}
.ap-art.ap-h2-dot h2::after {
    content: '';
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--ap-h2-color, #3b82f6) 40%, white);
}

/* H2: tape ── テープ風グラデーション＋左ライン */
.ap-art.ap-h2-tape h2 {
    padding: 10px 16px 10px 18px;
    border-left: 5px solid var(--ap-h2-color, #3b82f6);
    background: linear-gradient(
        to right,
        color-mix(in srgb, var(--ap-h2-color, #3b82f6) 10%, white) 0%,
        transparent 65%
    );
    position: relative;
}
.ap-art.ap-h2-tape h2::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 5px;
    width: 3px;
    background: color-mix(in srgb, var(--ap-h2-color, #3b82f6) 35%, white);
}

/* H2: shadow ── ドロップシャドウ枠 */
.ap-art.ap-h2-shadow h2 {
    padding: 11px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    box-shadow: 5px 5px 0 var(--ap-h2-color, #3b82f6);
}

/* H2: step ── 太＋細の2本縦バー */
.ap-art.ap-h2-step h2 {
    padding: 10px 16px 10px 22px;
    position: relative;
}
.ap-art.ap-h2-step h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--ap-h2-color, #3b82f6);
    border-radius: 3px 0 0 3px;
}
.ap-art.ap-h2-step h2::after {
    content: '';
    position: absolute;
    left: 9px;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: color-mix(in srgb, var(--ap-h2-color, #3b82f6) 40%, white);
    border-radius: 2px;
}

/* H2: pop ── 塗りつぶし＋吹き出し三角 */
.ap-art.ap-h2-pop h2 {
    padding: 12px 20px;
    background: var(--ap-h2-color, #3b82f6);
    color: #fff;
    border-radius: 6px;
    position: relative;
    font-weight: 800;
}
.ap-art.ap-h2-pop h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--ap-h2-color, #3b82f6);
}

/* H2: accent ── 斜めストライプ左アクセント */
.ap-art.ap-h2-accent h2 {
    padding: 10px 16px 10px 20px;
    border-bottom: 2px solid var(--ap-h2-color, #3b82f6);
    position: relative;
    overflow: hidden;
}
.ap-art.ap-h2-accent h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background: repeating-linear-gradient(
        -45deg,
        var(--ap-h2-color, #3b82f6) 0px,
        var(--ap-h2-color, #3b82f6) 3px,
        color-mix(in srgb, var(--ap-h2-color, #3b82f6) 20%, white) 3px,
        color-mix(in srgb, var(--ap-h2-color, #3b82f6) 20%, white) 7px
    );
}


/* ══════════════════════════════════════════════════════
   H3 STYLES
   ══════════════════════════════════════════════════════ */

/* H3: line ── シンプル左ボーダー */
.ap-art.ap-h3-line h3 {
    padding-left: 14px;
    border-left: 4px solid var(--ap-h3-color, #3b82f6);
}

/* H3: dot ── 左カラードット */
.ap-art.ap-h3-dot h3 {
    padding-left: 20px;
    position: relative;
}
.ap-art.ap-h3-dot h3::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ap-h3-color, #3b82f6);
}

/* H3: pill ── ピル型背景 */
.ap-art.ap-h3-pill h3 {
    padding: 5px 16px;
    background: color-mix(in srgb, var(--ap-h3-color, #3b82f6) 12%, white);
    border-radius: 20px;
    color: var(--ap-h3-color, #3b82f6);
    width: fit-content;
}

/* H3: shadow ── 左ボーダー＋色付きシャドウ */
.ap-art.ap-h3-shadow h3 {
    padding: 4px 12px;
    border-left: 3px solid var(--ap-h3-color, #3b82f6);
    box-shadow: 3px 3px 0 color-mix(in srgb, var(--ap-h3-color, #3b82f6) 20%, white);
}

/* H3: step ── 上半分がカラーの縦バー */
.ap-art.ap-h3-step h3 {
    padding-left: 15px;
    position: relative;
}
.ap-art.ap-h3-step h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: color-mix(in srgb, var(--ap-h3-color, #3b82f6) 30%, white);
}
.ap-art.ap-h3-step h3::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 50%;
    background: var(--ap-h3-color, #3b82f6);
}

/* H3: accent ── 斜めストライプ */
.ap-art.ap-h3-accent h3 {
    padding-left: 16px;
    position: relative;
}
.ap-art.ap-h3-accent h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: repeating-linear-gradient(
        -45deg,
        var(--ap-h3-color, #3b82f6) 0px,
        var(--ap-h3-color, #3b82f6) 2px,
        color-mix(in srgb, var(--ap-h3-color, #3b82f6) 20%, white) 2px,
        color-mix(in srgb, var(--ap-h3-color, #3b82f6) 20%, white) 5px
    );
}


/* ══════════════════════════════════════════════════════
   UL STYLES
   ══════════════════════════════════════════════════════ */

/* UL: dot ── カラードット */
.ap-art.ap-ul-dot ul li::marker { color: var(--ap-ul-color, #3b82f6); }

/* UL: check ── チェック */
.ap-art.ap-ul-check ul { list-style: none; padding-left: 0; }
.ap-art.ap-ul-check ul li { padding-left: 1.8em; position: relative; }
.ap-art.ap-ul-check ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--ap-ul-color, #3b82f6);
    font-weight: 700;
}

/* UL: arrow ── アロー */
.ap-art.ap-ul-arrow ul { list-style: none; padding-left: 0; }
.ap-art.ap-ul-arrow ul li { padding-left: 1.6em; position: relative; }
.ap-art.ap-ul-arrow ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--ap-ul-color, #3b82f6);
    font-weight: 700;
}

/* UL: bar ── 左バー */
.ap-art.ap-ul-bar ul { list-style: none; padding-left: 0; }
.ap-art.ap-ul-bar ul li { padding: 3px 8px 3px 14px; position: relative; margin: 0.5em 0; }
.ap-art.ap-ul-bar ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--ap-ul-color, #3b82f6);
    border-radius: 2px;
}

/* UL: square ── スクエア */
.ap-art.ap-ul-square ul { list-style: none; padding-left: 0; }
.ap-art.ap-ul-square ul li { padding-left: 1.6em; position: relative; }
.ap-art.ap-ul-square ul li::before {
    content: '■';
    position: absolute;
    left: 0;
    color: var(--ap-ul-color, #3b82f6);
    font-size: 0.7em;
    top: 0.35em;
}


/* ══════════════════════════════════════════════════════
   OL STYLES
   ══════════════════════════════════════════════════════ */

/* OL: number ── カラー太字数字 */
.ap-art.ap-ol-number ol li::marker {
    color: var(--ap-ol-color, #3b82f6);
    font-weight: 700;
}

/* OL: circle ── 丸数字 */
.ap-art.ap-ol-circle ol { list-style: none; padding-left: 0; counter-reset: ol-counter; }
.ap-art.ap-ol-circle ol li {
    padding-left: 2.4em;
    position: relative;
    counter-increment: ol-counter;
}
.ap-art.ap-ol-circle ol li::before {
    content: counter(ol-counter);
    position: absolute;
    left: 0;
    top: 0.1em;
    width: 1.5em;
    height: 1.5em;
    line-height: 1.5em;
    text-align: center;
    border-radius: 50%;
    border: 2px solid var(--ap-ol-color, #3b82f6);
    color: var(--ap-ol-color, #3b82f6);
    font-size: 0.78em;
    font-weight: 700;
}

/* OL: box ── カラーボックス数字 */
.ap-art.ap-ol-box ol { list-style: none; padding-left: 0; counter-reset: ol-counter; }
.ap-art.ap-ol-box ol li {
    padding-left: 2.4em;
    position: relative;
    counter-increment: ol-counter;
}
.ap-art.ap-ol-box ol li::before {
    content: counter(ol-counter);
    position: absolute;
    left: 0;
    top: 0.1em;
    width: 1.5em;
    height: 1.5em;
    line-height: 1.5em;
    text-align: center;
    border-radius: 3px;
    background: var(--ap-ol-color, #3b82f6);
    color: #fff;
    font-size: 0.78em;
    font-weight: 700;
}

/* OL: step ── ステップ風 */
.ap-art.ap-ol-step ol { list-style: none; padding-left: 0; counter-reset: ol-counter; }
.ap-art.ap-ol-step ol li {
    padding: 8px 14px 8px 2.8em;
    position: relative;
    counter-increment: ol-counter;
    margin-bottom: 8px;
    background: color-mix(in srgb, var(--ap-ol-color, #3b82f6) 6%, white);
    border-radius: 4px;
}
.ap-art.ap-ol-step ol li::before {
    content: counter(ol-counter);
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 1.4em;
    height: 1.4em;
    line-height: 1.4em;
    text-align: center;
    background: var(--ap-ol-color, #3b82f6);
    color: #fff;
    font-size: 0.82em;
    font-weight: 700;
    border-radius: 50%;
}


/* ══════════════════════════════════════════════════════
   STRONG STYLES
   ══════════════════════════════════════════════════════ */

/* Strong: highlight ── 蛍光ペン */
.ap-art.ap-strong-highlight strong {
    background: linear-gradient(
        transparent 50%,
        color-mix(in srgb, var(--ap-strong-color, #3b82f6) 30%, white) 50%
    );
    padding: 0 2px;
    font-weight: 700;
}

/* Strong: underline ── カラー下線 */
.ap-art.ap-strong-underline strong {
    border-bottom: 2.5px solid var(--ap-strong-color, #3b82f6);
    padding-bottom: 1px;
    font-weight: 700;
}

/* Strong: badge ── 枠線バッジ */
.ap-art.ap-strong-badge strong {
    border: 1.5px solid var(--ap-strong-color, #3b82f6);
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--ap-strong-color, #3b82f6);
    font-weight: 700;
    font-size: 0.94em;
}

/* Strong: pill ── 塗りつぶしピル */
.ap-art.ap-strong-pill strong {
    background: var(--ap-strong-color, #3b82f6);
    color: #fff;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.93em;
    font-weight: 700;
}

/* Strong: shadow ── カラーテキストシャドウ */
.ap-art.ap-strong-shadow strong {
    color: var(--ap-strong-color, #3b82f6);
    font-weight: 700;
    text-shadow: 2px 2px 0 color-mix(in srgb, var(--ap-strong-color, #3b82f6) 25%, white);
}

/* Strong: tape ── テープ風グラデーション */
.ap-art.ap-strong-tape strong {
    background: linear-gradient(
        to right,
        color-mix(in srgb, var(--ap-strong-color, #3b82f6) 15%, white),
        transparent 90%
    );
    border-left: 3px solid var(--ap-strong-color, #3b82f6);
    padding: 0 8px 0 4px;
    font-weight: 700;
}
