/* ========================================
   AITOLIE - Service Section
   Horizontal Cards with Dark Luxury Theme
   ======================================== */

/* Gold color palette */
.service {
    --gold-light: #E8D5A3;
    --gold: #C9A962;
    --gold-dark: #A68B3D;
}

.service {
    padding: 120px 0;
    background: linear-gradient(180deg, #0A0A0A 0%, #0F0F0F 50%, #0A0A0A 100%);
    position: relative;
    overflow: hidden;
}

/* Animated Background Text */
.service__bg-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-5deg);
    width: 200%;
    /* 画面幅より広くして切れ目をなくす */
    display: flex;
    pointer-events: none;
    z-index: 0;
    opacity: 0.05;
    /* かなり薄く */
    user-select: none;
}

.service__bg-text-row {
    display: flex;
    white-space: nowrap;
    animation: serviceTextScroll 30s linear infinite;
}

.service__bg-text span {
    font-size: 20vw;
    /* ビューポート幅に応じた巨大文字 */
    font-weight: 900;
    line-height: 1;
    font-family: 'Inter', sans-serif;
    color: transparent;
    -webkit-text-stroke: 2px var(--gold);
    padding-right: 4vw;
}

@keyframes serviceTextScroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Header */
.service__header {
    text-align: center;
    margin-bottom: 80px;
    position: relative;
    z-index: 1;
    /* 背景文字より上に */
}

.service__label {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 16px;
    padding: 8px 20px;
    border: 1px solid rgba(201, 169, 98, 0.3);
    border-radius: 20px;
}

.service__title {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 20px;
    letter-spacing: 0.05em;
}

.service__lead {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.8;
}

/* Cards Container - Single Column Centered */
.service__cards {
    display: flex;
    flex-direction: column;
    gap: 80px;
    max-width: 900px;
    /* カード幅を適切に制限 */
    margin: 0 auto;
    position: relative;
    padding: 0 20px;
    z-index: 1;
    /* 背景文字より上に */
}

/* Cards Stack - Vertical layout */
.service__card-stack {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 80px;
    /* カード間隔を広げて画像スペース確保 */
    position: relative;
    z-index: 2;
    /* パーティクルより前面に */
}

/* Responsive */
@media (max-width: 1024px) {
    .service__cards {
        max-width: 100%;
        padding: 0 40px;
    }
}

@media (max-width: 768px) {
    .service__cards {
        padding: 0 20px;
        gap: 60px;
    }

    .service__card-wrapper {
        height: auto;
        min-height: 350px;
    }

    .service__card-front {
        flex-direction: column;
    }

    .service__card-number {
        width: 100%;
        min-width: auto;
        height: 80px;
        border-right: none;
        border-bottom: 1px solid rgba(201, 169, 98, 0.2);
        font-size: 48px;
    }

    .service__card-content {
        padding: 24px;
    }

    .service__card-front::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: auto;
        width: 100%;
        height: 3px;
        background: linear-gradient(90deg, var(--gold) 0%, var(--gold-dark) 100%);
    }

    .service__back-content {
        flex-direction: column;
        gap: 24px;
    }

    .service__back-list {
        grid-template-columns: 1fr;
    }

    /* モバイルでの画像位置調整 */
    .service__card-bg-image {
        opacity: 0.4;
        width: 90%;
        /* 画面内に収まるように */
        max-width: 350px;
        height: auto;
        aspect-ratio: 4/3;
    }

    /* 背景文字のスマホ調整 */
    .service__bg-text {
        width: 400%;
        /* ループの切れ目が見えないように長く */
        transform: translate(-50%, -50%) rotate(-10deg);
        /* 角度を少しきつく */
    }

    .service__bg-text span {
        font-size: 25vw;
        -webkit-text-stroke: 1px var(--gold);
        padding-right: 8vw;
    }

    /* カード内テキスト調整：さらにコンパクト化 */
    .service__card-title {
        font-size: 20px;
        margin-bottom: 4px;
    }

    .service__card-desc {
        font-size: 12px;
        line-height: 1.5;
        margin-bottom: 8px;
    }

    .service__ai-tag {
        font-size: 10px;
        padding: 4px 10px;
        margin-bottom: 8px;
    }

    /* 裏面の調整：パディング大幅削減 */
    .service__back-content {
        padding: 0;
        gap: 20px;
    }

    .service__card-back {
        padding: 24px 16px;
        /* 裏面の左右パディングも削減 */
    }

    .service__back-number {
        display: none;
    }

    .service__back-title {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .service__back-list {
        gap: 8px;
    }

    .service__back-list li {
        font-size: 11px;
        /* リスト文字縮小 */
    }

    .service__back-cta {
        padding: 12px 24px;
        font-size: 11px;
    }
}

