/* Technical documentation inherits the existing source-reader visual system. */
#source-reader-modal .webgis-guide-intro {
    font: 400 1.2rem/1.6 var(--font-serif);
}

#source-reader-modal .webgis-guide-note {
    margin-top: 1rem;
    color: #666;
    font-size: 0.875rem;
    line-height: 1.6;
}

#source-reader-modal .webgis-diagram {
    margin: 1.5rem 0;
    --connector-colour: #aaa;
    --flow-gap: 1.5rem;
    --branch-gap: 0.875rem;
    --branch-drop: 1.5rem;
    --tree-indent: 1rem;
    --subbranch-gap: 0.75rem;
    --tree-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 8' preserveAspectRatio='none'%3E%3Cpath d='M0 4H24M20 .5L23.5 4L20 7.5' fill='none' stroke='%23aaa' stroke-width='1'/%3E%3C/svg%3E");
}

#source-reader-modal .webgis-flow {
    display: grid;
    grid-template-columns: repeat(var(--flow-columns, 3), minmax(0, 1fr));
    gap: var(--flow-gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

#source-reader-modal .webgis-flow > li,
#source-reader-modal .webgis-node {
    position: relative;
    min-width: 0;
    margin: 0;
    padding: 0.875rem 0.75rem;
    border: 1px solid #ccc;
    background: #fff;
    color: var(--text-primary);
    font: 400 0.8125rem/1.5 var(--font-sans);
    overflow-wrap: break-word;
}

#source-reader-modal .webgis-flow > li:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    width: calc(var(--flow-gap) + 1px);
    border-top: 1px solid var(--connector-colour);
}

#source-reader-modal .webgis-flow > li:not(:last-child)::after {
    content: '';
    position: absolute;
    left: calc(100% + var(--flow-gap) - 4px);
    top: calc(50% - 3.5px);
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid var(--connector-colour);
}

#source-reader-modal .webgis-flow strong,
#source-reader-modal .webgis-node strong {
    display: block;
    margin-bottom: 0.375rem;
    font: 500 0.875rem/1.4 var(--font-sans);
}

#source-reader-modal .webgis-flow span,
#source-reader-modal .webgis-node span {
    display: block;
    color: #666;
}

#source-reader-modal .webgis-branch-origin {
    max-width: 24rem;
    margin: 0 auto var(--branch-drop);
    text-align: center;
}

#source-reader-modal .webgis-branch-origin::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    height: calc(var(--branch-drop) + 1px);
    border-left: 1px solid var(--connector-colour);
}

#source-reader-modal .webgis-branches {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--branch-columns, 3), minmax(0, 1fr));
    gap: var(--branch-gap);
    margin: 0;
    padding: var(--branch-drop) 0 0;
    list-style: none;
    align-items: start;
}

#source-reader-modal .webgis-branches::before {
    content: '';
    position: absolute;
    top: 0;
    left: calc((100% - (var(--branch-columns, 3) - 1) * var(--branch-gap)) / var(--branch-columns, 3) / 2);
    right: calc((100% - (var(--branch-columns, 3) - 1) * var(--branch-gap)) / var(--branch-columns, 3) / 2);
    border-top: 1px solid var(--connector-colour);
}

#source-reader-modal .webgis-branch,
#source-reader-modal .webgis-subbranch {
    position: relative;
    min-width: 0;
    margin: 0;
    padding: 0;
}

#source-reader-modal .webgis-branches > li::before {
    content: '';
    position: absolute;
    top: calc(-1 * var(--branch-drop));
    left: 50%;
    height: var(--branch-drop);
    border-left: 1px solid var(--connector-colour);
}

#source-reader-modal .webgis-branches > li::after {
    content: '';
    position: absolute;
    top: -5px;
    left: calc(50% - 3.5px);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--connector-colour);
}

#source-reader-modal .webgis-subbranches {
    position: relative;
    display: grid;
    gap: var(--subbranch-gap);
    margin: 0;
    padding: var(--branch-drop) 0 0 var(--tree-indent);
    list-style: none;
}

#source-reader-modal .webgis-subbranches::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    height: calc(var(--branch-drop) / 2);
    border-left: 1px solid var(--connector-colour);
}

