/* ===== FONTS ===== */
@import url('options.css');

@font-face {
    font-family: 'Ark Pixel 10px';
    src: url('../fonts/arkpixel10/ark-pixel-10px-proportional-latin.otf.woff') format('woff');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Ark Pixel 10px';
    src: url('../fonts/arkpixel10/ark-pixel-10px-proportional-ja.otf.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    unicode-range: U+3000-9FFF, U+FF00-FFEF;
}

@font-face {
    font-family: 'Ark Pixel 12px Mono';
    src: url('../fonts/arkpixel10/ark-pixel-12px-monospaced-latin.otf.woff') format('woff');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Ark Pixel 12px Mono';
    src: url('../fonts/arkpixel10/ark-pixel-12px-monospaced-ja.otf.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    unicode-range: U+3000-9FFF, U+FF00-FFEF;
}

/* ===== BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* Prevent dragging on background images */
.sky-layer,
.scrolling-clouds,
.midground-layer,
.crows-layer,
.pyramid-midground,
.tree-foreground,
.title-logo,
.dither-layer {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

body {
    background-color: #000;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Ark Pixel 10px', monospace;
}

/* ===== SCREEN CONTAINER ===== */
.screen {
    width: 960px;
    height: 540px;
    position: relative;
    overflow: hidden;
    display: none;
}

.screen.active {
    display: block;
}

/* ===== TITLE SCREEN ===== */
#title-screen {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    background-color: #5a9bb8;
    animation: background-lighting 12s ease-in-out infinite;
}

@keyframes background-lighting {
    0%, 100% { 
        filter: brightness(1.0);
    }
    50% { 
        filter: brightness(1.12);
    }
}

/* Sky layer - farthest back, slowest parallax scroll */
.sky-layer {
    background-image: url("../assets/scenes/lastbackground.png");
    position: absolute;
    left: 0;
    top: 0;
    width: 2220px;
    height: 540px;
    z-index: 1;
    background-repeat: no-repeat;
    animation: skyScroll 90s linear forwards, sky-lighting 10s ease-in-out infinite;
}

/* Sky lighting - subtle, slow atmospheric changes */
@keyframes sky-lighting {
    0%, 100% { 
        filter: brightness(1.0) contrast(1.0);
    }
    50% { 
        filter: brightness(1.1) contrast(0.95);
    }
}

@keyframes skyScroll {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    83% {
        opacity: 1;
    }
    100% {
        transform: translateX(-630px); /* Slower parallax - less distance */
        opacity: 0;
    }
}

/* Cloud layer - second layer, medium-fast parallax */
.scrolling-clouds {
    background-image: url("../assets/scenes/scrollingclouds.png");
    position: absolute;
    left: 0;
    top: 0;
    width: 2220px;
    height: 540px;
    z-index: 2;
    background-repeat: no-repeat;
    animation: cloudScroll 60s linear forwards, cloud-lighting 6s ease-in-out infinite;
}

/* Cloud lighting - brightest, most affected by sunlight */
@keyframes cloud-lighting {
    0%, 100% { 
        filter: brightness(1.0) contrast(1.0);
    }
    50% { 
        filter: brightness(1.15) contrast(0.95);
    }
}

@keyframes cloudScroll {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    83% {
        opacity: 1;
    }
    100% {
        transform: translateX(-1260px); /* Medium parallax speed, updated for 2220px width */
        opacity: 0;
    }
}

/* Midground layer - trees/foliage, darkest lighting */
.midground-layer {
    background-image: url("../assets/scenes/midground.png");
    position: absolute;
    left: 0;
    top: 0;
    width: 960px;
    height: 540px;
    z-index: 5;
    background-repeat: no-repeat;
    animation: midground-lighting 7s ease-in-out infinite;
}

/* Crows animation - plays once */
.crows-layer {
    background-image: url("../assets/scenes/crows.gif");
    position: absolute;
    left: 0;
    top: 0;
    width: 960px;
    height: 540px;
    z-index: 4;
    background-repeat: no-repeat;
    opacity: 1;
    pointer-events: none;
    image-rendering: auto;
}

/* Midground lighting - darker, shadow variations */
@keyframes midground-lighting {
    0%, 100% { 
        filter: brightness(0.92) contrast(1.06);
    }
    40% { 
        filter: brightness(1.02) contrast(0.99);
    }
    80% { 
        filter: brightness(0.88) contrast(1.08);
    }
}

/* Pyramid midground - static, moderate lighting */
.pyramid-midground {
    background-image: url("../assets/scenes/pyramidmidground.png");
    position: absolute;
    left: 0;
    top: 0;
    width: 960px;
    height: 540px;
    z-index: 3;
    background-repeat: no-repeat;
    animation: pyramid-lighting 9s ease-in-out infinite;
}

/* Pyramid lighting - moderate brightness shifts, different timing */
@keyframes pyramid-lighting {
    0%, 100% { 
        filter: brightness(0.94) contrast(1.05);
    }
    33% { 
        filter: brightness(1.12) contrast(0.96);
    }
    66% { 
        filter: brightness(0.90) contrast(1.08);
    }
}

/* Tree foreground - gentle sway with lighting */
.tree-foreground {
    background-image: url("../assets/scenes/treeforeground.png");
    position: absolute;
    left: 0;
    top: 0;
    width: 960px;
    height: 540px;
    z-index: 6;
    background-repeat: no-repeat;
    animation: treeSway 5s ease-in-out infinite, tree-lighting 7s ease-in-out infinite;
}

/* Tree lighting - subtle shadow variations */
@keyframes tree-lighting {
    0%, 100% { 
        filter: brightness(0.90) contrast(1.07);
    }
    40% { 
        filter: brightness(1.00) contrast(1.00);
    }
    80% { 
        filter: brightness(0.86) contrast(1.09);
    }
}

@keyframes treeSway {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(-3px);
    }
}

/* Title logo overlay - subtle atmospheric lighting */
.title-logo {
    background-image: url("../assets/title.png");
    position: absolute;
    left: 0;
    top: 0;
    width: 960px;
    height: 540px;
    z-index: 8;
    pointer-events: none;
    background-repeat: no-repeat;
    animation: title-lighting 11s ease-in-out infinite;
}

/* Title lighting - very subtle, slow breathing effect */
@keyframes title-lighting {
    0%, 100% { 
        filter: brightness(1.0) contrast(1.0);
    }
    50% { 
        filter: brightness(1.08) contrast(0.98);
    }
}

/* Master dither layer overlay */
.dither-layer {
    background-image: url("../assets/ditherlayer.png");
    position: absolute;
    left: 0;
    top: 0;
    width: 960px;
    height: 540px;
    z-index: 10;
    pointer-events: none;
    background-repeat: repeat;
    mix-blend-mode: multiply;
    opacity: 0.3;
}

/* Copyright notice - only on title screen */
#title-screen .copyright {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: 'Ark Pixel 10px', monospace;
    color: #ff6b35;
    font-size: 10px;
    z-index: 11;
    pointer-events: none;
}

