/* public/assets/css/pillole.css */

/* Pillole fullscreen mode: hide site chrome */
body.is-pillole-fullscreen footer,
body.is-pillole-fullscreen .tt-footer,
body.is-pillole-fullscreen .tt-mobile-nav,
body.is-pillole-fullscreen .tt-mobile-bottom-nav,
body.is-pillole-fullscreen #footer {
    display: none !important;
}
body.is-pillole-fullscreen,
body.is-pillole-fullscreen .tt-container,
body.is-pillole-fullscreen .tt-container__right {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

/* Zero padding/margin on the wrapper containers so the feed reaches the
   viewport edges (top, bottom, left, right). NOT on .pillole-page itself —
   desktop uses margin:0 auto on the page to center it horizontally. */
body.is-pillole-fullscreen .tt-container__right,
body.is-pillole-fullscreen main {
    padding: 0 !important;
    margin: 0 !important;
}

.pillole-page {
    margin: 0 auto;
    max-width: 100%;
    padding: 0;
    color: #fff;
}

/* Feed container — scroll snap verticale */
.pillole-feed {
    height: calc(100vh - var(--pillole-top-offset, 0px));
    height: calc(100dvh - var(--pillole-top-offset, 0px));
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}
.pillole-feed::-webkit-scrollbar { display: none; }

.pillole-feed__empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 60vh; text-align: center; color: rgba(255,255,255,0.6);
    gap: 12px;
}
.pillole-feed__sentinel { height: 1px; }

/* Card pillola — full viewport */
.pillole-card {
    height: calc(100vh - var(--pillole-top-offset, 0px));
    height: calc(100dvh - var(--pillole-top-offset, 0px));
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    background: #000;
}
.pillole-card__media {
    position: relative;
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.pillole-card__video {
    width: 100%; height: 100%;
    object-fit: cover;
    background: #000;
}

.pillole-card__locked,
.pillole-card__unavailable {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
}
.pillole-card__locked-bg {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    filter: blur(20px) brightness(0.4);
}
.pillole-card__locked-content {
    position: relative; z-index: 1;
    text-align: center; padding: 24px;
    max-width: 320px;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}

/* Overlay con titolo, chips, azioni, descrizione */
.pillole-card__overlay {
    position: absolute; inset: 0;
    pointer-events: none;
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0) 70%, rgba(0,0,0,0.7) 100%);
}
.pillole-card__overlay > * { pointer-events: auto; }

.pillole-card__top {
    padding: 16px 16px 16px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.pillole-card__top-main {
    flex: 1;
    min-width: 0;
}
.pillole-card__top-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
    max-width: 50%;
}
.pillole-card__top-right .pillole-card__primary-chip {
    margin-top: 0; /* override the previous margin: gap from flex handles spacing */
}
.pillole-card__title {
    margin: 0 0 8px;
    font-family: var(--font-serif, Georgia, serif);
    font-size: 20px; font-weight: 600;
    line-height: 1.25;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.pillole-card__chips {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.pillole-chip {
    display: inline-flex; align-items: center;
    padding: 4px 10px;
    background: rgba(255,255,255,0.18);
    color: #fff;
    border-radius: 999px;
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    text-decoration: none;
    backdrop-filter: blur(8px);
}
.pillole-chip:hover { background: hsla(var(--gold) / 0.4); color: #fff; }

.pillole-card__actions {
    grid-row: 2;
    align-self: end;
    justify-self: end;
    display: flex; flex-direction: column; gap: 18px;
    padding: 16px;
}
.pillole-action {
    background: rgba(0, 0, 0, 0.4);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    position: relative;
    padding: 0;
    line-height: 1;
}
.pillole-action__icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    line-height: 1;
    color: inherit;
}
.pillole-action__icon svg {
    width: 100%;
    height: 100%;
    display: block;
    stroke-width: 2;
}
.pillole-action__icon i {
    display: block;
    width: 22px;
    height: 22px;
    font-size: 22px;
    line-height: 22px;
    text-align: center;
}
.pillole-action:hover { background: rgba(0,0,0,0.6); }
.pillole-action:active { transform: scale(0.92); }
.pillole-action.is-active { color: hsl(var(--gold)); }

.pillole-card__bottom {
    grid-row: 3;
    padding: 0 80px 12px 16px;
}
.pillole-card__desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: rgba(255,255,255,0.92);
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    max-height: 3.6em;
    overflow: hidden;
    transition: max-height 0.25s ease;
    cursor: pointer;
}
.pillole-card__desc.is-expanded { max-height: 50vh; overflow-y: auto; }

/* Centered play icon shown when video is paused (tap-to-resume affordance) */
.pillole-card__pause-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    width: 88px;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.25s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 5;
}
.pillole-card.is-paused .pillole-card__pause-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.pillole-card__progress {
    grid-row: 4;
    position: relative;
    height: 14px; /* generous touch target — visible "track" is smaller */
    background: transparent;
    cursor: pointer;
    touch-action: none;
    pointer-events: auto;
}
.pillole-card__progress::before {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.18);
    transition: height 0.15s ease;
}
.pillole-card__progress:hover::before,
.pillole-card__progress.is-scrubbing::before {
    height: 5px;
}
.pillole-card__progress-bar {
    position: absolute;
    left: 0; bottom: 0;
    width: 0%;
    height: 3px;
    background: hsl(var(--gold, 46 65% 52%));
    transition: width 0.18s linear, height 0.15s ease;
    pointer-events: none;
}
.pillole-card__progress:hover .pillole-card__progress-bar,
.pillole-card__progress.is-scrubbing .pillole-card__progress-bar {
    height: 5px;
}
.pillole-card__progress.is-scrubbing .pillole-card__progress-bar {
    transition: width 0.05s linear;
}
.pillole-card__progress-thumb {
    position: absolute;
    bottom: -2px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
}
.pillole-card__progress.is-scrubbing .pillole-card__progress-thumb {
    opacity: 1;
}

