/*
:filename: sppas.ui.swapp.statics.main.css
:author:   Brigitte Bigi
:contact:  develop@sppas.org
:summary:  Style to be used for any SPPAS Web-based UI application.

.. _This file is part of SPPAS: https://sppas.org/
..
    -------------------------------------------------------------------------

     ___   __    __    __    ___
    /     |  \  |  \  |  \  /              the automatic
    \__   |__/  |__/  |___| \__             annotation and
       \  |     |     |   |    \             analysis
    ___/  |     |     |   | ___/              of speech

    Copyright (C) 2011-2023 Brigitte Bigi
    Laboratoire Parole et Langage, Aix-en-Provence, France

    Use of this software is governed by the GNU Public License, version 3.

    SPPAS is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    SPPAS is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with SPPAS. If not, see <http://www.gnu.org/licenses/>.

    This banner notice must not be removed.

    -------------------------------------------------------------------------
*/

/* =======================================================================
                              FONTS DEFINITIONS
  See here: https://v-fonts.com/licenses/open-source for a list of open
  source variable fonts.
  No cursive font ia available.

  ======================================================================== */

@font-face {
    font-family: SansFont;
    src: url('../fonts/Commissioner.ttf');
}

@font-face {
    font-family: SerifFont;
  src: url('../fonts/SourceSerifPro.ttf');
}

@font-face {
  font-family: MonoFont;
  src: url('../fonts/FiraCode.ttf');
}

@font-face {
  font-family: PreFont;
  src: url('../fonts/ScienceGothic.ttf');
}

/* =======================================================================
                            VARIABLE DEFINITIONS
  ======================================================================== */

:root {
    --transition: 0.4s ease-in-out;
    --splash-height: 200px;

    /* Font definitions */
    --font-family-sans: SansFont, 'Verdana', sans-serif;
    --font-family-serif: SerifFont, 'Times New Roman', serif;
    --font-family-mono: MonoFont, 'Courier New', monospace;
    --font-family-pre: PreFont, 'Courier New', monospace;
    --typography-spacing-vertical: 1.2rem;

    /* Variables that are overridden if "sp-contrast" is used */
    /* ------------------------------------------------------ */

    --spacing: 14px;

    /* Font properties */
    --line-height: 1.1;
    --font-weight-thin: 100;
    --font-weight-normal: 350; /* CSS3 requires to choose 300 or 400. 350 is not supported */
    --font-weight-semibold: 500;
    --font-weight-bold: 700;
    --font-weight-black: 800;
    --font-size: 16px;

    /* Borders */
    --border-width: 2px;
    --border-color: transparent;

    /* Focus */
    --focus-border-color: rgba(0, 191, 255, 0.8);  /* Deep sky blue color */
    --focus-border-width: 2px;

    /* Table */
    --table-border-width: 1px;
    --table-border-color: transparent;
}

.sp-contrast {
    --spacing: 16px;

    /* Font properties */
    --line-height: 1.2;
    --font-weight-thin: 200;
    --font-weight-normal: 400;
    --font-weight-semibold: 600;
    --font-weight-bold: 750;
    --font-weight-black: 900;
    --font-size: 18px;

    /* Borders */
    --border-width: 1px;
    --border-color: var(--fg-color);

    /* Focus */
    --focus-border-color: rgb(0, 191, 255);
    --focus-border-width: 3px;

    /* Table */
    --table-border-width: 2px;
    --table-border-color: var(--fg-color);
}

/* Font properties for a local context usage */
.sp-sans {
  font-family: var(--font-family-sans);
}

.sp-serif {
  font-family: var(--font-family-serif);
}

.sp-mono {
  font-family: var(--font-family-mono);
}

.sp-pre {
  font-family: var(--font-family-pre);
}

.sp-weight-thin {
    font-weight: var(--font-weight-thin);
}

.sp-weight-normal {
    font-weight: var(--font-weight-normal);
}

