/**** General Layout */
* {
    box-sizing: border-box;
}
main {
    margin-top: 1em;
    margin-left: 20%;
    margin-right: 20%;
    margin-bottom: 2em;
    min-height: 85%;
}

body {
    margin: 0;
    top: 0;
    left: 0;
    padding: 0;
    position: absolute;
    height: 100%;
    width: 100%;
    min-height: 100vh;
}


/** Menu bar (top) */
.logo {
    height: 1.5em;
}

/** Document View */
.document-view {
    position: relative;
    margin: 0;
    margin-top: 1em;
    padding: 0;
    display:inline-block;
}
.document-view svg {
    max-height: 50vh;
}
.popup.selected {
    display: block;
}
.popup {
    position:absolute;
    display: none;
    padding:1em;
    border-radius: 10px;
    background-color:var(--color-bg);
    transition: background-color 0.25s;
    white-space:nowrap;
    transform: translate(0, -50%);
}



a.close-button {
    float: right;
    border-radius: 1em;
    padding-left: 0.1em;
    padding-right: 0.1em;
    line-height: 0.7em;
    color: var(--color-fg);
}

a.close-button:hover {
    background-color:#00000011;
    border: 1px solid var(--color-fg);
    text-decoration: none;
    color:var(--color-fg);
}
.popup-left {
    right: 100%;
}
.popup-right {
    left: 100%;
}
.popup-left:after {
        right: 0;
	content: '';
	position: absolute;
	top: 50%;
	width: 0;
	height: 0;
	border: 10px solid transparent;
	border-left-color: var(--color-bg);
	border-right: 0;
	margin-top: -10px;
	margin-right: -10px;
}
.popup-right:after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-right-color: var(--color-bg);
    border-left: 0;
    margin-top: -10px;
    margin-left: -10px;
}

.role, .info-title a {
    color:var(--color-fg);
    font-weight: bold;
}

/* Colors in the SVG files */
.syllabogram, .word {
    --color-fg: hsl(220, 100%, 30%);
    --color-bg: hsl(220, 100%, 90%);
    --color-svg: hsl(200, 100%, 50%);
}
.syllabogram.odd, .word.odd {
    --color-svg: hsl(240, 100%, 50%);
}
.logogram {
    --color-fg: hsl(120, 100%, 30%);
    --color-bg:hsl(120, 100%, 90%);
    --color-svg: hsl(120, 100%, 50%);
}
.transaction {
    --color-fg: hsl(60, 100%,30%);
    --color-bg: hsl(60, 100%,60%);
    --color-svg: hsl(60, 100%,70%);
}
.erasure {
    --color-fg: hsl(0, 100%, 30%);
    --color-bg: hsl(0, 100%, 90%);
    --color-svg: hsl(0, 100%, 50%);
}

.fraction {
    --color-fg: hsl(30, 100%, 30%);
    --color-bg: hsl(30, 100%, 70%);
    --color-svg: hsl(30, 100%, 50%);
}    
span .function {
    color:var(--color-fg, inherit);
}

.sign:hover rect, .word:hover rect {
    stroke-width: 3px;
    stroke-dasharray: 30;
    stroke-linecap: round;
    stroke: #333333;
    opacity: 0.3;
    cursor: pointer;
}

.sign, .word {
    transition: opacity 0.3s;
}
rect.sign, .word rect {
    stroke: #77777722;
    stroke-linecap: round;
    stroke-width: 6px;
    rx: 10;
    fill:var(--color-svg);
    opacity: 0.1;
}

rect.selected, .selected rect {
    stroke-width: 6px;
    stroke-dasharray: 30;
    stroke-linecap: round;
    stroke: #1111aa;
    opacity:0.40;
}


/******/
label {
    margin:0.3em;
}
li {
    margin-top: 0.6em;
    margin-bottom: 0.6em;
}
legend {
    font-weight:bold;
    font-style:italic;
    font-size: 1.5em;
    text-align:center;
    margin-left: auto;
    margin-right: auto;
}
header {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    min-width: 100%;
    margin-bottom: 0px;
    top:0px;
    position:fixed;
}
header a {
    text-decoration: none;
    color: inherit;
    padding: 10px;
    padding: 10px;
    white-space:nowrap;    
}

