body {
    overflow: scroll;
}

.back-to-top {
    display: block;
    position: fixed;
    top: 60px;
    left: 60px;
    z-index: 100;
}

.article-container {
    max-width: 1000px;
    margin: 30px auto 0;

    .article-header {
        .article-image {
            width: 100%;
            max-height: 650px;
            margin: 0 auto;
            border-radius: 14px;
            overflow: hidden;
            border: solid 1px var(--borderColor);
            box-shadow: var(--articleImageShadow);

            img {
                width: 100%;
                height: 100%;
                object-fit: cover;
            }
        }

        .article-title {
            width: 80%;
            margin: 0 auto;
            padding: 30px 0;
            font-size: 32px;
            font-weight: bold;
            text-align: center;
        }

        .article-meta {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            font-size: 14px;
            text-align: right;
            padding: 0 2px 6px;
            color: var(--metaColor);
            border-bottom: solid 1px var(--borderColor);

            .meta-times span:first-child {
                margin-right: 5px;
            }
        }
    }

    .article-content {
        .main-image {
            display: none;
        }

        h3 {
            position: relative;
            display: inline-block;
            font-size: 24px;
            font-weight: bold;
            padding: 0 0 5px 20px;
        }

        .block-section {
            p {
                font-size: 14px;
            }
        }

        .intro-section {
            position: relative;
            width: 100%;
            margin: 50px auto;
            padding: 20px 30px;
            border-radius: 10px;
            background-color: var(--introBgColor);

            h3::before {
                content: "";
                position: absolute;
                top: 6px;
                left: -5px;
                width: 24px;
                height: 24px;
                background: url("../images/circlePin.svg") no-repeat center;
            }
        }

        .article-toc {
            width: 100%;
            margin: 0 auto;
            padding: 20px 30px;
            border-radius: 10px;
            border: solid 1px var(--borderColor);

            h3 {
                padding: 0;
            }

            li {
                a {
                    position: relative;
                    font-size: 14px;
                    margin-left: 10px;
                    padding-left: 10px;

                    &:before {
                        content: "•";
                        position: absolute;
                        left: 0;
                        width: 20px;
                        height: 20px;
                        margin-top: 2px;
                        color: var(--fontColor);
                    }

                    &:hover {
                        text-decoration: underline;
                        transition: all 0.3s ease-in-out;
                    }
                }
            }
        }

        .tools-section {
            h3:nth-child(2) {
                margin-top: 50px;
                &::before {
                    content: "";
                    position: absolute;
                    top: 6px;
                    left: -5px;
                    width: 24px;
                    height: 24px;
                    background: url("../images/cameraIcon.svg") no-repeat center;
                }
            }

            .wp-block-list {
                padding-left: 20px;
                li {
                    position: relative;
                    font-size: 16px;
                    margin-left: 10px;
                    padding-left: 10px;

                    &:before {
                        content: "•";
                        position: absolute;
                        left: 0;
                        width: 20px;
                        height: 20px;
                        /* margin-top: 1px; */
                        color: var(--fontColor);
                    }
                }
            }
        }

        .steps-wrapper {
            padding-top: 50px;
            h3 {
                display: flex;
                justify-content: center;
                align-items: center;
            }

            .step-section {
                display: flex;
                justify-content: center;
                align-items: center;

                .is-layout-flow {
                    width: 100%;
                    margin: 0 auto 40px;
                    display: flex;
                    flex-direction: column;
                    justify-content: center;
                    align-items: center;

                    .is-layout-flex {
                        margin-top: 20px;
                    }
                }

                h3 {
                    display: inline-block;
                    min-width: 800px;
                    height: var(--stepHeight);
                    line-height: var(--stepHeight);
                    font-size: 16px;
                    color: var(--whiteColor);
                    background-color: var(--bgBkgColor);
                    border-radius: 5px;
                }
                p {
                    width: 80%;
                    font-size: 16px;
                    padding: 20px;
                }

                .aligncenter,
                .size-large,
                .is-resized {
                    width: 500px;
                    height: auto;
                    margin-top: 10px;
                    overflow: hidden;
                    border-radius: 5px;

                    img {
                        width: 100%;
                        height: 100%;
                        object-fit: cover;
                    }
                }
            }
        }

        .advice-section {
            position: relative;
            width: 100%;
            margin: 50px 0;
            padding: 20px 30px;
            border: solid 1px var(--accentColor);
            border-radius: 10px;
            h3::before {
                content: "";
                position: absolute;
                top: 6px;
                left: -5px;
                width: 24px;
                height: 24px;
                background: url("../images/pointIcon.svg") no-repeat center;
            }
        }
    }

    /* 関連記事セクション */
    .related-posts {
        margin: 50px 0;

        h3 {
            font-size: 24px;
            margin-bottom: 30px;
            text-align: center;
        }

        .article-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 24px;

            .article-card {
                border-radius: 10px;
                padding: 10px;
                background: #fafafa;
                box-shadow: 0 0 14px 2px rgba(15, 15, 15, 0.15);

                .article-box {
                    text-decoration: none;
                    color: inherit;
                }

                .article-thumb img {
                    width: 100%;
                    height: 200px;
                    object-fit: cover;
                    border-radius: 8px;
                }

                .article-content {
                    padding-top: 10px;

                    .article-title {
                        font-size: 16px;
                        font-weight: bold;
                        line-height: 1.2;
                        /* margin-bottom: 10px; */
                    }

                    .article-meta {
                        font-size: 12px;
                        color: #ccc;
                    }
                }
            }
        }
    }
}