.service__card-wrapper {
    perspective: 2000px;
    height: 260px;
    position: relative;
    /* 画像の基準点 */
}

/* 背景画像コンテナ */
.service__card-bg-image {
    position: absolute;
    z-index: -2;
    /* カードより確実に後ろへ */
    width: 400px;
    height: 300px;
    /* サイズアップ */
    border-radius: 8px;
    overflow: hidden;
    opacity: 0.8;
    /* 視認性を上げる */
    filter: grayscale(100%) contrast(1.1);
    transition: all 0.6s ease-out;
    pointer-events: none;
}

.service__card-bg-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    /* 画像自体の透明度も調整 */
}

/* 各画像の個別の位置調整 - より大胆にはみ出させる */
/* 1つ目: 左上 */
.service__card-wrapper:nth-child(1) .service__card-bg-image {
    top: -100px;
    left: -150px;
    width: 450px;
    height: 320px;
}

/* 2つ目: 右上 */
.service__card-wrapper:nth-child(2) .service__card-bg-image.card-bg-2 {
    top: -80px;
    right: -120px;
    width: 400px;
    height: 300px;
}

/* 3つ目: 左下 */
.service__card-wrapper:nth-child(3) .service__card-bg-image.card-bg-3 {
    bottom: -80px;
    left: -120px;
    width: 420px;
    height: 300px;
}

/* ホバー時の動き */
.service__card-wrapper:hover .service__card-bg-image {
    opacity: 1;
    transform: scale(1.05);
    filter: grayscale(0%);
    z-index: -1;
}

/* Card Container - Flips on hover */
.service__card {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    cursor: pointer;
}

@media (hover: hover) {
    .service__card-wrapper:hover .service__card {
        transform: rotateX(-180deg);
    }
}

.service__card-wrapper.is-flipped .service__card {
    transform: rotateX(-180deg);
}

/* Front & Back shared styles */
.service__card-front,
.service__card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
}

/* ========== FRONT SIDE - Horizontal Layout ========== */
.service__card-front {
    display: flex;
    background: rgba(15, 15, 15, 0.9);
    border: 1px solid rgba(201, 169, 98, 0.15);
    backdrop-filter: blur(20px);
}

/* Large Number Section */
.service__card-number {
    width: 140px;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(201, 169, 98, 0.1) 0%, rgba(201, 169, 98, 0.02) 100%);
    border-right: 1px solid rgba(201, 169, 98, 0.2);
    font-size: 72px;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 30px rgba(201, 169, 98, 0.3);
    font-family: 'Inter', sans-serif;
}

/* Content Section */
.service__card-content {
    flex: 1;
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* AI Tag - The impact line */
.service__ai-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--gold);
    background: rgba(201, 169, 98, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
    align-self: flex-start;
}

/* Card Title */
.service__card-title {
    font-size: 28px;
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

/* Catch Copy - One liner */
.service__card-catch {
    font-size: 15px;
    font-weight: 500;
    color: var(--gold-light);
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}

/* Description */
.service__card-desc {
    font-size: 14px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 12px;
}

/* Target Examples */
.service__target {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.05em;
}

/* CTA hint */
.service__card-cta {
    position: absolute;
    bottom: 20px;
    right: 30px;
    font-size: 11px;
    color: var(--gold);
    letter-spacing: 0.1em;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.service__card-wrapper:hover .service__card-cta {
    opacity: 0;
}

/* Gold accent line on left */
.service__card-front::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
}

/* ========== BACK SIDE ========== */
.service__card-back {
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.12) 0%, rgba(15, 15, 15, 0.98) 60%);
    border: 1px solid var(--gold);
    transform: rotateX(180deg);
    display: flex;
    align-items: center;
    padding: 40px 60px;
}