/** Quick Search */
.completion-main input {
    background-color: #eeeeee;
    padding-top:0.2em;
    padding-bottom:0.2em;
    border: 1px gray solid;
    border-radius:0.1em;
    width: 90%;
    color: inherit;
}

.completion-main input:focus {
    outline: 0; /* This is needed to override chrome's default behaviour. */
    border: 2px orange solid;
}

input:placeholder-shown {
    font-style: italic;
    color: darkgray;
}
/* Autocomplete */

.completion {
    position: absolute;
}
.completion-main input {
    width: 100%;
    box-sizing: border-box;
    font-size: 100%;
}
.completion-item {
    padding: 10px;
    font-size:0.7em;
    text-align: left;
    cursor: pointer;
    display: block;
    background-color: #ffffffcc;
    color:blue;
    border-bottom: 1px solid #d4d4d4;
}

.completion-item-value {
    
}
.completion-item-descr {
    float: right;
    margin-left: 2em;
}

.completion-main {
    position:relative;
    margin:0;
    padding: 0;
}
.completion {
    min-width: 100%;
    font-size: 0.5em;
    overflow: auto;
    display: block;
    max-height: 50vh;
}

/**** Home page */
body:has(#home) {
    background-image: url("background.jpg");
    background-repeat: no-repeat;
    background-size: 100vw 100vh;
    color: black;
}
/*** Home Page */
#home {
    margin-top: 10vh;
    display: grid;
    font-weight: 200;
    text-align: center;
    justify-items: center;
    grid-template-columns: repeat(6, max-content);
}

body:has(#home) aside#sidebar {
    display: none;
}
#home #quick-search {
    grid-area: 1 / 1 / 1 / 8;
    margin-bottom: 10vh;
    font-size: 2em;
    display: inline-block;
    width: 70%;
}
#home .completion-main input {
    background-image: url('search.png');
    background-size: auto 90%;
    background-repeat: no-repeat;
    padding: 0em;
    padding-left: 1.4em;
    color: black;
}
.home-search {
    grid-area: 2 / 1 / 2 / 4;
    font-size: 2.3em;
    margin-right: 1em;
    font-weight: bold;
}
#home .sep {
    grid-area: 1 / 4 / 4 / 4;
    width: 3em;
}
.home-browse {
    font-weight: bold;
    grid-area: 2 / 5 / 2 / 8;
    font-size: 2.3em;
    margin-bottom: 0.5em;
}
.home-search-document {
    grid-area: 3 / 2 / 3 / 2;
}
.home-search-sign {
    grid-area: 3 / 1 / 3 / 1;
}
.home-search-sequence {
    grid-area: 3 / 3 / 3 / 3;
}
.home-sign-list {
    grid-area: 3 / 5 / 3 / 5;
}
.home-document-list {
    grid-area: 3 / 6 / 3 / 6;
}
.home-map {
    grid-area: 3 / 7 / 3 / 7;
    font-size: 1em;
}
#home a:not(.completion-item) {
    margin-left: 0.5em;
    margin-right: 0.5em;
    color: inherit;
    border-radius: 20px;
    padding-left: 20px;
    padding-right: 20px;
    background-color: #55555544;
    border: 1px solid #55555544;
    text-decoration: none;
    font-size: 1.2em;
    font-weight: normal;
}

#home a:hover:not(.completion-item) {
    border: 1px orange solid;
    background-color: #0000ff33;
}

/***** General app things */ 

.title{
    font-weight: 200;
    font-size: 3em;
    text-align: center;
}
.subtitle{
    margin-top:1%;
    font-weight: 200;
    font-size: 1.8em;
    font-style: italic;
    text-align: center;
}
/***** Home page */

h1 {
    text-align: center;
    margin:20px;
}
h2 {
    text-align: center;
}
h3 {
    text-align: center;
}

a {
    color:blue;
    cursor: pointer;
    text-decoration: none;
}
:root {
    --button-hue:200;
}

.button {
    cursor: pointer;
    border-radius:1em;
    color:inherit;
    font-weight:bold;
    min-width: 1.5em;
    display:inline-block;
    text-align:center;
    border:3px solid hsla(var(--button-hue), 80%,20%);
    color:hsla(var(--button-hue), 80%,20%);
}
.button:hover{
    background-color:hsla(var(--button-hue), 80%,20%);
    color:hsla(var(--button-hue), 80%,80%);
}
a:hover {
    cursor:pointer;
    text-decoration: none;
}
main a:hover {
    color: purple;
}

