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

html, body {
    height: 100%; /* body가 뷰포트 전체 높이를 차지하도록 */
    /* overflow: hidden; 제거됨 - 스크롤 허용 */
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: #000000;
    background-image: url('img/bg.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* 배경 이미지가 스크롤과 함께 움직이지 않도록 고정 */
    color: #fff;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    
    /* 핵심 변경: body의 자식 요소들을 수평 중앙 정렬 */
    align-items: center; 
}




/* 헤더 */
.main-header {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
}

.main-title-img {
    max-width: 400px;
    width: 70%;
    height: auto;
    display: block;
    margin: 0 auto; /* 이미 중앙 정렬되어 있지만, 혹시 모를 경우를 대비해 유지 */
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.7));
}

/* 메인 콘텐츠 영역 */
.pasta-selection {
    width: 100%;
    text-align: center;
    padding: 0;
    margin-bottom: 0;
}

.pasta-selection h2 {
    font-family: 'Playball', cursive;
    font-size: 2em;
    color: #ffd700;
    margin-bottom: 20px;
}

/* 파스타 그리드 */
.pasta-grid {
    display: grid;
    /* auto-fit과 minmax를 사용하여 유동적인 열 개수와 카드 크기 유지 */
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* 최소 너비 유지 */
    gap: 15px; /* 그리드 아이템 간 간격 유지 */
    justify-content: center; /* 그리드 아이템들을 수평 중앙 정렬 */
    width: 100%;
    max-width: 750px; /* 그리드 자체의 최대 너비 유지 */
    margin: 0 auto; /* 그리드 자체를 컨테이너 내에서 중앙 정렬 */
}

.pasta-item {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* 이미지와 텍스트를 카드 내에서 중앙 정렬 */
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    aspect-ratio: 1 / 1; /* 정사각형 비율 유지 */
}

.pasta-item:hover {
    transform: translateY(-3px);
    background-color: rgba(255, 255, 255, 0.2);
}

.pasta-item img {
    max-width: 85%; /* 이미지 크기 유지 */
    height: auto;
    border-radius: 4px;
    margin-bottom: 5px;
    object-fit: contain; /* 이미지가 잘리지 않고 카드 안에 포함되도록 함 */
}

.pasta-item span {
    font-size: 1em;
    font-weight: 700;
    color: #f7e0b5;
    text-align: center;
    line-height: 1.2;
}

/* lasagna 이미지에만 적용되는 특별한 조절 */
.pasta-item[data-type="lasagna"] img {
    max-width: 70%; /* 이 값을 조절하여 다른 이미지와 비슷한 시각적 크기로 맞춰보세요 */
}


/* 미디어 쿼리 (반응형 조정) */

/* 태블릿 (min-width: 768px) */
@media (min-width: 768px) {
    .container {
        padding: 30px;
        max-width: 900px;
        margin-top: auto; /* 태블릿에서도 중앙 정렬 유지 */
        margin-bottom: auto; /* 태블릿에서도 중앙 정렬 유지 */
    }

    .main-title-img {
        max-width: 500px;
        margin-bottom: 25px;
    }

    .pasta-selection h2 {
        font-size: 2.5em;
        margin-bottom: 25px;
    }

    .pasta-grid {
        grid-template-columns: repeat(4, 1fr); /* 4열 고정 */
        gap: 20px;
        max-width: 750px;
    }

    .pasta-item {
        padding: 15px;
    }

    .pasta-item img {
        max-width: 80%;
    }

    .pasta-item span {
        font-size: 1.1em;
    }

    .pasta-item[data-type="lasagna"] img {
        max-width: 65%;
    }
}

/* 데스크탑 (min-width: 1024px) */
@media (min-width: 1024px) {
    

    .main-title-img {
        max-width: 600px;
        margin-bottom: 30px;
    }

    .pasta-selection h2 {
        font-size: 2.8em;
        margin-bottom: 30px;
    }

    .pasta-grid {
        gap: 25px;
        max-width: 850px;
    }

    .pasta-item {
        padding: 20px;
    }

    .pasta-item img {
        max-width: 75%;
    }

    .pasta-item span {
        font-size: 1.2em;
    }

    .pasta-item[data-type="lasagna"] img {
        max-width: 60%;
    }
}

/* 매우 작은 화면 (모바일 가로모드 등)에 대한 추가 미디어 쿼리 */
@media (max-width: 480px) {
    .container {
        padding: 15px;
        margin-top: auto;
        margin-bottom: auto;
    }
    .main-title-img {
        max-width: 350px;
        margin-bottom: 10px;
    }
    .pasta-selection h2 {
        font-size: 1.6em;
        margin-bottom: 10px;
    }
    .pasta-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .pasta-item {
        padding: 8px;
    }
    .pasta-item img {
        max-width: 80%;
    }
    .pasta-item span {
        font-size: 0.9em;
    }
}