@media screen and (max-width: 555px) {
    .article-container {
        .article-header {
            .article-image {
                box-shadow: none;
                border-radius: 0px;
            }

            .article-title {
                font-size: 28px;
            }

            .article-meta {
                width: 90%;
                margin: 0 auto;
            }
        }

        .article-content {
            width: 90%;
            margin: 0 auto;
            .intro-section,
            .article-toc,
            .advice-section {
                border-radius: 5px;
            }

            h3 {
                font-size: 22px;
            }

            .steps-wrapper {
                .step-section {
                    h3 {
                        min-width: 400px;
                    }
                    .is-layout-flow {
                        width: 100%;
                    }

                    .is-layout-flex {
                        flex-direction: column;
                    }

                    /* スマホ版での画像サイズ調整 */
                    .aligncenter,
                    .size-large,
                    .is-resized {
                        width: 100%;
                        height: auto;
                        margin: 10px auto;

                        img {
                            width: 100%;
                            height: auto;
                            object-fit: contain;
                        }
                    }

                    /* スマホ版でpタグを100%幅にする */
                    p {
                        width: 100%;
                    }

                    /* pタグとimgタグが両方存在する場合、縦並びにする */
                    &:has(img):has(p) {
                        display: block;
                    }

                    /* 画像がある場合でもpタグは100%幅を維持 */
                    &:has(img) p {
                        width: 100%;
                    }

                    /* スマホ版での画像サイズ調整 */
                    .aligncenter,
                    .size-large,
                    .is-resized {
                        width: 100%;
                        max-width: 350px;
                        height: auto;
                        margin: 10px auto;

                        img {
                            width: 100%;
                            height: auto;
                            object-fit: contain;
                        }
                    }
                }
            }
        }
    }
    .related-posts {
        .article-grid {
            .article-card {
                width: 100%;
                max-width: 400px;
                height: 180px;

                .article-box {
                    display: flex;
                    flex-direction: row-reverse;
                    align-items: center;
                    height: 100%;

                    .article-thumb {
                        flex: 0 0 160px;

                        img {
                            height: 160px;
                            width: 160px;
                        }
                    }

                    .article-content {
                        flex: 1;
                        padding: 0 10px 0 0;
                        display: flex;
                        flex-direction: column;
                        justify-content: space-between;
                        height: 100%;

                        .article-title {
                            font-size: 18px;
                            line-height: 1.4;
                            margin-bottom: 0;
                        }

                        .article-meta {
                            margin-top: auto;
                        }
                    }
                }
            }
        }
    }
}

@media screen and (min-width: 768px) {
    .pc-header {
        display: none !important;
    }
}
