:root {
    --infotv-bg: #0d1117;
    --infotv-text: #f0f6fc;
    --infotv-text-muted: rgba(240, 246, 252, 0.82);
    --infotv-accent: #58a6ff;
    --infotv-dot: rgba(255, 255, 255, 0.35);
    --infotv-dot-active: #ffffff;
    --infotv-timeline-bg: rgba(255, 255, 255, 0.12);
    --infotv-timeline-fill: rgba(255, 255, 255, 0.45);
    --infotv-footer-height: 72px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--infotv-bg);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--infotv-text);
}

.infotv {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--infotv-bg);
}

/* Slides */
.infotv__slides {
    position: absolute;
    inset: 0;
    bottom: var(--infotv-footer-height);
}

.infotv__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.infotv__slide.is-active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

.infotv__slide-media {
    position: absolute;
    inset: 0;
}

.infotv__slide-media img,
.infotv__slide-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.infotv__slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.75) 0%,
        rgba(0, 0, 0, 0.35) 40%,
        rgba(0, 0, 0, 0.15) 100%
    );
    pointer-events: none;
}

.infotv__slide--image-only .infotv__slide-overlay {
    background: transparent;
}

.infotv__slide--image-only .infotv__slide-media img {
    object-fit: contain;
    background: #ffffff;
}

.infotv__slide--image-only .infotv__slide-media video {
    object-fit: contain;
    background: #000000;
}

.infotv__slide-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2.5rem 4rem 3rem;
    z-index: 2;
    transform: translateY(12px);
    opacity: 0;
    transition: transform 0.7s ease 0.15s, opacity 0.7s ease 0.15s;
}

.infotv__slide.is-active .infotv__slide-content {
    transform: translateY(0);
    opacity: 1;
}

.infotv__slide-title {
    margin: 0 0 0.75rem;
    font-size: clamp(2rem, 4.5vw, 4.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.5);
}

.infotv__slide-text {
    margin: 0;
    max-width: 70ch;
    font-size: clamp(1.1rem, 2vw, 1.75rem);
    line-height: 1.45;
    color: var(--infotv-text-muted);
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.infotv__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(3px);
    opacity: 0.72;
    justify-self: end;
}

.infotv__brand-text {
    font-size: clamp(0.65rem, 1vw, 0.8rem);
    font-weight: 500;
    letter-spacing: 0.03em;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
}

.infotv__brand-company {
    font-size: clamp(0.65rem, 1vw, 0.8rem);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
}

/* Footer: dots + timeline */
.infotv__footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--infotv-footer-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 0 2rem 18px;
    z-index: 10;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
    overflow: visible;
}

.infotv__footer-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    overflow: visible;
}

.infotv__footer-spacer {
    /* Tasapainottaa vasemman brändin, jotta pallot pysyvät keskellä */
}

.infotv__dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    overflow: visible;
}

.infotv__dot {
    position: relative;
    width: 10px;
    height: 10px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--infotv-dot);
    cursor: pointer;
    transition: transform 0.25s ease, background 0.25s ease, opacity 0.25s ease;
    opacity: 0.7;
    overflow: visible;
}

.infotv__dot-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%) translateY(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 40;
}

