/* =========================================================
   西雅圖設計
   YouTube 作品播放器
   ========================================================= */


/* =========================================================
   整體播放器
   ========================================================= */

.ytx-player {
    position: relative;
    width: 100%;
    margin: 0 auto;
}


/* =========================================================
   16:9 影片區
   相容舊版 Chrome
   ========================================================= */

.ytx-stage {
    position: relative;

    width: 100%;
    height: 0;

    padding-top: 56.25%;

    overflow: hidden;

    background-color: #000;

    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
}


/* =========================================================
   YouTube 固定外層

   這個 div 不會被 YouTube API 換掉。
   所以透明度、定位全部控制這一層。
   ========================================================= */

.ytx-video-layer {
    position: absolute;

    top: 0;
    right: 0;
    bottom: 0;
    left: 0;

    z-index: 1;

    width: 100%;
    height: 100%;

    opacity: 0;

    pointer-events: none;

    transition:
        opacity .42s ease;
}


/* YouTube 真正開始播放後 */

.ytx-player.is-video-visible
.ytx-video-layer {
    opacity: 1;

    pointer-events: auto;
}


/* =========================================================
   YouTube holder / iframe
   ========================================================= */

.ytx-youtube {
    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;
}


.ytx-video-layer iframe {
    position: absolute !important;

    top: 0 !important;
    left: 0 !important;

    width: 100% !important;
    height: 100% !important;

    border: 0 !important;

    display: block !important;
}


/* =========================================================
   自訂封面
   ========================================================= */

.ytx-cover {
    position: absolute;

    top: 0;
    right: 0;
    bottom: 0;
    left: 0;

    z-index: 5;

    display: flex;

    align-items: center;
    justify-content: center;

    opacity: 1;

    transition:
        opacity .20s ease;
}


/*
播放真正開始時，
JS 會直接把封面 display:none。

YouTube 則從透明慢慢淡入。

底下還有完全相同的背景封面，
所以視覺上不會黑掉。
*/


/* =========================================================
   封面照片
   ========================================================= */

.ytx-cover-image {
    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
}


/* =========================================================
   自訂播放鍵
   ========================================================= */

.ytx-cover-play {
    position: relative;

    z-index: 2;

    width: 58px;
    height: 58px;

    margin: 0;
    padding: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    border:
        2px solid
        rgba(255,255,255,.94);

    border-radius: 50%;

    background:
        rgba(0,0,0,.15);

    cursor: pointer;

    box-shadow:
        0 3px 18px
        rgba(0,0,0,.25);

    transition:
        transform .18s ease,
        background .18s ease;
}


.ytx-cover-play:hover {
    transform:
        scale(1.08);

    background:
        rgba(0,0,0,.30);
}


.ytx-cover-play span {
    width: 0;
    height: 0;

    margin-left: 4px;

    border-top:
        9px solid transparent;

    border-bottom:
        9px solid transparent;

    border-left:
        15px solid #fff;
}


/* =========================================================
   控制列

   一整列固定：

   目前時間
   進度條
   全部時間
   全螢幕
   ========================================================= */

.ytx-controls {
    position: relative;

    width: 100%;
    height: 0;

    box-sizing: border-box;

    display: flex;

    flex-direction: row;

    align-items: center;

    justify-content: space-between;

    overflow: hidden;

    padding:
        0 12px;

    background:
        #0b0b0b;

    color:
        #fff;

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        height .18s ease,
        opacity .18s ease,
        visibility .18s ease;
}


/* =========================================================
   電腦

   滑鼠移入：
   出現

   移開：
   消失
   ========================================================= */

.ytx-player.is-started:not(.is-touch):hover
.ytx-controls {
    height: 38px;

    opacity: 1;

    visibility: visible;

    pointer-events: auto;
}


/* =========================================================
   手機

   JS 加 controls-visible 時出現。
   ========================================================= */

.ytx-player.is-started.controls-visible
.ytx-controls {
    height: 38px;

    opacity: 1;

    visibility: visible;

    pointer-events: auto;
}


/* =========================================================
   目前時間
   ========================================================= */

.ytx-current {
    flex:
        0 0 42px;

    width: 42px;

    height: 38px;

    margin: 0 10px 0 0;

    padding: 0;

    display: flex;

    align-items: center;

    justify-content: flex-end;

    box-sizing: border-box;

    white-space: nowrap;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    font-size: 11px;

    line-height: 1;

    color:
        rgba(255,255,255,.82);

    font-variant-numeric:
        tabular-nums;
}


/* =========================================================
   全部時間
   ========================================================= */

.ytx-duration {
    flex:
        0 0 42px;

    width: 42px;

    height: 38px;

    margin: 0 5px 0 10px;

    padding: 0;

    display: flex;

    align-items: center;

    justify-content: flex-start;

    box-sizing: border-box;

    white-space: nowrap;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    font-size: 11px;

    line-height: 1;

    color:
        rgba(255,255,255,.82);

    font-variant-numeric:
        tabular-nums;
}


