/* CSS Redesign based on user request */
:root {
    --bg-color: #d1d398;
    --text-color: #3d405b;
    --header-font: 'Cormorant Garamond', serif;
    --body-font: 'Noto Sans JP', sans-serif;
    --accent-font: 'Caveat', cursive;
    --accent-color-1: #e07a5f;
    /* Bright accent */
    --accent-color-2: #81b29a;
    /* Earthy accent */
}

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

body {
    background-color: var(--bg-color);
    font-family: var(--body-font);
    color: var(--text-color);
    margin: 0;
    letter-spacing: 0.05em;
    /* Increase letter spacing for '抜け感' */
}

main {
    padding: 0rem 0 2rem 0;
}

.site-header {
    padding: 15px 0;
    text-align: center;
}

.site-header img {
    max-width: 130px;
}

/* MV Section */
.main-visual {
    position: relative;
    width: 100%;
    margin-bottom: 3rem;
    /* max-width: 760px; */
    margin-left: auto;
    margin-right: auto;
    padding: 0 0 100px 0;
}

.main-visual::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('img/bg_pattarn.png');
    /* User-specified path */
    background-repeat: repeat;
    opacity: 0.25;
    z-index: -1;
    /* Place it behind the content */
}

.main-visual .base-img {
    display: block;
    width: 100%;
    margin: 0 auto;
    max-width: 560px;
}

.main-visual .overlay-img {
    position: absolute;
    top: 50%;
    right: 20%;
    transform: translate(-50%, -50%);
    width: 16%;
    max-width: 550px;
    min-width: 150px;
}

/* Banner Section */
.banner-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 15px;
    padding: 2rem 5%;
    background-color: transparent;
    margin: 0 auto;
}

.banner-section a {
    display: block;
    max-width: 760px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 8px;
}

.banner-section a:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.banner-section img {
    width: 100%;
    display: block;
    border-radius: 8px;
    margin: 0 auto;
}

/* Product List */
#itemlist {
    padding: 0 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.list-header h2 {
    font-family: var(--header-font);
    font-size: 3rem;
    text-align: center;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.list-header p {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 0.9rem;
    color: #888;
}

/* Filter Controls */
#floating-sort-container {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid #eee;
}

.serch-box__title span {
    font-family: var(--header-font);
    font-weight: 700;
}

/* Product Cards */
.cardWrap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 40px 25px;
}

.card {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.card a {
    text-decoration: none;
}

.card:hover {
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.card__imgFrame img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.card__info {
    padding: 1.5rem;
}

.card__name {
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.card__price-row--original {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 0.5rem;
}

.card__original-price {
    text-decoration: line-through;
}

.card__price-row--main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.card__discount-badge {
    background-color: var(--accent-color-1);
    color: #fff;
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 700;
    margin-right: 10px;
}

.card__discount-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-color-1);
}

.card__tax-label {
    font-size: 0.8rem;
    margin-left: 5px;
}

/* Item List Layout */
.itemList__lineup {
    display: flex;
    align-items: flex-start;
    gap: 30px;
    position: relative;
    padding:0 0 200px 0;
}

#floating-sort-container {
    flex: 0 0 280px;
    /* Sidebar width, no grow, no shrink */
    position: sticky;
    top: 20px;
    transition: opacity 0.3s, transform 0.3s;
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
    max-height: 1000px;
    overflow-y: scroll;
}

.content-wrapper {
    flex: 1;
    /* Main content takes remaining space */
    min-width: 0;
    /* Prevents flexbox overflow issues */
}

/* Filter Controls Styling */
.control-group {
    margin-bottom: 2rem;
}

.serch-box__title {
    margin-bottom: 1rem;
}

.category-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
}

