/* Dark theme tokens. The banner gradient and the white partner-logo tiles are
   deliberately not tokenised: the gradient is already dark, and the logo tiles have to
   stay light because the partner marks are drawn for light backgrounds. */
:root {
    --bg: #070f1c;
    --surface: #101a2b;
    --surface-raised: #18253a;
    --surface-sunken: #0c1524;
    --border: #223350;
    --text: #e7edf6;
    --text-muted: #9aabc3;
    --text-dim: #79899f;
    /* The brand navy is unreadable as a foreground on dark, so accents use a lighter
       tint of it and keep the navy for filled backgrounds only. */
    --accent: #4d8fd6;
    --accent-deep: #1f467a;
    --orange: #ff6b00;
}

/* Main Layout */
body {
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-weight: 300;
}

#wrapper {
    height: 100vh;
}

/* Banner */
#banner {
    background: linear-gradient(120.85deg, rgb(0, 24, 57) 0%, rgb(31, 70, 122) 98.31%);
    position: relative;
    min-height: 184px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    overflow: visible;
    z-index: 1;
    height: 210px;
    padding-top: 20px;
    padding-bottom: 74px;
}

#banner .first {
    text-align: center;
    font-size: 1.25em;
    color: rgba(255, 255, 255, 0.8);
}

#banner .second {
    text-align: center;
    font-size: 2em;
    font-weight: bold;
    color: white;
    padding-top: 0;
}

#banner .bottomline {
    width: 100%;
    height: 4px;
    background: linear-gradient(269.52deg, rgba(255, 107, 0, 0) 42%, var(--orange) 100%);
    position: absolute;
    bottom: 0px;
    transform: translateY(0%);
}

/* Logo cluster: Bitmovin above, partner marks below, straddling the banner edge. */
.logo-cluster {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateY(50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    z-index: 2;
}

.logo-primary {
    width: 100px;
    height: 100px;
    background-image: url('media/hexagon_base_blue.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-primary img {
    width: 58px;
    height: auto;
}

#banner h1 {
    margin: 0;
    padding: 14px 30px 0;
}

/* Container */
.container {
    position: relative;
    z-index: 0;
    padding: 20px;
    padding-top: 70px;
}

h1, h2, h3, p {
    font-weight: 300;
    text-align: center;
    margin: 40px;
}

.container > .row:first-child h2 {
    margin: 10px 40px;
}

/* Player */
#player-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    position: relative;
    line-height: 0;
    margin: auto;
    -webkit-box-shadow: 0px 0px 56px 0px rgba(0, 0, 0, 0.75);
    -moz-box-shadow: 0px 0px 56px 0px rgba(0, 0, 0, 0.75);
    box-shadow: 0px 0px 56px 0px rgba(0, 0, 0, 0.75);
}

#player-wrapper {
    position: relative;
}

.player-play-pause {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.player-play-pause:hover {
    background: rgba(0, 0, 0, 0.75);
}

.player-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.75);
    color: #ff6b6b;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.player-play-pause:disabled {
    opacity: 0;
    pointer-events: none;
}

/* Cards */
.card-text {
    text-align: center;
    margin: unset;
}

.additional-text {
    margin-top: 40px;
}

/* Custom Source */
.custom-source-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 18px;
}

.custom-input {
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 300;
    padding: 6px 9px;
    min-width: 130px;
}

.custom-input-label,
.custom-input-unit {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    margin: 0;
}

.custom-input-unit {
    margin-left: -3px;
}

.custom-input-narrow {
    max-width: 110px;
}

.custom-source-note {
    flex-basis: 100%;
    margin: 2px 0 0;
    color: var(--text-dim);
    font-size: 0.78rem;
    line-height: 1.45;
}

.custom-input-wide {
    flex: 1;
    min-width: 220px;
}

.custom-input::placeholder {
    color: var(--text-dim);
}

.custom-input:focus {
    border-color: var(--accent);
    outline: none;
}

.custom-source-btn {
    margin: 5px 5px 5px auto;
}

.custom-source-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Stream Buttons */
.stream-btn {
    margin: 5px;
    min-width: 120px;
}

.stream-btn.active {
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.5);
}

/* Controls Bar */
.controls-bar {
    background: var(--surface);
    border-radius: 8px;
    padding: 15px 20px;
    margin-top: 15px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 26px;
    row-gap: 12px;
}

.controls-bar .control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.controls-bar label {
    font-size: 0.85em;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
}

