/* pangolin-regular - latin_latin-ext */
@font-face {
    font-display: swap;
    font-family: 'Pangolin';
    font-style: normal;
    font-weight: 400;
    src: url('../fonts/pangolin-v11-latin_latin-ext-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

* {
    -webkit-user-select: none; /* disable selection/Copy of UIWebView */
    -webkit-touch-callout: none; /* disable the IOS popup when long-press on a link */
}

:root {
    --grid-area-rows: 20; /* overwritten by JavaScript */
    --grid-area-columns: 13; /* overwritten by JavaScript */
    --cell-size: 20vh;
    --grid-area-width: calc(var(--cell-size) * var(--grid-area-columns));
    --rounded-border: 10px;
    --rounded-border-zoomable: 0.6rem;
    --topscreen-bar-height: 72px;
    --person-token-height: 3em;
    --grid-area-look-ahead-cells: 4; /* overwritten by JavaScript */
}

html {
    font-family: "Pangolin", sans-serif;
    font-size: calc(var(--cell-size) / 11); /* --cell-size is the base size for this game and defined via JS */
    overflow: scroll !important;
}

html, body {
    overscroll-behavior-x: none;
    overscroll-behavior-y: none;
    overflow-x: clip; /* needed to stop horizontal overscroll on mobile or on PC while dragging */
    width: max(100vw, var(--grid-area-width));
    margin: 0;
}

body {
    position: relative;
    background: #010101;
    user-select:none;
}

body>svg {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    touch-action: none;
}

/* monitoring/debugging */
.fps-counter {
    position: fixed;
    background-color: white;
    z-index: 100000;
    bottom: 1rem;
    left: 0;
}

fieldset {
    border-radius: 0.25rem;
}

em {
    font-style: normal;
    color: orange;
}

/* #################### SCROLLBARS ###################### */

html {
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
    scrollbar-width: none;  /* Firefox */
}
html::-webkit-scrollbar {
    display: none;  /* Safari and Chrome */
}

/* Firefox */
body {
    scrollbar-color: #42b2bd transparent;
    scrollbar-width: thin;
}
/* Chrome */
*::-webkit-scrollbar {
    width: 10px;
    height: 0;
}
*::-webkit-scrollbar-track-piece  {
    background-color: transparent;
}
*::-webkit-scrollbar-thumb:vertical {
    height: 30px;
    background-color: #42b2bd;
}
#game-container {
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
    scrollbar-width: none;  /* Firefox */
}
#game-container::-webkit-scrollbar { 
    display: none;  /* Safari and Chrome */
}





.is-being-dragged {
    position: absolute !important;
    z-index: 10000 !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none !important;
    touch-action: none !important;
}


#overworld-castle-ruins {
    position: relative;
    height: 18rem;
    width: var(--grid-area-width);
    transform-origin: bottom;
    pointer-events:none;
    user-select: none;
    align-content: end;
    margin: 0 auto;
    padding-top: var(--topscreen-bar-height); /* replace by JS depending on the number of rows of unassigned persons that is functionally a "fixed" (but technically absolute) overlay */
    background-color: #0e141e;
}

#overworld-castle-ruins #ruins {
    width: var(--grid-area-width);
    position: absolute;
    bottom: 0;
    left: 1px;
}

#overworld-castle-ruins #overworld-fog-1,
#overworld-castle-ruins #overworld-fog-2{
    position: absolute;
    bottom: 0;
    width: var(--grid-area-width);
    height: 100%;
}



#current-stats {
    display: flex;
    position: absolute;
    bottom: 0;
    color: white;
    padding: 0 0 1rem 1rem;
    text-shadow: 0 0 0.5rem black, 0 0 0.25rem black;
    width: calc(var(--cell-size) * 2 - 1rem);
    height: 100%;
    background: linear-gradient(to right, black, transparent);
    align-items: start;
    flex-direction: column;
    justify-content: end;
}
#current-stats .stat-item {
    display: flex;
    align-items: center;
    pointer-events: all; /* needed for tooltips */
    padding-top: 1.5rem;
}
#current-stats .stat-item>a {
    border-radius: 0.6rem;
    color: white;
    text-decoration: none;
}
#current-stats .stat-item>a:hover {
    text-decoration: underline;
}
#current-stats #current-day {
    margin-left: 0.5rem;
}


#game-container {
    /*width: 100vw;*/
    /*height: 100vh;*/
    /*overflow: scroll;*/
    position: relative;
}

#topscreen-bar{
    position: fixed;
    top:0;
    width: 100vw;
    left: 50%; /* for browsers that do not support round with percentages (i.e. chromium) */
    left: round(down, 50%, 1px);
    transform: translate(-50%, 0);
    min-height: var(--topscreen-bar-height);
    user-select: none;
    transition: transform 0.3s ease-in-out;
    font-size: 18px; /* top screen bar has a fixed sized independent of the game area zoom level*/
}

#topscreen-bar.minimized {
    transform: translate(-50%, calc(-100% + 2.5em));
}

#topscreen-bar-content-wrap{
    display: flex;
    width: 100%;
    min-height: var(--topscreen-bar-height);
    user-select: none;
    background-color: black;
    box-shadow: 0 0 0.25em 0.25em black;
}

#grid-area {
    background-color: #020202;
    background: url("../images/webp/background-1-low_80.webp"), url("../images/webp/background-3-full_100.webp"), url("../images/webp/background-2-low_80.webp"), linear-gradient(to bottom, #4a4a4a, #020202);
    background-size: var(--grid-area-width), calc(var(--cell-size) * 1.6), var(--cell-size), 100%;
    background-blend-mode: overlay;
    display: grid;
    grid-template-columns: repeat(var(--grid-area-columns), var(--cell-size));
    grid-template-rows: repeat(var(--grid-area-rows), var(--cell-size));
    width: var(--grid-area-width);
    margin: 0 auto;
    overflow: hidden;
    will-change: scroll-position;
    transform: translateZ(0); /* Force GPU layer */
}

