/* cards-components.css
   Cards UI styles extracted for production reuse.
   Sections: Base, Layout, Variants, Placeholder, Responsive
*/

/* =====================
   Base
   ===================== */
.cards {
    display: grid;
    gap: 18px;
    justify-items: stretch;
}

/* Empty-state utility for cards containers */
.cards-empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

.cards--calendar {
    margin-top: 16px;
}

.cards.cards--orange-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    align-items: stretch;
    gap: 12px;
}

/* Non-orange cards span full width when orange grid is active,
   except the orange placeholder which stays single column */
.cards.cards--orange-grid .frame-card:not([data-frame="orange"]):not([data-frame="orange-placeholder"]) {
    grid-column: 1 / -1;
}

.frame-card {
    background: #fff;
    padding: 22px;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    width: 100%;
    --thumb-gap: 6px;
    --thumbs-per-view: 2;
    --thumb-aspect-w: 210;
    --thumb-aspect-h: 297;
}


/* Head: date (left) | CTA (right) */
.frame-card .card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.frame-card .card-head .head-left {
    flex: 0 0 var(--head-left-w, 160px);
    display: flex;
    align-items: center;
}

.frame-card .card-head .head-right {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: end;
}

.frame-card .date-badge {
    font-weight: 900;
    font-size: 45px;
    display: flex;
    align-items: center;
}

.frame-card .date-badge .date-week {
    font-size: 34px;
    line-height: 1;
    margin-left: var(--date-week-tighten, 0);
}

.frame-card .location {
    font-size: 16px;
    color: #222;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.frame-card.is-red .location {
    font-size: 14px;
}

.frame-card .location .fa-location-dot {
    color: #333;
}

.frame-card .period {
    font-size: 16px;
    color: #666;
    line-height: 1.2;
}

/* Meta: location | period */
.frame-card .card-meta {
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 13px;
    margin: 2px 0 6px;
}

.frame-card .card-meta .location {
    margin-left: 0;
}

.frame-card .card-meta .period {
    text-align: right;
}

.frame-card .card-meta .period-small {
    text-align: right;
}

.frame-card .card-title {
    font-size: 32px;
    color: #DC0001;
    font-weight: 900;
    line-height: 1.5;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.frame-card .card-title .chev {
    color: #DC0001;
    font-size: 22px;
}

.frame-card .card-title {
    letter-spacing: 0.5px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
}

.frame-card .more-link {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    color: #111;
    display: block;
}

/* Footer and action layout */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.card-footer .more-link {
    flex: 1;
}

/* Card body layouts */
.card-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.card-body--single {
    gap: 24px;
}

.card-body--stack {
    gap: 20px;
}

.card-body--split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 24px;
}

.card-body--with-button {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.card-body--simple {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-body--simple .more-link {
    text-align: right;
    margin-top: auto;
}

.card-info {
    display: flex;
    flex-direction: column;
}

.card-actions {
    display: flex;
    justify-content: center;
}

/* Toggle button */
.card-toggle {
    appearance: none;
    border: none;
    background: #fff;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
    color: #DC0001;
}

/* Wide toggle variant to unify with accordion/button style */
.card-toggle.card-toggle--wide {
    width: 100%;
    height: auto;
    padding: 14px 18px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #111;
}

.card-toggle.card-toggle--wide .card-toggle__label {
    font-weight: 700;
    font-size: 14px;
}

.card-toggle.card-toggle--wide .card-toggle__icon {
    font-size: 16px;
}

/* Center and enlarge wide toggle on Yellow(Gold) and Orange(Red) variants */
.frame-card.is-gold .card-footer,
.frame-card.is-red .card-footer {
    justify-content: center;
}



.frame-card.is-gold .card-toggle.card-toggle--wide,
.frame-card.is-red .card-toggle.card-toggle--wide {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid #ddd;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s ease;
    font-size: 14px;
}

.frame-card.is-gold .card-toggle.card-toggle--wide .card-toggle__label,
.frame-card.is-red .card-toggle.card-toggle--wide .card-toggle__label {
    font-size: 16px;
}

.card-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 26px rgba(0, 0, 0, 0.18);
}

.card-toggle__icon {
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
}

.card-toggle:disabled,
.card-toggle[aria-disabled="true"] {
    opacity: .35;
    cursor: default;
    transform: none;
    box-shadow: none;
}

/* Accordion */
.card-accordion {
    margin-top: auto;
}

.card-accordion__toggle {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid #ddd;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s ease;
    font-size: 14px;
}

.card-accordion__toggle:hover {
    background: #f8f9fa;
}

.card-accordion__toggle[aria-expanded="true"] {
    background: #fff;
}

.card-accordion__icon {
    transition: transform .3s ease;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
}

.card-accordion__toggle[aria-expanded="true"] .card-accordion__icon {
    transform: rotate(180deg);
}

.card-accordion__toggle[aria-disabled="true"],
.card-accordion__toggle:disabled {
    opacity: .4;
    cursor: default;
    pointer-events: none;
}

.card-accordion__panel {
    margin-top: 18px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height .28s ease, opacity .28s ease;
    pointer-events: none;
}

.card-accordion__panel.is-open {
    max-height: 1200px;
    opacity: 1;
    pointer-events: auto;
}

/* Thumbs slider */
.frame-card .thumbs-wrap {
    position: relative;
    margin-top: 14px;
    overflow: hidden;
}

.frame-card .thumbs {
    display: grid;
    grid-auto-flow: column;
    gap: var(--thumb-gap);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    grid-auto-columns: calc((100% - (var(--thumb-gap) * (var(--thumbs-per-view) - 1))) / var(--thumbs-per-view));
}

.frame-card .thumb {
    background: #e5e7eb;
    flex: 0 0 calc((100% - (var(--thumb-gap) * (var(--thumbs-per-view) - 1))) / var(--thumbs-per-view));
    aspect-ratio: var(--thumb-aspect-w) / var(--thumb-aspect-h);
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa0a6;
    font-size: 28px;
    scroll-snap-align: start;
}

.frame-card .thumb::after {
    content: '+';
}

.frame-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background: #fff;
    border-radius: inherit;
    display: block;
}

