/*
GNU FreeSans is released under the GNU General Public License. See the files in
this directory for details. OpenType MATH support is only available in the
development version.
*/

@namespace url('http://www.w3.org/1999/xhtml');
@namespace m url('http://www.w3.org/1998/Math/MathML');

@font-face {
    font-family: FreeSans;
    src: url('../fonts/FreeSans.woff');
}
@font-face {
    font-family: FreeSans;
    src:  url('../fonts/FreeSansBold.woff');
    font-weight: bold;
}
@font-face {
    font-family: FreeSans;
    src: url('../fonts/FreeSansOblique.woff');
    font-style: oblique;
}
@font-face {
    font-family: FreeSans;
    src: url('../fonts/FreeSansBoldOblique.woff');
    font-weight: bold;
    font-style: oblique;
}

.htmlmathparagraph, m|mtext {
    font-family: FreeSans;
}
m|math {
    font-family: FreeSans;
}

.oldstylenumbers {
    font-variant-numeric: oldstyle-nums;   /* Recommended syntax */
    font-feature-settings: 'onum';         /* OpenType feature syntax */
    -moz-font-feature-settings: 'onum';    /* Gecko <= 33 syntax */
    -webkit-font-feature-settings: 'onum'; /* Blink syntax */
}

/* Calligraphic letters do not seem to be available */
m|*.calligraphic {
}

.math {
    font-family: 'Roboto Slab', serif;
}

.math .small {
    font-size: 0.7em;
}

.math .frac {
    display: inline-flex;
    vertical-align: middle;
    flex-direction: column;
    text-align: center;
    margin-top: -1px;
}

.math .frac > *:first-child {
    border-bottom: 1px solid currentColor;
    padding-bottom: 5px;
}

.math .frac > *:last-child {
    padding-top: 5px;
}

.math .frac > * {
    padding: 0 0.5em;
}

.math .sqrt {
    border-top: 1px solid currentColor;
    margin-left: 10px;
    padding-left: 5px;
    position: relative;
    display: inline-block;
}

.math .sqrt::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -10px;
    bottom: 0px;
    width: 10px;
    background: currentColor;
    clip-path: polygon(
            0 50%,
            2px 50%,
            50% calc(100% - 2px),
            calc(100% - 2px) 0,
            100% 0,
            100% 2px,
            calc(50% + 2px) 100%,
            calc(50% - 2px) 100%,
            0 calc(50% + 2px)
    );
}

.surround {
    padding: 0 10px;
    position: relative;
    display: inline-block;
    --round: 5px;
    --off: 0;
}

.surround::before {
    content: '';
    width: 5px;
    position: absolute;
    top: 0px;
    left: var(--off);
    bottom: 0px;
    width: 5px;
    border-top: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    border-left: 1px solid currentColor;
    border-top-left-radius: var(--round);
    border-bottom-left-radius: var(--round);
}

.surround::after {
    content: '';
    width: 5px;
    position: absolute;
    top: 0px;
    right: var(--off);
    bottom: 0px;
    width: 5px;
    border-top: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    border-right: 1px solid currentColor;
    border-top-right-radius: var(--round);
    border-bottom-right-radius: var(--round);
}

.surround.round {
    --round: 10px 30px;
}

.surround.square {
    --round: 0;
}

.surround.curly {
    --round: 10px;
    --off: 5px;
    padding: 0 15px;
    background-image:
            linear-gradient(0deg, currentColor 25%, currentColor 25%),
            linear-gradient(0deg, currentColor 25%, currentColor 25%);
    background-repeat: no-repeat;
    background-size: 5px 2px;
    background-position: 0 center, 100% center;
}

.surround.sys {
    --round: 10px;
    --off: 5px;
    padding: 0 15px;
    background-image:
            linear-gradient(0deg, currentColor 25%, currentColor 25%);
    background-repeat: no-repeat;
    background-size: 5px 1px;
    background-position: 0 center;
}

.surround.sys::after {
    content: unset;
}

.cs {
    position: relative;
    display: inline-block;
}

.cs > sup {
    position: absolute;
    bottom: calc(100% - 10px);
    left: 50%;
    transform: translate(-50%);
    width: max-content;
}

.cs > sub {
    position: absolute;
    top: calc(100% - 5px);
    left: 50%;
    transform: translate(-50%);
    width: max-content;
}

.big {
    font-size: 2em;
    font-weight: 200;
}

.arrow {
    position: relative;
}

.arrow::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 5px);
    left: 0;
    right: 0;
    height: 2px;
    background: currentColor;
}

.arrow::after {
    content: '';
    position: absolute;
    bottom: calc(100% - 1px);
    right: -1px;
    height: 5px;
    width: 5px;
    border-top: 1px solid currentColor;
    border-right: 1px solid currentColor;
    transform-origin: top right;
    transform: rotate(45deg);
}

.surround.vec {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
}

.matrix {
    display: inline-grid;
    grid-template-columns: repeat(var(--c), 1fr);
    grid-gap: 5px;
    padding: 5px 15px;
    vertical-align: middle;
}

.annot {
    color: #607D8B;
    position: absolute;
    right: 15px;
    top: calc(50% - 0.5em);
}

msqrt mrow {
    margin-top: 2px !important;
}

.mrow-in-msqrt {
    margin-top: 2px !important;
}