select:invalid {
    color: gray;
}

/****** Document view */
/* Colors in the SVG files */
.syllabogram, .word {
    --color-fg: hsl(220, 100%, 30%);
    --color-bg: hsl(220, 100%, 90%);
    --color-svg: hsl(200, 100%, 50%);
}
.syllabogram.odd, .word.odd {
    --color-svg: hsl(240, 100%, 50%);
}
.logogram {
    --color-fg: hsl(120, 100%, 30%);
    --color-bg:hsl(120, 100%, 90%);
    --color-svg: hsl(120, 100%, 50%);
}
.transaction {
    --color-fg: hsl(60, 100%,30%);
    --color-bg: hsl(60, 100%,60%);
    --color-svg: hsl(60, 100%,70%);
}
.erasure {
    --color-fg: hsl(0, 100%, 30%);
    --color-bg: hsl(0, 100%, 90%);
    --color-svg: hsl(0, 100%, 50%);
}

.fraction, .punctuation {
    --color-fg: hsl(30, 100%, 30%);
    --color-bg: hsl(30, 100%, 70%);
    --color-svg: hsl(30, 100%, 50%);
}    
span .function {
    color:var(--color-fg, inherit);
}

svg .sign:hover, .word:hover rect {
    stroke-width: 3px;
    stroke-dasharray: 30;
    stroke-linecap: round;
    stroke: #333333;
    opacity: 0.3;
    cursor: pointer;
}

.sign, .word {
    transition: opacity 0.3s;
}
rect.sign, .word rect {
    stroke: #77777722;
    stroke-linecap: round;
    stroke-width: 6px;
    rx: 10;
    fill:var(--color-svg);
    opacity: 0.1;
}

rect.selected, .selected rect {
    stroke-width: 6px;
    stroke-dasharray: 30;
    stroke-linecap: round;
    stroke: #1111aa;
    opacity:0.40;
}
.unsure-reading {
    text-decoration: underline;
}


.button.search-button {
    text-align: center;
    font-size: 2em;
    display:block;
    font-weight: bold;
    padding: 10px;
    margin-bottom: 20px;
}

a.close-button {
    float: right;
    border-radius: 1em;
    padding-left: 0.1em;
    padding-right: 0.1em;
    line-height: 0.7em;
    color: var(--color-fg);
}

a.close-button:hover {
    background-color:#00000011;
    border: 1px solid var(--color-fg);
    text-decoration: none;
    color:var(--color-fg);
}
.document-metadata {
    text-align: center;
}
.document-popup-left {
    right: 100%;
}
.document-popup-right {
    left: 100%;
}
.document-popup-left:after {
        right: 0;
	content: '';
	position: absolute;
	top: 50%;
	width: 0;
	height: 0;
	border: 10px solid transparent;
	border-left-color: var(--color-bg);
	border-right: 0;
	margin-top: -10px;
	margin-right: -10px;
}
.document-popup-right:after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-right-color: var(--color-bg);
    border-left: 0;
    margin-top: -10px;
    margin-left: -10px;
}
#document-view svg {
    max-height: 50vh;
    display:inline;
}

/*** Search results */
/* Miniature */
.miniature{
    display:inline-flex;
    flex-direction:column;
    text-align: center;
    vertical-align: middle;
}
div.miniature {
    margin-left: 10px;
    margin-right: 10px;
    padding: 10px;
    padding-bottom: 2px;
}
.center {
    text-align: center;
    display:block;
}

svg {
    margin: 5px;
}

.result1 {
    margin: 20px;
}
.result1 > legend {
    margin: 0 auto;
    text-align: center;
    font-size: 2em;
}

/**** Edit popup */
#edit-popup {
    display: none;
    position: fixed;
    top:30%;
    left: 30%;
    width: 40%;
    border: 1px black solid;
    border-radius: 5px;
    padding: 10px;
    background-color: lightgray;
}

#edit-popup textarea {
    margin: 5%;
    width: 80%; }

/**** Notification */
#notification {
    margin: 10px;
    padding: 10px;
}

.error {
    background-color: #ffaaaa;
}


.comment-heading {
    font-size: 1.2em;
    font-weight: bold;
}

blockquote {
    border-left: 2px dashed lightblue;
    padding: 10px;
}
    
