.detail-wrap { max-width: 800px; margin: 0 auto; padding: 4rem 3rem 7rem; }
/* 一覧へ戻る。矢印が左へ滑り、下線が「戻る」向き＝右から左へ引かれる */
.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-ink);
    margin-bottom: 3rem;
    padding-bottom: 4px;
    background-image:
        linear-gradient(90deg, var(--accent-ink) 0%, var(--accent) 100%),
        linear-gradient(var(--border), var(--border));
    background-repeat: no-repeat, no-repeat;
    /* 1本目は右端から左へ伸ばす */
    background-position: 100% 100%, 0 100%;
    background-size: 0 1px, 100% 1px;
    transition: background-size 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.detail-back:hover { background-size: 100% 1px, 100% 1px; }
.detail-back::before {
    content: '←';
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.detail-back:hover::before { transform: translateX(-5px); }
.detail-meta { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.detail-date { font-size: 0.72rem; letter-spacing: 0.1em; color: var(--accent-ink); }
.detail-title {
    font-family: var(--serif);
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 2.5rem;
}
.detail-img { width: 100%; aspect-ratio: 16/9; overflow: hidden; margin-bottom: 2.5rem; }
.detail-img img { width: 100%; height: 100%; object-fit: cover; }
/* 本文は白い面にそのまま載せる（ぼかしたグラデーションは使わない） */
.detail-body {
    position: relative;
    background: var(--white);
    border: 1px solid var(--border);
    padding: 2.75rem 3rem 3rem;
}
/* 上罫の左端をブランドカラーで重ねる（他ページと同じ装飾） */
.detail-body::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    width: 64px;
    height: 2px;
    background: var(--accent);
}
.detail-body p { font-size: 0.9rem; line-height: 1.9; color: var(--mid); margin-bottom: 0.85rem; }
.detail-body p:last-child { margin-bottom: 0; }
/* エディタが挿入する空段落（<p><br></p>）は余白が二重になるため詰める */
.detail-body p:has(> br:only-child) { display: none; }
.detail-body h2 { font-family: 'Yu Mincho', 'YuMincho', 'Hiragino Mincho ProN', serif; font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 600; line-height: 1.4; margin: 2rem 0 0.7rem; border-left: 3px solid transparent; border-image: linear-gradient(to bottom, var(--accent), var(--accent-ink)) 1; padding-left: 1rem; }
.detail-body h3 { font-family: 'Yu Mincho', 'YuMincho', 'Hiragino Mincho ProN', serif; font-size: clamp(1rem, 2.5vw, 1.25rem); font-weight: 600; line-height: 1.4; margin: 1.6rem 0 0.5rem; color: var(--mid); }
.detail-body img { max-width: 100%; height: auto; display: block; margin: 1.5rem auto; }
.detail-body ul, .detail-body ol { padding-left: 1.5rem; margin-bottom: 0.85rem; font-size: 0.9rem; line-height: 1.9; }
.detail-body li { margin-bottom: 0.25rem; }
/* 入れ子の階層。Quill は li.ql-indent-1〜 で深さを表す */
.detail-body li.ql-indent-1 { margin-left: 1.5rem; }
.detail-body li.ql-indent-2 { margin-left: 3rem; }
.detail-body li.ql-indent-3 { margin-left: 4.5rem; }
.detail-body ul li.ql-indent-1 { list-style-type: circle; }
.detail-body ul li.ql-indent-2 { list-style-type: square; }
.detail-body ul li.ql-indent-3 { list-style-type: circle; }
.detail-body ol li.ql-indent-1 { list-style-type: lower-alpha; }
.detail-body ol li.ql-indent-2 { list-style-type: lower-roman; }
.detail-body ol li.ql-indent-3 { list-style-type: decimal; }
/* 段落のインデントにも対応 */
.detail-body p.ql-indent-1 { margin-left: 1.5rem; }
.detail-body p.ql-indent-2 { margin-left: 3rem; }
.detail-body p.ql-indent-3 { margin-left: 4.5rem; }
.detail-body strong { font-weight: 600; }
/* 引用。Quill は1行ごとに blockquote を作るため、
   連続する場合は隙間を打ち消してひと続きの塊に見せる */
/* 引用。見出し（緑の縦罫）と紛れないよう、面で見せる */
.detail-body blockquote {
    position: relative;
    margin: 1.75rem 0;
    /* 引用符の分だけ左が広いので、右も同じ量にして左右対称にする */
    padding: 1.1rem 2.75rem;
    background: #f0ede8;
    border-left: none;
    font-size: 0.9rem;
    line-height: 1.95;
    color: var(--text);
}
.detail-body blockquote::before {
    content: '“';
    position: absolute;
    left: 0.9rem;
    top: 0.35rem;
    font-family: var(--serif);
    font-size: 1.9rem;
    line-height: 1;
    color: var(--light);
}
/* 連続する行はひと続きの面に見せる（2行目以降は引用符を出さない） */
.detail-body blockquote + blockquote {
    margin-top: -1.75rem;
    padding-top: 0;
}
.detail-body blockquote + blockquote::before { content: none; }
.detail-body blockquote p { margin-bottom: 0.5rem; }
.detail-body blockquote p:last-child { margin-bottom: 0; }
/* コードブロック・インラインコード */
.detail-body pre,
.detail-body .ql-syntax {
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    /* 本文が白面になったため、コードは地色側で沈ませて区別する */
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.9;
    /* pre のままだと長い行がはみ出し、右のパディングが効かずに
       文字が枠ぎりぎりまで届いてしまうため折り返す */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow-x: auto;
}
.detail-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
    background: #f0ede8;
    padding: 0.1rem 0.35rem;
}
.detail-body pre code { background: none; padding: 0; font-size: inherit; }
/* 打ち消し線 */
.detail-body s, .detail-body del { color: var(--light); }
/* Quill の整列クラス */
.detail-body .ql-align-center { text-align: center; }
.detail-body .ql-align-right  { text-align: right; }
.detail-body .ql-align-justify { text-align: justify; }
.detail-body em { font-style: italic; }
.detail-body a {
    color: var(--accent-ink);
    padding-bottom: 2px;
    background-image:
        linear-gradient(90deg, var(--accent) 0%, var(--accent-ink) 100%),
        linear-gradient(var(--border), var(--border));
    background-repeat: no-repeat, no-repeat;
    background-position: 0 100%, 0 100%;
    background-size: 0 1px, 100% 1px;
    transition: background-size 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.detail-body a:hover { background-size: 100% 1px, 100% 1px; }
.detail-footer { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border); display: flex; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1.5rem; }
/* 記事上部の戻るリンクと同じクラスのため、フッター側は下マージンを打ち消す */
.detail-footer .detail-back { margin-bottom: 0; font-size: 0.8rem; }
.share-row { display: flex; align-items: center; gap: 1rem; }
.share-label { font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--light); }
.share-x {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    color: var(--bg);
    background: var(--text);
    border: 1px solid var(--text);
    transition: background 0.3s, color 0.3s;
}
/* ホバーで白地に反転する */
.share-x:hover { background: var(--white); color: var(--text); }
@media (prefers-reduced-motion: reduce) {
    .detail-back, .detail-back::before, .share-x { transition: none; }
}