/* Desktop nav arrows — hidden on mobile, shown on desktop */
.pillole-nav { display: none; }

@media (min-width: 1024px) {
    /* Center the feed inside .tt-container__right (the post-sidebar column),
       not the full viewport. Stays in normal flow with margin auto. */
    .pillole-page {
        position: relative;
        max-width: 480px;
        margin: 0 auto;
    }
    .pillole-feed, .pillole-card { height: calc(100vh - var(--pillole-top-offset, 0px)); }
    /* Nav arrows sit just outside the right edge of the centered video,
       absolutely positioned relative to .pillole-page (so they track with
       the centered column). */
    .pillole-nav {
        display: flex;
        flex-direction: column;
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        margin-left: 24px;
        gap: 12px;
        z-index: 60;
        pointer-events: none;
    }
    .pillole-nav__btn {
        pointer-events: auto;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.55);
        border: 1px solid rgba(255, 255, 255, 0.18);
        color: #fff;
        display: grid;
        place-items: center;
        cursor: pointer;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        transition: background 0.15s ease, transform 0.1s ease;
    }
    .pillole-nav__btn:hover {
        background: rgba(0, 0, 0, 0.8);
    }
    .pillole-nav__btn:active {
        transform: scale(0.92);
    }
    .pillole-nav__btn svg {
        display: block;
    }
}

/* Pagina raccolta */
.pillole-collection-page { padding-bottom: 32px; }
.pillole-collection-hero {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: hsl(var(--surface-3));
}
.pillole-collection-hero img { width: 100%; height: 100%; object-fit: cover; }
.pillole-collection-hero__overlay {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.85) 100%);
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 24px 16px;
    color: #fff;
}
.pillole-collection-hero__title {
    margin: 0 0 8px;
    font-family: var(--font-serif, Georgia, serif);
    font-size: 28px; font-weight: 600;
}
.pillole-collection-hero__desc { margin: 0 0 8px; color: rgba(255,255,255,0.85); }
.pillole-collection-hero__meta { font-size: 12px; color: rgba(255,255,255,0.65); text-transform: uppercase; letter-spacing: 0.1em; }

.pillole-collection-cta {
    display: block;
    margin: 16px;
    padding: 14px 18px;
    background: hsl(var(--gold));
    color: #000;
    text-align: center;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    transition: opacity 0.15s ease;
}
.pillole-collection-cta:hover { opacity: 0.9; color: #000; }

.pillole-collection-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 0 16px;
}
.pillole-collection-grid__item {
    aspect-ratio: 9 / 16;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #000;
    text-decoration: none;
    color: #fff;
}
.pillole-collection-grid__item img { width: 100%; height: 100%; object-fit: cover; }
.pillole-collection-grid__item-title {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 16px 10px 8px;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.85) 100%);
    font-size: 13px; font-weight: 600;
    line-height: 1.2;
}

@media (min-width: 768px) {
    .pillole-collection-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Link "Vedi tutte le raccolte" + primary collection chip */
.pillole-card__collections-link {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    transition: color 0.18s ease, text-decoration-color 0.18s ease;
}
.pillole-card__collections-link:hover {
    color: #fff;
    text-decoration-color: #fff;
}

/* Primary collection chip stacked under the title */
.pillole-card__primary-chip {
    display: inline-flex;
}

/* Offcanvas Raccolte (drawer destro) */
.pillole-collections-drawer {
    background: hsl(var(--surface-1, 0 0% 8%));
    color: #fff;
    width: min(420px, 100vw);
}
.pillole-collections-drawer .offcanvas-header {
    border-bottom: 1px solid hsl(var(--hairline, 0 0% 18%));
    padding: 16px 20px;
}
.pillole-drawer__title {
    margin: 0;
    font-family: var(--font-serif, Fraunces, Georgia, serif);
    font-size: 22px;
    font-weight: 600;
}
.pillole-drawer__empty {
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 24px;
}
.pillole-drawer__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
}
.pillole-drawer__card {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: hsla(var(--surface-2, 0 0% 12%) / 0.6);
    border: 1px solid hsl(var(--hairline, 0 0% 18%));
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.18s ease, transform 0.18s ease;
}
.pillole-drawer__card:hover {
    border-color: hsla(var(--gold, 46 65% 52%) / 0.4);
    transform: translateY(-1px);
    color: inherit;
}
.pillole-drawer__card-cover {
    flex-shrink: 0;
    width: 88px;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: hsl(var(--surface-3, 0 0% 14%));
}
.pillole-drawer__card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pillole-drawer__card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 22px;
}
.pillole-drawer__card-body {
    flex: 1;
    min-width: 0;
}
.pillole-drawer__card-title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}
.pillole-drawer__card-desc {
    margin: 0 0 6px;
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.65);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pillole-drawer__card-meta {
    font-size: 10px;
    font-weight: 700;
    color: hsl(var(--gold, 46 65% 52%));
    text-transform: uppercase;
    letter-spacing: 0.1em;
}


/* Ensure bottom sheet can render above the fullscreen feed */
body.is-pillole-fullscreen .tt-vd-sheet,
body.is-pillole-fullscreen .tt-vd-sheet-backdrop {
    z-index: 1080;
}

/* Neutralize global .tt-save-toggle absolute positioning inside the pillole feed.
   The global rule (platform-extras.css) sets position:absolute; top:10px; right:10px
   which would knock the Salva button out of the column flow. */
.pillole-card__actions .tt-save-toggle {
    position: static;
    top: auto;
    right: auto;
    box-shadow: none;
}
