/* details.html 専用 */
html,
body {
    overflow-x: clip;
}

.detail-page {
    background-color: #FFFBF7;
}

.detail-page #firstview {
    position: relative;
}

.detail-page #firstview .fv {
    width: 100%;
    display: block;
    object-fit: contain;
}

.detail-page #firstview .fv-wrap {
    width: 100%;
    aspect-ratio: var(--fv-aspect, 16/9);
    overflow: hidden;
}

/* 画像はボックスいっぱいにフィットさせる */
#firstview .fv-wrap>img.fv {
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#firstview .fv-wrap>img.fv.is-contain {
    object-fit: contain;
    background: #fff;
}

/* 右＝アイコン縦並び */
.detail-page #firstview .icons {
    position: absolute;
    top: 250px;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.detail-page #firstview .icons img {
    width: 40px;
    height: auto;
    margin-top: 16px;
}

/* 開いている時だけ：横並びでコメントドロワーの上付近に固定配置 */
body.drawer-open .detail-page #firstview .icons {
    position: fixed;
    top: -15px;
    right: -190px;
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 12px;
    z-index: 1002;
    transition: top .25s ease, right .25s ease;
}

.detail-page #firstview #tags {
    width: 100%;
    margin-bottom: 80px;
}

.detail-page #firstview h2 {
    padding-block: 20px;
}

.detail-page #tags .flex-tags {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    height: auto;
}

.detail-page #tags .tags {
    width: 45%;
    display: flex;
    flex-wrap: wrap;
    gap: 20px 10px;
}

.detail-page #tags .links {
    min-width: 30%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-end;
}


.detail-page #tags .link-tag {
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: 18px;
}

.detail-page #tags .site-visit,
.github-visit {
    width: 20px;
    height: 20px;
}


.detail-page #tags li {
    margin-bottom: 10px;
    padding: 0;
}

.detail-page #tags .tag {
    padding: 10px;
    margin: 0;
    list-style: none;
    border: solid 1px var(--color-main);
    border-radius: 10px;
}

.detail-page .project-info {
    margin-top: 32px;
    margin-inline: 0;
}

.detail-page .project-info-card {
    border: 1.5px solid var(--color-main);
    padding: 18px;
}

.detail-page .project-info-body p {
    line-height: 1.9;
}

.detail-page .project-info h2 {
    background: var(--color-main);
    color: #FFFBF7;
    padding: 12px 16px;
    border-radius: 10px 10px 0 0;
    font-size: 1.25rem;
}

/* スクショ画像 */
.detail-page .project-info-card .project-info-body img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    background: #FFFBF7;
    margin-inline: auto;
    padding: 12px;
}


/* 右コメント欄ドロワー */
:root {
    --header-h: 150px;
    --drawer-w: clamp(380px, 30vw, 520px);
}

/* ドロワーは transform だけで外に出す（レイアウトに影響させない） */
.comment-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--drawer-w);
    height: auto;
    background: #FFFBF7;
    border-left: 1px solid var(--color-main, #4A2B00);
    transform: translateX(100%);
    /* ← 閉じている時は完全オフキャンバス */
    transition: transform .35s cubic-bezier(.2, .7, .2, 1);
    z-index: 1001;
    overflow: hidden;
    /* ← 中の×などがはみ出さない */
    will-change: transform;
}

/* 見出しはドロワー側の h2 を使い、comments.php 側のタイトルは非表示に */
.comment-drawer .comments-area .comments-title {
    display: none;
}

/* ドロワー内の余白とタイポ */
.comment-drawer .drawer-body {
    padding: 20px 50px 100px;
}

