/* Editor Styles for Simple Slider */
.simple-slider-editor {
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 4px;
    background-color: #fafafa;
}

.simple-slider-editor::before {
    content: "スライダー (画像を配置)";
    display: block;
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 8px;
    font-weight: 600;
}

/* Target both the container directly (if no layout wrapper) and the layout wrapper if it exists */
.simple-slider-editor,
.simple-slider-editor>.block-editor-block-list__layout {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    align-items: stretch;
}

/* Ensure direct children (blocks) fit the grid */
.simple-slider-editor>.block-editor-block-list__block,
.simple-slider-editor>.block-editor-block-list__layout>.block-editor-block-list__block {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
}

.simple-slider-editor .wp-block-image {
    margin: 0;
}

.simple-slider-editor .wp-block-image img {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 2px;
    padding: 0;
    background: #fff;
}

/* Make the appender button look like a card/placeholder */
.simple-slider-editor .block-list-appender,
.simple-slider-editor .block-editor-button-block-appender {
    width: auto;
    height: auto;
    aspect-ratio: 16 / 9;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px dashed #ccc;
    border-radius: 2px;
}

.simple-slider-editor .block-list-appender:hover,
.simple-slider-editor .block-editor-button-block-appender:hover {
    border-color: #e5007e;
    background-color: #fff0f5;
}

.simple-slider-editor .block-list-appender button,
.simple-slider-editor .block-editor-button-block-appender button {
    width: 100%;
    height: 100%;
    justify-content: center;
    color: #555;
}

/* --- Top Page Slider (Swiper) --- */
.top-slider-section {
    width: 100%;
    margin-bottom: 60px;
    /* Allow slider to break out of constrained layout if necessary, usually controlled by alignfull but here we force it */
    margin-left: calc(50% - 50vw);
    width: 100vw;
}

.simple-slider-instance {
    width: 100%;
    padding-bottom: 10px;
    /* Space for shadow/overflow */
}

/* Pagination positioned below the slider (sibling) */
.js-simple-slider>.swiper-pagination {
    position: relative !important;
    bottom: auto !important;
    margin-top: 0px !important;
    width: 100% !important;
    display: flex;
    justify-content: center;
}

/* Scoped Slide Styles for Simple Slider Instance */
.simple-slider-instance .swiper-slide {
    /* Slide width: about 90% of screen/content */
    width: 90% !important;
    max-width: 880px !important;
    transition: transform 0.4s ease, opacity 0.4s ease;
    /* Inactive slides look smaller and faded */
    opacity: 0.6;
    transform: scale(0.9);
}

.simple-slider-instance .swiper-slide-active {
    opacity: 1;
    transform: scale(1);
    /* Active slide is original height and fully opaque */
    z-index: 10;
}

.simple-slider-instance .swiper-slide img,
.simple-slider-instance .swiper-slide a img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    overflow: hidden;
    display: block;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.simple-slider-instance .swiper-slide a {
    display: block;
    width: 100%;
    text-decoration: none;
}

.simple-slider-instance~.swiper-pagination .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    margin: 0 6px !important;
    background: #ccc;
    opacity: 1;
}

.simple-slider-instance~.swiper-pagination .swiper-pagination-bullet-active {
    background: #82c8e5;
    /* Sky Blue matching user image */
}

@media screen and (min-width: 769px) {
    .simple-slider-instance .swiper-slide {
        /* PC: maintain the 880px max-width, with room for side slides */
        width: 85% !important;
        max-width: 880px !important;
    }
}

/* --- Weekly Channel Scheduler Styles --- */

/* Wrapper for all daily contents */
/* Wrapper for all daily contents */
.pyonpyon-weekly-wrapper {
    width: 100%;
    margin-top: 30px;
    position: relative;
    min-height: 300px;
    /* Prevent collapse */
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    min-width: 0;
    /* Flex child fix */
}

/* Force override alignment styles which might cause 100vw overflow on mobile */
@media screen and (max-width: 768px) {
    .pyonpyon-weekly-wrapper {
        width: 100% !important;
        max-width: 100vw !important;
        /* Force fit to viewport */
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        left: auto !important;
        position: static !important;
    }
}

