/*
 * Copyright (c) 2019-2025 XMLmind Software. All rights reserved.
 *
 * This file is part of the XMLmind XML Editor project.
 * For conditions of distribution and use, see the accompanying legal.txt file.
 *
 * CSS styles for TEI Lite.
 */

@namespace url(http://www.tei-c.org/ns/1.0);
@namespace tei url(http://www.tei-c.org/ns/1.0);
/*
 * Not allowed in TEI Lite. Just in case.
 */
@namespace m "http://www.w3.org/1998/Math/MathML";

/*
 * In case elements which are not part of TEI Lite are being used.
 */
*|* {
    display: tree;
}

/*
 * Not allowed in TEI Lite. Just in case.
 */
m|math {
    display: inline;
    content: image-viewport(data-type, XML);
}

/*
 * ---------------------------------------
 * Macros
 * ---------------------------------------
 */

@property-value simple-collapser(iconColor) 
    collapser(color, iconColor);

@property-value extended-collapser(iconColor) 
    collapser(color, iconColor, show-level-menu, yes);

@property-group labelled-left(indent) {
    display: block;
    margin-top: 1em;
    margin-bottom: 1em;
    margin-left: indent;
}

@property-group auto-text(fontSize) {
    font-family: sans-serif;
    font-size: fontSize;
    font-weight: bold;
    font-style: normal;
    text-decoration: none;
    color: gray;
}

@property-group label-left() {
    display: marker;
    marker-offset: fill;
    content: element-name();
    property-group: auto-text(smaller);
}

/*
 * ===========================================================================
 * textstructure
 * ===========================================================================
 */

TEI,
teiCorpus {
    display: block;
    collapsible: yes;
    not-collapsible-head: 1;
}

TEI:before,
teiCorpus:before {
    display: block;
    content: extended-collapser(0) " " element-name();
    font-size: smaller;
    font-weight: bold;
    color: gray;
}

group {
    display: block;
}

text {
    display: block;
}

group > text:before,
group > text:after {
    display: block;
    content: icon(invisible) icon(invisible);
    background-color: #F0F0F0;
    margin: 0.5em 0;
}

front,
back {
    display: block;
    collapsible: yes;
    border: 1px dotted gray;
    padding: 1ex;
    margin-bottom: 1em;
}

front:before,
back:before {
    display: block;
    content: extended-collapser(0) " " element-name();
    property-group: auto-text(smaller);
    margin-top: 1em;
}

body {
    display: block;
    margin: 1em 0;
}

/*
 * ---------------------------------------
 * opener, etc.
 * ---------------------------------------
 */

dateline,
signed,
salute,
opener,
closer,
postscript,
trailer {
    property-group: labelled-left(6em);
}

dateline:before,
signed:before,
salute:before,
opener:before,
closer:before,
postscript:before,
trailer:before {
    property-group: label-left();
}

/*
 * ---------------------------------------
 * titlePage
 * ---------------------------------------
 */

titlePage {
    display: block;
    collapsible: yes;
    background-color: #EEF8FF;
    padding: 1ex;
    margin-bottom: 1em;
}

titlePage:before {
    display: block;
    content: simple-collapser(0) " titlePage";
    property-group: auto-text(smaller);
    border-bottom: 1px solid gray;
    margin-top: 1em;
}

docTitle {
    display: block;
    margin: 1em 0;
}

titlePart[type][type=main],
titlePart {
    display: block;
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    color: #206080;
}

titlePart[type][type=main]:first-of-type,
titlePart:first-of-type {
    margin-top: 0.67em;
}

titlePart[type=main]:last-of-type,
titlePart:last-of-type {
    margin-bottom: 0.67em;
}

titlePart[type] {
    font-size: 1.17em;
}

titlePart[type]:first-of-type {
    margin-top: 0.86em;
}

titlePart[type]:last-of-type {
    margin-bottom: 0.86em;
}

docDate,
docAuthor,
docImprint,
docEdition,
imprimatur,
epigraph,
argument,
byline {
    property-group: labelled-left(6em);
}

docDate:before,
docAuthor:before,
docImprint:before,
docEdition:before,
imprimatur:before,
epigraph:before,
argument:before,
byline:before {
    property-group: label-left();
}

docImprint > publisher,
docImprint > pubPlace,
dateline > docDate,
docImprint > docDate,
byline > docAuthor {
    display: inline;
}

docImprint > publisher:before,
docImprint > pubPlace:before,
dateline > docDate:before,
docImprint > docDate:before,
byline > docAuthor:before {
    display: inline-block;
    margin-left: 0.5ex;
    margin-right: 0.5ex;
}

/*
 * ---------------------------------------
 * div
 * ---------------------------------------
 */

div {
    display: block;
    collapsible: yes;
    margin-bottom: 1em;
}

/* Expects head to be the first child, which is not enforced by the schema. */
div:contains-element(tei|head) {
    not-collapsible-head: 1;
}

div:before {
    display: block;
    content: extended-collapser(0) " div";
    property-group: auto-text(smaller);
    border-bottom: 1px solid gray;
    margin-top: 1em;
}

div[type]:before {
    content: extended-collapser(0) " div"
             " type=" text(attr(type), color, #206080);
}

div[n]:before {
    content: extended-collapser(0) " div"
             " n=" attr(n);
}

div[type][n]:before {
    content: extended-collapser(0) " div"
             " type=" text(attr(type), color, #206080) 
             " n=" attr(n);
}

/*
 * ---------------------------------------
 * divGen
 * ---------------------------------------
 */

divGen {
    display: block;
    margin-bottom: 1em;
}

divGen:before,
divGen:empty {
    display: block;
    content: "divGen";
    property-group: auto-text(smaller);
    margin-top: 1em;
}

divGen[type]:before,
divGen[type]:empty {
    content: "divGen type=" text(attr(type), color, #206080);
}

divGen[n]:before,
divGen[n]:empty {
    content: "divGen n=" attr(n);
}

divGen[type][n]:before,
divGen[type][n]:empty {
    content: "divGen type=" text(attr(type), color, #206080) 
             " n=" attr(n);
}

divGen[type]:empty:before,
divGen[n]:empty:before,
divGen[type][n]:empty:before,
divGen:empty:before {
    content: none;
}

/*
 * ===========================================================================
 * core
 * ===========================================================================
 */

respStmt {
    display: block;
    border-left: 1px solid gray;
    padding: 0.5ex;
    margin: 1em 0;
}

respStmt > name,
resp {
    display: block;
    margin-left: 3em;
}

publisher,
pubPlace,
author,
editor,
biblScope,
relatedItem {
    property-group: labelled-left(6em);
}

respStmt > name:before,
resp:before,
publisher:before,
pubPlace:before,
author:before,
editor:before,
biblScope:before,
relatedItem:before {
    property-group: label-left();
}

relatedItem:empty:after {
    display: inline;
    content: "target=" attr(target);
    property-group: auto-text(smaller);
}

/*
 * ---------------------------------------
 * bibl, listBibl
 * ---------------------------------------
 */

bibl {
    display: block;
    margin: 1em 0;
}

bibl > author,
bibl > availability,
bibl > biblScope,
bibl > distributor,
bibl > edition,
bibl > editor,
bibl > extent,
bibl > funder,
bibl > principal,
bibl > pubPlace,
bibl > publisher,
bibl > relatedItem,
bibl > respStmt > name,
bibl > respStmt > resp,
bibl > respStmt,
bibl > sponsor {
    display: inline;
    margin: 0;
}

bibl > author:before,
bibl > availability:before,
bibl > biblScope:before,
bibl > distributor:before,
bibl > edition:before,
bibl > editor:before,
bibl > extent:before,
bibl > funder:before,
bibl > principal:before,
bibl > pubPlace:before,
bibl > publisher:before,
bibl > relatedItem:before,
bibl > respStmt > name:before,
bibl > respStmt > resp:before,
bibl > respStmt:before,
bibl > sponsor:before {
    display: inline-block;
    margin-left: 0.5ex;
    margin-right: 0.5ex;
}

bibl > respStmt:before {
    content: element-name();
    property-group: auto-text(smaller);
}

listBibl {
    display: block;
    margin-left: 1em;
    margin-top: 1em; 
    margin-bottom: 1em; 
}

listBibl > bibl {
    margin-left: 2em;
    margin-top: 0;
    margin-bottom: 0;
}

listBibl > bibl:before {
    display: marker;
    content: icon(filled-square, 0);
    color: gray;
}

/*
 * ---------------------------------------
 * note
 * ---------------------------------------
 */

/* "block" note */
text note[place=inline], /*trick to increase specificity*/
note {
    display: block;
    white-space: normal;
    font-family: normal;
    font-size: 0.9em;
    font-style: normal;
    font-weight: normal;
    text-decoration: none;
    padding: 1ex;
    background-color: #FFFFEE;
    padding: 2ex 1ex;
    border-top: 1px solid #E0E0D0;
    border-bottom: 1px solid #E0E0D0;
    margin: 1.1em 4.4em;
}

/* footnote */
note[place] {
    font-size: small; /*not smaller*/
    background-color: #EEF8FF;
    border-style: none;
    border-width: 0;
    margin: 1.2em 4.8em;
}

note[place=bottom],
note[place=below],
note[place=end] {
    border-bottom-left-radius: 0.5em;
    border-bottom-right-radius: 0.5em;
}

note[place=top],
note[place=above] {
    border-top-left-radius: 0.5em;
    border-top-right-radius: 0.5em;
}

note[place=margin],
note[place=opposite],
note[place=overleaf] {
    border-top-left-radius: 0.5em;
    border-bottom-left-radius: 0.5em;
}

note > *:first-child {
    margin-top: 0; 
}

note > *:last-child {
    margin-bottom: 0; 
}

note:before {
    display: marker; 
    content: "note";
    property-group: auto-text(1em);
}

note[n]:before {
    content: attr(n);
}

/*
 * ---------------------------------------
 * head
 * ---------------------------------------
 */

head {
    display: block;
    font-weight: bold;
    color: #206080;
}

head:first-of-type {
    margin-top: 1em;
}

head:last-of-type {
    margin-bottom: 1em;
}

divGen > head:first-of-type,
divGen > head:last-of-type,
divGen > head {
    margin-top: 2px;
    margin-bottom: 0;
}

div > head:first-of-type {
    font-size: 2em;
    margin-top: 2px;
    margin-bottom: 0.5em;
}

div div > head:first-of-type {
    font-size: 1.66em;
    margin-bottom: 0.6em;
}

div div div > head:first-of-type {
    font-size: 1.5em;
    margin-bottom: 0.67em;
}

div div div div > head:first-of-type {
    font-size: 1.17em;
    margin-bottom: 0.86em;
}

div div div div div > head:first-of-type {
    margin-bottom: 1em;
}

div div div div div div > head:first-of-type {
    font-size: 0.83em;
    margin-bottom: 1.2em;
}

/*
 * ---------------------------------------
 * p
 * ---------------------------------------
 */

p {
    display: block;
    margin: 1em 0;
}

/*
 * ---------------------------------------
 * l, lg
 * ---------------------------------------
 */

lg {
    display: block;
    margin-top: 1em; 
    margin-bottom: 1em; 
    margin-left: 1em;
}

l {
    display: block;
    margin-left: 3em;
}

l[n]:before {
    display: marker;
    marker-offset: fill;
    content: attr(n);
    property-group: auto-text(smaller);
}

/*
 * ---------------------------------------
 * sp, etc.
 * ---------------------------------------
 */

sp {
    display: block;
    margin-top: 1em; 
    margin-bottom: 1em; 
    margin-left: 1em;
}

text sp > *, /*trick to increase specificity*/
sp > * {
    margin-top: 0;
    margin-bottom: 0;
}

speaker {
    display: block;
    color: #600060;
    margin: 1em 0;
}

stage {
    display: block;
    text-align: center;
    font-style: italic;
    margin: 1em 0;
}

stage:before,
stage:after {
    display: inline;
    property-group: auto-text(1em);
}

stage:before {
    content: "[";
}

stage[type]:before {
    content: "[" text(attr(type), font-size, smaller) " ";
}

stage:after {
    content: "]";
}

/*
 * ---------------------------------------
 * list
 * ---------------------------------------
 */

list {
    display: block;
    margin-left: 1em;
    margin-top: 1em; 
    margin-bottom: 1em; 
}

item {
    display: block;
    margin-left: 2em;
}

item[n] {
    margin-left: 3em;
}

item:before {
    display: marker;
    marker-offset: 1ex;
    content: "-";
    property-group: auto-text(smaller);
}

list[rend~=bulleted] > item:before {
    content: disc;
}

list[type=instructions] > item:before,
list[rend~=numbered] > item:before {
    content: simple-counter(n, decimal);
}

list[rend~=lettered] > item:before {
    content: simple-counter(n, lower-alpha);
}

list[rend] > item[n]:before,
item[n]:before {
    content: attr(n);
    marker-offset: fill;
}

label {
    display: inline;
    font-weight: bold;
}

list > label {
    display: block;
}

list[rend~=runon],
list[rend~=inline] {
    display: inline;
    margin: 0;
}

list[rend~=runon] > item,
list[rend~=inline] > item {
    display: inline;
}

list[rend~=runon] > item:before,
list[rend~=inline] > item:before {
    display: inline-block;
    margin-left: 1ex;
    margin-right: 1ex;
}

list[rend~=runon] > label,
list[rend~=inline] > label {
    display: inline-block;
    margin-left: 1ex;
    margin-right: 1ex;
}

list[rend] > label + item:before,
list[rend] > label + item[n]:before,
list > label + item:before {
    content: none;
}

/*
 * ---------------------------------------
 * address
 * ---------------------------------------
 */

address {
    display: block;
    text-align: center;
    margin: 1em 0;
}

text address > *, /*trick to increase specificity*/
address > *,
addrLine {
    display: block;
    margin-top: 0;
    margin-bottom: 0;
}

/*
 * ---------------------------------------
 * ref, ptr
 * ---------------------------------------
 */

ref,
ptr {
    display: inline;
    color: navy;
}

ref:after,
ptr:after {
    display: inline;
    font-size: smaller;
    font-weight: normal;
    font-style: normal;
    text-decoration: none;
    font-family: normal;
}

ref:after {
    content: icon(right-link, 0) attr(target);
}

ptr:after {
    content: icon(link, 0) attr(target);
}

*[target] {
  tooltip-content: attr(target) "\A \A "
    invoke("com.xmlmind.xmleditapp.dndview.ExtensionMethods.bindingDescription",
           "{$c}followLinkAt");
}

/*TEST
ptr[target][rend="drag-source"]:after {
    content: " " drag-source(icon, icon(external-link), command, "tei.drag");
    vertical-align: text-top;
}

ptr[rend="drop-site"]:after {
    content: " " drop-site(icon, icon(right-target),
                           command, "setObject", 
                           parameter, "target anyURI - '%{value}'");
    vertical-align: text-top;
}
*/

/*
 * ---------------------------------------
 * q, etc.
 * ---------------------------------------
 */

q {
    display: inline;
}

q:before,
q:after {
    display: inline;
    property-group: auto-text(1em);
}

q:before {
    content: open-quote;
}

q[type]:before {
    content: "[" text(attr(type), font-size, smaller) "]" open-quote;
}

q:after {
    content: close-quote;
}

cit {
    display: block;
    border-left: 1px solid gray;
    padding: 0.5ex;
    margin: 1em 0;
}

cit > *:first-child {
    margin-top: 0;
}

cit > *:last-child {
    margin-bottom: 0;
}

mentioned {
    display: inline;
    font-style: italic;
}

soCalled {
    display: inline;
    font-style: italic;
}

soCalled:before,
soCalled:after {
    content: '"';
    property-group: auto-text(1em);
}

/*
 * ---------------------------------------
 * emph, abbr, name, etc.
 * ---------------------------------------
 */

emph {
    display: inline;
    font-style: italic;
}

foreign {
    display: inline;
    font-style: italic;
}

abbr {
    display: inline;
    font-weight: bold;
}

expan {
    display: inline;
    font-style: italic;
    color: #202060;
}

choice {
    display: inline;
}

choice > *:before {
    display: inline;
    content: " | ";
    property-group: auto-text(1em);
}

choice > *:first-child:before {
    content: none;
}

term {
    display: inline;
    font-weight: bold;
}

gloss {
    display: inline;
    font-style: italic;
}

name,
rs {
    display: inline;
    font-style: normal;
    font-weight: normal;
    text-decoration: none;
    color: #600060;
}

date,
time,
num {
    display: inline;
    font-style: normal;
    font-weight: normal;
    text-decoration: none;
    color: #206020;
}

num {
    font-family: monospace;
}

title {
    display: inline;
    font-style: italic;
    color: #206080;
}

/*
 * ---------------------------------------
 * hi
 * ---------------------------------------
 */

/*
 * @rend values taken from the TEI XSL stylesheets.
 */
*[rend~="smallcaps"],
*[rend~="sc"] {
    font-variant: small-caps;
}

*[rend~="bold"],
*[rend~="important"],
*[rend~="label"] {
    font-weight: bold;
}

*[rend~="italic"],
*[rend~="ital"],
*[rend~="it"],
*[rend~="i"],
*[rend~="att"] {
    font-style: italic;
}

*[rend~="underline"],
*[rend~="ul"] {
    text-decoration: underline;
}

*[rend~="subscript"],
*[rend~="sub"] {
    vertical-align: sub;
    font-size: smaller;
}

*[rend~="superscript"],
*[rend~="sup"] {
    vertical-align: super;
    font-size: smaller;
}

*[rend~="strikethrough"] {
    text-decoration: line-through;
}

*[rend~="typewriter"],
*[rend~="code"] {
    font-family: monospace;
}

*[rend~="gothic"] {
    font-family: fantasy;
}

*[rend~="calligraphic"] {
    font-family: cursive;
}

hi {
    display: inline;
    font-style: italic;
}

hi[rend] {
    font-style: normal;
}

hi[rend~="italic"],
hi[rend~="ital"],
hi[rend~="it"],
hi[rend~="i"],
hi[rend~="att"] {
    font-style: italic;
}

hi[rend~="subscript"],
hi[rend~="sub"],
hi[rend~="superscript"],
hi[rend~="sup"] {
    display: inline-block;
}

/*
 * ---------------------------------------
 * sic, corr, etc.
 * ---------------------------------------
 */

orig,
reg,
sic,
corr {
    display: inline;
    text-decoration: underline;
}

sic {
    color: #800000;
}

corr {
    color: #008000;
}

orig {
    color: #800080;
}

reg {
    color: #008080;
}

unclear,
gap {
    display: inline;
    color: #602020;
}

unclear:before,
gap:before,
unclear:after,
gap:after {
    display: inline;
    property-group: auto-text(smaller);
    color: #602020;
}

unclear:before,
gap:before {
    content: "[" element-name() " reason=" attr(reason) " ";
}

gap[extent]:before,
gap[unit]:before,
gap[quantity]:before {
    content: "[gap reason=" attr(reason) " extent=" attr(extent) " unit=" attr(unit) " quantity=" attr(quantity) " ";
}

unclear:after,
gap:after {
    content: "]";
}

add {
    display: inline;
    text-decoration: underline;
    color: #0000FF;
}

del {
    display: inline;
    text-decoration: line-through;
    color: #FF0000;
}

/*
 * ---------------------------------------
 * milestone, pb, lb
 * ---------------------------------------
 */

milestone,
pb {
    display: block;
    text-align: center;
    vertical-align: middle;
    property-group: auto-text(smaller);
    margin: 0 auto;
}

milestone {
    content: url(icons/milestone.png) " unit=" attr(unit);
}

pb {
    content: url(icons/page_break.png);
}

milestone[n] {
    content: url(icons/milestone.png) " unit=" attr(unit) " n=" attr(n);
}

pb[n] {
    content: url(icons/page_break.png) " n=" attr(n);
}

lb {
    display: inline;
    content: "\A"; 
    font-family: sans-serif; /* XXE client: "\A" -> NEWLINE_GLYPH+<br> */
    color: gray;
}

/*
 * ---------------------------------------
 * graphic, desc
 * ---------------------------------------
 */

graphic {
    display: inline;
}

graphic:before {
    display: inline;
    content: image-viewport(attribute, url, smooth, yes,
      content-width, 
      xpath("if(number(@scale) > 0, concat(number(@scale)*100,'%'), @width)"),
      content-height, 
      xpath("if(number(@scale) > 0, '', @height)"));
}

desc {
    display: inline;
    font-size: small;
}

desc:before,
desc:after {
    display: inline;
    property-group: auto-text(1em);
}

desc:before {
    content: "[";
}

desc:after {
    content: "]";
}

/*
 * ---------------------------------------
 * index
 * ---------------------------------------
 */

index {
    display: inline;
    white-space: normal;
    font-size: small; /*Not smaller*/
}

index:before {
    content: icon(left-half-disc, 0);
    property-group: auto-text(small);
}

index[indexName]:before {
    content: icon(left-half-disc, 0) attr(indexName) 
             icon(half-disc-separator, 0);
}

index:after {
    content: icon(right-half-disc, 0) attr(spanTo);
    property-group: auto-text(small);
}

index > term {
    font-family: normal;
    font-size: inherit;
    font-style: normal;
    font-weight: normal;
    text-decoration: none;
}

/*
 * ===========================================================================
 * tagdocs
 * ===========================================================================
 */

eg,
code,
ident,
gi,
att,
val {
    font-family: monospace; 
    font-style: normal;
    font-weight: normal;
    text-decoration: none;
}

eg {
    display: block;
    white-space: pre;
    background-color: #F0F0F0;
    border: 1px solid #E0E0E0;
    padding: 0.5ex;
    margin: 1.09em 0;
}

code {
    display: inline;
    background-color: #F0F0F0;
}

ident {
    display: inline;
    font-weight: bold;
}

gi {
    display: inline;
}

gi:before,
gi:after,
att:before,
val:before,
val:after {
    property-group: auto-text(1em);
}

gi:before {
    display: inline;
    content: "<";
}

gi:after {
    display: inline;
    content: ">";
}

att {
    display: inline;
}

att:before {
    display: inline;
    content: "@";
    font-size: smaller;
}

val {
    display: inline;
}

val:before,
val:after {
    display: inline;
    content: '"';
}

/*
 * ===========================================================================
 * linking
 * ===========================================================================
 */

anchor {
    display: inline;
    content: icon(left-target, 0) attr(xml|id);
    property-group: auto-text(smaller);
}

seg {
    display: inline;
}

/*
 * ===========================================================================
 * figures
 * ===========================================================================
 */

/*
 * ---------------------------------------
 * figure
 * ---------------------------------------
 */

figure > graphic {
    display: block;
    margin: 1em 0;
}

figure {
    collapsible: yes;
    collapsed-content: url(xxe-config:common/icons/figure.png);
    collapsed-content-align: center;
    display: block;
    border: 1px solid #F0F0F0;
    padding: 1ex;
    margin: 1em 0;
}

figure > head:first-of-type:before {
    display: inline;
    content: simple-collapser(0) " ";
}

figure > graphic,
figure > head {
    text-align: center;
}

figDesc,
figure > graphic > desc {
    display: block;
    text-align: left;
    font-size: small;
    margin: 1.2em 0;
}

figDesc:before,
figDesc:after {
    display: inline;
    property-group: auto-text(1em);
}

figDesc:before {
    content: "[";
}

figDesc:after {
    content: "]";
}

/*
 * ---------------------------------------
 * table
 * ---------------------------------------
 */

table {
    display: table; 
    collapsible: yes;
    not-collapsible-head: 1;
    collapsed-content: url(xxe-config:common/icons/table.png);
    collapsed-content-align: center;
    border: 1px outset gray;
    margin: 1em 0; 
}

/*TEST
table[rend=spreadsheet] {
    show-row-column-labels: yes;
}
*/

text table > *, /*trick to increase specificity*/
table > * {
    display: table-caption; 
}

table > head:first-of-type:before {
    display: inline;
    content: simple-collapser(0) " ";
}

table > head {
    text-align: center;
}

table > row,
row {
    display: table-row; 
    background-color: inherit; /*e.g. from read-only table*/
}

row[role=header],
row[role=label],
cell[role=label] {
    font-weight: bold;
    text-align: center;
}

row[role=header] {
    background-color: #F0F0FF;
}

row[role=data],
cell[role=data] {
    font-weight: normal;
    text-align: left;
}

cell {
    display: table-cell; 
}

cell {
    background-color: inherit;
    padding: 0.5ex; 
    border: 1px inset gray;
}

cell[cols] {
    column-span: concatenate(attr(cols));
}

cell[rows] {
    row-span: concatenate(attr(rows));
}

cell > *:first-child {
    margin-top: 0; 
}

cell > *:last-child {
    margin-bottom: 0; 
}

/*
 * ---------------------------------------
 * formula
 * ---------------------------------------
 */

formula {
    display: inline;
    font-family: monospace; 
}

/*
 * @rend values 'subeqn' and  'display' taken from the TEI XSL stylesheets.
 */
formula[rend~="display"] {
    display: block;
    margin: 1em 0;
}

/*
 * ===========================================================================
 * analysis
 * ===========================================================================
 */

/*
 * ---------------------------------------
 * interp, interpGrp
 * ---------------------------------------
 */

interpGrp {
    display: block;
    margin: 1em 0;
}

interp {
    display: block;
    margin-top: 1em; 
    margin-bottom: 1em; 
}

interpGrp > interp {
    margin-top: 0; 
    margin-bottom: 0; 
}

interp:before,
interp:after {
    display: inline;
    property-group: auto-text(smaller);
}

interp:before {
    content: "interp ";
}

interp[xml|id]:before {
    content: "interp " attr(xml|id) " ";
}

interp[inst]:after {
    content: " inst=" attr(inst);
}

/*
 * ---------------------------------------
 * s, w, pc
 * ---------------------------------------
 */

s,
w,
pc {
    display: inline;
}

s:before,
w:before,
w:after,
pc:before {
    display: inline;
    content: icon(left-half-disc, 0);
}

w:after,
s:after,
pc:after {
    display: inline;
    content: icon(right-half-disc, 0);
}

s:before,
s:after {
    color: #202060;
}

w:before,
w:after {
    color: #206020;
}

pc:before,
pc:after {
    color: #602020;
}

/*
 * ===========================================================================
 * header
 * ===========================================================================
 */

teiHeader {
    display: block;
    collapsible: yes;
    collapsed-content: paragraph(content(icon(pop-right, 0), " ", 
                                         xpath("if(tei:fileDesc/tei:titleStmt/tei:title[1] != '', tei:fileDesc/tei:titleStmt/tei:title[1], '(title here)')")), 
                                 font-weight, bold,
                                 font-size, 1.17em, 
                                 color, #606040);
    collapsed-content-align: center;
    collapsed: yes;
    border: 1px solid #E0E0D0;
    border-radius: 3px;
    background-color: #FFFFEE;
    padding: 1ex;
    margin-bottom: 1em;
}

/*
 * ---------------------------------------
 * fileDesc
 * ---------------------------------------
 */

fileDesc {
    display: block;
}

titleStmt {
    display: block;
}

titleStmt > title {
    display: block;
    text-align: center;
    font-weight: bold;
    font-style: normal;
    text-decoration: none;
    font-family: normal;
    font-size: 1.17em;
    color: #606040;
}

titleStmt > title:first-of-type {
    margin-top: 0.86em;
}

titleStmt > title:last-of-type {
    margin-bottom: 0.86em;
}

titleStmt > title:first-child:before {
    content: simple-collapser(0) " ";
}

sponsor,
funder,
principal {
    property-group: labelled-left(6em);
}

sponsor:before,
funder:before,
principal:before {
    property-group: label-left();
}

/*
 * ---------------------------------------
 * extent
 * ---------------------------------------
 */

extent {
    property-group: labelled-left(6em);
}

extent:before {
    property-group: label-left();
}

/*
 * ---------------------------------------
 * editionStmt
 * ---------------------------------------
 */

editionStmt,
publicationStmt,
seriesStmt,
notesStmt,
sourceDesc {
    display: block;
    margin-bottom: 1em;
}

editionStmt:before,
publicationStmt:before,
seriesStmt:before,
notesStmt:before,
sourceDesc:before {
    display: block;
    content: element-name();
    property-group: auto-text(smaller);
    border-bottom: 1px solid gray;
    margin-top: 1em;
}

edition {
    property-group: labelled-left(6em);
}

edition:before {
    property-group: label-left();
}

/*
 * ---------------------------------------
 * publicationStmt
 * ---------------------------------------
 */

idno {
    display: inline;
}

idno:before {
    display: inline;
    content: "idno ";
    property-group: auto-text(smaller);
}

idno[type]:before {
    content: attr(type) " ";
}

publicationStmt > idno,
publicationStmt > date,
publicationStmt > address,
publicationStmt > ptr,
publicationStmt > ref,
availability,
authority,
distributor {
    property-group: labelled-left(6em);
}

publicationStmt > idno:before,
publicationStmt > date:before,
publicationStmt > address:before,
publicationStmt > ptr:before,
publicationStmt > ref:before,
availability:before,
authority:before,
distributor:before {
    property-group: label-left();
}

licence {
    display: block;
    margin: 1em 0;
}

/*
 * ---------------------------------------
 * seriesStmt
 * ---------------------------------------
 */

seriesStmt > title,
seriesStmt > idno {
    property-group: labelled-left(6em);
}

seriesStmt > title:before,
seriesStmt > idno:before {
    property-group: label-left();
}

/*
 * ---------------------------------------
 * notesStmt
 * ---------------------------------------
 */

notesStmt > note {
    property-group: labelled-left(6em);
    font-size: 1em;
    background-color: transparent;
    padding: 0;
}

notesStmt > note:before {
    property-group: label-left();
}

/*
 * ---------------------------------------
 * encodingDesc
 * ---------------------------------------
 */

encodingDesc,
profileDesc,
revisionDesc {
    display: block;
    collapsible: yes;
    border: 1px solid #E0E0D0;
    padding: 1ex;
    margin-bottom: 1em;
}

encodingDesc:before,
profileDesc:before,
revisionDesc:before {
    display: block;
    content: simple-collapser(0) " " element-name();
    property-group: auto-text(smaller);
    margin-top: 1em;
}

projectDesc,
samplingDecl,
editorialDecl,
refsDecl,
classDecl,
taxonomy {
    property-group: labelled-left(6em);
}

projectDesc:before,
samplingDecl:before,
editorialDecl:before,
refsDecl:before,
classDecl:before,
taxonomy:before {
    property-group: label-left();
}

category {
    display: block;
    margin: 0;
}

category > category {
    margin-left: 2em;
}

category > gloss,
category > desc,
catDesc {
    display: block;
    font-weight: bold;
    font-style: normal;
    margin: 0;
}

category > gloss:before,
category > desc:before,
catDesc:before {
    display: inline;
    content: icon(hollow-diamond) " ";
    color: gray;
}

category > desc:after {
    content: none;
}

/*
 * ---------------------------------------
 * profileDesc
 * ---------------------------------------
 */

creation,
langUsage,
textClass,
keywords,
classCode,
catRef {
    property-group: labelled-left(6em);
}

creation:before,
langUsage:before,
textClass:before,
keywords:before,
classCode:before,
catRef:before {
    property-group: label-left();
}

language {
    display: block;
    margin: 0;
}

language:before {
    display: inline;
    content: "language " attr(ident) " ";
    property-group: auto-text(smaller);
}

keywords > term:before {
    content: ", ";
    property-group: auto-text(1em);
}

keywords > term:first-child:before {
    content: none;
}

keywords > list {
    margin: 0;
}

keywords[scheme]:after,
classCode:after,
catRef:after {
    display: inline;
    property-group: auto-text(smaller);
}

keywords[scheme]:after,
classCode:after {
    content: " scheme=" attr(scheme);
}

catRef:after {
    content: "target=" attr(target);
}

catRef[scheme]:after {
    content: "target=" attr(target) " scheme=" attr(scheme);
}

/*
 * ---------------------------------------
 * revisionDesc
 * ---------------------------------------
 */

revisionDesc > list {
    margin: 0;
}

change {
    display: block;
    margin: 0;
}

change:before {
    display: inline;
    content: "change ";
    property-group: auto-text(smaller);
}

change[who]:before {
    content: "change who=" attr(who) " ";
}

change[when]:before {
    content: "change when=" attr(when) " ";
}

change[who][when]:before {
    content: "change who=" attr(who) " when=" attr(when) " ";
}
