@font-face {
    font-family: 'Sabon Next LT';
    src: url('fonts/SabonNextLT-Regular.woff2') format('woff2'),
         url('fonts/SabonNextLT-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sabon Next LT', 'Times New Roman', Times, serif;
    background-color: white;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    font-size: 3.15em;
    transition: background-color 1s ease;
}

.container {
    position: fixed;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    z-index: 100;
    transition: opacity 0.5s ease;
}

/* Centered alphabet container */
.container.centered {
    left: 50%;
    transform: translate(-50%, -50%);
}

.container.hidden {
    opacity: 0;
    pointer-events: none;
}

.alphabet-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    justify-items: start;
    align-items: center;
    height: 90vh;
    width: auto;

}

/* Centered alphabet grid */
.container.centered .alphabet-grid {
    justify-items: center;
}

.letter-item {
    position: relative;
    cursor: pointer;
    text-align: center;
    height: calc(90vh / 26);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: auto;
}

/* Centered letter items */
.container.centered .letter-item {
    justify-content: center;
}

.letter {
    font-size: calc(90vh / 26 * 0.8);
    font-weight: normal;
    line-height: 1;
    display: inline-block;
    transition: opacity 0.2s ease, color 1s ease;
}

.letter-word {
    font-size: calc(90vh / 26 * 0.8);
    font-weight: normal;
    line-height: 1;
    color: #000000;
    transition: opacity 0.2s ease, color 1s ease;
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    pointer-events: none;
}

.letter.has-word {
    color: #000000;
}

.letter.no-word {
    color: #000000;
    opacity: 0.2;
}

/* When a video is playing, alphabet letters turn white */
body.video-playing .letter.has-word,
body.video-playing .letter.no-word,
body.video-playing .letter-word {
    color: #ffffff;
}

.letter-item.no-word {
    cursor: default;
}

/* Center Text Display */
.center-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, color 0.5s ease;
}

.center-text.visible {
    opacity: 1;
}

.center-text.white {
    color: white;
}

/* Instruction text when idle */
.instruction-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: calc(90vh / 26 * 0.8);
    font-weight: normal;
    line-height: 1.4;
    text-align: center;
    color: #000000;
    letter-spacing: 0.05em;
    max-width: 60vw;
    opacity: 1;
    pointer-events: none;
    z-index: 150;
    transition: opacity 0.4s ease;
}

.instruction-text.hidden {
    opacity: 0;
}

body.video-playing .instruction-text {
    opacity: 0;
}

.large-letter {
    font-size: 22.5vw;
    font-weight: normal;
    line-height: 1;
    margin-bottom: 0.2em;
}

.for-text {
    font-size: 6vw;
    font-weight: normal;
    line-height: 1;
    margin: 0.1em 0;
}

.large-word {
    font-size: 22.5vw;
    font-weight: normal;
    line-height: 1;
    margin-top: 0.2em;
}

/* Video Background */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    z-index: 50;
    opacity: 0;
    transition: opacity 1s ease;
    pointer-events: none;
}

.video-background.active {
    opacity: 1;
}

.video-background #videoPlayer {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hide cursor while video is playing and user is idle */
body.cursor-hidden {
    cursor: none;
}

/* Info Button */
.info-button {
    position: fixed;
    top: 50%;
    left: 12.5vw; /* center of left 25% of the screen */
    transform: translate(-50%, -50%);
    color: #000000;
    padding: 10px 18px;
    font-family: 'Sabon Next LT', 'Times New Roman', Times, serif;
    font-size: calc(90vh / 26 * 0.8);
    font-style: italic;
    letter-spacing: 0.05em;
    cursor: pointer;
    z-index: 200;
    display: inline-block;
    border: none;
    background: none;
}

/* References Button */
.references-button {
    position: fixed;
    top: 50%;
    right: 12.5vw; /* center of right 25% of the screen */
    transform: translate(50%, -50%);
    color: #000000;
    padding: 10px 18px;
    font-family: 'Sabon Next LT', 'Times New Roman', Times, serif;
    font-size: calc(90vh / 26 * 0.8);
    font-style: italic;
    letter-spacing: 0.05em;
    cursor: pointer;
    z-index: 200;
    display: inline-block;
    border: none;
    background: none;
}

.fullscreen-button {
    position: fixed;
    top: 60%;
    right: 40px;
    transform: translateY(-50%);
    color: #ffffff;
    padding: 10px 18px;
    font-family: 'Sabon Next LT';
    font-size: calc(90vh / 26 * 0.8);
    letter-spacing: 0.05em;
    cursor: pointer;
    z-index: 150;
    display: inline-block;
    border: none;
    background: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.fullscreen-button.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Hide info button while video is playing */
body.video-playing .info-button {
    opacity: 0;
    pointer-events: none;
}

body.alphabet-centered .fullscreen-button {
    top: auto;
    bottom: 100px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

/* ESC Notice */
.esc-notice {
    position: fixed;
    top: 50%;
    right: 40px;
    transform: translateY(-50%);
    color: #ffffff;
    font-family: 'Sabon Next LT', 'Times New Roman', Times, serif;
    font-size: calc(90vh / 26 * 0.8);
    letter-spacing: 0.05em;
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.esc-notice.visible {
    opacity: 0.3;
}

/* ESC notice at center bottom when alphabet is centered */
body.alphabet-centered .esc-notice {
    top: auto;
    bottom: 50px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
}

/* Info Panel */
.info-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 50vw;
    text-align: center;
    padding: 0 2vw;
    font-family: 'Sabon Next LT', 'Times New Roman', Times, serif;
    font-size: calc(90vh / 26 * 0.75);
    line-height: 1.5;
    color: #000000;
    opacity: 0;
    pointer-events: none;
    z-index: 160;
    transition: opacity 0.3s ease;
}

.info-panel.visible {
    opacity: 1;
    pointer-events: auto;
    color: #ffffff;
}

.info-panel .info-code {
    transition: opacity 0.5s ease;
    cursor: default;
}

.info-panel .info-code.hovering {
    opacity: 0;
}

/* When info panel is open, hide alphabet and instruction text */
body.info-open {
    background-color: #000000;
}

body.info-open #alphabetContainer {
    opacity: 0;
    pointer-events: none;
}

body.info-open .instruction-text {
    opacity: 0;
}

/* When info panel is open, change button text color to white */
body.info-open .info-button,
body.info-open .references-button {
    color: #ffffff;
}

/* References Panel */
.references-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    pointer-events: none;
    z-index: 140;
    transition: opacity 0.3s ease;
    background-color: white;
}

.references-panel.visible {
    opacity: 1;
    pointer-events: auto;
}

.references-images {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.references-images img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* When references panel is open, hide alphabet and instruction text */
body.references-open #alphabetContainer {
    opacity: 0;
    pointer-events: none;
}

body.references-open .instruction-text {
    opacity: 0;
}

/* When references panel is open, change button text color to white */
body.references-open .info-button,
body.references-open .references-button {
    color: #ffffff;
}

/* Hide references button while video is playing */
body.video-playing .references-button {
    opacity: 0;
    pointer-events: none;
}