/* Weekly Navigation Scroll on Mobile */
@media screen and (max-width: 768px) {

    /* ... existing content ... */
    .wp-block-group.is-nowrap:has(a[href*="#sun"]),
    .wp-block-group.is-nowrap:has(a[href*="#mon"]) {
        overflow-x: auto;
        justify-content: flex-start !important;
        /* Override center */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .wp-block-group.is-nowrap:has(a[href*="#sun"])::-webkit-scrollbar {
        display: none;
    }
}

.pyonpyon-weekly-content {
    display: none;
    /* Hidden by default */
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    animation: fadeIn 0.5s ease;
    box-sizing: border-box;
    min-width: 0;
    /* Flex child fix */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Style for Weekly Items */
/* Card Style for Weekly Items */
.pyonpyon-weekly-swiper {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden;
    margin-left: auto;
    margin-right: auto;
    min-width: 0;
    padding: 10px 0 20px 0;
}

/* 
   Rebuild: Use CSS-driven widths with slidesPerView: 'auto' 
   Mobile: ~1.4 viewport (approx 70% width)
   Tablet: 2 items
   PC: 3 items
*/
.pyonpyon-weekly-swiper .swiper-slide {
    height: auto;
    display: flex; /* 子要素（aタグ）を縦に伸ばせるようにする */
    box-sizing: border-box;
    width: 70% !important;
    /* Standard Mobile: 1.4 view equivalent */
    max-width: 100% !important;
    transition: opacity 0.3s;
    opacity: 0.4;
    padding: 0 10px;
    /* Fade out side slides */
}

/* スライド内のリンクとカードを縦いっぱいに広げる */
.pyonpyon-weekly-swiper .swiper-slide > a {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* Ensure links inside the slider respect custom colors on hover */
.pyonpyon-weekly-wrapper a:hover {
    opacity: 0.7;
    text-decoration: none;
}


.pyonpyon-weekly-swiper .swiper-slide-active,
.pyonpyon-weekly-swiper .swiper-slide-next {
    opacity: 1;
    /* Keep active and next visible */
}

/* Fix specific stuck behavior below 520px */
@media screen and (max-width: 520px) {
    .pyonpyon-weekly-swiper .swiper-slide {
        width: 70vw !important;
        /* Force responsive resizing on small screens */
    }
}

@media screen and (min-width: 769px) {
    .pyonpyon-weekly-swiper .swiper-slide {
        width: 50% !important;
        /* Tablet: exactly 2 items (no gap subtraction) */
        opacity: 1;
        /* Reset opacity for grid-like view if needed, or keep fade */
    }
}

@media screen and (min-width: 1000px) {
    .pyonpyon-weekly-swiper .swiper-slide {
        width: 33.333% !important;
        /* PC: exactly 3 items */
    }
}

.pyonpyon-card {
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pyonpyon-card:hover {
    transform: translateY(-5px);
}

.pyonpyon-card-img {
    aspect-ratio: 16 / 9;
    background: #f0f0f0;
    overflow: hidden;
}

.pyonpyon-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.pyonpyon-card:hover .pyonpyon-card-img img {
    transform: scale(1.05);
}

.pyonpyon-card-body {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.pyonpyon-card-title {
    font-size: var(--wp--preset--font-size--medium, 1.25em);
    font-weight: bold;
    margin: 0 0 15px;
    line-height: 1.4;
    color: #d04255;
    /* Matched design color */
}

.pyonpyon-card-meta-list {
    margin-bottom: 20px;
}

.pyonpyon-meta-row {
    display: flex;
    margin-bottom: 8px;
    font-size: calc(var(--wp--preset--font-size--small, 1rem) * 0.95);
    line-height: 1.5;
}

.pyonpyon-meta-label {
    min-width: 80px;
    color: #d04255;
    font-weight: bold;
}

.pyonpyon-meta-value {
    color: #333;
    font-weight: bold;
}

.pyonpyon-card-excerpt {
    font-size: calc(var(--wp--preset--font-size--small, 1rem) * 0.9);
    color: #666;
    line-height: 1.6;
}

.pyonpyon-card-meta {
    font-size: calc(var(--wp--preset--font-size--small, 1rem) * 0.85);
    color: #888;
    margin-top: auto;
    display: flex;
    gap: 10px;
}

.pyonpyon-no-post {
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border-radius: 8px;
    color: #666;
}

/* Active Tab Indicator Style (Optional, if user wants feedback on links) */
a.is-active-day {
    position: relative;
    color: #c82454 !important;
    /* Example main color */
}

a.is-active-day::after {
    content: '';
    position: absolute;
    bottom: -5px;
    /* Adjust based on layout */
    left: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
}