/* =========================================
   Works Page Styles
   ========================================= */

/* --- Layout Scaffolding --- */
.works-page {
    background-color: var(--bg-color);
    /* #0a0a0a */
    color: var(--text-color);
    min-height: 100vh;
    padding-top: 80px;
    /* Header height */
    overflow-x: hidden;
}

.works-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 100px;
    display: flex !important;
    flex-direction: column !important;
    width: 100%;
    gap: 0;
    overflow: visible !important;
}

/* --- Hero Section --- */
.works-hero {
    text-align: center;
    padding: 60px 0 40px;
    flex: none;
}

.works-hero__title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: 0.1em;
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
}

.works-hero__subtitle {
    font-size: 1rem;
    color: #888;
    margin-bottom: 40px;
    font-family: 'Noto Sans JP', sans-serif;
}

/* --- Filter Navigation --- */
.works-filter {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 60px;
    flex-wrap: wrap;
    flex: none;
}

.works-filter__btn {
    background: transparent;
    border: 1px solid #333;
    padding: 8px 24px;
    border-radius: 50px;
    color: #888;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.works-filter__btn:hover,
.works-filter__btn.is-active {
    background: var(--primary-color, #d4af37);
    /* Fallback to gold if var not set */
    color: #000;
    border-color: var(--primary-color, #d4af37);
}

/* --- Works Sections --- */
/* CRITICAL FIX: Ensure height calculation is robust */
.works-section {
    display: block !important;
    width: 100%;
    height: auto !important;
    min-height: 100px;
    /* Ensure non-zero height */
    margin-bottom: 100px !important;
    position: relative !important;
    clear: both;
    flex: none;
    overflow: visible !important;
}

/* Visibility Control for JavaScript Filter */
.works-section.is-hidden {
    display: none !important;
}

.works-section__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

/* Products Section Specifics */
.works-section--products {
    background: linear-gradient(180deg, rgba(201, 169, 98, 0.05), transparent);
    padding: 40px 0;
    border-radius: 20px;
    border: 1px solid rgba(201, 169, 98, 0.2);
    margin-top: 50px;
}

.works-section--products .works-section__title {
    padding-left: 20px;
    padding-right: 20px;
    border-bottom: 1px solid rgba(201, 169, 98, 0.2);
}

/* --- Works Flex Layout (Replaced Grid) --- */
.works-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 40px;
    /* Fallback for browsers supporting gap in flex */
    width: 100%;
    position: relative !important;
    z-index: 1;
    height: auto !important;
    overflow: visible !important;
}

/* Card Container for Flex Layout */
.work-card {
    display: block !important;
    width: calc(33.333% - 27px) !important;
    /* 3 columns with gap consideration */
    margin-bottom: 40px;
    /* Fallback vertical gap */
    text-decoration: none;
    perspective: 1000px;
    position: relative !important;
    height: auto !important;
}

.work-card__thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid #333;
    transition: transform 0.4s ease, border-color 0.4s ease;
}

.work-card:hover .work-card__thumb {
    transform: translateY(-5px);
    border-color: var(--primary-color, #d4af37);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.work-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.work-card:hover .work-card__img {
    transform: scale(1.05);
}

.work-card__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.work-card:hover .work-card__overlay {
    opacity: 1;
}

.work-card__overlay-text {
    color: #fff;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.05em;
    border: 1px solid #fff;
    padding: 8px 20px;
    border-radius: 30px;
}

.work-card__body {
    padding-top: 20px;
    display: flex;
    flex-direction: column;
}

.work-card__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    font-family: 'Noto Sans JP', sans-serif;
    transition: color 0.3s ease;
}

.work-card:hover .work-card__title {
    color: var(--primary-color, #d4af37);
}

.work-card__meta {
    display: flex;
    gap: 10px;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 12px;
}

.work-card__cat {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid #444;
    padding: 2px 8px;
    border-radius: 4px;
}

.work-card__desc {
    font-size: 0.9rem;
    color: #aaa;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Badges --- */
.work-card__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #333;
    color: #fff;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 2;
}

.work-card__badge--sale {
    background: linear-gradient(135deg, #C9A962, #8B7355);
    color: #fff;
    font-weight: 600;
}

/* --- Tags --- */
.work-card__tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.work-card__tag {
    background: #222;
    color: #888;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #333;
}

/* --- Buttons --- */
.work-card__btn {
    display: inline-block;
    background: transparent;
    color: #C9A962;
    border: 1px solid #C9A962;
    padding: 10px 24px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.work-card__btn:hover {
    background: #C9A962;
    color: #1a1a1a;
}

.work-card__btn--buy {
    background: linear-gradient(135deg, #C9A962, #8B7355);
    color: #fff;
    border: none;
    font-size: 1rem;
    padding: 14px 30px;
}

.work-card__btn--buy:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(201, 169, 98, 0.3);
}

/* --- Features List --- */
.work-card__features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 15px 0;
    font-size: 0.85rem;
    color: #888;
}

/* --- Pricing --- */
.work-card__pricing {
    background: #111;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
}

.work-card__price-item {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    border-bottom: 1px solid #222;
}

.work-card__price-item:last-child {
    border-bottom: none;
}

.work-card__price-item--featured {
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.1), transparent);
    margin: -15px;
    padding: 15px;
    border-radius: 12px;
}

.work-card__price-label {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 5px;
}

.work-card__price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #C9A962;
}

