/* --------------------------------------------------
   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 MOBILE STYLES
-------------------------------------------------- */
html, body {
    margin: 0;
    padding: 0;
    font-family: 'MinecraftThin', sans-serif;
    color: white;

    /* Use a centered cover background */
    background: url('/static/history_back.png') no-repeat center center;
    background-size: cover;

    min-height: 100vh;
    width: 100%;

    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;

    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;

    /* Typically disable custom cursor on mobile */
    cursor: 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)
   - Slightly off-screen at top
-------------------------------------------------- */
.centered-menu-line {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 60px;

    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
    border: 2px solid #2A6B2A;
    box-sizing: border-box;

    background-color: #4caf50;
    color: #fff;
    font-family: 'MinecraftThin', sans-serif;
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;

    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 4px;

    z-index: 9999;
    cursor: pointer;
    transition: opacity 0.25s ease;
}

/* Hide the nav button while loading */
body.loading .centered-menu-line {
    display: none;
}

/* --------------------------------------------------
   DROPDOWN MENU (Animate In/Out)
-------------------------------------------------- */
#menu-dropdown {
    position: fixed;
    top: 10px;
    left: 50%;
    width: 260px;

    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.1rem;
    transition: color 0.2s ease;
}

#menu-dropdown a:hover {
    color: #4caf50;
    background: none;
    text-decoration: none;
}

/* --------------------------------------------------
   CONTENT WRAPPER
   - Centered container for headings
-------------------------------------------------- */
.content-wrapper {
    width: 95%;
    max-width: 500px;
    margin-top: 8vh;
    margin-bottom: 5vh;
    position: relative;
    z-index: 2;
    margin-left: auto;
    margin-right: auto;
    text-align: center; /* Big headings are centered */
}

/* --------------------------------------------------
   TITLE
-------------------------------------------------- */
.title {
    font-family: 'Minecraft', sans-serif;
    font-size: clamp(2.5em, 5vw, 3.5em);
    margin: 3vh 0;
    text-shadow: 3px 3px 5px rgba(0, 0, 0, 0.8);
}

/* --------------------------------------------------
   PANELS
   - Use calc(100% - Xrem) to keep a margin on each side
   - Left-align text for readability
-------------------------------------------------- */
.panel {
    /* 
       Subtracting 2rem total means 1rem margin on each side. 
       Adjust as desired to widen or shrink the side margin.
    */
    width: calc(100% - 2rem);
    max-width: 460px;
    margin: 3vh auto; 
    padding: 25px;

    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;
    box-sizing: border-box; /* ensures padding is included in total width */
}

.panel h2 {
    font-size: 1.8em;
    margin-bottom: 15px;
    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.3em;
    margin: 15px 0;
    line-height: 1.7;
    font-family: 'MinecraftThin', sans-serif;
}

/* --------------------------------------------------
   GREEN BUTTON (Download World, etc.)
   - Using MinecraftThin
-------------------------------------------------- */
.green-btn {
    display: inline-block;
    padding: 12px 20px;
    font-size: 1.2em;
    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 MinecraftThin
-------------------------------------------------- */
.book-btn {
    background-color: #4caf50;
    color: white;
    font-family: 'MinecraftThin', sans-serif;
    font-size: 1em;
    font-weight: normal;
    text-transform: uppercase;
    padding: 7px 15px;
    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.2em;
    font-family: 'Minecraft', sans-serif;
    color: white;
}

/* Book Content Container */
.book-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.6);
    max-width: 300px;
    margin: 0 auto;
    text-align: center;
}
#translation {
    font-size: 1em;
    font-family: 'MinecraftThin', sans-serif;
    padding: 10px;
    color: white;
    line-height: 1.5;
}
#book-image {
    width: 160px;
    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: 6vw;
    max-width: 50px;
    height: auto;
    opacity: 0;
    animation: villagerFly 14s ease-in-out infinite;
    pointer-events: none;
}
@keyframes villagerFly {
    0%   { transform: translate(0vw, 0vh); }
    25%  { transform: translate(20vw, 5vh) rotate(10deg); }
    50%  { transform: translate(-20vw, 10vh) rotate(-10deg); }
    75%  { transform: translate(15vw, -5vh); }
    100% { transform: translate(0vw, 0vh); }
}

/* --------------------------------------------------
   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;
}