.service__back-number {
    width: 100px;
    min-width: 100px;
    font-size: 56px;
    font-weight: 700;
    color: var(--gold);
    opacity: 0.3;
    text-align: center;
}

.service__back-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 60px;
}

.service__back-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gold-light);
    margin-bottom: 20px;
    letter-spacing: 0.1em;
}

.service__back-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
}

.service__back-list li {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 8px;
}

.service__back-list li::before {
    content: '✓';
    color: var(--gold);
    font-size: 12px;
}

/* Back CTA Button */
.service__back-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.15em;
    color: #FFFFFF;
    background: transparent;
    border: 1px solid var(--gold);
    padding: 16px 32px;
    border-radius: 30px;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.service__back-cta:hover {
    background: var(--gold);
    color: #000000;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(201, 169, 98, 0.4);
}

/* Secondary button variation for View Works */
.service__back-cta--secondary {
    background: rgba(201, 169, 98, 0.05);
    border: 1px solid rgba(201, 169, 98, 0.4);
    margin-bottom: 12px;
}

.service__back-cta--secondary:hover {
    background: rgba(201, 169, 98, 0.15);
    border-color: var(--gold);
    color: var(--gold-light);
    transform: scale(1.05);
}


/* Hover glow effect */
.service__card-wrapper:hover .service__card-front {
    box-shadow: 0 10px 40px rgba(201, 169, 98, 0.15);
}

/* Entrance Animation */
.service__card-wrapper {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.service__card-wrapper.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.service__card-wrapper:nth-child(1).is-visible {
    transition-delay: 0s;
}

.service__card-wrapper:nth-child(2).is-visible {
    transition-delay: 0.15s;
}

.service__card-wrapper:nth-child(3).is-visible {
    transition-delay: 0.3s;
}

/* Responsive */

/* Service Decor Image */
.service__bg-decor-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.service__bg-decor-img {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 60vw;
    height: auto;
    opacity: 0.15;
    mix-blend-mode: color-dodge;
    filter: blur(2px);
    transform: rotate(15deg);
}

@media (max-width: 768px) {
    .service__bg-decor-img {
        width: 120vw;
        left: -30%;
        top: 0;
    }
}

/* ========== Mobile Refinements (CTA & Sizing) ========== */
/* CTA Text Switching */
.service__cta-sp {
    display: none;
}

@media (max-width: 768px) {
    .service__cta-pc {
        display: none;
    }

    .service__cta-sp {
        display: block;
    }

    /* Fix Back Card Overrides */
    .service__card-wrapper {
        min-height: 480px;
        /* Increase height to fit content */
    }

    .service__card-back {
        padding: 32px 20px;
        flex-direction: column;
        justify-content: flex-start;
        /* Start from top */
    }

    .service__back-content {
        padding: 0;
        gap: 24px;
        width: 100%;
        flex-direction: column;
        /* Stack list and button */
    }

    .service__back-list {
        grid-template-columns: 1fr;
        gap: 8px;
        /* Tighter gap */
        width: 100%;
    }

    .service__back-list li {
        font-size: 13px;
        line-height: 1.5;
        padding-bottom: 4px;
        border-bottom: 1px dotted rgba(255, 255, 255, 0.1);
        /* Optional guide */
    }

    .service__back-number {
        display: none;
    }

    .service__back-title {
        font-size: 16px;
        margin-bottom: 16px;
        text-align: center;
        width: 100%;
        border-bottom: 1px solid var(--gold);
        padding-bottom: 8px;
    }

    .service__back-cta {
        padding: 14px 0;
        font-size: 14px;
        width: 100%;
        max-width: 100%;
        margin-top: 8px;
        background: rgba(201, 169, 98, 0.1);
        /* Make it more clickable area style */
    }
}

/* Small Mobile Adjustments (<480px) */
@media (max-width: 480px) {
    .service__card-title {
        font-size: 20px;
        line-height: 1.4;
    }

    .service__card-desc {
        font-size: 12px;
        line-height: 1.6;
    }

    .service__card-content {
        padding: 20px 16px;
    }

    .service__card-number {
        height: 60px;
        font-size: 40px;
    }

    /* Ensure background image doesn't overflow */
    .service__card-bg-image {
        width: 100%;
        max-width: 100%;
        left: 0 !important;
        right: 0 !important;
    }
}