.success {
    background-color: lightgreen;
}

.save-comment {
    text-align: center;
    margin: 5px;
}

/* transcription */
.transcription-sign {
    width: 100vw;
    height: 100vh;
    display: inline-block;
    font-size: 3em;
}

#search-menu-contents {
    display: none;
}

#search-menu-contents a {
    display: block;
    margin: 0.2em;
    padding: 0.0em;
}
#search-menu-contents a:before {
    content: "≫ ";
}
                            
#search-menu:hover a {
    font-weight: bold;
}
#search-menu:hover #search-menu-contents {
    display: block;
    font-weight: normal;
}

.menu {
    position: relative;
}
.menu-title {
    font-style: italic;
    font-size:1.2em;
}
.menu-contents {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: auto;
    background: lightgrey;
    border: 1px solid black;
    border-radius: 10px;
    list-style-type: square;
    list-style-position: outside;
    list-style-image: none;
    z-index: 1;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    min-width: 250px;
    font-size: 1rem;
}

.menu:hover .menu-contents {
    display: block;
}
.menu-item {  padding: 5px; font-size: 1rem; }

.button { font-size: 1.3em; }
p,li { text-align: justify; }

/* Help */
.help {
    padding-left: 5px;
    padding-right: 5px;
    font-style: normal;
}
.question {
/*    background-image:url("help.png");
    background-size: 100% 100%;*/
    content: "?";
    border: 3px hsl(var(--button-hue), 50%, 30%) solid;
    vertical-align: top;
    border-radius: 50%;
    width: 1.1em;
    height: 1.1em;
    line-height: 1.1em;
    text-align: center;
    font-size: 1.2em;
    display:inline-block;
}
.help:hover .question {
    border: 3px purple solid;
    font-weight: bold;
    color: purple;
}

.help-content {
    visibility: hidden;
    position: absolute;
    z-index: 1;
    background-color: black;
    border-radius: 10px;
    width: 20em;
    font-size: 1rem;
    color: white;
    padding: 5px;
    margin: 5px;
}

.help:hover .help-content {
    visibility: visible;
}

.info-title {
    text-align: center;
    white-space:nowrap;    
    display: block;
    padding-right: 1em;
    padding-left: 1em;
    font-size: 1.2em;
    
}
.info-subtitle {
    font-size: 1.2em;
}

.smaller {
    padding-left: 1em;
    font-size: 0.8em;
}






#tooltip {
    z-index: 1;
    display:inline;
    width: 50px;
    max-width: max-content;
    opacity:1;
    text-align: center;
    position:fixed;
    width: auto;
    background-color: white;
    border: 1px black solid;
    border-radius: 10px;
    padding: 10px;
}



/* Inline signs */
.sign-representative-image {
    width: auto;
    height: inherit;
    position: relative;
    top:6px;
    margin-left:0.1em;
    margin-right:0.1em;
}
.composition .caption {
    font-size: 0.3em;
}
table {
    border-collapse: collapse;
    margin-left: auto;
    margin-right: auto;
}


.center img {
    margin-top:1em;
}
/* Map */
.map-link {
    stroke: #77777799;
    stroke-linecap: round;
    stroke-width: 6px;
    rx: 10;
    fill:transparent;
}
.map-link:hover {
    stroke: purple;
}
.sign-image-nice {
    max-height: 0.9em;
    object-fit: contain;
}

img.sign-image-inline {
    object-fit:contain;
    max-height: 1em;
    margin-inline: 0.3em;
}

.flex-table {
    display:flex;
    flex-flow: wrap;
    justify-content: center;
    align-content: flex-start;
}
.small > .flex-table-item {
    height: 9em;
}
.big > .flex-table-item {
    height: 11em;
}

a.flex-table-item {
    padding: 5px;
    width: 7em;
    display: flex;
    flex-direction: column;
    border: 1px solid black;
    text-align: center;
    position: relative;
    color: inherit;
    height: 8em;
    box-sizing: border-box;
    gap: 0.5em;
    &:hover {
	border: 3px solid purple;
    }
    .signnumber {
	font-size: 1em;
	top: 0;
	position:relative;
    }
    img {
	max-width: 100%;
	padding-inline: 20%;
	height: 5em;
	object-fit: contain;
    }	
    .composition {
	font-size: 0.7em;
    }
}

