@import url("../branding/fonts.css");

:root {
    color-scheme: light;
    font-family: "Soehne", Arial, sans-serif;
    --primary: #0f240d;
    --primary-dark: #0f4529;
    --brand-accent: #8ff2c2;
    --brand-muted: #f7f3ef;
    --secondary: #616161;
    --surface: #ffffff;
    --background: #fafaf8;
    --text: #000000;
    --text-secondary: #616161;
    --border: #d9d9d9;
    background: var(--background);
    color: var(--text);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
}

body.is-branded {
    display: flex;
    flex-direction: column;
    background: var(--background);
}

body.is-plain {
    background: var(--background);
}

.brand-bar {
    display: flex;
    align-items: center;
    min-height: 4rem;
    padding: .85rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.brand-lockup img {
    display: block;
    width: auto;
    height: 1.85rem;
}

.brand-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem 1.25rem;
    margin-top: auto;
    padding: 1rem 1.25rem;
    color: #ffffff;
    background: var(--primary);
}

.brand-footer a {
    color: inherit;
    font-weight: 700;
    letter-spacing: .04em;
    text-decoration: none;
}

.brand-footer a:hover,
.brand-footer a:focus-visible {
    text-decoration: underline;
    outline: none;
}

.brand-footer span {
    color: rgb(255 255 255 / 78%);
    font-size: .9rem;
}

button {
    font: inherit;
}

.player-shell {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 1rem 1rem 1.5rem;
}

.player-shell:has(.chapters-panel:not([hidden])) {
    width: min(1180px, 100%);
}

.player-header {
    margin-bottom: 1rem;
}

.player-header h1 {
    margin: 0 0 .35rem;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-family: "LT Museum", Georgia, serif;
    font-weight: 300;
    font-synthesis: none;
    line-height: 1.2;
}

.published-date,
.description,
.status {
    color: var(--text-secondary);
}

.video-frame {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: .75rem;
    background: #000;
    box-shadow: 0 1rem 3rem rgb(0 0 0 / 12%);
}

.video-frame:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.video-frame.controls-hidden {
    cursor: none;
}

.video-frame:has(.sound-pill:not([hidden])) {
    cursor: auto;
}

.sound-pill {
    position: absolute;
    z-index: 4;
    top: .75rem;
    left: .75rem;
    max-width: calc(100% - 1.5rem);
    padding: .65rem 1rem;
    border: 1px solid rgb(255 255 255 / 35%);
    border-radius: 999px;
    color: #ffffff;
    font-size: .85rem;
    background: rgb(0 0 0 / 78%);
    cursor: pointer;
    animation: sound-pill-enter .2s ease-out;
    transition: background .2s ease, transform .2s ease;
}

.sound-pill:hover,
.sound-pill:focus-visible {
    color: var(--primary);
    background: var(--brand-accent);
    outline: 2px solid #ffffff;
    outline-offset: 2px;
    transform: translateY(-1px);
}

.sound-pill[hidden] {
    display: none;
}

