/* ============================================================
   Challenge Section (Modern Bento Layout)
   - Uses scoped class names (.challenge-bento / .cb-*) to avoid
     conflicts with legacy .challenge-* rules in style.css.
   ============================================================ */

.challenge-bento {
    --c-primary: #ff6900;
    --c-primary-light: #ff9540;
    --c-peach: #FFD9C7;
    --c-peach-soft: #FFF5EE;
    --c-text: #111111;
    --c-text-sub: #5A5F6B;
    --c-border: rgba(17, 17, 17, 0.08);
    --c-shadow: 0 1px 2px rgba(17, 17, 17, 0.04), 0 8px 24px rgba(17, 17, 17, 0.06);
    --c-shadow-hover: 0 4px 12px rgba(255, 105, 0, 0.08), 0 16px 40px rgba(17, 17, 17, 0.10);
    --cb-radius: 20px;
    --cb-radius-inner: 16px;
    --cb-issue-bg: #f8f9fb;
    --cb-solution-bg: linear-gradient(165deg, #fff9f5 0%, var(--c-peach-soft) 100%);

    box-sizing: border-box;
    /* Top padding is 0 — bridge controls its own top space via margin-top
       so the connector line is perfectly symmetric to the bottom. */
    padding: 0 clamp(20px, 5vw, 40px) clamp(64px, 8vw, 120px);
    background: linear-gradient(180deg, #ffffff 0%, #FFF9F5 100%);
    color: var(--c-text);
    position: relative;
    overflow: visible;
}

/* Removed: single line that overlapped with statement text.
   Replaced by two split connectors on .cb-bridge (before/after). */


.challenge-bento *,
.challenge-bento *::before,
.challenge-bento *::after {
    box-sizing: border-box;
}

/* ============================================================
   Bridge — manifesto between Hero and Challenge head
   with split vertical connectors (before/after text block).
   ============================================================ */
.cb-bridge {
    /* Both top & bottom connectors share the same length for visual symmetry.
       Margin-top = margin-bottom = (gap + line-height + gap), so:
       - Above bridge: gap → top-dot → line → bottom-dot → gap → text
       - Below bridge: text → gap → top-dot → line → bottom-dot → gap → next section
       Perfectly mirrored. */
    --connector-h: clamp(64px, 8vw, 112px);
    --connector-gap: clamp(20px, 2.5vw, 32px);
    --connector-total: calc(var(--connector-h) + var(--connector-gap) * 2);

    max-width: 880px;
    margin: var(--connector-total) auto var(--connector-total);
    padding-top: 0;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* Top connector — emerges from Hero, dots at both endpoints */
.cb-bridge::before {
    content: "";
    position: absolute;
    top: calc(-1 * (var(--connector-h) + var(--connector-gap)));
    height: var(--connector-h);
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    background-color: transparent;
    background-image:
        radial-gradient(circle at 50% 50%, var(--c-primary) 3.2px, transparent 3.6px),
        radial-gradient(circle at 50% 50%, var(--c-primary) 3.2px, transparent 3.6px),
        linear-gradient(var(--c-primary), var(--c-primary));
    background-position: center top, center bottom, center center;
    background-size: 10px 10px, 10px 10px, 1px 100%;
    background-repeat: no-repeat, no-repeat, no-repeat;
    pointer-events: none;
    z-index: 0;
}

/* Bottom connector — mirror of top, dots at both endpoints */
.cb-bridge::after {
    content: "";
    position: absolute;
    top: calc(100% + var(--connector-gap));
    height: var(--connector-h);
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    background-color: transparent;
    background-image:
        radial-gradient(circle at 50% 50%, var(--c-primary) 3.2px, transparent 3.6px),
        radial-gradient(circle at 50% 50%, var(--c-primary) 3.2px, transparent 3.6px),
        linear-gradient(var(--c-primary), var(--c-primary));
    background-position: center top, center bottom, center center;
    background-size: 10px 10px, 10px 10px, 1px 100%;
    background-repeat: no-repeat, no-repeat, no-repeat;
    pointer-events: none;
    z-index: 0;
}

.cb-head,
.cb-grid {
    position: relative;
    z-index: 1;
}

/* Overline: rule — label — rule */
.cb-bridge__overline {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: clamp(12px, 1.4vw, 18px);
    color: var(--c-primary);
}

.cb-bridge__rule {
    display: inline-block;
    width: clamp(32px, 5vw, 56px);
    height: 1px;
    background: currentColor;
}

.cb-bridge__label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.24em;
    line-height: 1;
}

/* Manifesto statement — mesh gradient backdrop (concept: two touchpoints
   converging into one growing relationship).
   Shadow toned down so it doesn't compete with CTA cards / hub pills.
   セマンティクスは <p>（見た目は従来どおり）。 */
.cb-bridge__statement {
    display: block;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto clamp(14px, 1.6vw, 20px);
    padding: clamp(22px, 2.6vw, 36px) clamp(32px, 5vw, 64px);
    border-radius: clamp(20px, 3vw, 36px);
    background:
        radial-gradient(ellipse 60% 80% at 18% 22%, rgba(255, 105, 0, 0.14), transparent 60%),
        radial-gradient(ellipse 60% 80% at 82% 78%, rgba(255, 162, 95, 0.18), transparent 60%),
        radial-gradient(circle at 50% 50%, rgba(255, 247, 235, 0.65) 0%, rgba(255, 247, 235, 0) 75%);
    box-shadow:
        0 12px 32px rgba(255, 105, 0, 0.06),
        0 4px 12px rgba(17, 17, 17, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    font-size: clamp(28px, 4.4vw, 48px);
    font-weight: 900;
    line-height: 1.18;
    letter-spacing: -0.02em;
    color: var(--c-text);
    text-align: center;
    position: relative;
}

.cb-bridge__statement span {
    display: block;
}

.cb-bridge__statement span + span {
    margin-top: 4px;
}

.cb-bridge__statement span:last-child {
    color: var(--c-primary);
}

/* ============================================================
   Modern reveal sequence for the bridge manifesto.
   Triggered when the shared [data-reveal] observer adds .is-revealed.

   Flow:
     1. OUR APPROACH overline   (0s)
     2. 接点を、つなぐ。         (0.2s — left-to-right wipe + fade-up)
     3. 関係を、育てる。         (0.5s — left-to-right wipe + fade-up)
     4. caption                  (0.85s — fade-in)

   GPU-friendly (clip-path, opacity, transform only). No JS overhead — the
   shared single IntersectionObserver in new_top.html handles the trigger.
   ============================================================ */

/* Override the default [data-reveal] base — the bridge itself shouldn't move;
   only its children get individual animations. */
.cb-bridge[data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

/* Overline + caption: subtle fade only */
.cb-bridge[data-reveal] .cb-bridge__overline,
.cb-bridge[data-reveal] .cb-bridge__caption {
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.cb-bridge[data-reveal].is-revealed .cb-bridge__overline {
    opacity: 1;
}

.cb-bridge[data-reveal].is-revealed .cb-bridge__caption {
    opacity: 1;
    transition-delay: 0.85s;
}

/* Manifesto lines: left-to-right clip-path wipe + soft fade-up */
.cb-bridge[data-reveal] .cb-bridge__statement span {
    opacity: 0;
    transform: translateY(14px);
    clip-path: inset(0 100% 0 0);
    transition:
        opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.7s cubic-bezier(0.4, 0, 0.2, 1),
        clip-path 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.cb-bridge[data-reveal].is-revealed .cb-bridge__statement span {
    opacity: 1;
    transform: translateY(0);
    clip-path: inset(0 0 0 0);
}

.cb-bridge[data-reveal].is-revealed .cb-bridge__statement span:nth-child(1) {
    transition-delay: 0.2s;
}

.cb-bridge[data-reveal].is-revealed .cb-bridge__statement span:nth-child(2) {
    transition-delay: 0.5s;
}

@media (prefers-reduced-motion: reduce) {
    .cb-bridge[data-reveal] .cb-bridge__overline,
    .cb-bridge[data-reveal] .cb-bridge__caption,
    .cb-bridge[data-reveal] .cb-bridge__statement,
    .cb-bridge[data-reveal] .cb-bridge__statement span {
        opacity: 1;
        transform: none;
        clip-path: inset(0 0 0 0);
        transition: none;
    }
}

/* Supporting caption */
.cb-bridge__caption {
    margin: 0 auto;
    max-width: 560px;
    font-size: clamp(13px, 1.4vw, 15px);
    line-height: 1.75;
    color: var(--c-text-sub);
    font-weight: 500;
}

/* ---- Header block ---- */
.cb-head {
    max-width: var(--lp-section-head-max, min(880px, 100%));
    margin: 0 auto clamp(40px, 6vw, 72px);
    text-align: center;
    position: relative;
}

.cb-head__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto 16px;
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--c-peach-soft);
    color: var(--c-primary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.cb-head__eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-primary);
}

.cb-head__title {
    margin: 0 0 20px;
    font-size: clamp(24px, 3.2vw, 38px);
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.cb-head__desc {
    margin: 0;
    font-size: clamp(14px, 1.4vw, 16px);
    line-height: 1.85;
    color: var(--c-text-sub);
}

/* ---- Grid ---- */
.cb-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: min(var(--lp-content-max, 1200px), 100%);
    margin: 0 auto;
    align-items: stretch;
}

/* ---- Card ---- */
.cb-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--cb-radius);
    box-shadow: var(--c-shadow);
    overflow: hidden;
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cb-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.cb-card:hover {
    border-color: rgba(255, 105, 0, 0.28);
    box-shadow: var(--c-shadow-hover);
    transform: translateY(-4px);
}

/* ---- Hero band — badge + title row at top, image below ---- */
.cb-card__hero {
    background: #fff;
    display: flex;
    flex-direction: column;
}

.cb-card__hero-head {
    display: flex;
    align-items: center;
    gap: clamp(12px, 1.4vw, 16px);
    padding: clamp(18px, 2vw, 24px) clamp(20px, 2.4vw, 26px) clamp(14px, 1.6vw, 18px);
}

.cb-card__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--c-primary-light) 0%, var(--c-primary) 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.06em;
    box-shadow:
        0 4px 14px rgba(255, 105, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.cb-card__hero-title {
    flex: 1 1 auto;
    min-width: 0;
}

/* Tiny neutral eyebrow that labels this side of the card as "the problem" */
.cb-card__issue-label {
    display: inline-block;
    align-self: flex-start;
    padding: 3px 10px;
    background: rgba(17, 17, 17, 0.05);
    border: 1px solid rgba(17, 17, 17, 0.06);
    color: var(--c-text-sub);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1.5;
}

.cb-card__hero-head .cb-card__issue-title {
    margin: 0;
    font-size: clamp(16px, 1.55vw, 19px);
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: -0.005em;
    color: var(--c-text);
}

.cb-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: transparent;
}

.cb-card__icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ---- Issue text area — 課題ラベル + 説明文 ---- */
.cb-card__issue {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: clamp(18px, 2.2vw, 24px) clamp(22px, 2.6vw, 28px) clamp(16px, 2vw, 22px);
    background: var(--cb-issue-bg);
    border-top: 1px solid var(--c-border);
}

.cb-card__issue-desc {
    margin: 0;
    width: 100%;
    font-size: clamp(13px, 1.25vw, 14px);
    line-height: 1.8;
    color: var(--c-text-sub);
}

/* ---- Solution half ---- */
.cb-card__solution {
    position: relative;
    margin: 0;
    padding: clamp(20px, 2.2vw, 26px) clamp(22px, 2.6vw, 28px) clamp(20px, 2.2vw, 24px);
    background: var(--cb-solution-bg);
    border-radius: 0;
    border-top: 3px solid var(--c-primary);
    border-left: none;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

/* "私たちの解決策" — 課題ラベルと同位置 */
.cb-card__solution-label {
    display: inline-block;
    align-self: flex-start;
    padding: 3px 10px;
    background: rgba(255, 105, 0, 0.1);
    border: 1px solid rgba(255, 105, 0, 0.16);
    color: var(--c-primary);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: none;
    line-height: 1.5;
    max-width: 100%;
}

.cb-card__solution-title {
    margin: 0;
    font-size: clamp(15px, 1.45vw, 17px);
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: -0.01em;
    color: var(--c-text);
}

.cb-card__solution-desc {
    margin: 0;
    font-size: clamp(13px, 1.25vw, 14px);
    line-height: 1.8;
    color: var(--c-text-sub);
    flex-grow: 1;
}

/* ---- Responsive ---- */
/* tablet: 2 列 + 1 枚 orphan だと 3 枚目が「孤立して細い」と感じられるため、
   モバイルと同じく単列スタックへ。max-width で iPad 縦の icon 巨大化を抑制。 */
@media (max-width: 1023px) {
    .cb-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: min(720px, 100%);
        margin-left: auto;
        margin-right: auto;
    }
    .cb-card:nth-child(3) {
        grid-column: auto;
        width: auto;
        max-width: none;
        margin-inline: 0;
    }
}

@media (max-width: 1023px) {
    /* 課題カードは縦長のため tablet 以下は先頭2件＋展開 */
    .cb-grid--collapsible:not(.is-expanded) .cb-card--extra {
        display: none !important;
    }
    .challenge-bento .cb-grid__toggle.lp-disclosure-toggle {
        max-width: min(720px, 100%);
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 767px) {
    .challenge-bento {
        /* ブリッジ非表示分、Hero 直下の課題セクション用に上余白を確保 */
        padding: clamp(40px, 10vw, 56px) 16px 64px;
    }

    .cb-head__title {
        font-size: clamp(24px, 6vw, 32px);
        line-height: 1.35;
    }

    /* モバイル: マニフェストブリッジは表示しない */
    .cb-bridge {
        display: none !important;
    }
    .cb-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .cb-card:nth-child(3) {
        grid-column: auto;
        max-width: none;
    }
    .cb-card__hero-head {
        gap: 12px;
        padding: 16px 18px 14px;
    }
    .cb-card__num {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        font-size: 13px;
    }
    .cb-card__hero-head .cb-card__issue-title {
        font-size: 15px;
    }
    .cb-card__icon {
        aspect-ratio: 1 / 1;
    }
    .cb-card__issue {
        padding: 16px 18px 14px;
    }
    .cb-card__solution {
        padding: 18px 18px 18px;
        gap: 10px;
    }
    .cb-card {
        --cb-radius: 16px;
        border-radius: var(--cb-radius);
    }
}

@media (min-width: 1024px) {
    /* 03 は .cb-card--extra だが、revert すると display:grid/subgrid が外れるため指定しない
       （tablet 以下の display:none は 1023px 以下のメディアクエリ内のみ） */

    /* PC: 3列 — 解決策ブロックの高さを横並びで揃える（subgrid） */
    .cb-grid {
        gap: var(--lp-grid-gap, 28px);
        max-width: min(var(--lp-content-max, 1200px), 100%);
        grid-template-rows: auto auto 1fr;
        align-items: stretch;
    }

    .cb-card {
        display: grid;
        grid-template-rows: subgrid;
        grid-row: span 3;
        min-height: 0;
        height: auto;
        align-self: stretch;
        --cb-radius: 22px;
        border-radius: var(--cb-radius);
    }

    .cb-card__solution {
        flex-grow: 0;
        display: flex;
        flex-direction: column;
        min-height: 100%;
        height: 100%;
        box-sizing: border-box;
        padding: 24px 28px 26px;
        gap: 14px;
    }

    .cb-card__solution-title {
        font-size: 17px;
    }

    .cb-card__solution-desc {
        flex: 1 1 auto;
        margin-bottom: 0;
    }
}

/* subgrid 非対応ブラウザ: カード高さを揃えて解決策を flex で伸ばす */
@supports not (grid-template-rows: subgrid) {
    @media (min-width: 1024px) {
        .cb-grid {
            grid-template-rows: none;
        }

        .cb-card,
        .challenge-bento .cb-card--extra {
            display: flex;
            flex-direction: column;
            grid-template-rows: unset;
            grid-row: auto;
            height: 100%;
        }

        .cb-card__solution {
            flex: 1 1 auto;
            min-height: 0;
            height: auto;
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .cb-card {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .cb-card:hover {
        transform: none;
    }
}