.controls-bar .latency-value {
    font-family: monospace;
    font-size: 1.1em;
    font-weight: 400;
    min-width: 60px;
}

.volume-toggle {
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 2px;
}

.volume-toggle:hover {
    color: var(--accent);
}

.volume-toggle svg {
    fill: currentColor;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    height: 16px;
    width: 76px;
}

.volume-slider::-webkit-slider-runnable-track {
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: 3px;
    height: 4px;
}

.volume-slider::-moz-range-track {
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: 3px;
    height: 4px;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background: var(--accent);
    border-radius: 50%;
    height: 12px;
    margin-top: -5px;
    width: 12px;
}

.volume-slider::-moz-range-thumb {
    background: var(--accent);
    border: none;
    border-radius: 50%;
    height: 12px;
    width: 12px;
}

.volume-slider:focus {
    outline: none;
}

.volume-slider.muted::-webkit-slider-thumb {
    background: var(--text-dim);
}

.volume-slider.muted::-moz-range-thumb {
    background: var(--text-dim);
}

.controls-bar .volume-value {
    color: var(--text-muted);
    font-family: monospace;
    font-size: 0.85em;
    min-width: 44px;
}

.quality-select {
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 300;
    padding: 3px 6px;
}

.quality-select:focus {
    outline: none;
    border-color: var(--accent);
}

.latency-btn.active {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #06101f;
}

.selector-section {
    margin-top: 30px;
}

/* Stream Selector */
.stream-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.provider-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.provider-filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    padding: 4px 14px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.provider-filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.provider-filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #06101f;
}

/* Partner strip: attribution under the player, not a control. */
.partner-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-bottom: 18px;
}

