/* お客様の声（詳細・一覧・トップ・実績ページの導線）で共通の値 */
#voice,
#voice-list,
#voice-top,
.works-interview {
    --voice-green-weak: color-mix(in srgb, var(--color-main) 8%, #fff);
    --voice-line: #e0e0e0;
}

/* タグ（詳細ページの記事上部・一覧カードで共通） */
.voice-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    li {
        font-size: 12px;
        color: var(--color-main);
        border: 1px solid var(--color-main);
        border-radius: 100vh;
        padding: 2px 10px;
    }
}

/* お客様の声（インタビュー記事） */
#voice {
    /* 読みやすさのため、本文の幅を1行あたり約40文字に抑える */
    .voice-article {
        max-width: 760px;
        margin: 0 auto;
    }

    .voice-tags {
        margin-top: 32px;
    }

    .voice-title {
        font-size: 32px;
        font-weight: 600;
        line-height: 1.5;
        margin-top: 16px;
    }

    .voice-subtitle {
        color: var(--color-sub);
        margin-top: 8px;
    }

    .voice-hero {
        display: grid;
        grid-template-columns: 1.4fr 1fr;
        margin-top: 32px;
        border-radius: 4px;
        overflow: hidden;

        img {
            display: block;
            width: 100%;
            height: 100%;
            min-height: 300px;
            object-fit: cover;
            object-position: center 35%;
        }
    }

    /* 写真とキャプションを縦に並べ、写真が右の緑の枠と同じ高さまで伸びるようにする */
    .voice-hero-photo {
        display: flex;
        flex-direction: column;

        img {
            flex: 1;
            height: auto;
        }

        figcaption {
            font-size: 14px;
            color: var(--color-sub);
            line-height: 1.6;
            padding-top: 8px;
            background: #fff;
        }
    }

    .voice-hero-text {
        background: var(--color-main);
        color: #fff;
        padding: 32px;

        p {
            font-size: 14px;
            line-height: 1.8;
        }

        /* 上の p 指定より詳細度を高くするため、.voice-hero-text の中に書く */
        .voice-hero-label {
            letter-spacing: 0.1em;
            opacity: 0.9;
        }

        .voice-hero-name {
            font-size: 22px;
            font-weight: 600;
            margin: 4px 0 16px;
        }
    }

    .voice-summary {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        margin-top: 24px;

        div {
            background: var(--voice-green-weak);
            border-radius: 4px;
            padding: 20px;
        }

        h4 {
            font-size: 14px;
            font-weight: 600;
            color: var(--color-main);
            letter-spacing: 0.1em;
            margin-bottom: 8px;
        }

        p {
            font-size: 14px;
            line-height: 1.8;
        }
    }

    /* 実績詳細の #table01 に揃える */
    .voice-overview {
        width: 100%;
        border-collapse: collapse;
        margin-top: 24px;

        tr {
            border-bottom: 1px solid #b5b1b1;
        }

        th,
        td {
            padding: 16px 0;
            /* 担当範囲など折り返す行があるため、行間だけ広げる */
            line-height: 1.8;
        }

        th {
            width: 35%;
        }

        @media only screen and (max-width: 480px) {
            th,
            td {
                display: block;
                width: 100%;
            }

            td {
                padding-top: 0;
            }
        }
    }

    .voice-q {
        position: relative;
        font-size: 22px;
        font-weight: 600;
        line-height: 1.6;
        margin-top: 64px;
        margin-bottom: 16px;
        padding-left: 48px;

        &::before {
            content: "Q";
            position: absolute;
            left: 0;
            top: 2px;
            width: 34px;
            height: 34px;
            border-radius: 50%;
            background: var(--color-main);
            color: #fff;
            font-size: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
    }

    /* 本文は実績詳細（.works-flex-item p）に揃える */
    .voice-a {
        font-size: 18px;
        letter-spacing: 0.05em;
        line-height: 1.8;
        margin-bottom: 16px;
    }

    /* QAの合間に入れる写真（本文幅いっぱい） */
    .voice-photo {
        display: block;
        width: 100%;
        height: auto;
        border-radius: 4px;
        margin-top: 32px;
    }

    /* リニューアル前後のトップページ比較（PCは横並び、SPは縦積み） */
    .voice-compare {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        margin-top: 32px;

        img {
            display: block;
            width: 100%;
            height: auto;
            /* 2枚の高さがわずかに違うため、比率を揃えて上端基準で切り抜く */
            aspect-ratio: 1440 / 746;
            object-fit: cover;
            object-position: top;
            border: 1px solid var(--voice-line);
            border-radius: 4px;
        }

        figcaption {
            font-size: 14px;
            color: var(--color-sub);
            text-align: center;
            margin-top: 8px;
        }

        @media screen and (max-width: 768px) {
            grid-template-columns: 1fr;
        }
    }

    .voice-speaker {
        font-weight: 600;
        color: var(--color-main);
        margin-right: 4px;
    }

    .voice-mrp {
        display: flex;
        gap: 24px;
        align-items: flex-start;
        border: 1px solid var(--voice-line);
        border-radius: 4px;
        padding: 32px;
        margin-top: 64px;

        h4 {
            font-weight: 600;
            margin-bottom: 8px;
        }

        p {
            font-size: 18px;
            letter-spacing: 0.05em;
            line-height: 1.8;
            margin-bottom: 8px;
        }
    }

    .voice-mrp-photo {
        flex: none;
        width: 96px;
        height: 96px;
        border-radius: 50%;
        object-fit: cover;
        background: #fff;
    }

    .voice-points-title {
        font-size: 22px;
        font-weight: 600;
        margin-top: 64px;
    }

    .voice-points {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-top: 16px;

        div {
            border: 1px solid var(--voice-line);
            border-radius: 4px;
            padding: 20px;
            font-size: 14px;
        }

        h4 {
            color: var(--color-main);
            font-weight: 600;
            margin-bottom: 8px;
        }

        ul {
            list-style: disc;
            padding-left: 1.2em;
            line-height: 1.8;
        }
    }

    @media screen and (max-width: 768px) {
        .voice-title {
            font-size: 1.3125rem;
        }

        .voice-hero,
        .voice-summary,
        .voice-points {
            grid-template-columns: 1fr;
        }

        .voice-hero img {
            min-height: 220px;
        }

        .voice-q {
            font-size: 1.125rem;
            margin-top: 48px;
        }

        .voice-a,
        .voice-mrp p {
            font-size: 1rem;
        }

        .voice-mrp {
            flex-direction: column;
            padding: 24px;
        }
    }
}

