/* Copyright 2014 Google Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

@page {
    margin: 10%;
}
@page :left {
    @top-left { content: string(docname); font-weight: bold; font-size: 10pt; }
    @top-right { content: normal; }
    @bottom-left { content: counter(page); font-size: 10pt; }
    @bottom-right { content: "© ISO/IEC " string(pubyear) " — All rights reserved";
                    font-size: 10pt; }
}
@page :right {
    @top-left { content: normal; }
    @top-right { content: string(docname); font-weight: bold; font-size: 10pt; }
    @bottom-left { content: "© ISO/IEC " string(pubyear) " — All rights reserved";
                   font-size: 10pt; }
    @bottom-right { content: counter(page); font-size: 10pt; }
}
@page front-matter :left {
    @bottom-left { content: counter(page, lower-roman); font-size: 10pt; }
}
@page front-matter :right {
    @bottom-right { content: counter(page, lower-roman); font-size: 10pt; }
}
@page first-technical {
    @top-left {
        content: "TECHNICAL SPECIFICATION";
        font-weight: bold; font-size: 10pt;
        border-top: thick solid black; border-bottom: thick solid black; margin: 2.5em 0;
    }
    @top-right {
        content: "ISO/IEC TS 19568:" string(pubyear) "(E)";
        font-weight: bold; font-size: 10pt;
        border-top: thick solid black; border-bottom: thick solid black; margin: 2.5em 0;
    }
}
@page :first {
    @top-left { content: normal; }
    @top-right { content: normal; }
    @bottom-left { content: normal; }
    @bottom-right { content: normal; }
}

body { margin: 0; }

.firsttech {
    page: first-technical;
    font-weight: bold;
    font-size: 12pt;
    line-height: 150%;
    page-break-before: always;
    counter-reset: page 1;
    margin-bottom: 6em;
}

.firsttech + cxx-clause {
    page: first-technical;
    page-break-before: avoid;
}

@media screen {
    body { max-width: 7in;
           /* Make room for paragraph numbers. */
           margin-left: 2em }
}

@media print {
    html { font-size: 10pt; }
    * /deep/ code { font-size: 80%; }
    /* Note that only Prince generates clickable links. */
    * /deep/ a[href] { text-decoration:none; }
}

@media screen {
    /* Needed to make the <cxx-titlepage>'s vertical spacing work.
       For print see the <cxx-titlepage> definition. */
    html, body {height: 100%}
}

* /deep/ .docname { string-set: docname content(); }
* /deep/ .pubyear { string-set: pubyear content(); }

cxx-clause, cxx-foreword { page-break-before: always; }
@media screen {
    cxx-clause, cxx-toc, cxx-foreword { margin-top: 3em; }
}

cxx-clause::shadow header, cxx-foreword::shadow h1 { font-size: 150%; }
cxx-toc::shadow h1 { font-size: 150%; }
cxx-clause cxx-section::shadow header { font-size: 117%; }
cxx-clause cxx-section cxx-section::shadow header { font-size: 100%; }

[data-bookmark-label] { bookmark-label: attr(data-bookmark-label); }
h1 { bookmark-level: 1; }
cxx-toc::shadow h1 { bookmark-level: 2; }
cxx-clause h1, cxx-foreword h1 { bookmark-level: 2; }
cxx-clause cxx-section h1 { bookmark-level: 3; }
cxx-clause cxx-section cxx-section h1 { bookmark-level: 4; }
/* The <h2> is a subtitle, which shouldn't get a PDF bookmark. */
cxx-titlepage::shadow h2 { bookmark-level: none; }

*::shadow .section-number { string-set: current-section "§ " content(); }

p {margin-top: .5em; margin-bottom: .5em}
p:first-child, ul, ol {margin-top: 0}

[para_num]::before { content: attr(para_num); float: left;
                     font-size: 70%; margin-left: -2.5em; width: 1.5em; text-align: right; }

del {text-decoration: line-through; color: #8B0040;}
ins {text-decoration: underline; color: #005100;}

pre {
    margin-left: 1em;
    margin-top: .5em;
    margin-bottom: .5em;
}

* /deep/ wbr::after {
    white-space: normal;
    content: '\200B';
}
* /deep/ code {
    /* Make inline code avoid line wraps unless we override it with <wbr>. */
    white-space: nowrap;
}
* /deep/ pre code {
    /* Keep block-code wrapping according to its context. */
    white-space: inherit;
}

* /deep/ table {
    border-collapse: collapse;
}
* /deep/ td, th {
    padding-left: .2em;
    padding-right: .2em;
    border: thin solid black;
}

/* Use an em-dash for the list bullet.
   'print' is a proxy for supporting ::marker. */
@media screen {
    ul {
        list-style: none;
        /* Relative positioning on the 'ul' lets the absolutely-positioned
           marker align relative to it.*/
        position: relative;
    }
    ul li:before {
        content: "\2014";
        position: absolute; left: 10px;
    }
}
@media print {
    ul li::marker {
        content: "\2014";
    }
    [is=cxx-table].list ul li::marker {
        content: none;
    }
}

/* This is here rather than inside elements/toc.html because browsers
   don't understand leader() or target-counter(), so they drop them
   inside the CSSOM. */
@media print {
    /* Generate page numbers in the table of contents. */
    cxx-toc::shadow a[href]::after { content: leader(" . ") target-counter(attr(href), page); }

    cxx-footnote::shadow aside { float: footnote; footnote-policy: line; }
}