.work-card__price small {
    font-size: 0.7rem;
    color: #666;
    font-weight: 400;
}

.work-card__price-note {
    font-size: 0.75rem;
    color: #666;
    margin-top: 5px;
}

.work-card__powered {
    text-align: center;
    font-size: 0.7rem;
    color: #555;
    margin-top: 15px;
}

/* --- Product Card Extended --- */
.work-card--product .work-card__body {
    padding: 20px;
    background: #1a1a1a;
    border-radius: 0 0 12px 12px;
    border: 1px solid #333;
    border-top: none;
}

.work-card--product .work-card__thumb {
    border-radius: 12px 12px 0 0;
}

.work-card--product .work-card__desc {
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

/* --- Buy Buttons --- */
.work-card__buy-btn {
    display: block;
    margin-top: 12px;
    padding: 12px 20px;
    background: #222;
    color: #C9A962;
    border: 1px solid #C9A962;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
}

.work-card__buy-btn:hover {
    background: #C9A962;
    color: #1a1a1a;
}

.work-card__buy-btn--primary {
    background: linear-gradient(135deg, #C9A962, #8B7355);
    color: #fff;
    border: none;
}

.work-card__buy-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 169, 98, 0.4);
}

/* --- Detail Page Specific --- */
.work-detail-hero {
    height: 60vh;
    min-height: 400px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 60px;
}

.work-detail-hero__bg {
    position: absolute;
    inset: 0;
    z-index: -1;
}

.work-detail-hero__bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.4);
}

.work-detail-hero__content {
    text-align: center;
    z-index: 1;
    padding: 0 20px;
}

.work-detail-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.work-detail-meta {
    display: inline-flex;
    gap: 20px;
    color: #ccc;
    font-size: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.work-detail-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 100px;
}

.work-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
    padding: 30px;
    background: #111;
    border-radius: 12px;
    border: 1px solid #333;
}

.work-info-item dt {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.work-info-item dd {
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
}

.work-content p {
    margin-bottom: 2em;
    line-height: 1.8;
    color: #ccc;
}

.work-content h2 {
    font-size: 1.8rem;
    margin: 3em 0 1em;
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
}

.work-content img {
    width: 100%;
    border-radius: 8px;
    margin: 2em 0;
    border: 1px solid #333;
}

.work-cta-area {
    margin-top: 80px;
    padding: 40px;
    background: linear-gradient(145deg, #1a1a1a, #0d0d0d);
    border: 1px solid #333;
    border-radius: 16px;
    text-align: center;
}

.work-cta-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color, #d4af37);
    /* Gold */
    margin-bottom: 20px;
    display: block;
}

.work-cta-btn {
    display: inline-block;
    background: var(--primary-color, #d4af37);
    /* Gold */
    color: #000;
    font-weight: 700;
    padding: 16px 40px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1.2rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.work-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(212, 175, 55, 0.3);
}

.work-cta-note {
    display: block;
    margin-top: 15px;
    font-size: 0.85rem;
    color: #888;
}

/* --- Mobile Responsiveness (Flexbox) --- */
@media (max-width: 768px) {
    .works-grid {
        flex-direction: column;
        /* Stack cards vertically */
    }

    .work-card {
        width: 100% !important;
        /* Full width on mobile */
        margin-bottom: 30px;
    }

    .works-hero__title {
        font-size: 2rem;
    }

    .work-detail-title {
        font-size: 2rem;
    }

    .work-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .works-section--products {
        padding: 20px 0;
        margin-top: 40px;
    }
}

/* --- WP stacking fix: ensure hero background is visible (avoid negative z-index disappearing in theme stack) --- */
.work-detail-hero{
  position: relative;
  isolation: isolate;
}
.work-detail-hero__bg{
  z-index: 0;
  pointer-events: none;
}
.work-detail-hero__content{
  position: relative;
  z-index: 1;
}