.frame-card .thumb:has(img)::after {
    content: none;
}

.frame-card .thumbs-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #c9cdd1;
    background: #fff;
    color: #333;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}

.frame-card .thumbs-prev {
    left: 4px;
}

.frame-card .thumbs-next {
    right: 4px;
}

/* Variants: Red (Orange), Gold, Silver, Marble */
.frame-card.is-red {
    border: 10px solid transparent;
    border-image: url('/assets/images/frame_red.png') 36 round;
    min-height: 380px;
    --thumb-aspect-w: 210;
    --thumb-aspect-h: 297;
    --date-week-tighten: 0px;
}

.cards.cards--orange-grid .frame-card.is-red {
    min-height: 350px;
    max-width: 310px;
}

.frame-card.is-red .card-head {
    flex-direction: row;
    align-items: center;
    gap: 7px;
}

.frame-card.is-red .card-head .head-left {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
}

.frame-card.is-red .card-head .head-right {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    order: 0;
    width: auto;
}

.frame-card.is-red .period {
    font-size: 12px;
    margin-bottom: 0;
}

.frame-card.is-red .card-title {
    font-size: 18px;
    color: #DC0001;
}

.frame-card.is-red .card-title .chev {
    font-size: 14px;
    color: #DC0001;
}

.frame-card.is-red .machines-head {
    font-size: 16px;
}

.frame-card.is-red .machines-text {
    font-size: 14px;
    line-height: 1.4;
}

.frame-card.is-red .card-body--with-button {
    gap: 6px;
}

.frame-card.is-red .card-footer {
    margin-top: 8px;
}



.frame-card.is-gold {
    border: 15px solid transparent;
    border-image: url('/assets/images/frame_gold.png') 36 round;
    min-height: 400px;
    --thumb-aspect-w: 16;
    --thumb-aspect-h: 9;
}

.frame-card.is-gold .card-title {
    font-size: 24px;
    color: #DC0001;
}

.frame-card.is-gold .card-title .chev {
    font-size: 18px;
    color: #DC0001;
}

.frame-card.is-gold .card-toggle {
    margin-left: auto;
}