.sp-weight-bold {
    font-weight: var(--font-weight-bold);
}

.sp-weight-black {
    font-weight: var(--font-weight-black);
}

/* =======================================================================
                            PAGES STYLING
  ======================================================================== */

* {
    margin: 0;
    padding: 0;
    -ms-text-size-adjust: 100%;
}

*, *:before, *:after {
    box-sizing: inherit;
}

*, ::after, ::before {
    box-sizing: border-box;
    background-repeat: no-repeat
}

::after, ::before {
    text-decoration: inherit;
    vertical-align: inherit
}

html {
    width: 100%;
    height: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    position: relative;
    cursor: default;

    background-clip: content-box;
    transition: all var(--border-color) 0.3s;
    transition-duration: 0.4s;

    -webkit-tap-highlight-color: transparent;

    background-color: var(--bg-color);
    color: var(--fg-color);

    font-size: var(--font-size);
    font-family: var(--font-family-sans);
    font-weight: var(--font-weight-normal);
    font-style: normal;
    font-variant: normal;
    line-height: var(--line-height);
    text-rendering: optimizeLegibility;
    overflow-wrap: break-word;

    -moz-tab-size: 4;
    tab-size: 4;
    flex-direction: column;
}

/* =======================================================================
                     Document structure
   ======================================================================= */

body > header {
    text-align: center;
    margin: auto;
    padding: 0;
    padding-top: var(--typography-spacing-vertical);
    background: var(--main-color1);
    color: inherit;
    width: 100%;
    min-height: 2rem;
}

body > header > * {
    text-align: center;
}

body > nav {
    background: var(--main-color1);
    color: inherit;
    width: 100%;
    position: -webkit-sticky;  /* Safari */
    position: sticky;   /* is positioned based on the user's scroll position */
    top: 0;
    overflow: hidden;
    margin: auto;
    padding: 0;
    /* box-shadow: [h-offset] [v-offset] [blur-radius] [spread-radius] [color]; */
    box-shadow: 0 0.3rem 0.4rem 0.2rem var(--shadow-color);
}

body > main {
    padding: 1rem;
    padding-top: 3rem;
}

body > footer {
    margin: auto;
    margin-bottom: 2rem;
    padding: var(--typography-spacing-vertical);
    background: var(--main-color2);
    color: var(--main-color-contrast1);
    min-height: 4rem;
    box-shadow: 0 0.3rem 0.8rem 0.2rem var(--shadow-color);
}

body > footer > * :is(p, h1, h2, h3, li) {
    color: var(--main-color-contrast1);
}

/* =======================================================================
                       ACCESSIBILITY SPECIFIC STYLING
  ======================================================================== */

:is(a, video, input, area, select, button, input, textarea, summary, li) {
    --outline-offset: 0;
    --outline-size: calc(2*var(--focus-border-width));
    --outline-style: solid;
    --outline-color: var(--focus-border-color);
}

:is(a, video, input, area, select, button, input, textarea, summary, li):focus {
    outline: var(--outline-size) var(--outline-style) var(--outline-color);
    outline-offset: var(--outline-offset, var(--outline-size));
}

:is(a, video, input, area, select, button, input, textarea, summary, li):focus-visible {
    outline: var(--outline-size) var(--outline-style) var(--outline-color);
    outline-offset: var(--outline-offset, var(--outline-size));
}

:is(a, video, input, area, select, button, input, textarea, summary, li):focus:not(:focus-visible) {
    outline: none;
}

/* And this is a property to be assigned to a tag in case we want to force
 it to have focus style.
 For example: <label class="focusable"> <input [...] /> </label>
*/

.focusable {
    border: var(--focus-border-width) solid transparent;
    border-radius: calc(2 * var(--focus-border-width));
}

.focusable:focus, .focused {
    border: var(--focus-border-width) solid var(--focus-border-color);
    border-radius: calc(1 * var(--focus-border-width));
}

/* =======================================================================
                       HTML ELEMENTS STYLING
  ======================================================================== */

*:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

section {
    padding-left: 1.5rem;
    padding-right: 1rem;
    padding-top: var(--typography-spacing-vertical);
    padding-bottom: var(--typography-spacing-vertical);
}

nav > section {
    padding-bottom: 0;
}

/* ---------------------------- Head titles ------------------------------ */
/* font-size is calculated with the global --font-size variable because
   it has to change in contract view. By using font-size: 1.7rem; the size
   of the font is not changed when switching in contrast view.
 */

h1, h2, h3, h4, h5, h6 {
    padding-bottom: var(--typography-spacing-vertical);
    letter-spacing: 1px;  /* For those who can't see colors */
}

h1 {
    padding-top: var(--typography-spacing-vertical);
    font-size: calc(1.7 * var(--font-size));
    font-weight: var(--font-weight-bold);
    letter-spacing: 2px;
    color: var(--h1-color);
}

h2 {
    padding-top: calc(0.5*var(--typography-spacing-vertical));
    font-size: calc(1.5 * var(--font-size));
    color: var(--h2-color);
    font-weight: var(--font-weight-bold);
}

h3 {
    font-size: calc(1.3 * var(--font-size));
    color: var(--h3-color);
    font-weight: var(--font-weight-normal);
    font-style: normal;
}

h4 {
    font-size: calc(1.2 * var(--font-size));
    color: var(--h4-color);
    font-weight: var(--font-weight-normal);
}

h5 {
    font-size: calc(1.1 * var(--font-size));
    color: var(--h4-color);
    font-weight: var(--font-weight-normal);
}

h6 {
    font-size: var(--font-size);
    color: var(--h4-color);
    font-weight: var(--font-weight-normal);
}

/* ---------------------- Text & inline text ----------------------------- */

p {
    padding-bottom: var(--typography-spacing-vertical);
    text-align: justify;
    text-justify: inter-word;
    display: block;
}

div {
    display: inline-block;
}

b {
    font-weight: var(--font-weight-bold);
}

strong {
    font-weight: var(--font-weight-black);
}

mark {
    background: #ff0;
    color: #000
}

small {
    font-size: 80%
}

sub, sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline
}

sub {
    bottom: -0.25em
}

sup {
    top: -0.5em
}

code, kbd, pre, samp {
    font-family: var(--font-family-pre);
    font-size: 0.9rem
}

kbd {
    font-weight: bolder;
}

mark {
    color: var(--mark-color);
    text-decoration: none;
}

ins {
    color: var(--ins-color);
    text-decoration: none;
}

del {
    color: var(--del-color);
}

blockquote {
    background-color: var(--bg-color2);
    display: block;
    margin: var(--typography-spacing-vertical) 2rem var(--typography-spacing-vertical) 4rem;
    padding: var(--spacing);
    border-right: none;
    border-left: .25rem solid var(--blockquote-border-color);
    border-inline-start: 0.25rem solid var(--blockquote-border-color);
    border-inline-end: none
}

blockquote > cite {
    background-color: transparent;
    display: block;
    margin-top: calc(var(--typography-spacing-vertical) * .5);
    color: var(--blockquote-footer-color);
}

a {
    color: var(--fg-color-a);
    -webkit-transition-duration: 0.2s;
    -moz-transition-duration: 0.2s;
    -o-transition-duration: 0.2s;
    transition-duration: 0.2s;
    border: var(--focus-border-width) solid transparent;
    border-radius: calc(2 * var(--focus-border-width));
}

a:hover {
    opacity: 100%;
    border: var(--focus-border-width) dashed var(--focus-border-color);
    border-radius: calc(2 * var(--focus-border-width));
}

/* --------------------------------- List(s) ----------------------------- */

ol, ul {
    line-height: calc(1.4 * var(--line-height));
    padding: 0;
    margin-bottom: var(--typography-spacing-vertical);
    background-color: unset;
}