.infotv__dot-tooltip-card {
    display: block;
    width: clamp(140px, 16vw, 220px);
    background: rgba(12, 18, 28, 0.96);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.infotv__dot-tooltip-frame {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.infotv__dot-tooltip-frame img,
.infotv__dot-tooltip-frame video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.infotv__dot-tooltip-title {
    display: block;
    padding: 0.45rem 0.55rem 0.5rem;
    font-size: clamp(0.7rem, 1.1vw, 0.85rem);
    font-weight: 600;
    line-height: 1.25;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.infotv__dot:hover .infotv__dot-tooltip,
.infotv__dot:focus-visible .infotv__dot-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.infotv__dot:hover {
    opacity: 1;
    transform: scale(1.15);
}

.infotv__dot.is-active {
    background: var(--infotv-dot-active);
    opacity: 1;
    transform: scale(1.25);
}

.infotv__dot:focus-visible {
    outline: 2px solid var(--infotv-accent);
    outline-offset: 3px;
}

/* Hillitty kasvava aikajana */
.infotv__timeline {
    width: min(320px, 40vw);
    height: 3px;
    border-radius: 999px;
    background: var(--infotv-timeline-bg);
    overflow: hidden;
}

.infotv__timeline-bar {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: var(--infotv-timeline-fill);
    transform-origin: left center;
    transform: scaleX(0);
    will-change: transform;
}

.infotv__timeline-bar.is-animating {
    transition: transform linear;
}

/* Hillityt ohjauspainikkeet – oikea alakulma */
.infotv__controls {
    position: absolute;
    right: 1.25rem;
    bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    z-index: 20;
    opacity: 0.38;
    transition: opacity 0.3s ease;
}

.infotv__controls:hover,
.infotv__controls:focus-within {
    opacity: 0.82;
}

.infotv__control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.28);
    color: rgba(255, 255, 255, 0.82);
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.infotv__control-btn:hover {
    background: rgba(0, 0, 0, 0.45);
    color: #ffffff;
}

.infotv__control-btn:focus-visible {
    outline: 2px solid var(--infotv-accent);
    outline-offset: 2px;
    opacity: 1;
}

.infotv__control-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.infotv__control-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.infotv__control-icon--play,
.infotv__control-icon--exit {
    display: none;
}

.infotv__control-btn--pause.is-paused .infotv__control-icon--pause,
.infotv__control-btn--fullscreen.is-fullscreen .infotv__control-icon--enter {
    display: none;
}

.infotv__control-btn--pause.is-paused .infotv__control-icon--play,
.infotv__control-btn--fullscreen.is-fullscreen .infotv__control-icon--exit {
    display: flex;
}

.infotv.is-overview-open .infotv__controls {
    opacity: 0;
    pointer-events: none;
}

/* Diayleiskatsaus */
.infotv__overview {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(8, 12, 18, 0.96);
    backdrop-filter: blur(8px);
}

.infotv__overview-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 0.75rem 1rem 1rem;
}

.infotv__overview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.65rem;
    flex-shrink: 0;
}

.infotv__overview-title {
    margin: 0;
    font-size: clamp(1.5rem, 3.5vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.infotv__overview-count {
    color: var(--infotv-text-muted);
    font-weight: 500;
    font-size: 0.85em;
}

.infotv__overview-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: background 0.2s ease;
}

.infotv__overview-close svg {
    width: 20px;
    height: 20px;
}

.infotv__overview-close:hover {
    background: rgba(255, 255, 255, 0.16);
}

.infotv__overview-close:focus-visible {
    outline: 2px solid var(--infotv-accent);
    outline-offset: 2px;
}

.infotv__overview-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    gap: 0.75rem;
    overflow: auto;
    align-content: stretch;
    align-items: stretch;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
}

@media (max-width: 900px), (max-height: 520px) {
    .infotv__overview-grid {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        align-content: unset;
        gap: 0.75rem;
        overflow-x: hidden;
        overflow-y: auto;
        scroll-snap-type: y proximity;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 0.35rem;
    }

    .infotv__overview-item {
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        max-width: none;
        scroll-snap-align: start;
    }

    .infotv__overview-frame {
        width: 100%;
        height: auto;
        max-height: none;
        aspect-ratio: 16 / 9;
    }

    .infotv__overview-item:hover .infotv__overview-frame,
    .infotv__overview-item:focus-visible .infotv__overview-frame {
        transform: translateY(0) scale(1.01);
    }
}

.infotv__overview-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-height: 0;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.infotv__overview-frame {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.infotv__overview-frame--media-only {
    background: #111;
}

.infotv__overview-frame img,
.infotv__overview-frame video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.infotv__overview-item:hover .infotv__overview-frame,
.infotv__overview-item:focus-visible .infotv__overview-frame {
    border-color: rgba(88, 166, 255, 0.75);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.infotv__overview-item.is-active .infotv__overview-frame {
    border-color: var(--infotv-accent);
    box-shadow: 0 0 0 1px var(--infotv-accent), 0 12px 28px rgba(0, 0, 0, 0.45);
}

.infotv__overview-meta {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 0;
    flex-shrink: 0;
    padding: 0 0.15rem;
}

.infotv__overview-num {
    flex-shrink: 0;
    font-size: clamp(0.8rem, 1.2vw, 0.95rem);
    font-weight: 700;
    color: var(--infotv-accent);
}

.infotv__overview-label {
    font-size: clamp(0.8rem, 1.2vw, 0.95rem);
    color: var(--infotv-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.infotv__overview-item:focus-visible {
    outline: none;
}

.infotv__overview-item:focus-visible .infotv__overview-meta {
    color: #fff;
}
