/* ── Knygos Showcase Frontend ── */

.knygos-showcase-wrap {
    max-width: 1400px;
    margin: 2em auto;
    padding: 0 1em;
}

/* Section headings */
.knygos-section-heading {
    font-size: 24px;
    text-align: center;
    margin: 2em 0 0.5em;
    padding-bottom: 0.4em;
    color: #333;
    border-bottom: 2px solid #C2A25B;
    display: inline-block;
    width: 100%;
}

/* Grid */
.knygos-showcase-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5em;
    margin: 1.5em auto 2em;
}

/* Item card */
.knygos-showcase-item {
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: knygosFadeIn 0.8s ease-out forwards;
    opacity: 0;
}

.knygos-showcase-item:nth-child(1)  { animation-delay: 0.1s; }
.knygos-showcase-item:nth-child(2)  { animation-delay: 0.2s; }
.knygos-showcase-item:nth-child(3)  { animation-delay: 0.3s; }
.knygos-showcase-item:nth-child(4)  { animation-delay: 0.4s; }
.knygos-showcase-item:nth-child(5)  { animation-delay: 0.5s; }
.knygos-showcase-item:nth-child(6)  { animation-delay: 0.6s; }
.knygos-showcase-item:nth-child(7)  { animation-delay: 0.7s; }
.knygos-showcase-item:nth-child(8)  { animation-delay: 0.8s; }
.knygos-showcase-item:nth-child(n+9){ animation-delay: 0.9s; }

.knygos-showcase-item:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

/* Link resets */
.knygos-showcase-link,
.knygos-showcase-link:hover,
.knygos-showcase-link:focus,
.knygos-showcase-link:active,
.knygos-showcase-link:visited {
    display: block;
    text-decoration: none !important;
    border: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    background: none !important;
    outline: none !important;
    color: inherit;
    cursor: pointer;
}

/* Cover */
.knygos-showcase-cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: 8px;
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
}

.knygos-showcase-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 3px solid #fff !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: border-color 0.3s ease, transform 0.3s ease;
    outline: none !important;
}

.knygos-showcase-item:hover .knygos-showcase-cover img {
    border-color: #C2A25B !important;
    transform: scale(1.02);
}

/* Title under image */
.knygos-showcase-title {
    padding: 0.75em 0.5em 1em;
    text-align: center;
    font-size: 0.9em;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
    min-height: 4.5em;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-decoration: none !important;
    transition: color 0.3s ease;
    gap: 4px;
}

.knygos-showcase-title-text {
    display: block;
}

.knygos-showcase-item:hover .knygos-showcase-title {
    color: #C2A25B;
}

/* Audio / PDF icons next to title */
.knygos-showcase-icons {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.knygos-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    transition: background 0.2s;
}

.knygos-icon--audio {
    color: #C2A25B;
    background: rgba(194, 162, 91, 0.12);
}

.knygos-icon--pdf {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.10);
}

.knygos-showcase-item:hover .knygos-icon--audio {
    background: rgba(194, 162, 91, 0.25);
}

.knygos-showcase-item:hover .knygos-icon--pdf {
    background: rgba(192, 57, 43, 0.2);
}

/* Responsive grid */
@media (min-width: 1025px) {
    .knygos-showcase-item {
        flex: 0 0 calc(25% - 1.5em);
        max-width: calc(25% - 1.5em);
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .knygos-showcase-item {
        flex: 0 0 calc(33.333% - 1.5em);
        max-width: calc(33.333% - 1.5em);
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .knygos-showcase-item {
        flex: 0 0 calc(50% - 1em);
        max-width: calc(50% - 1em);
    }
    .knygos-showcase-grid {
        gap: 1em;
    }
}

@media (max-width: 480px) {
    .knygos-showcase-item {
        flex: 0 0 80%;
        max-width: 80%;
    }
    .knygos-showcase-grid {
        gap: 1.5em;
    }
}

@keyframes knygosFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.knygos-showcase-empty {
    text-align: center;
    padding: 3em;
    color: #666;
    font-style: italic;
    width: 100%;
}

/* ── Popup ── */

.knygos-popup {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.knygos-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
    cursor: default;
}

.knygos-popup-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    max-width: 900px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    animation: knygosPopIn 0.25s ease-out;
}

@keyframes knygosPopIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.knygos-popup-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #888;
    line-height: 1;
    z-index: 3;
    transition: color 0.2s;
}

.knygos-popup-close:hover {
    color: #333;
}

.knygos-popup-img-link {
    flex: 0 0 auto;
    max-width: 45%;
    margin-right: 24px;
    display: block;
    text-decoration: none !important;
    border: none !important;
}

.knygos-popup-img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: opacity 0.3s;
}

.knygos-popup-img-link:hover .knygos-popup-img {
    opacity: 0.85;
}

.knygos-popup-details {
    flex: 1;
    min-width: 0;
}

.knygos-popup-title {
    font-size: 22px;
    color: #333;
    margin: 0 0 8px;
    line-height: 1.3;
}

.knygos-popup-author {
    font-size: 15px;
    color: #888;
    margin: 0 0 12px;
    font-style: italic;
}

/* Popup badges */
.knygos-popup-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.knygos-popup-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
}

.knygos-popup-badge svg {
    flex-shrink: 0;
}

.knygos-popup-badge--audio {
    background: rgba(194, 162, 91, 0.15);
    color: #9a7d2e;
}

.knygos-popup-badge--pdf {
    background: rgba(192, 57, 43, 0.1);
    color: #c0392b;
}

.knygos-popup-desc {
    font-size: 15px;
    color: #444;
    line-height: 1.65;
}

@media (max-width: 768px) {
    .knygos-popup-content {
        flex-direction: column;
        padding: 20px;
    }

    .knygos-popup-img-link {
        max-width: 100%;
        margin-right: 0;
        margin-bottom: 16px;
    }
}
