:root {
    --bg: #000000;
    --text: rgb(215, 215, 215);
    --text-soft: rgb(200, 200, 200);
    --muted: rgb(181, 181, 181);
    --dim: rgb(140, 140, 140);
    --white: #ffffff;
    --panel-width: 657px;
    --button-bg: rgba(255, 255, 255, 0.5);
    --button-text: #000000;
    --transition-slow: 1000ms ease;
    --title-font: 9.4px;
    --side-font: 10.4px;
    --ui-font: 15px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;
}

body {
    overflow: hidden;
}

/*
 * Keep this family because the current JavaScript waits for "Acry Art"
 * before starting the typewriter animation. It points to the same file
 * as JetBrains Mono, while unsupported Braille glyphs may still use the
 * browser's normal fallback font.
 */
@font-face {
    font-family: "Acry Art";
    src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

pre,
code,
kbd,
samp {
    font-family: "JetBrains Mono", monospace;
}

/*
 * The current JavaScript wraps every Braille character in one of these
 * spans. Keep the spans neutral so they render like ordinary text.
 */
.braille-cell {
    display: inline;
    margin: 0;
    padding: 0;
    border: 0;
}

#title,
.side-panel pre {
    font-family: "JetBrains Mono", monospace;
    font-weight: 400;
    font-style: normal;
    font-synthesis: none;
    font-kerning: none;
    font-variant-ligatures: none;
    font-feature-settings:
        "liga" 0,
        "calt" 0,
        "kern" 0;
    letter-spacing: 0;
    word-spacing: 0;
}

a {
    color: var(--text);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button {
    font: inherit;
}

.black {
    color: black;
}

#overlay {
    position: fixed;
    inset: 0;
    background: black;
    z-index: 9999;
    opacity: 1;
    transition: opacity var(--transition-slow);
    pointer-events: none;
}

#cursor-trail {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 20;
}

.page {
    min-height: 100vh;
    display: grid;
    grid-template-columns:
        minmax(210px, 23vw)
        minmax(640px, 1fr)
        minmax(210px, 23vw);
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "title title title"
        "left center right"
        ". bottom .";
    gap: 1.25rem;
    padding: 14px 18px 18px;
    position: relative;
    z-index: 1;
}

#title-container {
    grid-area: title;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 18px;
}

#title {
    margin: 0;
    font-size: var(--title-font);
    line-height: calc(1em + 3px);
    color: var(--white);
    white-space: pre;
    width: max-content;
    max-width: 100%;
    overflow: hidden;
}

.side-panel {
    align-self: center;
    white-space: pre-wrap;
    font-size: var(--side-font);
    color: var(--text);
}

.side-panel pre {
    margin: 0;
    line-height: calc(1em + 3px);
}

#left-section {
    grid-area: left;
    justify-self: start;
    text-align: left;
    padding-left: clamp(8px, 2vw, 30px);
}

#right-section {
    grid-area: right;
    justify-self: end;
    text-align: right;
    padding-right: clamp(8px, 2vw, 30px);
}

.center-column {
    grid-area: center;
    align-self: center;
    justify-self: center;
    width: min(100%, calc(var(--panel-width) + 80px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transform: translateY(-10px);
}

#tab-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
    font-size: var(--ui-font);
    user-select: none;
}

.tab-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    padding: 8px 10px;
    letter-spacing: 0.02em;
    transition: none;
}

.tab-button[aria-pressed="false"] {
    color: var(--muted);
}

.tab-button:hover,
.tab-button:focus-visible {
    color: var(--text-soft);
    outline: none;
}

.tab-button[aria-pressed="true"] {
    color: var(--text);
}

.tab-button[aria-pressed="true"]:hover,
.tab-button[aria-pressed="true"]:focus-visible {
    color: var(--text);
}

.stage-wrap {
    width: min(100%, var(--panel-width));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.media-shell {
    position: relative;
    width: 100%;
    aspect-ratio: 657 / 370;
    min-height: 220px;
    overflow: hidden;
    border-radius: 0;
    box-shadow: none;
}

.media-panel {
    position: absolute;
    inset: 0;
    display: none;
    width: 100%;
    height: 100%;
}

.media-panel.active {
    display: block;
}

#video-stage {
    background: black;
}

#video-player,
#youtube-frame {
    width: 100%;
    height: 100%;
    display: block;
    background: black;
}

#video-player {
    object-fit: contain;
}

#youtube-frame {
    border: 0;
}

.media-nav {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 0;
    background: var(--button-bg);
    color: var(--button-text);
    font-size: 16.4px;
    text-align: center;
    line-height: 40px;
    cursor: pointer;
    pointer-events: auto;
    transition: none;
}

.nav-btn:hover,
.nav-btn:focus-visible {
    outline: none;
}

#prev-btn {
    left: 7px;
}

#next-btn {
    right: 7px;
}

.status-text {
    position: absolute;
    left: 50%;
    bottom: 46px;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--dim);
    text-align: center;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 0;
    max-width: calc(100% - 24px);
}

#video-index-text {
    color: var(--muted);
    font-size: 14px;
    min-height: 1.2em;
    text-align: center;
    visibility: visible;
}

#bottom-message-container {
    position: fixed;
    left: 50%;
    bottom: 46px;
    transform: translateX(-50%);
    min-height: 1.5em;
    width: max-content;
    max-width: min(90vw, 850px);
    font-size: var(--ui-font);
    line-height: 1.5em;
    color: var(--muted);
    opacity: 0;
    transition: opacity 0.5s ease;
    text-align: center;
    pointer-events: none;
    z-index: 5;
}

.copy-text {
    color: var(--text);
    cursor: pointer;
}

.copy-confirmation {
    display: none;
    color: var(--dim);
    margin-left: 10px;
    opacity: 1;
    transition: opacity 0.5s;
}

@media (max-width: 1200px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .page {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto;
        grid-template-areas:
            "title"
            "center"
            "left"
            "right"
            "bottom";
        padding-bottom: 32px;
    }

    #left-section,
    #right-section {
        justify-self: center;
        text-align: center;
        padding: 0;
    }

    #title {
        width: auto;
        max-width: 100%;
        overflow-x: auto;
    }
}

@media (max-width: 780px) {
    :root {
        --ui-font: 14px;
    }

    .page {
        gap: 16px;
    }

    #left-section,
    #right-section {
        display: none;
    }

    .center-column {
        width: 100%;
    }

    .stage-wrap {
        width: 100%;
    }

    .media-shell {
        border-radius: 0;
    }

    .nav-btn {
        width: 36px;
        height: 36px;
        line-height: 36px;
    }

    #title {
        font-size: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #overlay,
    #bottom-message-container,
    .copy-confirmation {
        transition: none;
    }
}