@keyframes sound-pill-enter {
    from { opacity: 0; transform: translateY(-.25rem); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .sound-pill { animation: none; transition: none; }
}

.video-frame.controls-hidden .player-controls {
    opacity: 0;
    pointer-events: none;
}

.video-overlay-play {
    position: absolute;
    z-index: 2;
    left: 50%;
    top: 50%;
    display: grid;
    width: clamp(3.75rem, 8vw, 5rem);
    aspect-ratio: 1;
    padding: 0 0 0 .3rem;
    border: 0;
    border-radius: 50%;
    place-items: center;
    color: #ffffff;
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    background: rgb(0 0 0 / 58%);
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: background .15s ease, transform .15s ease;
}

.video-overlay-play:hover,
.video-overlay-play:focus-visible {
    color: var(--primary);
    background: var(--brand-accent);
    outline: none;
    transform: translate(-50%, -50%) scale(1.06);
}

.video-overlay-play[hidden],
.player-controls[hidden] {
    display: none;
}

.player-controls {
    position: absolute;
    z-index: 3;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    gap: .55rem;
    min-height: 3.5rem;
    padding: 1.2rem .75rem .55rem;
    color: #ffffff;
    background: linear-gradient(transparent, rgb(0 0 0 / 88%));
    opacity: 1;
    transition: opacity .2s ease;
}

.player-control-button {
    display: grid;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    place-items: center;
    color: #ffffff;
    font-size: 1.1rem;
    line-height: 1;
    background: transparent;
    cursor: pointer;
}

.player-control-button:hover,
.player-control-button:focus-visible {
    background: rgb(255 255 255 / 18%);
    outline: 2px solid rgb(255 255 255 / 85%);
    outline-offset: 1px;
}

.device-control[aria-pressed="true"] {
    color: var(--primary);
}

.play-control span {
    margin-left: .1rem;
    font-size: .95rem;
}

.volume-control span {
    position: relative;
    width: .55rem;
    height: .7rem;
    border-radius: .08rem;
    background: currentColor;
}

.volume-control span::before {
    position: absolute;
    right: 45%;
    top: 50%;
    width: .7rem;
    height: .7rem;
    background: currentColor;
    content: "";
    clip-path: polygon(100% 0, 100% 100%, 0 50%);
    transform: translateY(-50%);
}

.volume-control span::after {
    position: absolute;
    left: .68rem;
    top: 50%;
    width: .55rem;
    height: .85rem;
    border: .12rem solid currentColor;
    border-top-color: transparent;
    border-bottom-color: transparent;
    border-left: 0;
    border-radius: 0 100% 100% 0;
    content: "";
    transform: translateY(-50%);
}

.volume-control.is-muted span::after {
    left: .7rem;
    width: .65rem;
    height: .12rem;
    border: 0;
    border-radius: .1rem;
    background: currentColor;
    transform: translateY(-50%) rotate(45deg);
}

.video-timeline,
.video-volume {
    height: 1rem;
    margin: 0;
    accent-color: var(--brand-accent);
    cursor: pointer;
}

.video-timeline {
    flex: 1 1 auto;
    min-width: 4rem;
}

.video-volume {
    flex: 0 1 5rem;
    width: 5rem;
}

.video-time {
    flex: 0 0 auto;
    min-width: max-content;
    font-size: .78rem;
    font-variant-numeric: tabular-nums;
    font-family: "Soehne Mono", Consolas, monospace;
}

.quality-control {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .25rem;
    min-width: 0;
    padding: .15rem .25rem .15rem .4rem;
    border: 1px solid rgb(255 255 255 / 35%);
    border-radius: .4rem;
    color: #ffffff;
    font-size: .8rem;
    background: rgb(0 0 0 / 36%);
}

.quality-control:focus-within,
.quality-control:hover {
    border-color: rgb(255 255 255 / 85%);
    background: rgb(255 255 255 / 14%);
}

.quality-icon {
    font-size: .95rem;
    line-height: 1;
}

.quality-control select {
    max-width: 10rem;
    border: 0;
    padding: .2rem .25rem;
    color: #ffffff;
    font: inherit;
    background: transparent;
    cursor: pointer;
}

.quality-control select:focus-visible {
    outline: none;
}

.quality-control option {
    color: #ffffff;
    background: #202020;
}

.quality-control[hidden] {
    display: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.player-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 1.5rem;
}

.player-layout:has(.chapters-panel:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 24rem);
}

video {
    display: block;
    width: 100%;
    max-height: var(--player-height, 70dvh);
    object-fit: contain;
    background: #000;
    cursor: pointer;
}

.video-frame:fullscreen {
    display: grid;
    border: 0;
    border-radius: 0;
    place-items: center;
    background: #000000;
}

.video-frame:-webkit-full-screen {
    display: grid;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    place-items: center;
    background: #000000;
}

.video-frame:-webkit-full-screen video {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    object-fit: contain;
}

.video-frame:fullscreen video {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    object-fit: contain;
}

.player-layout:has(.chapters-panel:not([hidden])) video {
    max-height: var(--player-height, 70dvh);
}