ul li {
    list-style: square;
    margin-left: 1rem;  /* hum... why this is required ??? */
}

ol li {
    list-style-type: none;
    counter-increment: item;
}

ol li:before {
    content: counter(item) ".";
    font-family: var(--font-family-mono);
}

/* -------------------------------- Table(s) ----------------------------- */

:where(table) {
    /*width: 100%;*/
    max-width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    text-indent: 0;
    empty-cells: show;
    margin-bottom: var(--typography-spacing-vertical);
    border: var(--table-border-width) solid var(--table-border-color);
    caption-side: top;
}

td, th {
    padding: calc(var(--spacing) / 2) var(--spacing);
    border-bottom: var(--table-border-width) solid var(--table-border-color);
    border-left: var(--table-border-width) dashed var(--table-border-color);

    color: var(--fg-color);
    font-weight: var(--font-weight-normal);
    font-size: var(--font-size);
    text-align: left;
}

table[role=grid] thead {
    background-color: var(--table-head-bg-color);
    color: var(--table-head-fg-color);
    font-weight: bold;
}

tfoot td, tfoot th {
    border-top: var(--table-border-width) solid var(--table-border-color);
    border-bottom: 0;
}

table[role=grid] tbody tr:nth-child(even) {
    background-color: var(--table-row-stripped-bg-color);
}

caption {
    padding-left: calc(2 * var(--table-border-width));
    text-align: left;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    font-size: 80%;
    font-weight: var(--font-weight-semibold);
}

caption span {
    font-style: italic;
}

table caption {
    background-color: var(--table-caption-bg-color);
    color: var(--table-caption-fg-color);
}

/* ----------------- Button, Label and Input tags ----------------------- */

button, input, a[role=button] {
    overflow: visible;
}

button, select, a[role=button]  {
    text-transform: none;
    text-decoration: none;
}

button, [type=button], [type=reset], [type=submit], [role=button] {
    -webkit-appearance: button;
}

button, *[role=button], *[role=menuitem] {
    border: var(--focus-border-width) solid var(--buttons-fg-color);
    border-radius: calc(2 * var(--focus-border-width));

    background-color: var(--buttons-bg-color1);
    color: var(--fg-color2);

    display: inline-block;
    cursor: pointer;
    transition: all 0.4s;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;

    font-weight: normal;
    font-style: normal;
    font-variant: normal;
    font-size: 0.9rem;
    overflow: hidden;

    padding-top: 0.3rem;
    padding-right: 0.5rem;
    padding-bottom: 0.4rem;
    padding-left: 0.5rem;

    /* for the buttons embedded in a box */
    flex-grow: 1;      /* default is 0 */
    flex-shrink: 1;    /* default is 1 */
    flex-basis: auto;  /* default is auto */
}

button:enabled:hover, a[role=button]:hover {
    border: var(--focus-border-width) dashed var(--focus-border-color);
    background-color: var(--buttons-bg-color2);
}

button:enabled img:hover {
    transform: scale(1.2);
}

.sp-contrast button {
    font-weight: bolder;
    padding-top: 0.4rem;
    padding-left: 0.6rem;
    padding-right: 0.6rem;
    padding-bottom: 0.5rem;
}

.sp-button-icon {
	margin-left: 0.3rem;
	margin-right: 0.3rem;
    max-width: 2rem;
    max-height: 2rem;
	vertical-align: middle;
}

.sp-button-text {
	font-family: inherit;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    border-bottom: 1px dashed;
    border-color: transparent;
}

button:enabled .sp-button-text:hover {
    border-color: var(--fg-color2);
}

.button-icon-only {
    flex-grow: 0;
    background: transparent;
}

/* ----------------- media & figure ----------- */

figure {
    margin: auto;
    text-align: center;
}

figcaption {
    text-align: center;
    color: var(--table-caption-bg-color);
}

video {
    margin: auto;
    max-width: 90%;
}

img {
    max-width: 100%;
}

/* ----------------- progress ----------- */

