[data-role="anchor"] {
  /* for Fixed Headers + Section Anchors */
  scroll-snap-margin-top: calc(var(--base-gap) + var(--base-padding));
  scroll-margin-top:      calc(var(--base-gap) + var(--base-padding));
}

[data-role="anchor"]:target + .section-title {
  background-color: var(--color-highlight);
}

/* article */

article {
  position: relative;
  padding:  calc(var(--base-padding)*1.5)
            calc(var(--base-padding)*1.5)
            var(--base-padding)
            calc(var(--base-padding)*1.5);
}

[data-role='current'] article {
  background-color: var(--color-bg-contrast);
  border: 1px solid var(--color-fg-contrast);
  height: 100%;
}

[data-role='parents'] article,
[data-role='children'] article {
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  width: var(--card-width);
}

[data-role='parents'] article {
  margin-right: var(--traceability-arrow);
}

[data-role='children'] article {
  margin-left: var(--traceability-arrow);
}

.traceability-view article + article {
  margin-top: var(--base-padding);
}

.deep-traceability-view article {
  width: var(--card-width);
  height: 100%;
}

.document-view article {
  background-color: var(--color-bg-contrast);
  padding: calc(var(--base-padding)*2) calc(var(--base-padding)*3);
  max-width: 900px;
}

/* .table-view */

.table-view [data-section] {
  background-color: var(--color-bg-contrast);
  padding: var(--base-padding);
}

.table-view header [data-section] {
  background-color: var(--color-bg-main);
  color: var(--color-text-main);

  display: flex;
  align-items: center;
  height: var(--base-gap);

  position: -webkit-sticky; /* Safari */
  position: sticky;
  z-index: 10;
  top: calc(var(--base-gap)*(-1));
}

.table-view header [data-section]::before {
  content: attr(data-section) " ";
  font-size: .85rem;
  text-transform: capitalize;
  font-weight: bold;
}

.table-view [data-section] p:first-child { margin-top: 0; }
.table-view [data-section] p:last-child { margin-bottom: 0; }

/* requirement_statement */

.document-view .requirement_statement {
  margin: calc(var(--base-margin)*2) 0px;
  font-size: calc(var(--base-font-size)*1.2);
}

/* arrows */

[data-role='parents'] article::before,
[data-role='children'] article::before {
  content: '\2190';
  position: absolute;
  top: calc(var(--base-padding)*1.5);
  display: block;
  width: var(--traceability-arrow);
  line-height: var(--traceability-arrow);
  font-size: calc(var(--traceability-arrow) * 1);
  text-align: center;
  color: var(--color-accent-dark);
}

[data-role='parents'] article::before {
  right: calc(var(--traceability-arrow) *(-1) - 1px);
}

[data-role='children'] article::before {
  left: calc(var(--traceability-arrow) *(-1) - 1px);
}

/*  */

div.document {
  display: contents;
}

section:target [data-role="current"] .section-title {
  background-color: var(--color-highlight);
}

section p {
  margin: var(--base-margin) 0;
}

h1 { font-size: 2em; }
h2 { font-size: 1.6em; }
h3 { font-size: 1.4em; }
h4 { font-size: 1.2em; }
h5 { font-size: 1em; }
h6 { font-size: 1em; }

/* section-title */

.section-title {
  margin: 0 0 0.5rem;
  line-height: 1.4;
  color: var(--color-accent);
}

.section-title[data-level]::before {
  content: attr(data-level) " ";
  font-weight: bold;
}

.traceability-view .section-title,
.deep-traceability-view .section-title {
  font-size: 1.1em;
  line-height: 1.2;
}

.table-view .section-title {
  font-size: 1rem;
  line-height: 1.2;
}

/* blockquote */

blockquote {
  color: #666;
  padding: .25em 0 0.25em 1rem;
  border-left: 4px solid #ccc;
}

/* pre.code */

pre.code {
  font-family: var(--code-font-family);

  font-size: var(--code-font-size);
  line-height: 1.8;
  margin:   var(--code-font-size) 0;
  padding:  calc(var(--code-font-size)*1.2)
            calc(var(--code-font-size)*1.2)
            calc(var(--code-font-size)*1.2)
            calc(var(--code-font-size)*2);

  overflow: auto;
  background-color: var(--color-bg-main);
  border: 1px solid var(--color-border);
}

cite {
  position: relative;
  padding: 2px 6px;
  font-style: normal;
  font-family: var(--code-font-family);
  font-size: var(--code-font-size);
  background-color: var(--color-bg-main);
  border: 1px solid var(--color-border);
  border-radius: 4px;

  overflow-wrap: break-word;
  word-wrap: break-word;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* reference */

a.reference.external {
  display: inline-block;
  max-width: 100%;
  vertical-align: bottom;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* tags */

.tags {
  padding-bottom: var(--base-gap);
}

.tag {
  display: inline-flex;
    align-items: center;
  background-color: rgba(0,0,0,0.1);
  border: 2px solid rgba(0,0,0,0.05);
  font-size: 12px;
  line-height: 1;
  vertical-align: middle;
  margin: 2px 0px;
  padding-left: 8px;
  border-radius: 2em;
}

.tag_badge {
  display: inline-flex;
    justify-content: center;
    align-items: center;
  font-size: 11px;
  background-color: rgba(255, 255, 255, 0.75);
  border: 4px solid transparent;
  min-width: 18px;
  height: 18px;
  border-radius: 2em;
  margin-left: 4px;
}

/* ul */

article ul,
article ol {
  padding-left: 1.6em;
}

/* object */

article object {
  width: 100%;
  padding: 1em;
  background: var(--color-bg-contrast);
}

/* meta table */

dl.requirement_meta {
  display: table;
  border-collapse: collapse;
  margin-bottom: 1rem;
}
.requirement_meta div {
  display: table-row;
}
.requirement_meta dt,
.requirement_meta dd {
  display: table-cell;
  padding: 0 6px;
  font-size: .85rem;
  line-height: 1.4;
  font-family: 'Courier New', Courier, monospace;
  border: 1px solid #dddddd;
}
.requirement_meta dt::after {
  content: ':';
}

/* requirement_parent */

.requirement_parent,
ul.requirement_parent {
  font-size: 14px;
  line-height: 1.4;
  list-style: none;
  padding-left: 1em;
  margin-top: .5rem;
}
.requirement_parent li::before {
  content: '\2190';
  color: var(--color-accent-dark);
  display: inline-block;
  width: 1em;
  margin-left: -1em;
}
.requirement_parent a:link,
.requirement_parent a:visited {
  color: var(--color-accent-dark);
  text-decoration: underline;
}
.requirement_parent a:hover {
  text-decoration: none;
}
.requirement_parent-uid {
  position: relative;
  font-weight: bold;
}

/* comment */

.requirement_comment {
  font-size: .9em;
  font-style: italic;
}

.requirement_comment + .requirement_comment {
  margin-top: var(--base-margin);
}

.requirement_comment p:first-child::before {
  content: "Comment: ";
  font-weight: bold;
}

/* free-text */

.traceability-view .free-text,
.deep-traceability-view .free-text {
  font-size: .85em;
}

/* RECURIVE */

.recursive_row,   /* ul */
.recursive_column /* li */ {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recursive_row {
  display: flex;
  flex-direction: row;
  margin-bottom: var(--traceability-arrow);
}

.recursive_row:last-child {
  margin-bottom: 0;
}

.recursive_column {
  min-width: var(--card-width);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

[data-role="parents"] .recursive_row {
  /* parents are shown in reverse order: */
  flex-direction: row-reverse;
}

.recursive_cell {
  position: relative;
  height: 100%;
}
