/* Modern Organic Library Style - Refined Final Version */

:root {
    --base-color: #fdfdfb;
    --text-main: #2c3e50;
    --text-sub: #576574;
    --accent-blue: #5d8aa8;
    --accent-rose: #c06c84;
    --accent-gold: #d4a373;
    --border-color: #e8e8e1;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --font-title: 'Montserrat', sans-serif;
    --font-body: 'Noto Sans JP', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--base-color);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Shapes */
.background-container {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.morph-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    mix-blend-mode: multiply;
    animation: morph 20s infinite alternate;
}

.shape-1 {
    width: 60vw;
    height: 60vw;
    top: -10%;
    left: -10%;
    background: radial-gradient(circle, var(--accent-blue), transparent 70%);
}

.shape-2 {
    width: 50vw;
    height: 50vw;
    bottom: -10%;
    right: -10%;
    background: radial-gradient(circle, var(--accent-rose), transparent 70%);
    animation-delay: -5s;
}

@keyframes morph {
    0% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
        transform: rotate(0deg);
    }

    50% {
        border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;
        transform: rotate(180deg);
    }

    100% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
        transform: rotate(360deg);
    }
}

/* Header */
.main-header {
    text-align: center;
    padding: 6rem 1rem 3rem;
}

.main-title {
    font-family: var(--font-title);
    font-size: 2.5rem;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-sub);
    letter-spacing: 0.1em;
}

/* Process Container */
.process-container {
    display: flex;
    justify-content: center;
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    align-items: stretch;
}

/* Connectors */
.connector-line {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 0;
}

@media (min-width: 901px) {
    .connector-line {
        flex: 0 0 100px;
        height: 100px;
        margin: auto 0;
    }
}

@media (max-width: 900px) {
    .connector-line {
        width: 100%;
        height: 80px;
        margin: 1rem 0;
    }
}

.connection-path-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 2;
}

.connection-path-flow {
    fill: none;
    stroke: var(--accent-blue);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 20, 100;
    filter: drop-shadow(0 0 5px var(--accent-blue));
    opacity: 0;
    transition: opacity 0.5s;
}

.connector-line.active .connection-path-flow {
    opacity: 1;
    animation: flow-animation 2s linear infinite;
}

@keyframes flow-animation {
    0% {
        stroke-dashoffset: 120;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

/* Cards */
.step-card {
    flex: 1;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: transform 0.4s, box-shadow 0.4s;
    position: relative;
    z-index: 1;
    overflow: hidden;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
}

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

.step-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
}

.card-top-line {
    height: 8px;
    width: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-rose));
}

.step-content {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
}