progress {
    width: 100%;
    height: 2rem;
    display: block;
    position: relative;
    border: 1px solid var(--main-color1);
    border-radius: calc(2 * var(--focus-border-width));
}

progress::-webkit-progress-bar {
    background: var(--fg-color2);
    color: var(--main-color2);
}
progress::-webkit-progress-value {
    background: var(--fg-color2);
    color: var(--main-color2);
}
progress::-moz-progress-bar {
    background: var(--fg-color2);
    color: var(--main-color2);
}

.progress-infinite {
    animation-name: animprogress;
    animation-duration: 1s;
    animation-iteration-count: infinite;
    animation-timing-function: ease;
}

@keyframes animprogress {
    from { background-color: var(--fg-color2); }
    to { background-color: var(--main-color2); }
}

/* ----------------- others ----------- */

hr {
    box-sizing: content-box;
    height: 0;
    overflow: visible;
    border: 0;
    border-top: 1px solid rgba(128, 128, 128, 0.5);
    margin: 1rem 0
}

/* =======================================================================
                        Custom classes
   ======================================================================= */

/* --------- A simple panel, intended to be used as container.  */

.sp-panel {
    border: 0;
    padding: 0;
    margin: 0;
    position: relative;
}

.sp-panel:after, .sp-panel:before {
    content: "";
    display: table;
    clear: both
}

main > .panel-item:nth-child(even) {
    background-color: var(--bg-color1);
    color: var(--fg-color2);
}

/* --------- A simple panel with a flexible layout  */

.flex-panel {
    display: flex;
    justify-content: space-evenly;
}

.flex-panel > * {
    flex-grow: 0;
    flex-shrink: 1;
    flex-basis: auto;
}

/* Properties of the items in a flex panel -- if declared as it. */
.flex-item {
    margin: 0;
}

/* Properties of the columns an items depending on the screen */
@media only screen and (min-width: 820px) {

    .flex-panel {
        flex-direction: row;
    }

    .flex-item {
        margin-right: 1rem;
        margin-bottom: 0;
    }

    .flex-border-left {
        border-left-style: solid;
        border-color: var(--main-color-contrast1);
    }

}

@media only screen and (max-width: 820px) {

    .flex-panel {
        flex-direction: column;
        text-align: center;
    }

    body > footer > * > * > * > ul >li {
        list-style: none;
    }

    nav.flex-panel {
        flex-direction: row;
    }


    .flex-item {
        margin-bottom: 0;
    }

    .flex-border-left {
        border-top-style: solid;
        border-color: var(--main-color-contrast1);
    }

}

body > footer .flex-item a {
    color: var(--main-color-contrast1);
}

/* --------- A simple panel with a grid layout  */

.grid-panel {
    margin: auto;
    display: grid;
    justify-content: space-evenly;
    align-items: center;
}

/* Properties of the items in a flex panel -- if declared as it. */
.grid-item {
    margin-bottom: 0;
}


/* ----------- Styling others ----------- */

.copyright {
    text-align: center;
    font-size: 80%;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.sp-grayscale {
    filter: grayscale(50%)
}

.hide {
    display: none;
}

.center {
    margin: auto;
    text-align: center;
}

.right-bottom {
    position: absolute;
    bottom: 0;
    right: 1rem;  /* room for scrollbar */
}

.width-full {
    width: 100%;
}

.width-three-quarters {
    width: 75%;
}

.width-half {
    width: 50%;
}

.width-almost-half {
    width: 45%;
}

.small-padding-top {
    padding-top: 5rem;
}

.padding-button {
    padding: 1rem;
}

.logo-link{
    display: inline-block;
}

.small-logo  {
    max-height: 3.5rem;
    width: auto;
}

.medium-logo {
    max-height: 6.5rem;
    width: auto;
}

.large-logo {
    max-height: 10rem;
    width: auto;
}

.extra-large-logo {
    width: 40rem;
    min-width: 15rem;
}
