/**
 * Video Listing Block Styles
 * For frontend and editor.
 * Restyled for the v2 parchment design: Crimson Pro titles, Lora meta,
 * gold hairlines (--rule), leather accents (--green --leather).
 *
 * @package Zelda_Central
 */

/* ===================================
   EDITOR PREVIEW
   =================================== */

.wp-block-zelda-video-listing-editor {
    padding: 2rem;
    background: #e9ddb633;
    border: 2px dashed var(--gold, #b18c43);
    text-align: center;
}

.wp-block-zelda-video-listing-editor .video-listing-preview {
    max-width: 400px;
    margin: 0 auto;
}

.wp-block-zelda-video-listing-editor .video-listing-icon {
    font-size: 3rem;
    color: var(--gold, #b18c43);
    margin-bottom: 1rem;
}

.wp-block-zelda-video-listing-editor .video-listing-icon .dashicons {
    width: auto;
    height: auto;
    font-size: inherit;
}

.wp-block-zelda-video-listing-editor h3 {
    font-family: var(--font-heading, "Crimson Pro", Georgia, serif);
    margin: 0 0 0.5rem;
    color: var(--ink, #17221b);
    font-size: 1.25rem;
}

.wp-block-zelda-video-listing-editor p {
    margin: 0.5rem 0;
    color: var(--muted, #55523e);
}

/* ===================================
   FRONTEND - CONTAINER
   =================================== */

.video-listing-container {
    margin: 2rem 0;
}

.video-listing-empty {
    padding: 2rem;
    text-align: center;
    border: 1px dashed var(--gold, #b18c43);
    color: var(--muted, #55523e);
}

/* ===================================
   GRID LAYOUT
   =================================== */

.video-listing-container.layout-grid .video-listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* ===================================
   LIST LAYOUT
   =================================== */

.video-listing-container.layout-list .video-listing-grid {
    display: flex;
    flex-direction: column;
}

.video-listing-container.layout-list .video-listing-card {
    border-bottom: 1px solid var(--rule, #bba16b66);
}

.video-listing-container.layout-list .video-listing-card:last-child {
    border-bottom: 0;
}

.video-listing-container.layout-list .video-listing-card:hover {
    background: #fff8e755;
}

.video-listing-container.layout-list .video-card-link {
    display: flex;
    flex-direction: row;
    width: 100%;
    padding: 0.75rem;
}

.video-listing-container.layout-list .video-card-thumbnail {
    width: 240px;
    height: 135px;
    flex-shrink: 0;
    padding-bottom: 0;
}

.video-listing-container.layout-list .video-card-content {
    flex: 1;
    padding: 0.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: transparent;
}

.video-listing-container.layout-list .video-card-title {
    margin-bottom: 0.4rem;
    font-size: 1.1rem;
}

.video-listing-container.layout-list .video-card-excerpt {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

/* ===================================
   VIDEO CARD
   =================================== */

.video-listing-card {
    background: #e9ddb633;
    border: 1px solid var(--rule, #bba16b66);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.video-listing-card:hover {
    border-color: var(--gold, #b18c43);
    box-shadow: 0 6px 14px #37291424;
}

/* Inside .entry-content every link is gold-underlined; the whole card is an
   <a>, which would underline title and excerpt text too. Out-specificify it. */
.video-card-link,
.entry-content .video-card-link,
.entry-content .video-card-link:hover {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* ===================================
   THUMBNAIL
   =================================== */

.video-card-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #17251e;
    border-bottom: 1px solid #6b613e;
    overflow: hidden;
}

.video-card-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-listing-card:hover .video-card-thumbnail img {
    transform: scale(1.05);
}

/* Duration badge */
.video-card-thumbnail .video-duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Play overlay */
.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    z-index: 1;
}

.video-play-overlay .icon {
    width: 56px;
    height: 56px;
    color: #fff;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.video-listing-card:hover .video-play-overlay {
    background: rgba(0, 0, 0, 0.3);
}

.video-listing-card:hover .video-play-overlay .icon {
    opacity: 1;
    transform: scale(1);
}

/* ===================================
   CARD CONTENT
   =================================== */

.video-card-content {
    padding: 1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.video-card-title {
    font-family: var(--font-heading, "Crimson Pro", Georgia, serif);
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 0.5rem;
    color: var(--ink, #17221b);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-decoration: none;
    border-bottom: none;
}

.video-listing-card:hover .video-card-title {
    color: #586433;
    text-decoration: underline;
    text-decoration-color: var(--gold, #b18c43);
    text-underline-offset: 2px;
}

.video-card-excerpt {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--muted, #55523e);
    margin: 0 0 0.875rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-decoration: none;
    border-bottom: none;
}

.video-card-excerpt.entry-content p,
.entry-content .video-card-excerpt,
.video-card-excerpt p,
.video-card-excerpt a {
    overflow: hidden !important;
    text-decoration: none !important;
    border-bottom: none !important;
}

.video-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--muted, #55523e);
    margin-top: auto;
    padding-top: 0.6rem;
    border-top: 1px solid var(--rule, #bba16b66);
}

.video-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.video-card-meta .icon {
    width: 15px;
    height: 15px;
    color: #8d702e;
    flex-shrink: 0;
}

.video-meta-game {
    font-weight: 600;
    color: #63583e;
}

.video-meta-date {
    font-variant-numeric: tabular-nums;
}

/* ===================================
   PAGINATION
   =================================== */

.video-listing-pagination {
    margin-top: 2.5rem;
}

.video-listing-pagination .page-numbers {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.video-listing-pagination .page-numbers li {
    margin: 0;
}

.video-listing-pagination a.page-numbers,
.video-listing-pagination span.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    background: #e9ddb633;
    border: 1px solid var(--rule, #bba16b66);
    color: var(--ink, #17221b);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.video-listing-pagination a.page-numbers:hover {
    background: var(--gold-light, #edcf81);
    border-color: var(--gold, #b18c43);
}

.video-listing-pagination span.page-numbers.current {
    background: var(--green, #09291f) var(--leather, none) repeat;
    background-size: 520px;
    border-color: var(--gold, #b18c43);
    color: #fff1cb;
}

.video-listing-pagination .page-numbers .prev,
.video-listing-pagination .page-numbers .next {
    font-weight: 600;
}

.video-listing-pagination .page-numbers .icon {
    width: 14px;
    height: 14px;
}

/* ===================================
   RESPONSIVE
   =================================== */

/* Tablets */
@media (max-width: 768px) {
    .video-listing-container.layout-grid .video-listing-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }

    .video-listing-container.layout-list .video-card-link {
        flex-direction: column;
    }

    .video-listing-container.layout-list .video-card-thumbnail {
        width: 100%;
        height: auto;
        padding-bottom: 56.25%;
    }

    .video-listing-pagination a.page-numbers,
    .video-listing-pagination span.page-numbers {
        min-width: 36px;
        height: 36px;
        padding: 0 0.5rem;
        font-size: 0.9rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .video-listing-container.layout-grid .video-listing-grid {
        grid-template-columns: 1fr;
    }

    .video-card-content {
        padding: 0.75rem;
    }

    .video-card-title {
        font-size: 1.15rem;
    }

    .video-card-meta {
        font-size: 0.8rem;
        gap: 0.5rem;
    }

    /* Hide some pagination numbers on mobile */
    .video-listing-pagination .page-numbers li:not(.prev):not(.next):not(.current) {
        display: none;
    }

    .video-listing-pagination .page-numbers li:nth-child(2),
    .video-listing-pagination .page-numbers li:nth-last-child(2) {
        display: list-item;
    }
}