.step-header-group {
    min-height: 110px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.visual-area {
    width: 100%;
    height: 180px;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 8px;
    margin: 1.5rem 0;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
}

.step-text-group {
    min-height: 180px;
    text-align: left;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.step-number {
    font-family: var(--font-title);
    font-size: 0.9rem;
    color: var(--accent-gold);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.step-title {
    font-family: var(--font-title);
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.step-japanese {
    font-size: 0.9rem;
    color: var(--text-sub);
}

/* Note Style Restoration - CRITICAL */
.note {
    font-size: 0.8rem !important;
    color: var(--accent-blue) !important;
    opacity: 0.8;
    font-weight: 500;
    margin-top: auto;
    padding-top: 1rem;
}

.catch-copy {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.description {
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

/* STEP 1: Pulse */
.pulse-container {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--accent-blue);
    border-radius: 50%;
    opacity: 0.3;
}

.step-card.visible .pulse-circle {
    animation: pulse-radar 2s ease-out infinite;
}

.pulse-circle.delay-1 {
    animation-delay: 1s;
}

.mic-icon-modern {
    position: relative;
    z-index: 2;
    width: 50px;
    height: 50px;
    background: var(--accent-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(93, 138, 168, 0.4);
}

.icon-svg-white {
    width: 24px;
    height: 24px;
    color: white;
}

@keyframes pulse-radar {
    0% {
        transform: scale(0.8);
        opacity: 0.6;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* STEP 2: Conversion */
.conversion-bridge {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    overflow: visible;
}

.process-core {
    width: 60px;
    height: 60px;
    background: white;
    border: 2px solid var(--accent-blue);
    border-radius: 12px;
    transform: rotate(45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.core-box {
    width: 30px;
    height: 30px;
    background: var(--accent-blue);
    border-radius: 4px;
    animation: core-rotate 4s linear infinite;
}

@keyframes core-rotate {
    0% {
        transform: rotate(0deg) scale(0.8);
    }

    50% {
        transform: rotate(180deg) scale(1.1);
    }

    100% {
        transform: rotate(360deg) scale(0.8);
    }
}

.p-data,
.p-thread {
    width: 8px;
    height: 8px;
    position: absolute;
    border-radius: 2px;
}

.p-data {
    background: var(--accent-rose);
    left: -50px;
}

.p-thread {
    background: var(--accent-gold);
    right: -50px;
    border-radius: 50% 50% 0 0;
    width: 2px;
    height: 12px;
}

.step-card.visible .p-data {
    animation: flow-in 1.5s linear infinite;
}

.step-card.visible .p-thread {
    animation: flow-out 1.5s linear infinite;
}

@keyframes flow-in {
    0% {
        transform: translate(-100px, -20px);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translate(0, 0);
        opacity: 0;
    }
}

@keyframes flow-out {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translate(100px, 20px) rotate(45deg);
        opacity: 0;
    }
}

/* --- STEP 3: Perfectly Synchronized Horizontal Sewing --- */
.sewing-machine-visual {
    width: 100%;
    height: 100%;
    position: relative;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stitch-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.horizontal-stitch-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.horizontal-stitch-line {
    fill: none;
    stroke: var(--accent-gold);
    stroke-width: 4;
    stroke-linecap: round;
    /* ステッチの角丸 */
    stroke-dasharray: 8 12;
    /* ステッチ8px, 間隔12px */
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
    /* 糸の立体感 */
}

/* 針と完全に同期した流れ */
.step-card.visible .horizontal-stitch-line {
    animation: stitch-flow 0.4s linear infinite;
    /* 針の 0.4s と一致させる */
}

@keyframes stitch-flow {
    from {
        stroke-dashoffset: 0;
    }

    to {
        stroke-dashoffset: -20;
    }

    /* 負の値に設定して「左へ流れる」ように修正 */
}

.sewing-needle-group {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 10;
    pointer-events: none;
}

.sewing-needle {
    width: 3px;
    height: 40px;
    background: linear-gradient(to bottom, #bdc3c7, #2c3e50);
    border-radius: 2px;
    transform: translate(-50%, -100%);
}

/* 0.4s loop: 0.2s down (stitching), 0.2s up */
.step-card.visible .sewing-needle {
    animation: final-needle-action 0.4s infinite alternate ease-in-out;
}

@keyframes final-needle-action {
    0% {
        transform: translate(-50%, -100%);
    }

    /* 針が上 */
    100% {
        transform: translate(-50%, 0%);
    }

    /* 針が刺さる */
}

/* Tech/Footer */
.tech-experience-section {
    padding: 6rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.tech-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.tech-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.tech-desc {
    font-size: 1rem;
    line-height: 1.9;
    color: var(--text-sub);
}

.visual-circle {
    position: relative;
    width: 300px;
    height: 300px;
}

.circle-wave {
    position: absolute;
    inset: 0;
    border: 1px solid var(--accent-rose);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    animation: morph 15s linear infinite;
    mix-blend-mode: multiply;
    /* 有機的な重なりのためのブレンド */
    opacity: 0.4;
    background: radial-gradient(circle at center, rgba(192, 108, 132, 0.1), transparent 70%);
}

.circle-wave.delay-1 {
    animation-delay: -5s;
    border-color: var(--accent-blue);
    background: radial-gradient(circle at center, rgba(93, 138, 168, 0.1), transparent 70%);
}

.circle-wave.delay-2 {
    animation-delay: -10s;
    border-color: var(--accent-gold);
    background: radial-gradient(circle at center, rgba(212, 163, 115, 0.1), transparent 70%);
}

.main-footer {
    text-align: center;
    padding: 6rem 1rem;
}

.cta-link-button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, var(--accent-rose), #a05066);
    color: white;
    text-decoration: none;
    padding: 1.5rem 4rem;
    border-radius: 60px;
    box-shadow: 0 10px 25px rgba(192, 108, 132, 0.4);
    transition: all 0.4s;
}

.cta-link-button:hover {
    transform: translateY(-8px) scale(1.02);
}

.cta-main {
    font-family: var(--font-title);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    margin-bottom: 0.4rem;
}

.cta-sub {
    font-size: 0.85rem;
    opacity: 0.9;
}

@media (max-width: 900px) {
    .process-container {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
    }

    .tech-grid {
        grid-template-columns: 1fr;
    }

    .cta-link-button {
        padding: 1.5rem 2rem;
        width: 90%;
    }
}