/*
 * Copyright (c) 2011-2012 Pixware SARL. 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.
 *
 * Used to style a DocBook 5.0, 5.1 document set. See the <documentSetFactory> 
 * element in docbook5_common.incl. 
 */

@namespace "http://docbook.org/ns/docbook";
@namespace db5 "http://docbook.org/ns/docbook";

@import url(docbook-config:css/inline1.imp);
@import url(docbook-config:css/inline2.imp);

*,
*:comment,
*:processing-instruction,
topic > *,
set > *,
book > *,
part > *,
reference > *,
preface > *,
chapter > *,
article > *,
appendix > *,
section > *,
sect1 > *,
sect2 > *,
sect3 > *,
sect4 > *,
sect5 > *,
info > * {
    display: none;
}

topic,
set,
book,
part,
reference,
preface,
chapter,
article,
appendix {
    display: block;
    collapsible: yes;
    not-collapsible-head: 1; /* title or info */
    margin-top: 0.5ex;
    margin-left: 4ex;
}

refentry {
    display: block;
    content: "RefEntry: " xpath("join(.//db5:refname, ', ')");
    margin-left: 4ex;
}

glossary {
    display: block;
    content: xpath("if(./db5:info/db5:title, string(./db5:info/db5:title), ./db5:title, string(./db5:title), 'Glossary')");
    margin-left: 4ex;
}

section,
sect1,
sect2,
sect3,
sect4,
sect5 {
    display: block;
    margin-left: 4ex;
}

*:root {
    margin-top: 0;
    margin-left: 0;
}

info:contains-element(title) {
    display: block; 
}

title {
    display: block;
    margin: 0 2px; /* This trick allows to make a difference between the title 
                      and its containing division when pressing Up/Down in
                      the DocSetPane. */
}

title * {
    display: inline;
}

title indexterm {
    display: none;
}

topic > title,
topic > info > title,
set > title,
book > title,
part > title,
reference > title,
preface > title,
chapter > title,
article > title,
appendix > title,
set > info > title,
book > info > title,
part > info > title,
reference > info > title,
preface > info > title,
chapter > info > title,
article > info > title,
appendix > info > title {
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 0.25ex;
    margin-bottom: 0.25ex;
}

/*
 * Title which is the the first child of a division.
 */

set > title:first-child:before {
    content: collapser() " Set: ";
}

book > title:first-child:before {
    content: collapser() " Book: ";
}

reference > title:first-child:before {
    content: collapser() " Reference: ";
}

preface > title:first-child:before {
    content: collapser() " Preface: ";
}

article > title:first-child:before {
    content: collapser() " Article: ";
}

part > title:first-child:before { 
    content: collapser() " Part " simple-counter(n-, upper-roman) ": "; 
}

chapter > title:first-child:before { 
    content: collapser() " Chapter " simple-counter(n-, decimal) ": "; 
}

appendix > title:first-child:before { 
    content: collapser() " Appendix " simple-counter(n-, upper-alpha) ": "; 
}

sect1 > title:first-child:before { 
    content: simple-counter(n-) ". "; 
}

sect2 > title:first-child:before { 
    content: simple-counter(nn-) ". "; 
}

sect3 > title:first-child:before { 
    content: simple-counter(nnn-) ". "; 
}

sect4 > title:first-child:before { 
    content: simple-counter(nnnn-) ". "; 
}

section > title:first-child:before { 
    content: simple-counter(n-) ". "; 
}

section section > title:first-child:before { 
    content: simple-counter(nn-) ". "; 
}

section section section > title:first-child:before { 
    content: simple-counter(nnn-) ". "; 
}

section section section section > title:first-child:before { 
    content: simple-counter(nnnn-) ". "; 
}

section section section * section > title:first-child:before { 
    content: ""; 
}

/*
 * Title contained in the first info child of a division.
 */

set > info:first-child > title:before {
    content: collapser() " Set: ";
}

book > info:first-child > title:before {
    content: collapser() " Book: ";
}

reference > info:first-child > title:before {
    content: collapser() " Reference: ";
}

preface > info:first-child > title:before {
    content: collapser() " Preface: ";
}

article > info:first-child > title:before {
    content: collapser() " Article: ";
}

part > info:first-child > title:before { 
    content: collapser() " Part " simple-counter(n--, upper-roman) ": "; 
}

chapter > info:first-child > title:before { 
    content: collapser() " Chapter " simple-counter(n--, decimal) ": "; 
}

appendix > info:first-child > title:before { 
    content: collapser() " Appendix " simple-counter(n--, upper-alpha) ": "; 
}

sect1 > info:first-child > title:before { 
    content: simple-counter(n--) ". "; 
}

sect2 > info:first-child > title:before { 
    content: simple-counter(nn--) ". "; 
}

sect3 > info:first-child > title:before { 
    content: simple-counter(nnn--) ". "; 
}

sect4 > info:first-child > title:before { 
    content: simple-counter(nnnn--) ". "; 
}

section > info:first-child > title:before { 
    content: simple-counter(n--) ". "; 
}

section section > info:first-child > title:before { 
    content: simple-counter(nn--) ". "; 
}

section section section > info:first-child > title:before { 
    content: simple-counter(nnn--) ". "; 
}

section section section section > info:first-child > title:before { 
    content: simple-counter(nnnn--) ". "; 
}

section section section * section > info:first-child > title:before { 
    content: ""; 
}

/*
 * topic
 */

topic > title,
topic > info > title {
    color: rgb(85,26,139);
}

topic > title:first-child:before,
topic > info:first-child > title:before {
    /* Topic not numbered. */
    content: collapser(collapsed-icon, icon(pop-right), 
                       expanded-icon, icon(pop-down),
                       color, rgb(85,26,139)) " "; 
}