#source-reader-modal .webgis-subbranches::after {
    content: '';
    position: absolute;
    top: calc(var(--branch-drop) / 2);
    left: 0;
    right: 50%;
    border-top: 1px solid var(--connector-colour);
}

#source-reader-modal .webgis-subbranch::before {
    content: '';
    position: absolute;
    left: calc(-1 * var(--tree-indent));
    top: calc(-1 * var(--subbranch-gap));
    bottom: calc(-1 * var(--subbranch-gap));
    border-left: 1px solid var(--connector-colour);
}

#source-reader-modal .webgis-subbranch:first-child::before {
    top: calc(-1 * var(--branch-drop) / 2);
}

#source-reader-modal .webgis-subbranch:last-child::before {
    bottom: 50%;
}

#source-reader-modal .webgis-subbranch::after {
    content: '';
    position: absolute;
    top: calc(50% - 4px);
    left: calc(-1 * var(--tree-indent));
    width: var(--tree-indent);
    height: 8px;
    background: var(--tree-arrow) center / 100% 100% no-repeat;
}

#source-reader-modal .webgis-diagram figcaption {
    margin-top: 0.75rem;
    color: #666;
    font: 400 0.8125rem/1.6 var(--font-sans);
}

#source-reader-modal .webgis-table {
    margin: 1.25rem 0;
    border-collapse: collapse;
}

#source-reader-modal .webgis-table thead th {
    font: 500 0.8125rem/1.45 var(--font-sans);
    text-transform: none;
    letter-spacing: 0;
}

#source-reader-modal .webgis-table th:first-child {
    width: 30%;
}

#source-reader-modal .webgis-table td,
#source-reader-modal .webgis-table th[scope="row"] {
    font-size: 0.875rem;
    line-height: 1.6;
}

#source-reader-modal .webgis-table td small {
    display: block;
    margin-top: 0.375rem;
    color: #666;
    font: inherit;
    font-size: 0.8125rem;
}

#source-reader-modal #platform-data .webgis-table th {
    text-align: left;
}

#source-reader-modal #platform-data .webgis-dataset-table th:first-child {
    width: 44%;
}

#source-reader-modal #platform-data .webgis-dataset-table a {
    color: inherit;
}

#source-reader-modal #platform-data .webgis-dataset-table :is(th, td):nth-child(2) {
    width: 16%;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

#source-reader-modal #platform-data .webgis-dataset-table tfoot :is(th, td) {
    border-top: 1px solid #aaa;
    font-weight: 500;
}

#source-reader-modal #platform-data .source-part:first-of-type {
    margin-top: 0;
}

#source-reader-modal #platform-data :is(.webgis-dataset-table th small, .webgis-data-key small, .webgis-location-comparison small) {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font: 400 0.8125rem/1.5 var(--font-sans);
}

#source-reader-modal #platform-data .webgis-data-key {
    margin: 0.75rem 0 0;
    font: 400 0.875rem/1.5 var(--font-sans);
}

#source-reader-modal #platform-data .webgis-data-key > div {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: 1rem;
    padding: 0.5rem 0;
    border-top: 1px solid #e5e5e5;
}

#source-reader-modal #platform-data :is(.webgis-data-key dt, .webgis-location-comparison dt) {
    margin: 0;
    font-weight: 500;
}

#source-reader-modal #platform-data :is(.webgis-data-key dd, .webgis-location-comparison dd) {
    min-width: 0;
    margin: 0;
}

#source-reader-modal #platform-data .webgis-location-comparison {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin: 1rem 0 0;
    font: 400 0.875rem/1.5 var(--font-sans);
}

#source-reader-modal #platform-data .webgis-location-comparison > div {
    padding-left: 0.75rem;
    border-left: 1px solid #ccc;
}

#source-reader-modal #platform-data .webgis-location-comparison dd {
    margin-top: 0.375rem;
}

#source-reader-modal .webgis-cite {
    margin-left: 0.15em;
    font-size: 0.75em;
    line-height: 0;
    white-space: nowrap;
}

#source-reader-modal .webgis-cite a {
    text-decoration: none;
    overflow-wrap: normal;
}

#source-reader-modal .webgis-cite a:hover {
    text-decoration: underline;
}

