/* ============================================================
   Kuse Portfolio — Frontend Styles  v1.3
   ============================================================ */

.kuse-portfolio-wrap *,
.kuse-portfolio-wrap *::before,
.kuse-portfolio-wrap *::after {
    box-sizing: border-box;
}

.kuse-no-items {
    text-align: center;
    color: #999;
    padding: 40px 0;
}

/* ============================================================
   FILTER TABS
   ============================================================ */
.kuse-filter-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

/* Funnel icon */
.kuse-filter-tabs > svg {
    flex-shrink: 0;
    color: #555;
    margin-right: 10px;
    width: 20px;
    height: 20px;
}

.masonry-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    outline: none;
    line-height: 1.2;
    font-family: inherit;
    letter-spacing: -0.01em;
}

/* Hover: soft gray fill */
.masonry-tab:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #111;
}

/* Active: solid black rounded square, white text */
.masonry-tab.active {
    background: #111111;
    color: #ffffff;
    font-weight: 600;
}

.masonry-tab.active:hover {
    background: #222222;
}

/* ============================================================
   MASONRY GRID
   ============================================================ */
.kuse-masonry-grid {
    position: relative;
    width: 100%;
}

/* ============================================================
   CARD
   ============================================================ */
.kuse-card {
    position: absolute;
    will-change: opacity, transform;
}

.kuse-card.masonry-filtered,
.kuse-card.masonry-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.kuse-card-inner {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.10);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    cursor: pointer;
}

.kuse-card-inner:hover {
    transform: translateY(-4px);
    box-shadow: 0 2px 8px rgba(0,0,0,.10), 0 14px 36px rgba(0,0,0,.15);
}

/* ============================================================
   MEDIA WRAPPER
   ============================================================ */
.kuse-media {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #ebebeb;
    display: block;
    /* IMPORTANT: do NOT add transform here — it creates a new
       stacking context and can swallow pointer events on children */
}

.kuse-media.ratio-landscape { aspect-ratio: 16 / 9; }
.kuse-media.ratio-portrait  { aspect-ratio: 9 / 16; }

/* ── Thumbnail <img> — always on top until video plays ── */
.kuse-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 2;
    display: block;
    transition: opacity 0.3s ease;
    opacity: 1;
    pointer-events: none; /* never intercept clicks */
}

/* No-thumbnail placeholder */
.kuse-thumb-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    background: #e8e8e8;
    pointer-events: none;
}

.kuse-thumb-placeholder svg {
    width: 40px;
    height: 40px;
    color: #bbb;
}

/* ── Video element — under thumbnail until played ── */
.kuse-media video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    display: block;
    pointer-events: none; /* never intercept clicks */
}

/* Playing: video rises above thumbnail (JS also fades thumb out) */
.kuse-media video.is-playing {
    z-index: 3;
}

/* ── Dark scrim — only while video is playing ── */
.kuse-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    background: rgba(0,0,0,0.12);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* never intercept clicks */
}

.kuse-media.video-active .kuse-overlay {
    opacity: 1;
}

/* ============================================================
   PLAY / PAUSE BUTTON
   z-index: 5 — sits above everything in the media wrapper.
   NO backdrop-filter — it creates a stacking context that
   breaks pointer-events in Safari and some Chrome versions.
   ============================================================ */
.kuse-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.80);
    z-index: 5;

    width: 64px;
    height: 64px;
    border-radius: 50%;

    background: rgba(22, 22, 22, 0.62);
    /* backdrop-filter intentionally omitted */

    display: flex;
    align-items: center;
    justify-content: center;

    /* Hidden until hovered (CSS) or playing (JS adds .is-pause) */
    opacity: 0;
    pointer-events: none;  /* disabled until visible */
    transition: opacity 0.22s ease, transform 0.22s ease, background 0.18s ease;
    cursor: pointer;
    border: none;
    outline: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Play triangle icon */
.kuse-play-btn svg {
    width: 22px;
    height: 22px;
    margin-left: 4px; /* optical center for triangle */
    display: block;
    flex-shrink: 0;
    pointer-events: none;
}

/* Show button on card hover — re-enable pointer-events too */
.kuse-card-inner:hover .kuse-play-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

.kuse-play-btn:hover {
    background: rgba(8, 8, 8, 0.78);
    transform: translate(-50%, -50%) scale(1.07) !important;
}

/* ── PAUSE STATE — transparent bg, white bars, always visible ── */
.kuse-play-btn.is-pause {
    background: transparent;
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1) !important;
    pointer-events: all !important; /* must be clickable even without hover */
}

.kuse-play-btn.is-pause svg {
    width: 26px;
    height: 26px;
    margin-left: 0;
    /* readable over any video frame */
    filter: drop-shadow(0 1px 6px rgba(0,0,0,.65));
}

.kuse-play-btn.is-pause:hover {
    background: rgba(0,0,0,0.25);
}

/* ============================================================
   CARD INFO
   ============================================================ */
.kuse-card-info {
    padding: 14px 18px 20px;
    background: #fff;
}

/* Gray category label */
.kuse-category {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: #888;
    margin-bottom: 6px;
    line-height: 1.3;
}

/* Bold dark title */
.kuse-title {
    margin: 0;
    padding: 0;
    font-size: 16px;
    font-weight: 700;
    color: #111;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .kuse-card-inner { border-radius: 16px; }
    .kuse-play-btn { width: 56px; height: 56px; }
    .kuse-play-btn svg { width: 18px; height: 18px; }
    .kuse-play-btn.is-pause svg { width: 22px; height: 22px; }
    .kuse-title { font-size: 15px; }
    .kuse-category { font-size: 12px; }
}

/* Mobile: no hover → button always visible */
@media (max-width: 767px) {
    .kuse-filter-tabs {
        gap: 2px;
        margin-bottom: 20px;
        flex-wrap: nowrap;          /* single row — no wrapping */
        overflow-x: auto;           /* horizontal scroll */
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;      /* Firefox — hide scrollbar */
        -ms-overflow-style: none;   /* IE/Edge — hide scrollbar */
        padding-bottom: 4px;        /* small breathing room */
    }

    /* Chrome/Safari — hide scrollbar */
    .kuse-filter-tabs::-webkit-scrollbar {
        display: none;
    }

    /* Prevent tabs from shrinking */
    .masonry-tab {
        flex-shrink: 0;
        padding: 7px 12px;
        font-size: 13px;
    }

    /* Keep icon from shrinking */
    .kuse-filter-tabs > svg {
        flex-shrink: 0;
    }
    .kuse-card-inner { border-radius: 14px; }

    .kuse-play-btn {
        opacity: 1 !important;
        transform: translate(-50%, -50%) scale(1) !important;
        pointer-events: all !important;
        width: 54px;
        height: 54px;
        background: rgba(22,22,22,.60);
    }

    .kuse-card-info { padding: 12px 14px 16px; }
    .kuse-title { font-size: 14px; }
    .kuse-category { font-size: 12px; }
}