/* Workaround for iOS Safari: https://github.com/mdn/browser-compat-data/issues/20308 */
@supports (-webkit-touch-callout: none) {
    #grid-area {
        background: url("../images/background-ios-fallback.jpeg");
        background-size: var(--cell-size);
        background-blend-mode: unset;
    }
}


#grid-area.reached-rock-bottom::after {
    display:block;
    content:'You have reached rock bottom, for now.';
    position: absolute;
    width: 100%;
    height: calc(var(--cell-size) * 3);
    background: repeating-linear-gradient(
            45deg,
            var(--button-color-main),
            var(--button-color-main) 3px,
            transparent 3px,
            transparent 30px
    );
    bottom: 0;
    border-top: 3px solid var(--button-color-main);
    color: var(--button-color-main);
    text-align: center;
    font-size: 2rem;
    line-height: 2;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
}




.window {
    display: table-cell;
    background-color: #194a4f;
    padding: 0 16px;
    vertical-align: middle;
    line-height: 1.25;
    color: white;
    text-shadow: 0 0 0.15em black;
    border-radius: var(--rounded-border);
    border: outset 4px #c6b78b;
}


#unassigned-people {
    display: flex;
    gap: 1em;
    flex-flow: row wrap;
    overflow: visible;
    width: 100%;
    padding: 0.5em;
    min-height: var(--person-token-height);
}

#unassigned-people-wrap {
    display: none;
}
.menu-people #unassigned-people-wrap {
    display: contents;
}

@media only screen and (max-width: 799px) {
    #unassigned-people {
        gap: 0.5em;
    }
}

#unassigned-people .hidden-because-too-many-items:not(.hidden-item-counter):not(.is-being-dragged) {
    display:none;
}
#unassigned-people .hidden-item-counter {
    display: none;
    color:white;
    width: calc(var(--topscreen-bar-height) - 1em);
    height: calc(var(--topscreen-bar-height) - 1em);
    outline: solid 0.125em white;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    pointer-events: none;
}

#unassigned-people .hidden-item-counter.show {
    display:flex;
}

#topscreen-bar-button-wrap {
    display: flex;
    justify-content: center;
}

#topscreen-bar-button-wrap .topscreen-bar-button {
    padding: 0;
    margin: 0 0 0 -1px;
    width: 10em;
    display: block;
    height: 2.5em;
    top: 0;
    background-color: black;
    color: white;
    outline: none;
    animation: none;
}

#topscreen-bar-button-wrap .topscreen-bar-button:first-of-type{
    border-radius: 0 0 0 var(--rounded-border-zoomable);
}
#topscreen-bar-button-wrap .topscreen-bar-button:last-of-type {
    border-radius: 0 0 var(--rounded-border-zoomable) 0;
}
#topscreen-bar-button-wrap .topscreen-bar-button>img {
    height: 1.5em;
}

#topscreen-bar-button-wrap .topscreen-bar-button::after {
    display: none;
}

#topscreen-bar #topscreen-bar-close::before {
    content: "▲";
    display: block;
    margin: 0 auto;
}
#topscreen-bar.minimized #topscreen-bar-close::before {
    content: "▼";
}


#topscreen-bar-button-wrap .topscreen-bar-button:hover,
.inventory-button:hover {
    background-color: #42b2bd;
    z-index:1;
}


#resources {
    color: white;
    display: none;
    flex-wrap: wrap;
    width: 100%;
    user-select: none;
    background-color: black;
}

.menu-resources #resources {
    display: flex;
}

#resources .resource {
    position: relative;
    border: 1px black solid;
    text-align: center;
    background-color: #111;
    padding: 0.5em;
    border-radius: 0.25em;
    min-width: 2.6em; /* this is the max width of 4 digits in the current font so sibling elements don't move around when numbers change */
}


.small-font {
    font-size: 0.76em;
}
#grid-area .small-font {
    font-size: 0.76rem;
}
.building.rock button.delete .small-font {
    font-size: 2rem;
}



.resource.deficit {
    color:red;
}







.drag-image-overlay-construction-drag {
    position: absolute;
    z-index: 1000;
    pointer-events: none;
    user-select: none;
    touch-action: none;
    height: 4rem;
}


.resource-icon {
    height: 1em;
}
.resource-icon-full {
    width: 64px;
}
.resource-value-pair {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    flex-direction: column;
}
button .resource-value-pair {
    pointer-events: none;
    user-select: none;
    touch-action: none;
}
#resources .resource-icon {
    height: 2em;
}
#resources .resource-value-pair .resource-value {
    margin-top: 0.5em;
}
.building.rock .reclaim-value .resource-value {
    align-self: center;
}
.building.rock .reclaim-value .resource-value-pair {
    font-size:2rem;
    box-shadow: inset 0 0 0 3rem black, 0 0 0.5rem 0.5rem black;
}


.moving-icon {
    position: absolute;
    pointer-events: none;
    user-select: none;
    touch-action: none;
    visibility: hidden;
}

.moving-icon.animated {
    visibility: visible;
}

/* ############ FILTER BUTTONS ############# */

.filter-menu {
    color: white;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: center;
    max-height: var(--topscreen-bar-height);
}

.filter-menu>a {
    line-height: 1;
    padding-right: 0.5em;
    max-height: 33%;
}
.filter-menu>a>img {
    width: 100%;
    height: 100%;
}

.filter-menu>a:hover {
    background-color: var(--button-color-main);
}
