/* ============================================================
   YouTube Gallery & Slider — yt-gallery.css  v2.0
   Layout: video in evidenza + lista laterale
   ============================================================ */

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

.ytg-wrap {
    --ytg-red:     #FF0000;
    --ytg-dark:    #0f0f0f;
    --ytg-surface: #1a1a1a;
    --ytg-border:  rgba(255,255,255,.08);
    --ytg-text:    #f1f1f1;
    --ytg-muted:   #909090;
    --ytg-radius:  10px;
    font-family: 'Roboto', 'YouTube Sans', sans-serif;
    background: var(--ytg-dark);
    color: var(--ytg-text);
    border-radius: var(--ytg-radius);
    overflow: hidden;
}

.ytg-error {
    background: #1a1a1a;
    color: #ff6b6b;
    padding: 20px;
    border-left: 4px solid #ff6b6b;
    border-radius: var(--ytg-radius);
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.ytg-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.ytg-lightbox.ytg-lb-open { display: flex; }

.ytg-lb-inner {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.ytg-lb-iframe-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: var(--ytg-radius);
    overflow: hidden;
}
.ytg-lb-iframe-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.ytg-lb-info h2 {
    margin: 0 0 6px;
    font-size: 1.1rem;
    font-weight: 600;
}
.ytg-lb-info p {
    margin: 0;
    font-size: .85rem;
    color: var(--ytg-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ytg-lb-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    opacity: .7;
    transition: opacity .2s;
    z-index: 100000;
    line-height: 1;
}
.ytg-lb-close:hover { opacity: 1; }

/* ============================================================
   LAYOUT PRINCIPALE: featured + sidebar
   ============================================================ */
.ytg-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 0;
    min-height: 360px;
}

/* ---- FEATURED (sinistra) ---- */
.ytg-featured {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--ytg-border);
}

.ytg-featured-thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    background: #000;
    cursor: pointer;
    flex-shrink: 0;
}
.ytg-featured-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.ytg-featured-thumb:hover img,
.ytg-featured-thumb:focus-visible img { transform: scale(1.03); }
.ytg-featured-thumb:focus-visible { outline: 2px solid var(--ytg-red); outline-offset: -2px; }

.ytg-featured-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.6) 0%, transparent 55%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s;
}
.ytg-featured-thumb:hover .ytg-featured-overlay,
.ytg-featured-thumb:focus-visible .ytg-featured-overlay { opacity: 1; }

.ytg-featured-play {
    width: 80px;
    height: 80px;
    background: rgba(255,0,0,.88);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #fff;
    padding-left: 5px;
    transition: transform .2s;
}
.ytg-featured-thumb:hover .ytg-featured-play { transform: scale(1.1); }

.ytg-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--ytg-red);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
}

.ytg-featured-info {
    padding: 16px 20px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ytg-featured-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--ytg-text);
}
.ytg-featured-channel {
    font-size: .78rem;
    color: var(--ytg-muted);
}
.ytg-featured-desc {
    margin: 4px 0 0;
    font-size: .82rem;
    color: var(--ytg-muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- SIDEBAR (destra) ---- */
.ytg-sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--ytg-surface);
}

.ytg-sidebar-heading {
    margin: 0;
    padding: 14px 16px 10px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ytg-muted);
    border-bottom: 1px solid var(--ytg-border);
    flex-shrink: 0;
}

.ytg-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}
.ytg-list::-webkit-scrollbar { width: 4px; }
.ytg-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* Lista item */
.ytg-list-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--ytg-border);
    transition: background .18s;
    outline: none;
}
.ytg-list-item:last-child { border-bottom: none; }
.ytg-list-item:hover,
.ytg-list-item:focus-visible { background: rgba(255,255,255,.05); }
.ytg-list-item:focus-visible { outline: 2px solid var(--ytg-red); outline-offset: -2px; }

.ytg-list-thumb {
    position: relative;
    width: 112px;
    min-width: 112px;
    padding-top: 63px; /* ~16:9 su 112px */
    border-radius: 6px;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}
.ytg-list-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.ytg-list-item:hover .ytg-list-thumb img { transform: scale(1.06); }

.ytg-list-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: rgba(255,255,255,0);
    background: rgba(0,0,0,0);
    transition: color .2s, background .2s;
}
.ytg-list-item:hover .ytg-list-play,
.ytg-list-item:focus-visible .ytg-list-play {
    color: #fff;
    background: rgba(255,0,0,.4);
}

.ytg-list-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 2px;
    min-width: 0;
}
.ytg-list-title {
    font-size: .82rem;
    font-weight: 600;
    color: var(--ytg-text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ytg-list-channel {
    font-size: .72rem;
    color: var(--ytg-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
    .ytg-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }
    .ytg-featured { border-right: none; border-bottom: 1px solid var(--ytg-border); }
    .ytg-sidebar { max-height: 320px; }
    .ytg-list { max-height: 260px; }
}

@media (max-width: 480px) {
    .ytg-list-thumb { width: 88px; min-width: 88px; padding-top: 50px; }
    .ytg-featured-info { padding: 12px 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .ytg-featured-thumb img,
    .ytg-list-thumb img { transition: none !important; }
}