.player-layout:has(.chapters-panel:not([hidden])) .video-frame:fullscreen video {
    max-height: 100vh;
}

.player-layout:has(.chapters-panel:not([hidden])) .video-frame:-webkit-full-screen video {
    max-height: 100vh;
}

.chapters-panel {
    min-height: 0;
}

.chapters-panel h2,
.about h2 {
    margin: 0 0 .7rem;
    font-size: 1.25rem;
    font-weight: 500;
}

.chapters {
    max-height: var(--chapters-height, 72vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: .3rem;
}

.about {
    margin-top: 1.5rem;
}

.chapters {
    display: grid;
    gap: .7rem;
}

.chapter {
    display: grid;
    grid-template-columns: 6rem minmax(0, 1fr);
    gap: .8rem;
    width: 100%;
    padding: .7rem;
    border: 1px solid var(--border);
    border-radius: .55rem;
    color: inherit;
    text-align: left;
    background: var(--surface);
    cursor: pointer;
}

.chapter:hover,
.chapter:focus-visible {
    border-color: var(--primary);
    outline: none;
}

.chapter.is-active {
    border-color: var(--primary);
    background: var(--brand-muted);
}

.chapter img {
    width: 6rem;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: .3rem;
    background: #f1f3f5;
}

.chapter-title {
    display: block;
    font-weight: 650;
}

.chapter-time,
.chapter-description {
    display: block;
    margin-top: .2rem;
    color: var(--text-secondary);
    font-size: .9rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1rem;
}

.share-menu {
    position: relative;
}

.share-options {
    position: absolute;
    z-index: 1;
    display: grid;
    min-width: max-content;
    margin-top: .35rem;
    padding: .35rem;
    border: 1px solid var(--border);
    border-radius: .45rem;
    background: var(--surface);
    box-shadow: 0 .5rem 1rem rgb(0 0 0 / 12%);
}

.share-option {
    padding: .5rem .7rem;
    border: 0;
    border-radius: .3rem;
    color: var(--text);
    text-align: left;
    background: transparent;
    cursor: pointer;
}

.share-option:hover,
.share-option:focus-visible {
    background: var(--brand-muted);
    outline: none;
}

.related-videos {
    margin-top: 1.5rem;
}

.related-videos h2 {
    margin: 0 0 .7rem;
    font-size: 1.1rem;
}

.related-video-list {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.related-video {
    border: 1px solid var(--secondary);
    border-radius: .45rem;
    padding: .55rem .85rem;
    color: var(--text);
    text-align: left;
    background: var(--surface);
    cursor: pointer;
}

.related-video:hover,
.related-video:focus-visible {
    border-color: var(--primary);
    outline: none;
}

.action {
    border: 1px solid var(--primary);
    border-radius: .45rem;
    padding: .55rem .85rem;
    color: #ffffff;
    background: var(--primary);
    cursor: pointer;
}

.action:hover,
.action:focus-visible {
    background: var(--primary-dark);
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.action:disabled,
.related-video:disabled,
.share-option:disabled {
    cursor: wait;
    opacity: .65;
}

.actions[hidden],
.share-options[hidden],
.status[hidden] {
    display: none;
}

.error {
    color: #700808;
}

@media (max-width: 760px) {
    .player-layout,
    .player-layout:has(.chapters-panel:not([hidden])) {
        grid-template-columns: 1fr;
    }

    .chapters {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .player-shell {
        padding-top: 1rem;
    }

    .brand-bar,
    .brand-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .brand-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .player-controls {
        flex-wrap: wrap;
        gap: .3rem;
        padding-right: .45rem;
        padding-left: .45rem;
    }

    .video-timeline {
        flex: 1 0 100%;
        order: -1;
    }

    .video-volume {
        flex: 1 1 3rem;
        width: 3rem;
        min-width: 2.5rem;
    }

    .quality-control select {
        max-width: 6.5rem;
    }

    .video-time {
        font-size: .7rem;
    }
}

@media (max-width: 480px) {
    .quality-icon {
        display: none;
    }

    .quality-control select {
        max-width: 4rem;
    }

    .video-time {
        display: none;
    }
}
