* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    --xRef-badge-size: 30px;
}

body, input, select, tspan {
    font-family: 'Merriweather', Georgia, 'Times New Roman', Times, serif;
    line-height: 1.6;
}

body {
    margin: 0;
    display: flex;
    background: url('img/Backgrounds/bg_aoe2_hd_paper.jpg') repeat;
    font-size: 10pt;
}

#techtree {
    background: url('img/Backgrounds/bg_aoe2_hd_paper.jpg') repeat local;
}

a, a:hover, a:visited, a:active {
    color: #4d3617;
}

.credits,
.credits a {
    font-size: 8pt;
    color: #4d3617;
}

.credits p {
    margin-bottom: 0;
}

#container {
    min-width: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: fill-available;
    display: flex;
    flex-direction: column;
}

#navigation {
    padding-left: 1rem;
}

#helptext {
    position: absolute;
    display: none;
    width: 300px;
    background-color: #eee;
    border: 2px solid #bbb;
    padding: 0.4rem;
    font-size: 10pt;
}

#helptext p {
    margin-top: 0;
    margin-bottom: 8px;
}

#helptext h3 {
    font-family: sans-serif;
    font-size: 9pt;
    text-transform: uppercase;
    color: #4d3617;
    margin: 2px 10px 0 0;
    float: left;
}

#helptext__x_ref__container {
    /* There are 37 civs, 4x8+5 makes the badges fit into a square. */
    max-width: calc(var(--xRef-badge-size) * 8);
    margin: auto;
    padding-top: 0.2rem;
}

/* Style for helptext Cross-Reference buttons */
#helptext #helptext__x_ref div button {
    background-color: transparent;
    border: none;
    padding: 0;
}

/* Style for helptext Cross-Reference image badges */
#helptext #helptext__x_ref div button img {
    width: var(--xRef-badge-size);
    height: var(--xRef-badge-size);
}

#helptext__x_ref h3 {
    float: none;
}

#helptext summary {
    font-family: sans-serif;
    font-size: 8pt;
    color: #4d3617;
    text-transform: uppercase;
    cursor: pointer;
}

#wrapper {
    min-width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: -ms-autohiding-scrollbar;
}


#techtree {
    border-left: 6px solid #4d3617;
    flex: 1 0 auto;
    position: relative;
    width: calc(100vw - 22rem - 20px);
    overflow-x: scroll;
}

#metainfo {
    border-right: 6px solid #4d3617;
    border-right: none;
    width: 20rem;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow: auto;
    height: 100vh;
}

#civselect {
    font-size: 18px;
    font-weight: bold;
    background-color: #72604a;
    flex: 1 0 auto;
    margin-right: 1rem;
    color: white;
    text-shadow: #000000 -3px 2px;
    box-shadow: inset 0 2px #3f4806, inset 2px -2px #768141, inset -2px 0 #768141;
    height: 36px;
    padding: 5px;
}

#civselect option {
    text-shadow: none;
}

#civselect:focus {
    outline: none;
}

#civinfo {
    flex: 1 0 auto;
    font-size: 10pt;
}

#civtitle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#thanks {
    flex: 0 0 auto;
}

hr {
    overflow: visible;
    /* For IE */
    height: 30px;
    margin-bottom: -15px;
    border-style: solid;
    border-color: black;
    border-width: 1px 0 0 0;
    border-radius: 20px;
}

hr:before {
    /* Not really supposed to work, but does */
    display: block;
    content: '';
    height: 30px;
    margin-top: -31px;
    border-style: solid;
    border-color: black;
    border-width: 0 0 1px 0;
    border-radius: 20px;
}

#buildingindex__table {
    margin: auto;
    border: none;
    border-spacing: 5px;
}

#key__table {
    border: none;
    border-spacing: 10px;
}

.locale-switcher {
    position: relative;
    display: inline-block;
}

.locale-switcher:after {
    content: '▾';
    right: 8px;
    top: 2px;
    position: absolute;
    pointer-events: none;
    font-family: Arial, sans-serif;
}

.locale-switcher select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    max-width: 320px;
    float: right;
    margin: 0;
    padding: 0 20px 0 3px;
    background-color: rgba(0, 0, 0, 0.15);
    background-image: none;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 0;
    word-break: normal;
}

.locale-switcher:hover select {
    background-color: rgba(0, 0, 0, 0.20);
    border: 1px solid rgba(0, 0, 0, 0.30);
}

.locale-switcher select:focus {
    outline: none;
}

#navigation {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.node__overlay {
    fill: transparent;
    cursor: pointer;
}

.node.is-highlight .node__overlay {
    stroke: #fff;
    stroke-width: 3px;
}

.xRef__badge {
    cursor: pointer;
}

.connection {
    fill: none;
    stroke: #000;
    stroke-width: 2px;
}

.connection.is-highlight {
    stroke: #fff;
    stroke-width: 3px;
}

@media (max-width: 900px) {
    #techtree {
        width: auto;
        overflow-x: auto;
    }
}

a.inverted {
    background-color: rgba(50,50,50,.5);
    color: #ccc;
    padding: .2em;
}

.helptext__heading,
.helptext__upgrade_cost {
    line-height: 1;
}

.cost {
    white-space: nowrap;
    padding-left: .25em;
}
.cost:after {
    vertical-align: -40%;
    padding-left: 2px;
    margin-bottom: -2px;
}
.cost.wood:after {
    content: url("img/wood.png");
}
.cost.food:after {
    content: url("img/food.png");
}
.cost.gold:after {
    content: url("img/gold.png");
}
.cost.stone:after {
    content: url("img/stone.png");
}