/* =========================================================
   進度條外框
   ========================================================= */

.ytx-progress-box {
    position: relative;

    flex: 1 1 auto;

    min-width: 50px;
    height: 20px;

    display: flex;

    align-items: center;
}


/* =========================================================
   底部灰色軌道
   ========================================================= */

.ytx-progress-track {
    position: absolute;

    left: 0;
    right: 0;
    top: 50%;

    height: 3px;

    transform: translateY(-50%);

    background:
        rgba(255, 255, 255, .34);

    border-radius: 3px;

    overflow: hidden;

    pointer-events: none;
}


/* =========================================================
   已播放紅色區域
   JS 只需要改 width
   ========================================================= */

.ytx-progress-fill {
    width: 0%;
    height: 100%;

    background: #e50914;

    border-radius: 3px 0 0 3px;

    pointer-events: none;
}


/* =========================================================
   真正可以拖曳的 range
   完全透明，只留下白色圓點
   ========================================================= */

.ytx-progress {
    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 20px;

    margin: 0;
    padding: 0;

    border: 0;

    background: transparent !important;

    outline: none;

    cursor: pointer;

    -webkit-appearance: none;
    appearance: none;
}


/* Chrome / Android / Safari */

.ytx-progress::-webkit-slider-runnable-track {
    width: 100%;
    height: 20px;

    border: 0;

    background: transparent;
}


.ytx-progress::-webkit-slider-thumb {
    width: 11px;
    height: 11px;

    margin-top: 4.5px;

    border: 0;

    border-radius: 50%;

    background: #fff;

    box-shadow:
        0 1px 3px
        rgba(0, 0, 0, .45);

    cursor: pointer;

    -webkit-appearance: none;
    appearance: none;
}


/* Firefox */

.ytx-progress::-moz-range-track {
    height: 20px;

    border: 0;

    background: transparent;
}


.ytx-progress::-moz-range-progress {
    background: transparent;
}


.ytx-progress::-moz-range-thumb {
    width: 11px;
    height: 11px;

    border: 0;

    border-radius: 50%;

    background: #fff;

    box-shadow:
        0 1px 3px
        rgba(0, 0, 0, .45);

    cursor: pointer;
}

/* =========================================================
   全螢幕

   SVG 四個角。
   不再用文字、CSS 漸層或方框。
   ========================================================= */

.ytx-fullscreen {
    flex:
        0 0 30px;

    width: 30px;
    height: 30px;

    margin: 0;
    padding: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    box-sizing: border-box;

    border: 0;

    background:
        transparent;

    color:
        #fff;

    cursor: pointer;

    opacity:
        .85;
}


.ytx-fullscreen:hover {
    opacity:
        1;
}


.ytx-fullscreen svg {
    width: 20px;
    height: 20px;

    display: block;

    overflow: visible;
}


.ytx-fullscreen polyline {
    fill: none;

    stroke: #fff;

    stroke-width: 2;

    stroke-linecap: square;

    stroke-linejoin: miter;
}


/* =========================================================
   全螢幕模式
   ========================================================= */

.ytx-player:fullscreen {
    width: 100vw;
    height: 100vh;

    display: flex;

    flex-direction: column;

    background:
        #000;
}


.ytx-player:fullscreen
.ytx-stage {
    flex:
        1 1 auto;

    width: 100%;
    height: auto;

    padding-top: 0;
}


.ytx-player:fullscreen
.ytx-controls {
    flex:
        0 0 auto;
}


/* 舊版 WebKit */

.ytx-player:-webkit-full-screen {
    width: 100vw;
    height: 100vh;

    display: flex;

    flex-direction: column;

    background:
        #000;
}


.ytx-player:-webkit-full-screen
.ytx-stage {
    flex:
        1 1 auto;

    width: 100%;
    height: auto;

    padding-top: 0;
}


/* =========================================================
   手機
   ========================================================= */

@media (max-width: 700px) {

    .ytx-cover-play {
        width: 50px;
        height: 50px;
    }


    .ytx-cover-play span {
        border-top-width: 8px;

        border-bottom-width: 8px;

        border-left-width: 13px;
    }


    .ytx-player.is-started.controls-visible
    .ytx-controls {
        height: 36px;
    }


    .ytx-controls {
        padding:
            0 8px;
    }


    .ytx-current {
        flex-basis: 38px;

        width: 38px;

        height: 36px;

        margin-right: 7px;

        font-size:
            10px;
    }


    .ytx-duration {
        flex-basis: 38px;

        width: 38px;

        height: 36px;

        margin-left: 7px;

        margin-right: 3px;

        font-size:
            10px;
    }


    .ytx-fullscreen {
        flex-basis:
            28px;

        width:
            28px;

        height:
            28px;
    }


    .ytx-fullscreen svg {
        width:
            19px;

        height:
            19px;
    }

}