/*
    Dungeon Dweller - main menu styles.

    Purely presentational, unlike game_styles.css: nothing here is measured or
    read back by JavaScript. src/index.js only toggles the `hidden` attribute on
    the menu and the instructions panel.

    Sizing leans on clamp() against viewport units so the menu scales smoothly
    without breakpoints; the single media query at the foot only widens the
    fixed-width blocks on narrow screens.

    Paths are relative to index.html at the repo root - except the @font-face
    below, which resolves relative to this stylesheet in styles/.
*/

@font-face {
    font-family: 'medieval';
    src: url("./fonts/MedievalSharp-Regular.ttf") format("truetype");
    font-display: swap;
}

:root {
    --gold: #e8c87a;
    --ink: #f6ecd8;
    --shadow: rgba(0, 0, 0, 0.85);
    --panel: rgba(12, 9, 7, 0.82);
    --panel-edge: rgba(232, 200, 122, 0.35);
}

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

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: clamp(32px, 8vh, 90px);
    min-height: 100vh;
    padding: 4vh 4vw;
    /* The original artwork, now served locally instead of from blenderartists.org.
       The gradients on top keep the menu text legible over it. */
    background:
        radial-gradient(ellipse at 50% 20%, rgba(120, 88, 44, 0.28), transparent 62%),
        linear-gradient(180deg, rgba(20, 14, 10, 0.45) 0%, rgba(10, 7, 5, 0.62) 65%, rgba(4, 3, 2, 0.8) 100%),
        url("../images/menu_bg.jpeg") center / cover no-repeat fixed,
        #0d0907;
    color: var(--ink);
    font-family: medieval, "Palatino Linotype", Georgia, serif;
}

/* ---------------------------------------------------------------- title */
#title {
    width: min(70vw, 1000px);
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    gap: 2vw;
    padding: 1.5vw 1vw;
    background-image: url("../images/wall.jpeg");
    background-size: cover;
    border-radius: 8px;
    box-shadow: 0 0 0 2px rgba(232, 200, 122, 0.18), 0 18px 50px rgba(0, 0, 0, 0.7);
}

.title-text {
    font-size: clamp(2rem, 10vh, 5.5rem);
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.02em;
    color: var(--ink);
    /* Replaces the two stacked copies of the text the old markup used. */
    text-shadow: 3px 3px 0 var(--shadow), 0 0 24px rgba(232, 200, 122, 0.25);
}

.crest {
    width: clamp(48px, 7vw, 110px);
    aspect-ratio: 1 / 1;
    flex: none;
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

.shield {
    background-image: url("../images/shield.png");
}

.sword {
    background-image: url("../images/sword.png");
}

/* ----------------------------------------------------------------- menu */
#options {
    width: min(50vw, 720px);
    min-height: 40vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: clamp(24px, 6vh, 70px);
    padding: 4vh 6vw;
    background-image: url("../images/framedungeon.png");
    background-size: 100% 100%;
}

.menu-item {
    font-family: inherit;
    font-size: clamp(1.5rem, 7vh, 3.4rem);
    font-weight: 700;
    color: var(--ink);
    text-shadow: 3px 3px 0 var(--shadow);
    background: none;
    border: none;
    text-decoration: none;
    cursor: pointer;
    padding: 4px 16px;
    border-radius: 8px;
    transition: color 160ms ease;
}

.menu-item-small {
    font-size: clamp(1.1rem, 4vh, 1.8rem);
}

.menu-item:hover,
.menu-item:focus-visible {
    color: var(--gold);
    animation: popping 500ms infinite;
}

.menu-item:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 4px;
}

/* ---------------------------------------------------------------- panel */
.panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(55vw, 820px);
    max-height: 86vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(14px, 3vh, 28px);
    padding: clamp(28px, 6vh, 60px) clamp(32px, 7vw, 90px);
    text-align: center;
    background-image: url("../images/framedungeon.png");
    background-size: 100% 100%;
    /* Huge spread doubles as a full-viewport scrim without extra markup. */
    box-shadow: 0 0 0 100vmax rgba(6, 4, 3, 0.78);
}

.panel[hidden] {
    display: none;
}

.panel h2 {
    font-size: clamp(1.6rem, 6vh, 3rem);
    text-shadow: 3px 3px 0 var(--shadow);
}

.explanation {
    font-size: clamp(0.95rem, 2.4vh, 1.3rem);
    line-height: 1.5;
    max-width: 60ch;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 480px;
}

.control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    font-size: clamp(0.85rem, 2vh, 1.1rem);
}

.control dd {
    color: var(--gold);
}

kbd {
    font-family: inherit;
    display: inline-block;
    background: rgba(232, 200, 122, 0.16);
    border: 1px solid var(--panel-edge);
    border-radius: 4px;
    padding: 1px 7px;
    margin: 0 1px;
    color: var(--gold);
}

@keyframes popping {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-7.5px); }
    50% { transform: translateY(-15px); }
    75% { transform: translateY(-7.5px); }
}

@media (prefers-reduced-motion: reduce) {
    .menu-item:hover,
    .menu-item:focus-visible {
        animation: none;
    }
}

@media (max-width: 780px) {
    #title {
        width: 94vw;
    }

    #options {
        width: 94vw;
        padding: 4vh 8vw;
    }

    .panel {
        width: 94vw;
    }
}