/* Menu */
.menu {
    position: absolute;
    left: 50%;
    top: 256px;
    transform: translateX(-50%);
    z-index: 11;
    text-align: center;
}

.menu-item {
    font-size: 30px;
    font-family: "Ark Pixel 10px", monospace;
    color: #aaaaaa;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 18px 0;
}

.menu-item.active {
    color: #ff6b35;
    text-shadow: 0 0 8px rgba(255, 107, 53, 0.8),
                 0 0 12px rgba(255, 107, 53, 0.6);
}

.menu-item:hover {
    color: #ff8c5a;
}

/* ===== STORY SCROLL SCREEN ===== */
#story-screen {
    background-color: #000;
}

.story-scroll {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.story-text {
    position: absolute;
    left: 50%;
    top: 100%; /* Start below viewport */
    transform: translateX(-50%);
    width: 80%;
    max-width: 700px;
    color: #cae7e1;
    font-family: 'Ark Pixel 12px Mono', monospace;
    font-size: 24px;
    line-height: 1.8;
    text-align: center;
    white-space: pre-line;
}

.story-text.scrolling {
    animation: storyScroll 45s linear forwards;
}

@keyframes storyScroll {
    0% {
        top: 100%;
    }
    100% {
        top: -180%; /* Scroll up and fully off screen */
    }
}

/* ===== TRANSITIONS ===== */
.fade-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity 2.5s ease;
}

.fade-overlay.active {
    opacity: 1;
}

/* ===== OPTIONS MODAL ===== */
.options-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 25000;
    justify-content: center;
    align-items: center;
}

.options-modal.active {
    display: flex;
}

.options-modal-content {
    width: 960px;
    height: 540px;
    position: relative;
}

.options-modal .options-panel {
    background-color: rgba(26, 26, 26, 0.98);
}