#source-reader-modal .webgis-guide-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.125rem;
    margin-top: 1rem;
    font-size: 0.9375rem;
}

#source-reader-modal .webgis-reference-list {
    padding-left: 1.75rem;
    font-size: 0.875rem;
}

#source-reader-modal .webgis-reference-list li {
    padding: 0.875rem 0 0.875rem 0.25rem;
    border-top: 1px solid #dedede;
    scroll-margin-block: 1rem;
}

#source-reader-modal .webgis-reference-list li:first-child {
    border-top: 0;
}

#source-reader-modal .webgis-reference-list li::marker {
    color: #666;
    font-variant-numeric: tabular-nums;
}

#source-reader-modal .webgis-reference-list li:target {
    outline: 1px solid #aaa;
    outline-offset: 0.25rem;
}

@media (max-width: 700px) {
    #source-reader-modal .webgis-flow {
        grid-template-columns: 1fr;
        --flow-gap: 1.625rem;
    }
    #source-reader-modal .webgis-flow > li:not(:last-child)::before {
        top: 100%;
        left: 50%;
        width: 0;
        height: calc(var(--flow-gap) + 1px);
        border-top: 0;
        border-left: 1px solid var(--connector-colour);
    }
    #source-reader-modal .webgis-flow > li:not(:last-child)::after {
        top: calc(100% + var(--flow-gap) - 4px);
        left: calc(50% - 3.5px);
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 5px solid var(--connector-colour);
        border-bottom: 0;
    }
    #source-reader-modal .webgis-branch-origin {
        margin-bottom: 0;
    }
    #source-reader-modal .webgis-branch-origin::after {
        height: calc(var(--branch-drop) / 2 + 1px);
    }
    #source-reader-modal .webgis-branches {
        grid-template-columns: 1fr;
        padding-left: var(--tree-indent);
    }
    #source-reader-modal .webgis-branches::before {
        top: calc(var(--branch-drop) / 2);
        left: 0;
        right: 50%;
    }
    #source-reader-modal .webgis-branches > li::before {
        top: calc(-1 * var(--branch-gap));
        bottom: calc(-1 * var(--branch-gap));
        left: calc(-1 * var(--tree-indent));
        height: auto;
    }
    #source-reader-modal .webgis-branches > li:first-child::before {
        top: calc(-1 * var(--branch-drop) / 2);
    }
    #source-reader-modal .webgis-branches > li:last-child::before,
    #source-reader-modal .webgis-branches > li::after {
        display: none;
    }
    #source-reader-modal .webgis-branches > li > .webgis-node::before {
        content: '';
        position: absolute;
        left: calc(-1 * var(--tree-indent) - 1px);
        top: calc(-1 * var(--branch-gap) - 1px);
        height: calc(50% + var(--branch-gap) + 1px);
        border-left: 1px solid var(--connector-colour);
    }
    #source-reader-modal .webgis-branches > li:first-child > .webgis-node::before {
        top: calc(-1 * var(--branch-drop) / 2 - 1px);
        height: calc(50% + var(--branch-drop) / 2 + 1px);
    }
    #source-reader-modal .webgis-branches > li > .webgis-node::after {
        content: '';
        position: absolute;
        top: calc(50% - 4px);
        left: calc(-1 * var(--tree-indent) - 1px);
        width: calc(var(--tree-indent) + 1px);
        height: 8px;
        background: var(--tree-arrow) center / 100% 100% no-repeat;
    }
    #source-reader-modal .webgis-table th:first-child {
        width: 34%;
    }
    #source-reader-modal #platform-data .webgis-dataset-table :is(th, td) {
        padding-inline: 0.5rem;
    }
    #source-reader-modal #platform-data .webgis-dataset-table th:first-child {
        width: auto;
    }
    #source-reader-modal #platform-data .webgis-dataset-table :is(th, td):nth-child(2) {
        width: 4.5rem;
    }
    #source-reader-modal #platform-data .webgis-dataset-table :is(th, td):nth-child(3) {
        width: 6.5rem;
        white-space: nowrap;
    }
    #source-reader-modal #platform-data .webgis-data-key > div {
        grid-template-columns: 5.5rem minmax(0, 1fr);
        gap: 0.75rem;
    }
    #source-reader-modal #platform-data .webgis-location-comparison {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}