.frame-card.is-gold .card-body--with-button {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.frame-card.is-gold .card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.frame-card.is-gold .card-footer {
    margin-top: auto;
}

.frame-card.is-silver {
    border-bottom: 1px solid #333;
    margin-bottom: 8px;
    border-radius: 0;
    padding: 8px;
    box-shadow: none;
    min-height: auto;
    --thumb-aspect-w: 16;
    --thumb-aspect-h: 9;
    gap: 0;
    background-color: transparent;
    height: 180px;
}

.frame-card.is-silver .card-body--simple {
    gap: 6px;
}

.frame-card.is-silver .card-head--compact {
    min-height: auto;
}

.frame-card.is-silver .date-badge {
    font-size: 22px;
}

.frame-card.is-silver .date-badge .date-week {
    font-size: 16px;
}

.frame-card.is-silver .location,
.frame-card.is-silver .period-small {
    font-size: 11px;
}

.frame-card.is-silver .card-title {
    font-size: 16px;
    margin: 0 0 2px;
}

.frame-card.is-silver .card-title .chev {
    font-size: 13px;
}

.frame-card.is-silver .machines-head {
    font-size: 13px;
    margin: 0 0 2px;
}

.frame-card.is-silver .machines-text {
    font-size: 12px;
    line-height: 1.4;
}

.frame-card.is-silver .more-link {
    font-size: 13px;
}

/* Marble frame with holographic overlays */
.frame-card.is-marble {
    border: 15px solid transparent;
    border-image: url('/assets/images/frame_marble.png') 36 round;
    min-height: 470px;
    --thumb-aspect-w: 210;
    --thumb-aspect-h: 297;
    position: relative;
    z-index: 0;           /* 子の z-index:-1 を自コンテキスト内にとどめる */
    isolation: isolate;   /* 新しいスタッキングコンテキストを作成 */
}

.frame-card.is-marble .card-body--with-button {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.frame-card.is-marble .card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.frame-card.is-marble .card-footer {
    margin-top: auto;
    padding-top: 12px;
}

.frame-card.is-marble::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #fff; /* 内側は常に白 */
    pointer-events: none;
    z-index: -1;
}

/* マーブル枠の外周レインボー・グロー（周囲のみ表示） */
.frame-card.is-marble::after {
    content: '';
    position: absolute;
    inset: -15px;
    pointer-events: none;
    z-index: -2;
    border: 3px solid transparent;
    background: linear-gradient(90deg, transparent, white, transparent);
    background-size: 200% 100%;
    animation: light-run 2.5s linear infinite;
    will-change: background-position;
    opacity: 0.8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .frame-card {
        padding: 12px 10px;
        --thumb-gap: 4px;
        --thumbs-per-view: 2;
    }

    .frame-card.is-marble {
        min-height: 360px;
    }

    .frame-card.is-marble .card-body {
        gap: 12px;
    }

    .frame-card.is-marble .machines-text {
        line-height: 1.3;
    }

    .frame-card .date-badge {
        font-size: 28px;
    }

    .frame-card .date-badge .date-week {
        font-size: 20px;
    }

    .frame-card .card-title {
        font-size: 20px;
    }

    .frame-card .card-title .chev {
        font-size: 16px;
    }

    .frame-card .machines-head {
        font-size: 16px;
        margin: 4px 0 6px;
    }

    .frame-card .machines-text {
        font-size: 14px;
        line-height: 1.6;
    }

    .frame-card .period {
        font-size: 12px;
    }

    .frame-card .location {
        font-size: 12px;
    }

    .frame-card.is-red .date-badge {
        font-size: 18px;
    }

    .frame-card.is-red .date-badge .date-week {
        font-size: 14px;
    }

    .frame-card.is-red .card-title {
        font-size: 16px;
        color: #DC0001;
    }

    .frame-card.is-red .card-title .chev {
        font-size: 12px;
        color: #DC0001;
    }

    .frame-card.is-red .location {
        font-size: 10px;
    }

    .frame-card.is-red .period {
        font-size: 10px;
    }

    .frame-card.is-red .machines-head {
        font-size: 14px;
    }

    .frame-card.is-red .machines-text {
        font-size: 12px;
        line-height: 1.3;
    }

    .frame-card.is-gold .card-title {
        font-size: 18px;
        color: #DC0001;
    }

    .frame-card.is-gold .card-title .chev {
        font-size: 14px;
        color: #DC0001;
    }

    .frame-card.is-gold {
        min-height: 330px;
        height: 330px;
    }


    .frame-card.is-silver .card-title {
        font-size: 16px;
    }

    .frame-card.is-silver .card-title .chev {
        font-size: 12px;
    }

    .cards.cards--orange-single .frame-card.is-red {
        max-width: 250px;
    }

    .cards.cards--orange-grid .frame-card.is-red {
        max-width: 100%;
    }

    .cards.cards--orange-grid .frame-card[data-frame="orange-placeholder"] {
        max-width: 100%;
    }
}

/* =====================
   Variants
   ===================== */
/* Orange (red frame) */
.frame-card.is-red {
    border: 10px solid transparent;
    border-image: url('/assets/images/frame_red.png') 36 round;
    min-height: 380px;
    --thumb-aspect-w: 210;
    --thumb-aspect-h: 297;
    --date-week-tighten: 0px;
}

/* When orange grid active, keep card compact */
.cards.cards--orange-grid .frame-card.is-red {
    min-height: 350px;
    max-width: 310px;
}

/* Head unified */
.frame-card.is-red .card-head {
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.frame-card.is-red .card-head .head-right {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    order: 0;
    width: auto;
}

/* Visual tuning - Orange */
.frame-card.is-red .date-badge {
    font-size: 34px;
}

.frame-card.is-red .date-badge .date-week {
    font-size: 18px;
}

.frame-card.is-red .card-title {
    font-size: 20px;
    margin: 6px 0 10px;
}

.frame-card.is-red .machines-head {
    font-size: 16px;
    margin: 0 0 6px;
}

.frame-card.is-red .machines-text {
    font-size: 14px;
    line-height: 1.6;
}

.frame-card.is-red .card-body--with-button {
    gap: 6px;
    justify-content: space-between;
}

.frame-card.is-red .card-footer {
    margin-top: 8px;
}


/* =====================
   Placeholder (orange 1-item)
   ===================== */
.frame-card[data-frame="orange-placeholder"] {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 350px;
    max-width: 310px;
    border-radius: 0;
    border: 2px dashed #D2D2D2;
    background: #fff;
    box-shadow: none;
    padding: 0;
}

.frame-card[data-frame="orange-placeholder"] .ad-ph {
    width: 70%;
    max-width: 220px;
    aspect-ratio: 261 / 195;
    background: url('/assets/images/ad_text.png') center center / contain no-repeat;
}

/* =====================
   Placeholder (none/blue size)
   ===================== */
.frame-card[data-frame="none-placeholder"] {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #D2D2D2;
    background: #fff;
    padding: 0;
}

.frame-card[data-frame="none-placeholder"] .ad-ph {
    width: 70%;
    max-width: 220px;
    aspect-ratio: 261 / 195;
    background: url('/assets/images/ad_text_edge-none.png') center center / contain no-repeat;
}

/* =====================
   Responsive
   ===================== */
@media (max-width: 768px) {

    /* オレンジグリッドのレスポンシブ対応をシンプルに */
    .cards.cards--orange-grid .frame-card.is-red {
        max-width: none !important;
    }

    .cards.cards--orange-grid .frame-card[data-frame="orange-placeholder"] {
        max-width: none !important;
    }
}

@media (max-width: 560px) {
    .frame-card .card-meta {
        gap: 8px;
    }

    .frame-card .card-meta .location,
    .frame-card .location {
        font-size: 14px;
    }

    .frame-card .card-meta .period-small {
        font-size: 11px;
    }

    .frame-card.is-red .date-badge {
        font-size: 28px;
    }

    .frame-card.is-red .date-badge .date-week {
        font-size: 16px;
    }

    .frame-card.is-red .card-title {
        font-size: 18px;
    }

    /* オレンジグリッドをシンプルに2カラム維持 */
    .cards.cards--orange-grid .frame-card.is-red {
        max-width: none !important;
        min-height: 320px !important;
    }

    .cards.cards--orange-grid .frame-card[data-frame="orange-placeholder"] {
        max-width: none !important;
        min-height: 320px !important;
    }
}

@media (max-width: 480px) {
    .frame-card{
        gap: 3px;
    }
    .frame-card .card-head{
        margin: 0;
    }
    .frame-card .card-meta{
        margin: 0;
    }

    .frame-card.is-red {
        padding: 7px;
        gap: 3px;
    }

    .frame-card.is-gold .card-toggle.card-toggle--wide,
    .frame-card.is-red .card-toggle.card-toggle--wide {
        height: auto;
        padding: 8px 0px;
    }

    .frame-card.is-red .card-head {
        gap: 0px;
        margin-bottom: 2px;
    }

    .frame-card.is-red .card-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .frame-card.is-red .card-meta .location,
    .frame-card .location {
        font-size: 10px;
    }

    .frame-card.is-red .period,
    .frame-card.is-red .period-small {
        font-size: 8px;
    }

    .frame-card.is-red .date-badge {
        font-size: 16px;
    }

    .frame-card.is-red .date-badge .date-week {
        font-size: 12px;
    }

    .cards.cards--orange-grid {
        gap: 4px;
    }

    .frame-card.is-red .more-link {
        font-size: 8px;
    }

    .frame-card.is-red .card-title {
        font-size: 14px;
        margin: 2px 0 4px;
    }

    .frame-card.is-red .machines-head {
        font-size: 12px;
    }

    .frame-card.is-red .machines-text {
        font-size: 10px;
    }

    .frame-card.is-red .card-body--with-button {
        gap: 4px;
    }

    .frame-card.is-red .card-footer {
        margin-top: 4px;
    }


    .frame-card.is-red .card-toggle.card-toggle--wide .card-toggle__label {
        font-size: 12px;
    }

    .frame-card.is-red .card-toggle.card-toggle--wide .card-toggle__icon {
        font-size: 12px;
    }

    .frame-card.is-red .card-toggle.card-toggle--wide .card-toggle__label {
        font-size: 12px;
    }

    .frame-card.is-red .card-toggle.card-toggle--wide .card-toggle__icon {
        font-size: 12px;
    }

    .frame-card .more-link {
        font-size: 14px;
    }
}
/* ライトランアニメーション */
@keyframes light-run {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