.comment-drawer h2 {
    padding: 20px 50px;
    margin-top: 60px;
    font-weight: 700;
    font-size: 20px;
    color: var(--color-main, #4A2B00);
}

.comment-drawer .comments {
    padding: 20px 50px;
}

.comment-drawer .comments li {
    padding-block: 8px;
    list-style: none;
    margin: 0;
}

/* 行のレイアウト：author（太字） — content を1行に */
.comment-drawer .comment,
.comment-drawer .comment-body {
    margin-bottom: 16px;
}

.comment-drawer .comment-author {
    font-weight: 700;
    margin-right: .3em;
}

.comment-drawer .comment-content {
    display: inline;
}

/* 本文を横並びに */
.comment-drawer .comment-content p {
    display: inline;
    margin: 0;
}

/* 作者名と本文の間にダッシュを自動挿入（マークアップに依存せず再現） */
.comment-drawer .comment-author::after {
    content: " — ";
    font-weight: 400;
}

/* フォーム（ニックネーム + コメントのみ） */
.comment-drawer .comment-form {
    margin-top: 14px;
}

.comment-drawer .comment-form label {
    display: block;
    font-size: 12px;
    color: #4a2b00;
    margin: 0 0 6px;
}

.comment-drawer .comment-form-author input,
.comment-drawer .comment-form-comment textarea {
    width: 80%;
    box-sizing: border-box;
    border: 1px solid #4a2b00;
    background: #fff;
    padding: 10px 12px;
    border-radius: 8px;
}

.comment-drawer .form-submit {
    margin-top: 10px;
}

.comment-drawer .form-submit .submit {
    appearance: none;
    cursor: pointer;
    font-weight: 700;
    border: 1px solid var(--color-main, #4A2B00);
    background: #fff;
    padding: 10px 16px;
    margin-top: 10px;
    border-radius: 8px;
    color: var(--color-main, #4A2B00);
}


.comment-drawer .form-submit .submit:hover,
.comment-drawer .form-submit .submit:focus-visible {
    background: var(--color-main, #67420F);
    color: #FFFBF7;
    border-color: var(--color-main, #67420F);
    transform: translateY(-1px);
    outline: none;
}

/* 閉じるボタン */
.drawer-close {
    position: absolute;
    right: 20%;
    top: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--color-main, #4A2B00);
    background: #FFFBF7;
    color: var(--color-main, #4A2B00);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 20px;
    cursor: pointer;
}

/* ドロワーが閉じている時は × を非活性（念のため） */
.comment-drawer:not(.is-open) .drawer-close {
    opacity: 0;
    pointer-events: none;
}

.drawer-close::before {
    content: "×";
    line-height: 1;
}

/* ←コメント展開時main内だけ縮小 */
#appFrame {
    will-change: transform;
}

body.drawer-open #appFrame {
    width: calc(100vw - var(--drawer-w));
    transition: width .35s cubic-bezier(.2, .7, .2, 1);
    border-right: 1px solid var(--color-main, #4A2B00);
}

/* wrapper 開いている時だけ左寄せに */
body.drawer-open .wrapper {
    margin-left: 0;
}

/* スクロール設定 */
.comment-drawer .drawer-body {
    overflow: auto;
    overscroll-behavior: contain;
}

/* コメントのコメント */
.comment-list .children {
    margin-left: 1.25rem;
    padding-left: .9rem;
    border-left: 1px dashed rgba(0, 0, 0, .18);
}

/* 既定は畳む */
.comment-list .children {
    display: none;
}

.comment-list .children.is-open {
    display: block;
}

/* 返信を表示ボタンの見た目 */
.comment-actions .toggle-replies {
    display: inline-block;
    margin-inline: 10px;
    font-weight: 500;
    border: 1px solid var(--color-main, #4A2B00);
    padding: 2px 10px;
    border-radius: 5px;
    cursor: pointer;
}

.comment-actions .toggle-replies[aria-expanded="true"] {
    background: var(--color-main, #67420F);
    color: #FFFBF7;
}

/* スマホでは縮小しない*/
@media (max-width: 768px) {
    body.drawer-open #appFrame {
        transform: none;
    }

    .comment-drawer {
        width: 100vw;
        left: auto;
    }
}

/*-------------------------------------------
iconsのレスポンシブ
-------------------------------------------*/
@media (max-width: 1024px) {
    .detail-page #firstview .icons {
        position: static;
        /* フローに乗せる */
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        /* ← 中央寄せのほうが自然 */
        align-items: flex-start;
        gap: 12px;
        margin-top: 12px;
        /* FV画像との余白 */
    }

    .detail-page #tags .flex-tags {
        padding-top: 35px;
    }
}

/*-------------------------------------------
Tags・詳細カードレスポンシブ
-------------------------------------------*/
@media (max-width: 768px) {

    .detail-page h2 {
        font-size: 18px;
    }
    
    .detail-page #tags .tags {
        gap: 10px;
        font-size: 12px;
    }

    .detail-page #tags .tags span {
        padding: 8px;
    }

    .detail-page #firstview #tags {
        margin-bottom: 40px;
    }

    .detail-page #firstview h2 {
        padding-block: 10px;
        font-size: 18px;
    }

    .detail-page #tags .flex-tags {
        padding-top: 10px;
    }

    .detail-page .project-info h2  {
        font-size: 18px;
        padding: 8px 12px;
    }
}