.partner-strip-label {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.logo-partners {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.logo-partner {
    height: 42px;
    background-color: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 12px;
}

.logo-partner img {
    max-height: 100%;
    max-width: 96px;
    width: auto;
    object-fit: contain;
}

.logo-partner-lockup img {
    max-width: 22px;
}

.logo-partner-lockup span {
    font-size: 0.85rem;
    font-weight: 600;
    color: #001839;
    white-space: nowrap;
}

/* Stream Cards */
.stream-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stream-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    font-family: inherit;
    font-weight: 300;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.stream-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.stream-card.active {
    border-color: #ff6b00;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.35);
}

.stream-card.unsupported {
    background: var(--surface-sunken);
    border-style: dashed;
}

.stream-card.unsupported .stream-card-name,
.stream-card.unsupported .stream-card-relay {
    color: var(--text-dim);
}

.stream-card-relay {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.stream-card-name {
    font-size: 0.98rem;
    font-weight: 400;
    line-height: 1.3;
}

.stream-card-description {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
    flex-grow: 1;
}

.stream-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.stream-card-badge {
    background: var(--surface-raised);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.stream-card-badge-warning {
    background: rgba(255, 146, 10, 0.16);
    color: #ffb05c;
}

.content {
    margin-bottom: 10em;
}

/* Publisher */
#publisher-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.publisher-devices {
    display: flex;
    gap: 8px;
    width: 100%;
}

.publisher-devices select {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 300;
}

.publisher-preview {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

#preview-video {
    max-height: 200px;
    border-radius: 6px;
    background: #000;
}

.live-badge {
    display: none;
    position: absolute;
    top: 6px;
    right: 6px;
    background: #e00;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.4;
}

.live-badge.visible {
    display: block;
}

.publisher-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.publisher-start-btn,
.publisher-load-btn {
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    padding: 6px 24px;
    border: 1px solid #1f467a;
    background: linear-gradient(120deg, #001839, #1f467a);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.02em;
    display: inline-block;
}

.publisher-start-btn:hover,
.publisher-load-btn:hover {
    background: linear-gradient(120deg, #001839, #2a5a9e);
    box-shadow: 0 2px 8px rgba(31, 70, 122, 0.3);
    color: white;
}

.publisher-start-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Intro Text */
.intro-text {
    font-size: 0.95em;
    color: var(--text-muted);
    line-height: 1.7;
    margin: 10px 40px 30px;
}

.affiliation-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 30px 40px 14px;
}

.affiliation-logos .logo-partner {
    width: 148px;
    transition: box-shadow 0.15s;
}

.affiliation-logos .logo-partner:hover {
    box-shadow: 0 0 0 3px rgba(77, 143, 214, 0.3);
}

.affiliation-text {
    font-size: 0.88em;
    color: var(--text-dim);
    line-height: 1.7;
    margin: 0 40px 30px;
}

.credit-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(77, 143, 214, 0.4);
}

.credit-link:hover {
    color: var(--text);
    border-bottom-color: var(--text);
}

/* Architecture Diagram */
.architecture-section {
    margin-top: 50px;
}

.architecture-section h3 {
    margin-bottom: 20px;
}

.architecture-diagram {
    width: 100%;
    border-radius: 8px;
    background: #fff;
    padding: 18px;
    box-sizing: border-box;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

/* Quotes */
.quote-section {
    margin-top: 50px;
}

.moq-quote {
    border-left: 4px solid var(--accent);
    padding: 15px 25px;
    margin: 20px 0;
    background: var(--surface);
    border-radius: 0 8px 8px 0;
}

.moq-quote p {
    text-align: left;
    font-style: italic;
    font-size: 0.95em;
    line-height: 1.7;
    color: var(--text);
    margin: 0 0 10px 0;
}

.moq-quote footer {
    text-align: left;
    font-weight: 400;
    color: var(--accent);
    font-size: 0.9em;
}

/* NAB CTA */
.nab-cta {
    margin-top: 60px;
    margin-bottom: 40px;
    padding: 40px 0;
    background: linear-gradient(120.85deg, rgb(0, 24, 57) 0%, rgb(31, 70, 122) 98.31%);
    border-radius: 12px;
}

.nab-cta h2 {
    color: white;
    margin: 0 0 15px 0;
}

.cta-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95em;
    line-height: 1.7;
    margin: 0 0 10px 0;
}

.cta-booths {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    font-size: 1.05em;
    margin: 15px 0 25px 0;
}

.btn-cta {
    background: linear-gradient(269.52deg, rgb(255, 255, 255) 50%, rgb(255, 107, 0) 100%);
    color: #001839;
    font-weight: 400;
    padding: 10px 30px;
    border-radius: 6px;
    border: none;
    transition: all 0.2s ease;
}

.btn-cta:hover {
    opacity: 0.9;
    color: #001839;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.3);
}

/* Bootstrap overrides. The vendored stylesheet assumes a light page, so the components
   used here are re-pointed at the theme tokens rather than restyled from scratch. */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.card-body {
    color: var(--text);
}

.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background-color: var(--surface-raised);
    border-color: var(--accent);
    color: var(--text);
}

.btn-outline-danger {
    color: #ff7b7b;
    border-color: #7d2b2b;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
    background-color: #b02a2a;
    border-color: #b02a2a;
    color: #fff;
}

.form-control,
.form-control-sm {
    background-color: var(--surface-sunken);
    border-color: var(--border);
    color: var(--text);
}

.form-control:focus {
    background-color: var(--surface-sunken);
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 0 0 0.2rem rgba(77, 143, 214, 0.25);
}

.form-control option {
    background-color: var(--surface-sunken);
    color: var(--text);
}

/* Responsive */
@media (max-width: 800px) {
    #banner .second {
        font-size: 1.4em;
    }
    #banner .first p {
        font-size: 0.9em;
    }

    #banner {
        height: 186px;
        padding-bottom: 64px;
    }

    .container {
        padding: 10px;
        padding-top: 60px;
    }

    .logo-cluster {
        gap: 10px;
    }

    .logo-primary {
        width: 74px;
        height: 74px;
    }

    .logo-primary img {
        width: 42px;
    }

    .stream-btn {
        min-width: 70px;
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    .stream-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stream-selector {
        justify-content: center;
    }

    .provider-filter-btn {
        font-size: 0.78rem;
        padding: 3px 11px;
    }

    .logo-partner {
        height: 34px;
        padding: 5px 9px;
    }

    .logo-partner img {
        max-width: 74px;
    }

    .logo-partner-lockup span {
        font-size: 0.75rem;
    }

    .controls-bar {
        padding: 10px;
        gap: 10px;
        flex-direction: column;
        align-items: flex-start;
    }

    .controls-bar .control-group {
        flex-wrap: wrap;
        gap: 5px;
    }

    .latency-btn {
        font-size: 0.75rem !important;
        padding: 3px 8px !important;
    }

    h1, h2, h3, p {
        margin: 20px 10px;
    }

    .intro-text {
        margin: 10px 10px 20px;
    }

    .nab-cta {
        margin: 40px 10px 20px;
        padding: 25px 15px;
    }
}