fieldset {
    border: 1px darkgray solid;
    border-radius:20px;
    box-shadow: 1px 1px 1px hsl(var(--button-hue), 50%, 10%);
    margin:1em;
}
::placeholder {
    color:hsl(var(--button-hue), 20%, 70%);
    opacity:1;
}
fieldset.search {
    --button-hue:300;
    background-color:hsl(var(--button-hue),70%, 95%);
    color:hsl(var(--button-hue), 70%, 20%);
    border-color:hsl(var(--button-hue), 70%, 20%);
}
input {
    background-color: #ffffff90;
    border: 1px hsl(var(--button-hue), 50%, 20%) solid;
    color:inherit;
    box-shadow: 1px 1px 1px hsl(var(--button-hue), 50%, 10%);
}

select {
    border: 1px hsl(var(--button-hue), 50%, 20%) solid;
    background-color:hsl(var(--button-hue),40%, 85%);
    color:hsl(var(--button-hue),70%, 20%);
    box-shadow: 1px 1px 1px hsl(var(--button-hue), 50%, 10%);
}
select option:disabled {
    color:hsl(var(--button-hue),40%, 20%);
}    
input[type="checkbox"] {
    appearance:none;
    border: 1px hsl(var(--button-hue), 50%, 20%) solid;
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: middle;
    background-color: transparent;
    box-shadow: 1px 1px 1px hsl(var(--button-hue), 50%, 10%);
}
input[type="checkbox"]:hover {
    background-color:hsl(var(--button-hue), 30%, 70%);
}
input[type="checkbox"]:checked{
    background-color: hsl(var(--button-hue), 50%, 20%);
}
fieldset.search legend {
    color:hsl(var(--button-hue), 100%, 20%);
}
fieldset.group {
    --button-hue:110;
    background-color:hsl(var(--button-hue),70%, 95%);
    color:hsl(var(--button-hue), 50%, 10%);
    border-color:hsl(var(--button-hue), 100%, 20%);
}
fieldset.group legend {
    color:hsl(var(--button-hue), 100%, 20%);
}

fieldset.result1 {
    --button-hue:230;
    background-color:hsl(var(--button-hue),60%, 100%);
    border-color:hsl(var(--button-hue), 100%,20%);
    color:hsl(var(--button-hue), 100%,20%);
}

fieldset div.miniature {
    margin:10px;
}
fieldset div.miniature:hover {
    border: 2px dashed hsl(230, 100%, 20%);
    border-radius:1em;
    margin:8px;
}
fieldset.result1 legend {
    color:hsl(230,100%, 20%);
}
    
.unclassified {
    font-size: 0.7em;
}



.two-columns {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.two-columns div { padding: 10px; }

footer{
    border-top: 1px solid black;
    width: 100%;
    box-sizing: border-box;
    position:fixed;
    bottom: 0vh;
    background-color: white;
    max-height: 1.5em;
    min-height: 1.5em;
    color: black;
    z-index: 1;
}

.home footer a {
    color: lightblue;
}
.home footer {
    position: absolute;
    color: white;
    background-color: #00000033;
}
/** Side bar */

.home #sidebar {
    display: none;
}

aside#sidebar {
    position: fixed;
    z-index: 1;
    left: 0.5em;
    top:10%;
    font-size: 1.5em;

    summary::marker {
	content: "";
    }

    details {
	display: flex;
	flex-direction: row;
	gap: 3ch;
	position: relative;
	summary {
	    cursor: pointer;
	    img {
		aspect-ratio: 1;
		width: 5ch;
	    }
	}
	> span {
	    position: absolute;
	    left: 7ch;
	    top: 0.5ch;
	    min-width: 20ch;
	}
    }
    details[open] {
	summary img {
	    border: 2px solid black;
	}
    }
    #quick-search {
	line-height: 1.5em;
	min-width: 40ch;
    }

    .search-content {
	text-wrap: nowrap;
	border: 1px solid black;
	background-color: lightgray;
	padding: 1ch;
    }
}

#quick-search #side-search {
    display: none;
    position: absolute;
    top: 0;
    left: 1.5em;
    padding-left: 0.5em;
    min-width: 20em;
}
#quick-search:hover #side-search {
    display: inline;
}
    
.form-error {
    background-color: hsl(0, 50%, 80%);
    color: hsl(0, 50%, 30%);
    margin: 0.5em;
}