@media (max-width: 425px) {
    .detail-page #tags .flex-tags {
        flex-direction: column;
        gap: 40px;
        height: auto;
        padding-top: 10px;
    }

    .detail-page #tags .tags {
        width: 100%;
    }

    .detail-page #tags .links {
        width: 100%;
        align-items: flex-start;
    }
}

/*-------------------------------------------
いいねボタンを既存のアイコン画像でWP-Ulikeを反映させる
-------------------------------------------*/
.icons .like-proxy {
    appearance: none;
    background: transparent;
    border: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.icons .like-proxy img {
    width: 40px;
    height: auto;
    display: block;
}

.icons .like-proxy .like-count {
    font-weight: 700;
    color: var(--color-main, #4A2B00);
    font-size: .95rem;
}

/* 本物の WP ULike ボタンは視覚的に隠す */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}


/*-------------------------------------------
Share modal
-------------------------------------------*/
/* ===== Share modal base ===== */
.share-modal {
    position: fixed;
    inset: 0;
    display: none;
    /* aria-hidden=false で表示 */
    z-index: 4000;
    /* ドロワーより前に */
}

.share-modal[aria-hidden="false"] {
    display: block;
}

/* 背景の暗幕 */
.share-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
}

/* パネル本体 */
.share-modal__content {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(500px, 92vw);
    background: #FFFBF7;
    border: 1px solid var(--color-main, #4A2B00);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
    padding: 30px;
    z-index: 1;
    text-align: center;
}

.share-modal__title {
    margin: 0 0 14px;
    color: var(--color-main, #4A2B00);
    font-weight: 700;
}

/* 閉じるボタン */
.share-modal__close {
    position: absolute;
    right: 16px;
    top: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--color-main, #4A2B00);
    background: #FFFBF7;
    cursor: pointer;
    font-size: 18px;
}

/* アイコン群（アイコン自体がリンク） */
.share-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 14px 0 12px;
    margin-bottom: 16px;
}

.share-icon img {
    width: 40px;
    height: 40px;
    display: block;
    transition: transform .2s, opacity .2s;
}

.share-icon:hover img {
    transform: scale(1.08);
    opacity: .9;
}

/* コピー行 */
.share-link-box {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.share-link-box input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--color-main, #4A2B00);
    border-radius: 8px;
    background: #fff;
}

.share-link-box button {
    padding: 8px 12px;
    border: 1px solid var(--color-main, #4A2B00);
    background: #fff;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    color: black;
}

@media (max-width: 350px) {

    .share-link-box {
        flex-direction: column;
    }

    .share-modal__close {
        right: 8px;
        top: 8px;
    }
}

.share-link-box button:hover {
    background: var(--color-main, #67420F);
    color: #FFFBF7;
}

.share-note {
    margin-top: 8px;
    font-size: 12px;
    color: #c44;
}

/* ドロワーと共存しても前に出す */
body.drawer-open #shareModal {
    z-index: 4000;
}


/*-------------------------------------------
comments レスポンシブ
-------------------------------------------*/
@media (max-width: 768px) {
    body.drawer-open .detail-page #firstview .icons {
        top: 16px;
    }

    .drawer-close {
        left: 50px;
        top: 70px;
    }

    .comment-drawer h2 {
        margin-top: 120px;
        padding-bottom: 0;
    }

    .comment-drawer .drawer-body {
        height: 100vh;
        width: 100vw;
        overscroll-behavior: auto;
    }

    body.drawer-open .wrapper {
        display: none;
    }

    .comment-drawer {
        border-left: none;
    }

}