/* お客様の声 一覧（トップページの Voice セクションでも同じカードを使う） */
#voice-list,
#voice-top {
    .voice-list-lead {
        margin-top: 32px;
        font-size: 18px;
        letter-spacing: 0.05em;
        line-height: 1.8;

        @media screen and (max-width: 768px) {
            font-size: 1rem;
        }
    }

    .voice-cards {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
        margin-top: 32px;
    }

    .voice-card {
        display: flex;
        flex-direction: column;
        height: 100%;
        border: 1px solid var(--voice-line);
        border-radius: 4px;
        overflow: hidden;
        background: #fff;
        color: inherit;
        text-decoration: none;
        transition: opacity 0.3s;
        padding-top: 20px;

        &:hover,
        &:focus-visible {
            opacity: 0.6;
        }

        img {
            display: block;
            width: 100%;
            aspect-ratio: 16 / 10;
            object-fit: cover;
        }
    }

    .voice-card-body {
        display: flex;
        flex-direction: column;
        flex: 1;
        padding: 16px 20px 20px;
    }

    .voice-card-title {
        font-size: 16px;
        font-weight: 600;
        line-height: 1.6;
        margin-top: 12px;
    }

    .voice-card-name {
        font-size: 14px;
        color: var(--color-sub);
        margin-top: auto;
        padding-top: 12px;
    }

    @media screen and (max-width: 1024px) {
        .voice-cards {
            grid-template-columns: repeat(2, 1fr);
        }
    }

    @media screen and (max-width: 768px) {
        .voice-cards {
            grid-template-columns: 1fr;
        }
    }
}