@media (max-width: 768px) {
    .detail-wrap { padding: 3rem 1.25rem 2.5rem; }
    .detail-body { padding: 1.75rem 1.25rem 2rem; }
}
@media (max-width: 480px) {
    /* 片手持ちで親指が届く右下に戻る導線を置く */
    .detail-footer { flex-direction: column; align-items: stretch; gap: 1.5rem; }
    .detail-footer .detail-back {
        align-self: flex-end;
        /* 端ぎりぎりだと押しづらいので、タップ領域を広げつつ右端に揃える */
        padding: 0.5rem 0;
    }
}

/* ── いいねボタン ── */
.like-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin-top: 3rem;
}
.like-label {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: var(--light);
    transition: color 0.3s;
}
.like-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--mid);
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: border-color 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                color 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.like-btn:hover {
    border-color: var(--accent);
    color: var(--accent-ink);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(142, 195, 31, 0.18);
}
.like-heart { display: inline-flex; transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.like-btn:hover .like-heart { transform: scale(1.12); }
.like-count { font-variant-numeric: tabular-nums; }
/* 日付・カテゴリの隣に置く小型版 */
.like-btn-sm {
    padding: 0.2rem 0.6rem;
    gap: 0.3rem;
    font-size: 0.68rem;
}
.like-btn-sm:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgba(142, 195, 31, 0.16); }

/* 押した瞬間：ハートが弾んで塗りつぶされる */
.like-btn.is-liked {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}
.like-btn.is-liked .like-heart svg { fill: currentColor; }
.like-btn.is-burst .like-heart { animation: likePop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes likePop {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.45) rotate(-8deg); }
    55%  { transform: scale(0.88) rotate(4deg); }
    100% { transform: scale(1) rotate(0); }
}
/* ボタンから広がる波紋 */
.like-btn.is-burst::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 999px;
    border: 2px solid var(--accent);
    animation: likeRipple 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    pointer-events: none;
}
@keyframes likeRipple {
    0%   { transform: scale(1); opacity: 0.9; }
    100% { transform: scale(1.9); opacity: 0; }
}
/* 飛び散る粒 */
.like-particle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    pointer-events: none;
    animation: likeFly 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes likeFly {
    0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
    70%  { opacity: 1; }
    100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2); opacity: 0; }
}
/* 数字が跳ね上がる */
.like-count.is-bump { animation: likeBump 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes likeBump {
    0%   { transform: translateY(0); }
    40%  { transform: translateY(-7px); }
    100% { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .like-btn, .like-heart { transition: none; }
    .like-btn.is-burst .like-heart,
    .like-btn.is-burst::after,
    .like-particle,
    .like-count.is-bump { animation: none; }
    .like-particle { display: none; }
}

/* 下書きプレビューの帯（管理者にのみ表示される） */
.draft-notice {
    margin-bottom: 2rem;
    padding: 0.85rem 1.25rem;
    background: color-mix(in srgb, #d9a441 14%, var(--white));
    border: 1px solid color-mix(in srgb, #d9a441 45%, transparent);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: #8a6412;
}
.draft-notice strong { font-weight: 600; }
