/* --------------------------------------------------
   IMPORT FONTS
-------------------------------------------------- */
@font-face {
    font-family: 'Minecraft';
    src: url('/style/minecraft.ttf') format('truetype');
}
@font-face {
    font-family: 'MinecraftThin';
    src: url('/style/minecraft_thin.otf') format('opentype');
}

/* --------------------------------------------------
   GLOBAL + BASE DESKTOP STYLES
-------------------------------------------------- */
html, body {
    margin: 0;
    padding: 0;
    font-family: 'MinecraftThin', sans-serif;
    color: white;
    min-height: 100vh;
    width: 100%;
    background: url('/static/history_back.png') no-repeat center center fixed;
    background-size: cover;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    cursor: url('/style/custom_cursor.png'), auto;
    -webkit-overflow-scrolling: touch;
}

/* Villager Container */
.villager-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

/* --------------------------------------------------
   NAVIGATE BUTTON (Green Tab)
-------------------------------------------------- */
.centered-menu-line {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 340px;
    height: 70px;
    border-bottom-left-radius: 30px;
    border-bottom-right-radius: 30px;
    border: 2px solid #2A6B2A;
    box-sizing: border-box;
    background-color: #4caf50;
    color: #fff;
    font-family: 'MinecraftThin', sans-serif;
    font-size: 1.3rem;
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 1px;
    z-index: 9999;
    cursor: url('/style/custom_cursor.png'), auto;
    transition: opacity 0.25s ease;
}
.centered-menu-line:hover {
    cursor: url('/style/custom_cursor_hover.png'), pointer;
}

/* Hide nav while loading */
body.loading .centered-menu-line {
    display: none;
}

/* --------------------------------------------------
   DROPDOWN MENU (Animate In/Out)
-------------------------------------------------- */
#menu-dropdown {
    position: fixed;
    top: 10px;
    left: 50%;
    width: 300px;
    transform: translateX(-50%) scaleY(0);
    transform-origin: top center;
    background-color: rgba(0, 0, 0, 0.85);
    border: 1px solid #4caf50;
    border-radius: 8px;
    padding: 10px 15px;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    z-index: 9999;
}
#menu-dropdown.show {
    transform: translateX(-50%) scaleY(1);
    opacity: 1;
    pointer-events: auto;
}
#menu-dropdown ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
#menu-dropdown li {
    margin: 8px 0;
}
#menu-dropdown a {
    color: #fff;
    text-decoration: none;
    font-family: 'MinecraftThin', sans-serif;
    font-size: 1.2rem;
    transition: color 0.2s;
}
#menu-dropdown a:hover {
    color: #4caf50;
    background: none;
    text-decoration: none;
}

/* --------------------------------------------------
   CONTENT WRAPPER
   - Centered for consistency with the nav bar
-------------------------------------------------- */
.content-wrapper {
    width: 95%;
    max-width: 900px;
    text-align: center;
    margin-top: 8vh;
    margin-bottom: 5vh;
    position: relative;
    z-index: 2;
    margin-left: auto;
    margin-right: auto; /* ensures the entire wrapper is centered */
}

/* --------------------------------------------------
   TITLE (History Page)
-------------------------------------------------- */
.title {
    font-family: 'Minecraft', sans-serif;
    font-size: clamp(3.5em, 6vw, 6em);
    margin: 3vh 0 4vh;
    text-shadow: 4px 4px 7px rgba(0, 0, 0, 0.8);
}

/* --------------------------------------------------
   PANELS
   - Slightly narrower width, auto margins
   - Left-aligned text for readability
-------------------------------------------------- */
.panel {
    width: 80%;
    max-width: 850px;
    padding: 5vh 3vw;
    margin: 3vh auto;
    background-color: rgba(0, 0, 0, 0.85);
    border-radius: 15px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
    text-align: left;
}

/* Panel Headings & Paragraphs */
.panel h2 {
    font-size: clamp(2.8em, 5vw, 3.5em);
    margin-bottom: 20px;
    line-height: 1.3;
    font-family: 'Minecraft', sans-serif;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.7);
}
.panel p {
    font-size: 1.4em;
    margin: 15px 0;
    line-height: 1.7;
    font-family: 'MinecraftThin', sans-serif;
}

/* ----------------------------------------
   GREEN BUTTON (Download World, etc.)
   - Use MinecraftThin font
---------------------------------------- */
.green-btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 1.4em;
    font-family: 'MinecraftThin', sans-serif;
    font-weight: normal;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 8px;
    background-color: #4caf50;
    color: white;
    transition: background-color 0.3s;
}
.green-btn:hover {
    background-color: #45a049;
}

/* ----------------------------------------
   BOOK NAVIGATION BUTTONS
   - Also use MinecraftThin font
---------------------------------------- */
.book-btn {
    background-color: #4caf50;
    color: white;
    font-family: 'MinecraftThin', sans-serif;
    font-size: 1.2em;
    font-weight: normal;
    text-transform: uppercase;
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.book-btn:hover {
    background-color: #45a049;
    transform: scale(1.05);
}
.book-btn:disabled {
    background-color: #3a853f;
    cursor: not-allowed;
    transform: none;
}
#page-number {
    font-size: 1.4em;
    font-family: 'Minecraft', sans-serif;
    color: white;
}

/* Book Content Container */
.book-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.6);
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
}
#translation {
    font-size: 1.2em;
    font-family: 'MinecraftThin', sans-serif;
    padding: 10px;
    color: white;
    line-height: 1.5;
}
#book-image {
    width: 200px;
    height: auto;
    border-radius: 6px;
    box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease;
}
#book-image:hover {
    transform: scale(1.02);
}

/* --------------------------------------------------
   VILLAGER ANIMATION
-------------------------------------------------- */
.villager {
    position: absolute;
    width: 80px;
    height: 80px;
    opacity: 0;
    animation: villagerAnimation 10s linear infinite;
    pointer-events: none;
}
@keyframes villagerAnimation {
    0% {
        transform: translate(var(--startX), var(--startY)) scale(var(--scale)) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    50% {
        transform: translate(var(--endX), var(--endY)) scale(calc(var(--scale) * 1.1)) rotate(180deg);
    }
    100% {
        transform: translate(var(--endX), var(--endY)) scale(calc(var(--scale) * 1.2)) rotate(360deg);
        opacity: 0;
    }
}

/* --------------------------------------------------
   LOADING SCREEN
-------------------------------------------------- */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.loading-gif {
    width: 150px;
    height: auto;
}
