@font-face {
  font-display: block;
  font-family: Domine;
  font-style: normal;
  font-weight: normal;
  src: url('./art/Domine.ttf') format("truetype")
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border: 0;
    outline: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
    background: transparent;
    color: inherit;
}
    html, body {
        height: 100%;
        background-color: #222;
        place-content: center;
        overflow: hidden;
        font-family: "Domine", Georgia, 'Times New Roman', Times, serif;
        text-shadow: 0 0 3px black, 0 0 2px black;
        -webkit-font-smoothing:none;       
    }
    article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section {
        display: block;
    }
    ol, ul {
        list-style: none;
    }
    blockquote, q {
        quotes: none;
    }
    blockquote::before, blockquote::after,
    q::before, q::after {
        content: '';
        content: none;
    }
    table {
        border-collapse: collapse;
        border-spacing: 0;
    }
    button, input, select, textarea {
        font: inherit;
        color: inherit;
        background: none;
        border: none;
        outline: none;
        box-shadow: none;
        appearance: none;
    }
    img, video {
        max-width: 100%;
        height: auto;
        display: block;
    }
    a {
        color: inherit;
        text-decoration: none;
        background: transparent;
    }

#position-info {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 9;
    background-color: #222222be;
    color: wheat;
    padding: 10px;
}

#engine-wrapper {
    margin: 0 auto;
    width: 100dvw;
    height: 100dvh;
    overflow: hidden;
    perspective: 700px;
    perspective-origin: center center;
    image-rendering: pixelated;
    transform-style: preserve-3d;
    filter: contrast(1.2);
    overflow: hidden;
}

#engine-wrapper::before {
  position: absolute;
  width: 100%;
  height: 102%;
  content: '';
  top: 0;
  left: 0;
  background-image: url('grain.gif');
  background-size: 200px 200px;
  background-position: center;
  z-index: 2;
  opacity: 0.1;
  pointer-events: none;
  mix-blend-mode:color-burn;
  filter: contrast(1) brightness(2) sepia(2);
}

#engine-wrapper::after {
    content: '';
    background-image: url(overlay3.png);
    background-size: cover;
    mix-blend-mode: soft-light;
    position: absolute;
    opacity: 0.2;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#floor {
    width: 10000px;
    height: 10000px;
    margin: 0 auto;
    image-rendering: pixelated;
    border-radius: 50%;
    z-index: 2;
    position: absolute;
    transform: translateZ(0) scale3d(0.05, 0.05, 1);
    transform-origin: 000px 000px;
    transform-style: preserve-3d;
    filter: url(#posterize);
}


#renderer {
    margin: 0 auto;
    width: 500px;
    height: 500px;
    backface-visibility: hidden;
    border-radius: 50%;
    transform: rotateX(90deg) scale3d(10, 10, 10) translate3d(0px, 0px, -4px);
    transform-origin: 250px 250px;
    transform-style: preserve-3d;
    image-rendering: pixelated;
    will-change: transform, background-position;
}

#horizon {
  width: 100dvw;
  height:  100dvh;
  background-image: url("horizon.PNG");
  background-size: 2048px 2048px;
  z-index: 0;
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  filter: saturate(0.3) contrast(1.3);
  background-repeat: repeat;
  background-position: bottom;
  pointer-events: none;
  transform: scaleY(1) scaleX(1);
}


.player {
    background-color: red;
    position: absolute;
    display: none;
}
.land-cell {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    align-content: center;
    transform-style: preserve-3d;
    will-change: transform;
}

.land-cell .tree {
    background-image: url('1.png');
    width: 10px;
    height: 10px;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    image-rendering: pixelated;
    background-size: contain;
    background-repeat: no-repeat;
    position: relative;
    transform-origin: bottom;
    background-position: bottom;
}
.land-cell .tree.Big {
    transform: translateY(-50%) rotateX(-90deg) scale3d(3, 3, 3) rotateY(var(--rotation-z, 0deg)) ;
}
.land-cell .tree.Small {
    transform: translateY(-50%) rotateX(-90deg) scale3d(0.5, 0.5, 0.5) rotateY(var(--rotation-z, 0deg)) ;
}

#player {
    z-index: 10; /* Ensure player is above land cells */
    outline: 1px solid red;
    width: 1px;
    height: 1px;
    position: absolute;
    top: 248px;
    left: 248px;
}


@keyframes treeMove {
    0% {
      transform:translateY(-50%) rotateX(-90deg) scale3d(3, 3, 3) rotateZ(0.5deg) rotateY(var(--rotation-z, 0deg));
    }
    50% {
      transform:translateY(-50%) rotateX(-90deg) scale3d(3, 3, 3) rotateZ(-0.5deg) rotateY(var(--rotation-z, 0deg));
    }
    100% {
      transform:translateY(-50%) rotateX(-90deg) scale3d(3, 3, 3) rotateZ(0.5deg) rotateY(var(--rotation-z, 0deg));
    }
}

#hud {
    width: 100dvw;
    height: 100dvh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#hud #crosshair {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    aspect-ratio: 1/1;
    background-image: url('/art/crosshair.png');
    background-size: cover;
    opacity: 0.7;
}


#minimap-container {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 200px;
    height: 200px;
    overflow: hidden;
        background-color: black;
}

#minimap {
    width: 100%;
    height: 100%;
    image-rendering:optimizeSpeed;
}

#minimap-player {
    position: absolute;
    width: 4px;
    height: 4px;
    background: red;
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.interface-modules {
    border: 1px outset orange;
    border-radius: 3px;
    box-shadow: 0 0 5px black;
}

#compass-container {
  position: absolute;
  width: 200px;
  height: 34px;
  background-image: url("../Art/compass.png");
  background-size: 800px 34px;
  background-repeat: repeat;
  left: 50%;
  top: 20px;
  translate: -50% 0%;
  z-index: 2;
  scale: 1;
  border: 1px solid #b36828;
  box-shadow: black 0px 0px 10px, inset 0 0 15px rgba(68, 37, 11, 0.726);
  border-radius: 5px;
  image-rendering: pixelated;
}
#compass-container:after {
  position: absolute;
  width: 200px;
  height: 34px;
    top: 0;
    left: 0;
    background-image: url('../art/compass-overlay.png');
    background-size: cover;
    z-index: 1;
}

#menu {
    border: 1px solid black;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70dvw;
    aspect-ratio: 16/9;
    border: 50px solid transparent;
    background-color: #00000062;
    position: absolute;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    z-index: 999;
    backdrop-filter: blur(5px);
    visibility: hidden;
}

#menu #world {
    display: flex;
    flex-direction: column;
    border: 1px solid bisque;
    padding: 20px;
    gap: 20px;
    color: white;
    user-select: none;
}

#world-map-container {
    width: 500px;
    height: 500px;
    background-color: #4a681b;
    cursor: pointer;
    pointer-events: all;
    overflow: scroll;
}

#world-map {
    image-rendering: pixelated;
    background-image: url('/texture.bmp');
    background-size: cover;
    width: 1500px;
    height: 1500px;
    background-color: #4a681b;
    cursor: pointer;
    pointer-events: all;


}


#terrain-silhouette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: red; /* test color to verify clipping */
    z-index: 999;
    pointer-events: none;
    display: none;
}

#terrain-debug-visualizer {
    width: 400px;
    aspect-ratio: 2/1;
    background-color: #222;
    left: 400px;
    position: absolute;
}