/* トップページの Voice セクション：カードを横1列に並べる手動スライダー */
#voice-top {
    .voice-slider-head {
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        gap: 16px;
    }

    .voice-slider-nav {
        display: flex;
        gap: 12px;

        &[hidden] {
            display: none;
        }

        button {
            display: grid;
            place-items: center;
            width: 48px;
            height: 48px;
            border: 1px solid var(--color-main);
            border-radius: 50%;
            background: #fff;
            color: var(--color-main);
            cursor: pointer;
            transition: color 0.3s, background-color 0.3s, opacity 0.3s;

            &:hover:not(:disabled) {
                background: var(--color-main);
                color: #fff;
            }

            &:disabled {
                opacity: 0.3;
                cursor: default;
            }
        }

        svg {
            width: 20px;
            height: 20px;
            fill: none;
            stroke: currentColor;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }
    }

    .voice-cards {
        /* 一度に見せる枚数 */
        --voice-per-view: 3;
        --voice-gap: 24px;
        /* 次のカードの端をのぞかせる幅（すき間を含む）。スライドするときだけ指定する */
        --voice-peek: 0px;
        display: flex;
        gap: var(--voice-gap);
        /* 見出しとカードの間隔は #works に揃える */
        margin-top: 40px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        scrollbar-width: none;

        &::-webkit-scrollbar {
            display: none;
        }

        > li {
            flex: 0 0 calc((100% - var(--voice-gap) * (var(--voice-per-view) - 1) - var(--voice-peek)) / var(--voice-per-view));
            scroll-snap-align: start;
        }

        /* 横スクロールの枠の外にはみ出した部分は切れるため、キーボード操作時の枠線はカードの内側に描く */
        .voice-card:focus-visible {
            outline-offset: -3px;
        }

        @media (prefers-reduced-motion: reduce) {
            scroll-behavior: auto;
        }

        /* マウスでドラッグしている間は、吸い付きとなめらかスクロールを止めて指に追従させる */
        &.is-dragging {
            scroll-snap-type: none;
            scroll-behavior: auto;
            cursor: grabbing;
            user-select: none;
        }
    }

    /* 一度に見せる枚数より多いときは、次のカードの端をのぞかせ、横に送れることを伝える */
    .voice-cards:has(> li:nth-child(4)) {
        --voice-peek: calc(var(--voice-gap) + 64px);
    }

    @media screen and (max-width: 1024px) {
        .voice-cards {
            --voice-per-view: 2;
        }

        .voice-cards:has(> li:nth-child(3)) {
            --voice-peek: calc(var(--voice-gap) + 64px);
        }
    }

    @media screen and (max-width: 768px) {
        .voice-cards {
            --voice-per-view: 1;
        }

        .voice-cards:has(> li:nth-child(2)) {
            --voice-peek: 15%;
        }
    }
}

/* 制作実績ページからインタビューへの導線 */
.works-interview {
    margin-top: 64px;

    h5 {
        font-size: 22px;
        font-weight: 500;
        margin-bottom: 16px;
    }

    a {
        display: flex;
        gap: 24px;
        align-items: center;
        border: 1px solid var(--voice-line);
        border-radius: 4px;
        padding: 20px;
        color: inherit;
        text-decoration: none;
        transition: opacity 0.3s;

        &:hover,
        &:focus-visible {
            opacity: 0.6;
        }
    }

    img {
        flex: none;
        width: 240px;
        aspect-ratio: 16 / 10;
        object-fit: cover;
        border-radius: 4px;
    }

    .works-interview-title {
        font-size: 18px;
        font-weight: 600;
        line-height: 1.6;
    }

    .works-interview-more {
        color: var(--color-main);
        font-weight: 500;
        margin-top: 12px;
    }

    @media screen and (max-width: 768px) {
        a {
            flex-direction: column;
            align-items: stretch;
            gap: 16px;
        }

        img {
            width: 100%;
        }

        .works-interview-title {
            font-size: 1rem;
        }
    }
}