.category-action-btn {
    background: transparent;
    border: 1px solid var(--accent-color-2);
    color: var(--accent-color-2);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-action-btn:hover {
    background: var(--accent-color-2);
    color: #fff;
}

.category-group {
    margin-bottom: 1rem;
}

.category-group-label {
    font-weight: 700;
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.checkbox-filter-container label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-filter-container input[type="checkbox"] {
    /* display: none; を削除して表示する */
    margin-right: 8px; /* テキストとの間に余白を追加 */
    vertical-align: middle;
}

.checkbox-filter-container label span {
    /* position: relative; を削除 */
    vertical-align: middle;
}


/* Select Dropdown */
.selecter__wrapper {
    position: relative;
}

select#js-sort {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

.selecter__wrapper::after {
    content: '▼';
    font-size: 12px;
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    pointer-events: none;
    color: #888;
}

/* Slider Filters */
.slider-filter {
    margin-bottom: 1.5rem;
}

.slider-values {
    font-size: 0.9rem;
    color: #555;
}

/* General responsive adjustments */
@media (max-width: 1024px) {
    .itemList__lineup {
        display: block;

    }

    /* On tablet, sidebar is not sticky */
    #floating-sort-container {
        position: relative;
        top: auto;
        flex: 1 1 100%;
        width: 100%;
        max-width: none;
        margin-bottom: 2rem;
    }
}

@media (min-width: 769px) {

    /* PC: .serch-boxをサイドバーとして表示 */
    .serch-box {
        display: block;
        position: static;
        transform: none;
        visibility: visible;
        background: #fff;
        padding: 1.5rem;
        border-radius: 12px;
        border: 1px solid #f0f0f0;
        max-height: none;
        overflow-y: visible;
        box-shadow: none;
    }

    /* PCでは閉じるボタンは不要 */
    .serch-box .close-filter-btn {
        display: none;
    }
}

/* Final Style Overrides */
#active-filters {
    margin-bottom: 1rem;
}

.sort-info {
    margin-bottom: 1rem;
    color: #888;
    font-size: 0.9rem;
}

/* This was moved from inside the media query to be globally available */
.filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    /* Adjusted z-index */
    transition: opacity 0.3s ease;
}

.filter-overlay.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.serch-box .close-filter-btn {
    display: none;
    /* Hide on desktop by default */
}

/* On mobile, the button is a FAB. On desktop, it is not used. */
@media (min-width: 769px) {
    #sort-toggle-btn {
        display: none;
    }
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .main-visual {
        padding: 0 10% 100px 10%;
    }

    .main-visual .overlay-img {
        position: absolute;
        top: 44%;
        right: -13%;
        transform: translate(-50%, -50%);
        width: 33%;
        max-width: 550px;
    }

    /* This is the mobile trigger button, now always visible */
    #sort-toggle-btn {
        display: flex;
        /* Show it on mobile */
        align-items: center;
        justify-content: center;
        gap: 8px;
        position: fixed;
        bottom: 20px;
        right: 20px;
        /* Positioned on the right */
        z-index: 998;
        padding: 12px 24px;
        background-color: var(--accent-color-1);
        color: white;
        border: none;
        border-radius: 30px;
        font-size: 1rem;
        font-weight: 700;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        cursor: pointer;
        transition: transform 0.3s ease;
    }

    /* This is the filter panel that slides up */
    #floating-sort-container.serch-box {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        overflow-y: auto;
        background: #fff;
        z-index: 1001;
        /* Adjusted z-index */
        padding: 20px;
        padding-top: 50px;
        /* Space for close button */
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        visibility: hidden;
        display: block;
        /* Ensure it's not display:none */
    }

    #floating-sort-container.is-open {
        transform: translateY(0);
        visibility: visible;
    }

    /* Style the close button for the mobile modal */
    .serch-box .close-filter-btn {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        font-size: 24px;
        color: #888;
        background: none;
        border: none;
        cursor: pointer;
        padding: 5px;
        line-height: 1;
    }
}

@media (max-width: 768px) {
    .cardWrap {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        /* Adjust gap for mobile two-column layout */
    }

    .card__info {
        padding: 0 .5rem .5em .5em;
    }
    #itemlist{
        padding: 0 1%;
    }
}
/* カードの商品名スクロール用スタイル */
.card__name-wrapper {
    overflow: hidden; /* はみ出したテキストを隠す */
    white-space: nowrap; /* 中の要素を折り返さない */
    display: flex;
}

.card__name {
    /* 通常のスタイル */
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.4;
    
    /* アニメーション用のスタイル */
    display: inline-block;
    padding-right: 2em; /* テキスト間の隙間 */
    animation: marquee 8s linear infinite;
}

@keyframes marquee {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-100%);
    }
}