/*
 * Study metadata pages: description tab (display templates) and the
 * geospatial feature catalogue tab.
 *
 * Moved out of inline <style> blocks in:
 *  - application/views/display_templates/index.php
 *  - application/views/display_templates/fields/field_*.php
 *  - application/views/survey_info/geospatial_*.php
 *  - application/views/survey_info/data_dictionary_layout.php,
 *    variables_by_file.php, variable_ddi.php
 *
 * Description rules are scoped to .display-template-page (the display
 * template container); feature catalogue rules to .geo-catalogue or geo-*
 * classes; data dictionary rules to .dd-catalogue, .variables-container or
 * .variable-container, so nothing leaks to other study tabs.
 *
 * Colors use the theme variables from _variables.css.
 */


/* ============================================================
   Description tab (display templates)
   ============================================================ */

.display-template-page h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: .35rem;
    margin-bottom: .5rem;
    padding-top: 1.25rem;
}

/* gap before a section heading ~2rem (was ~3rem); sections only add a small bottom pad */
.display-template-page .field-section-container {
    padding-bottom: .5rem !important;
}

/* field label: small bold uppercase in the body text color; size and case set it apart from the value */
.display-template-page .field-title {
    text-transform: uppercase;
    margin-top: 1.35rem;
    margin-bottom: .15rem;
    font-size: .75rem;
    letter-spacing: .03em;
    font-weight: 700 !important;
    color: var(--color-main);
}

.display-template-page h4.field-title {
    margin-top: 0;
}

.display-template-page .field-section-container .field-section-container h2 {
    font-size: 1.15rem;
    padding-top: 1rem;
}

/* Same gap between every field: spacing comes from the field title; renderers' own bottom margins are reset */
.display-template-page .field-section-container .field {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.display-template-page .field-stacked-record {
    margin-bottom: 0;
}

.display-template-page .field-value > ul:last-child,
.display-template-page .field-value > p:last-child {
    margin-bottom: 0;
}

.display-template-page .geog-contact + .geog-contact {
    margin-top: .5rem;
}

.display-template-page .badge-tags {
    font-size: 14px !important;
}

.display-template-page .field-array-nested table {
    width: auto;
    margin: 0;
    min-width: 8rem;
}

/* Tables: horizontal rules only, plain header */
.display-template-page .table-grid {
    width: 100%;
    border: 0;
    font-size: .875rem;
    margin-bottom: 0;
}

.display-template-page .table-grid th,
.display-template-page .table-grid td {
    border-left: 0;
    border-right: 0;
    border-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding: .4rem .6rem .4rem 0;
}

.display-template-page .table-grid tr:first-child th {
    background: #fff;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: .8125rem;
}

.display-template-page .table-grid tr,
.display-template-page .table-grid tr:nth-child(odd) td,
.display-template-page .table-grid tr:nth-child(even) td {
    background: transparent;
}

.display-template-page .field-array-nested .table-grid td,
.display-template-page .field-array-nested .table-grid th {
    padding: .2rem .4rem .2rem 0;
}

/* long tables: first rows, then a "Show all" button (extra rows carry the hidden attribute) */
.display-template-page .field-table-toggle {
    padding: 0;
    margin-top: .35rem;
    font-size: .875rem;
}

@media print {
    .display-template-page .field-table-collapsible .field-table-row-extra[hidden] {
        display: table-row !important;
    }

    .display-template-page .field-table-toggle {
        display: none !important;
    }
}

/* indented text in descriptions becomes a markdown code block: keep line breaks, drop the indent, wrap, body font */
.display-template-page .field-value pre,
.display-template-page .field-value pre code {
    white-space: pre-line;
    overflow-wrap: anywhere;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* Get Microdata tab: headings in step with the study description; terms at body size */
.get-microdata-page h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: .75rem;
}

.get-microdata-page h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: .5rem;
}

.get-microdata-page h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.get-microdata-page .access-terms {
    margin-bottom: 1rem;
}

.get-microdata-page .access-terms ul,
.get-microdata-page .access-terms ol {
    padding-left: 1.25rem;
}

.get-microdata-page .access-terms li {
    margin-bottom: .4rem;
}

/* single-column tables rendered as a list */
.display-template-page .field-value-list {
    padding-left: 1.1rem;
    margin-bottom: 0;
}

/* long text: first lines with a "Show more" toggle */
.display-template-page .field-clamp-body {
    max-height: 22rem;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent);
    mask-image: linear-gradient(to bottom, #000 75%, transparent);
}

.display-template-page .field-clamp-open .field-clamp-body {
    max-height: none !important;
    -webkit-mask-image: none;
    mask-image: none;
}

.display-template-page .field-clamp-toggle {
    padding: 0;
    font-size: .875rem;
}

.display-template-page .field-clamp-less,
.display-template-page .field-clamp-open .field-clamp-more {
    display: none;
}

.display-template-page .field-clamp-open .field-clamp-less {
    display: inline;
}

/* phone: section dropdown instead of the link list */
.display-template-page .metadata-section-select {
    margin: .75rem 0 .25rem;
}

/* Section menu (scrollspy) */
.display-template-page .metadata-sidebar-container {
    top: 1rem;
    padding-top: 20px;
}

.display-template-page .metadata-sidebar-container .nav-link {
    padding: .3rem .75rem;
    border-left: 2px solid transparent;
}

.display-template-page .metadata-sidebar-container .nav-link.active {
    border-left-color: var(--action-color);
    background: var(--wbg-lightbluegray);
    font-weight: 600;
}


/* --- field_feature_catalog --- */

.feature-catalog-container .feature-row {
    position: relative;
    color: var(--action-color);
}

.feature-catalog-container .feature-row:hover {
    background: var(--wbg-lightbluegray);
}

.feature-catalog-container .icon-toggle {
    position: absolute;
    right: 20px;
    top: 8px;
    font-size: 20px;
}

.feature-catalog-container .collapsed .up_arrow,
.feature-catalog-container .show_feature .down_arrow {
    display: none;
}

.feature-catalog-container .show_feature {
    background: #ced4da;
}

.feature-catalog-container .collapsed,
.feature-catalog-container .show_feature {
    cursor: pointer;
}

.feature-catalog-container .text-truncate {
    margin-right: 30px;
}


/* --- field_scripts_script --- */

.scripts-section .btn-xs {
    font-size: small;
}

.scripts-section [data-toggle="collapse"] i:before {
    content: "\f139";
}

.scripts-section [data-toggle="collapse"].collapsed i:before {
    content: "\f13a";
}


/* --- field_photo_gallery --- */

.resource-photo .carousel-container {
    border: 1px solid gainsboro;
    padding: 5px;
}

.resource-photo .carousel-inner {
    max-height: 300px;
    overflow: hidden !important;
    height: 300px;
}

.resource-photo .carousel-img {
    max-height: 300px;
    width: auto;
    margin: auto;
}

.resource-photo .carousel-indicators {
    bottom: -5px;
}

.resource-photo .icon-wrap {
    background: #545b62;
    padding: 10px;
    padding-bottom: 5px;
    border: 1px solid white;
}

.resource-photo .gallery-indicators li {
    height: 11px;
    border: 1px solid #ced4da;
    background-color: #6c757d;
}

.resource-photo .carousel-indicators .active {
    background-color: #f8f9fa;
}


/* ============================================================
   Geospatial feature catalogue tab
   ============================================================ */

/* --- Layout: sidebar + body (geospatial_catalogue_layout, data_dictionary_layout) --- */

.geo-catalogue .var-info-panel,
.dd-catalogue .var-info-panel {
    display: none;
}

.geo-catalogue .table-variable-list td,
.dd-catalogue .table-variable-list td {
    cursor: pointer;
}

.geo-catalogue .table-variable-list .var-breadcrumb,
.dd-catalogue .table-variable-list .var-breadcrumb {
    display: none;
}

.geo-catalogue .var-id,
.dd-catalogue .var-id {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}

.geo-catalogue .nada-list-group-item,
.dd-catalogue .nada-list-group-item {
    position: relative;
    display: block;
    padding: 5px 10px 5px 5px;
    margin-bottom: -1px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-left: 0;
    border-right: 0;
    font-size: small;
    word-wrap: break-word;
}

.geo-catalogue .nada-list-group-title,
.dd-catalogue .nada-list-group-title {
    font-weight: bold;
    border-top: 0;
}

.geo-catalogue .sidebar-files .nada-list-group-item a,
.dd-catalogue .sidebar-files .nada-list-group-item a {
    display: block;
    word-break: break-word;
    overflow-wrap: break-word;
}

.geo-catalogue .sidebar-files .nada-list-group-item.active,
.dd-catalogue .sidebar-files .nada-list-group-item.active {
    background: var(--wbg-lightbluegray);
    border-left: 3px solid var(--action-color);
    padding-left: 8px;
}

.geo-catalogue .sidebar-files .nada-list-group-item.active a,
.dd-catalogue .sidebar-files .nada-list-group-item.active a {
    color: var(--color-main);
    font-weight: 600;
}

/* variable groups tree (data_dictionary_layout) */
.dd-catalogue .nada-list-vgroup {
    padding-inline-start: 0;
    font-size: small;
    list-style-type: none;
}

.dd-catalogue .nada-list-subgroup {
    padding-left: 10px;
}

.dd-catalogue .nada-list-subgroup .nada-list-vgroup-item {
    padding-left: 24px;
    position: relative;
    list-style: none;
}

.dd-catalogue .nada-list-subgroup .nada-list-vgroup-item:before {
    position: absolute;
    font-family: 'FontAwesome';
    top: 0;
    left: 10px;
    content: "\f105";
}

@media (max-width: 767.98px) {
    /* stacked: sidebar above content */
    .geo-catalogue .sidebar-files,
    .dd-catalogue .sidebar-files {
        margin-bottom: 1.25rem;
    }

    .geo-catalogue .body-files.wb-border-left,
    .dd-catalogue .body-files.wb-border-left {
        border-left: 0;
    }

    .geo-catalogue .sidebar-files .nada-list-group,
    .dd-catalogue .sidebar-files .nada-list-group {
        max-height: 12rem;
        overflow-y: auto;
    }
}

/* --- Feature types list (geospatial_feature_types) --- */

.geo-catalogue .table-data-files td {
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

/* --- Shared bits --- */

.geo-muted {
    color: var(--color-label);
}

.geo-type {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .75rem;
    font-weight: normal;
    color: #495057;
    background: #f1f3f5;
    border: 1px solid #e2e6ea;
    border-radius: 3px;
    padding: 1px 6px;
    white-space: nowrap;
}

.geo-count {
    font-size: .8rem;
    color: var(--color-label);
    white-space: nowrap;
}

.geo-dl {
    margin: 1rem 0 0;
}

.geo-dl > dt,
.geo-dl > dd {
    padding-left: 0;
}

.geo-dl dt {
    font-weight: 600;
}

.geo-dl dd {
    margin-bottom: .35rem;
}

/* --- Feature type page (geospatial_feature_type) --- */

.geo-ft-header h3 {
    margin-bottom: .25rem;
}

.geo-ft-header .geo-ft-desc {
    margin: .5rem 0 0;
}

.geo-attr-list .var-row .geo-attr-meta {
    text-align: right;
}

.geo-attr-list .var-row .geo-attr-meta > * {
    margin-left: .5rem;
}

.pnl-active .geo-muted,
.pnl-active .geo-count {
    color: inherit;
    opacity: .85;
}

@media (max-width: 575.98px) {
    /* phone: name on its own line, label and value info below */
    .geo-attr-list .var-row > .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .geo-attr-list .var-row .geo-attr-meta {
        text-align: left;
    }

    .geo-attr-list .var-row .geo-attr-meta > *:first-child {
        margin-left: 0;
    }
}

/* --- Attribute view (geospatial_features) --- */

.geo-attr h3 {
    margin-bottom: .1rem;
}

.geo-attr .geo-attr-in {
    font-size: .9rem;
    margin-bottom: 1rem;
}

/* --- Listed values (geospatial_listed_values) --- */

.geo-lv {
    margin-top: 1rem;
}

.geo-lv-title {
    font-weight: 600;
    margin-bottom: .35rem;
}

.geo-lv table {
    margin-bottom: 0;
}

.geo-lv thead th {
    border-top: 0;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.geo-lv td,
.geo-lv th {
    padding: .3rem .5rem;
}

.geo-lv .geo-lv-code {
    width: 1%;
    white-space: nowrap;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .85rem;
}

.geo-lv-codes {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 4 160px;
    column-gap: 1.5rem;
}

.geo-lv-codes li {
    break-inside: avoid;
    padding: .2rem 0;
    border-bottom: 1px solid #f1f3f5;
}

.geo-lv .geo-lv-extra {
    display: none;
}

.geo-lv.geo-lv-expanded .geo-lv-extra {
    display: revert;
}

.geo-lv .geo-lv-less {
    display: none;
}

.geo-lv.geo-lv-expanded .geo-lv-more {
    display: none;
}

.geo-lv.geo-lv-expanded .geo-lv-less {
    display: inline;
}

.geo-lv-toggle {
    padding: 0;
    margin-top: .35rem;
    font-size: .875rem;
}


/* ============================================================
   Data dictionary: variable list and variable detail
   ============================================================ */

/* --- Data file header (variables_by_file) --- */

.dd-file-header {
    margin-bottom: 1.5rem;
}

.dd-file-label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--color-label);
}

.dd-file-name {
    margin: 0 0 .25rem;
}

.dd-file-desc {
    margin: 0 0 .5rem;
}

.dd-file-info {
    display: flex;
    flex-wrap: wrap;
    margin: .5rem 0 0;
}

.dd-file-info > div {
    margin-right: 2rem;
}

.dd-file-info dt {
    font-weight: normal;
    font-size: .8rem;
    color: var(--color-label);
}

.dd-file-info dd {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.dd-file-notes {
    margin-top: .75rem;
}

/* --- Variable list rows (variables_by_file) --- */

.dd-catalogue .variables-container .var-row {
    padding: 2px 40px 2px 0;
}

.dd-catalogue .variables-container .var-row > [class*="col"] {
    padding-top: .3rem;
    padding-bottom: .3rem;
}

.dd-catalogue .variables-container .var-id {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .875rem;
}

.dd-catalogue .variables-container .var-label {
    color: var(--color-main);
}

.dd-catalogue .variables-container .icon-toggle {
    top: 50%;
    transform: translateY(-50%);
    right: 14px;
    font-size: 18px;
    line-height: 1;
}

.dd-catalogue .variables-container .var-row:hover a {
    color: var(--action-color);
}

/* --- Active row + expanded panel (both catalogues) --- */

.variables-container .var-row.pnl-active {
    background: var(--wbg-lightblue);
    box-shadow: inset 3px 0 0 var(--action-color);
    font-weight: normal;
    border-bottom: 0;
}

.variables-container .var-row.pnl-active a {
    color: var(--action-color);
    font-weight: 600;
}

.variables-container .var-row.pnl-active .var-label {
    font-weight: 600;
}

.variables-container .table-variable-list .var-info-panel {
    background: var(--wbg-lightbluegray);
    box-shadow: inset 3px 0 0 var(--action-color);
    border-bottom: 1px solid var(--border-color);
}

.dd-catalogue .var-info-panel .panel-td {
    width: 100%;
    padding: 1rem 1rem 1rem 1.25rem;
}

/* --- Variable detail (variable_ddi) --- */

.variable-container .fld-inline .fld-name {
    color: var(--color-label);
}

.variable-container .xsl-subtitle {
    margin-top: 1.25rem;
}

.variable-in-panel > .xsl-subtitle:first-child {
    margin-top: 0;
}

.variable-container .var-overview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
    gap: .5rem 1.5rem;
    margin: .5rem 0 1rem;
}

.variable-container .var-overview .sum-stat {
    font-size: .9rem;
}

.variable-container .var-overview dt {
    font-weight: normal;
    font-size: .8rem;
}

.variable-container .var-overview dd {
    margin: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.variable-container .bar-container {
    min-width: 150px;
}

/* categories (metadata_templates/fields/field_var_category) */

.variable-container .var-cat-table {
    background: #fff;
    margin-bottom: 0;
    font-size: .875rem;
    border: 1px solid var(--border-color);
}

.variable-container .var-cat-table td,
.variable-container .var-cat-table th {
    padding: .3rem .6rem;
    vertical-align: middle;
}

.variable-container .var-cat-table .var-cat-value {
    width: 1%;
    white-space: nowrap;
    padding-right: 1.5rem;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .85rem;
}

.variable-container .var-cat-table th.var-cat-value {
    font-family: inherit;
    font-size: .8125rem;
}

/* long category lists scroll inside a fixed height; header stays visible */
.var-cat-scroll {
    max-height: 26rem;
    overflow-y: auto;
    border-bottom: 1px solid var(--border-color);
}

.var-cat-scroll .var-cat-head th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
    box-shadow: inset 0 -1px 0 var(--border-color);
}

.var-cat-scroll .var-cat-table {
    border-collapse: separate;
    border-spacing: 0;
}

.var-cat-scroll .var-cat-table td,
.var-cat-scroll .var-cat-table th {
    border-top: 0;
    border-bottom: 1px solid var(--border-color);
}

/* counts and percent bars */
.variable-container .var-cat-table .var-cat-num {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
    padding-left: 1.5rem;
}

.variable-container .var-cat-table .var-cat-pct {
    width: 12rem;
    min-width: 9rem;
    padding-left: 1.5rem;
}

.variable-container .var-cat-pct-wrap {
    display: flex;
    align-items: center;
}

.variable-container .var-cat-bar {
    flex: 1 1 auto;
    height: 8px;
    border-radius: 4px;
    background: #e9ecef;
    overflow: hidden;
}

.variable-container .var-cat-bar > span {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: 4px;
    background: var(--action-color);
}

.variable-container .var-cat-pct-text {
    flex: 0 0 3.5rem;
    text-align: right;
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
    color: var(--color-label);
}

.variable-container .xsl-warning.var-cat-note {
    margin: .5rem 0 0;
    font-size: .8rem;
    color: var(--color-label);
}

/* readability: darker secondary text inside variable details (labels, captions, percents, note) */
.variable-container {
    --color-label: hsl(0, 0%, 33%);
}

.var-info-panel .variable-container .xsl-caption {
    color: var(--color-label);
}

.variable-container .var-cat-table th {
    font-size: .8125rem;
}

.variable-container .var-cat-table td,
.variable-container .var-cat-table th {
    padding-top: .35rem;
    padding-bottom: .35rem;
}

/* table sits on the tinted panel: white rows with a faint stripe */
.variable-container .var-cat-table tr:nth-child(odd) td {
    background: #fafbfc;
}

.variable-container .var-cat-table tr:nth-child(even) td {
    background: #fff;
}

/* tags grouped by a column, e.g. topics by vocabulary (field_array_tags) */
.display-template-page .tag-group {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: .35rem;
}

.display-template-page .tag-group-label {
    flex: 0 0 auto;
    min-width: 6rem;
    margin-right: .75rem;
    font-size: .8125rem;
    font-weight: 600;
    color: hsl(0, 0%, 36%);
}

.display-template-page .tag-group-tags {
    flex: 1 1 0;
    min-width: 12rem;
}

.display-template-page .field-tags .badge-tags {
    margin: 0 .25rem .3rem 0;
    white-space: normal;
    text-align: left;
}

.display-template-page .field-tags .badge-tags a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--border-color);
}

/* rich text cells (e.g. Role) arrive as <p>: keep the cell's font size, no paragraph gap */
.display-template-page .table-grid td p,
.display-template-page .table-grid td ul,
.display-template-page .table-grid td ol,
.display-template-page .table-grid td li {
    font-size: inherit;
    line-height: inherit;
}

.display-template-page .table-grid td p:last-child,
.display-template-page .table-grid td ul:last-child,
.display-template-page .table-grid td ol:last-child {
    margin-bottom: 0;
}

/* no row stripes: beat bootstrap's .table-striped tbody tr:nth-of-type(odd) */
.display-template-page .table-grid.table-striped tbody tr:nth-of-type(odd),
.display-template-page .table-grid.table-striped tbody tr:nth-of-type(even) {
    background-color: transparent;
}


/* ============================================================
   Study page shell and header panel (survey_info/layout.php, info.php)
   Moved from inline <style> blocks.
   ============================================================ */

.study-metadata-page .metadata-sidebar-container .nav .active {
    background: #e9ecef;
}

/* --- study page tabs (survey_info/study_tabs.php): underline style --- */

.study-metadata-page .study-tabs-nav {
    position: relative;
    margin-top: 1.5rem;
}

.study-metadata-page .page-header .study-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    border-bottom: 0;
}

.study-metadata-page .page-header .study-tabs::-webkit-scrollbar {
    display: none;
}

.study-metadata-page .page-header .study-tabs .nav-item,
.study-metadata-page .page-header .study-tabs .nav-item.active {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    font-weight: normal;
}

.study-metadata-page .page-header .study-tabs .nav-link {
    padding: .6rem 1rem;
    margin-bottom: 0;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: hsl(0, 0%, 33%);
    font-size: .9375rem;
    font-weight: 500;
    white-space: nowrap;
}

.study-metadata-page .page-header .study-tabs .nav-link:hover,
.study-metadata-page .page-header .study-tabs .nav-link:focus {
    color: var(--color-main);
    border-bottom-color: #d0d5da;
    text-decoration: none;
}

.study-metadata-page .page-header .study-tabs .nav-link.active {
    color: var(--action-color);
    font-weight: 600;
    border-bottom-color: var(--action-color);
    background: transparent;
}

.study-metadata-page .page-header .study-tabs .get-microdata {
    margin-right: .15rem;
}

/* phone: fade at the right edge while more tabs are scrolled out of view */
.study-metadata-page .study-tabs-nav::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 3px;
    width: 2.5rem;
    pointer-events: none;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff);
    opacity: 0;
    transition: opacity .15s;
}

.study-metadata-page .study-tabs-nav.has-more::after {
    opacity: 1;
}

.study-metadata-page .study-subtitle {
    font-size: .7em;
    margin-bottom: 10px;
}

.study-metadata-page .badge-outline {
    background: transparent;
    color: #03a9f4;
    border: 1px solid #9e9e9e;
}

.study-metadata-page .get-microdata-btn {
    font-size: 14px;
}

.study-metadata-page .study-header-right-bar {
    font-size: 14px;
    color: gray;
}

.study-metadata-page .study-header-right-bar span {
    display: block;
    margin-bottom: 15px;
}

.study-metadata-page .study-header-right-bar .stat {
    margin-bottom: 10px;
    font-size: small;
}

.study-metadata-page .study-header-right-bar .stat .stat-label {
    font-weight: bold;
    text-transform: uppercase;
}

.study-metadata-page .field-metadata__table_description__ref_country .field-value,
.study-metadata-page .field-metadata__study_desc__study_info__nation .field-value {
    max-height: 350px;
    overflow: auto;
}

/* --- header info rows: label | value --- */

.study-info .study-info-content {
    font-size: 14px;
    margin-top: 1.25rem;
    padding-right: 2rem;
}

.study-info .study-info-row {
    display: flex;
    align-items: baseline;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.study-info .study-info-label {
    flex: 0 0 9rem;
    max-width: 9rem;
    padding-right: 1rem;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--color-main);
}

.study-info .study-info-value {
    flex: 1 1 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.study-info .study-copy-btn {
    padding: 0 .25rem;
    margin-left: .25rem;
    font-size: .8rem;
    line-height: 1;
    color: var(--color-label);
    vertical-align: baseline;
}

.study-info .study-copy-btn:hover,
.study-info .study-copy-btn:focus {
    color: var(--action-color);
}

/* collections: navigation links, shown as plain tags */
.study-info .study-collection {
    display: inline-block;
    margin: 0 .35rem .25rem 0;
    padding: .1rem .55rem;
    border-radius: 1rem;
    background: var(--wbg-lightbluegray);
    color: var(--action-color);
    font-size: .8125rem;
}

.study-info .study-collection:hover {
    background: var(--wbg-lightblue);
    text-decoration: none;
}

/* downloads: one button style, icon per file type */
.study-info .study-dl-btn {
    display: inline-block;
    margin: 0 .35rem .25rem 0;
    padding: .15rem .6rem;
    border: 1px solid var(--action-color);
    border-radius: var(--border-radius);
    color: var(--action-color);
    font-size: .8125rem;
    white-space: nowrap;
}

.study-info .study-dl-btn:hover {
    background: var(--action-color);
    color: #fff;
    text-decoration: none;
}

.study-info .study-dl-btn i {
    margin-right: .2rem;
}

@media (max-width: 767.98px) {
    /* phone: thumbnail column is hidden (d-none d-md-block in info.php) */

    .study-info .study-info-content {
        padding-right: 0;
    }

    /* phone: label above value */
    .study-info .study-info-row {
        display: block;
    }

    .study-info .study-info-label {
        max-width: none;
        margin-bottom: .15rem;
    }
}

/* created / updated / views / downloads: icon items under the title */
.study-info .study-stats {
    clear: both;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1.25rem;
    padding-top: .5rem;
    font-size: .8125rem;
    color: var(--color-label);
}

.study-info .study-stats-sep {
    display: none;
}

.study-info .study-stats .stat {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    white-space: nowrap;
    cursor: default;
}

.study-info .study-stats .stat i {
    color: var(--action-color);
}

.study-info .study-stats .stat-value {
    color: var(--color-main);
}

/* country/years line + action button: wrap without leftover indent */
.study-info .study-title-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem 1rem;
}

.study-info .study-title-meta::after {
    display: none;
}

.study-info .study-title-meta > * {
    float: none !important;
    margin-left: 0 !important;
}

.study-info .study-title-meta .sub-title {
    margin-bottom: 0;
}

@media (max-width: 767.98px) {
    .study-info .study-stats {
        gap: .25rem 1rem;
    }

    .study-info .study-info-content {
        margin-top: 1rem;
    }
}

/* study title: 28px desktop, 24px phone (subtitle scales with it at .7em) */
.study-info #dataset-title {
    font-size: 1.75rem;
    line-height: 1.2;
}

@media (max-width: 767.98px) {
    .study-info #dataset-title {
        font-size: 1.5rem;
        line-height: 1.25;
    }

    /* keep section headings below the title size on phones */
    .display-template-page h2 {
        font-size: 1.3rem;
    }
}


/* ============================================================
   Study page surfaces: grey page, white header band, white content panel.
   Same tokens as the catalog search page (catalog-vue-chrome.css), which
   the classic layout does not load, so they are repeated here.
   ============================================================ */

body:has(.study-metadata-page) {
    --study-page-bg: #f2f4f7;
    --study-border: #d0d5dd;
    --study-border-subtle: #e3e7ec;
    --study-text: #1a2332;
    --study-text-secondary: #2f3a4a;
    --study-link: #1565c0;
    --study-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    background: var(--study-page-bg);
    color: var(--study-text);
}

body:has(.study-metadata-page) .site-header {
    background: #fff;
}

/* One panel: title block on top, tab strip, then the tab content, joined with no gap */
.study-metadata-page .page-header {
    background: transparent;
    border-bottom: 0;
    margin: 0;
    padding: 0;
}

.study-metadata-page .page-header > .container {
    background: #fff;
    border: 1px solid var(--study-border);
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    padding: 1.25rem 1.5rem 0;
}

.study-metadata-page .study-metadata-body-content {
    margin-top: 0;
    margin-bottom: 2rem;
    background: #fff;
    border: 1px solid var(--study-border);
    border-top: 0;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 2px 4px rgba(15, 23, 42, .05);
    padding: 1.5rem 1.5rem 1.5rem;
}

.study-metadata-page #tabs.study-metadata {
    background: transparent;
    border: 0;
    padding: 0;
}

/* tab bar: white, a divider below, active tab underlined in blue */
.study-metadata-page .study-tabs-nav {
    margin: 1.25rem -1.5rem 0;
    padding: 0 1rem;
    border-top: 0;
    border-bottom: 1px solid var(--study-border);
    background: #fff;
}

/* last info row: no divider right above the tab bar */
.study-metadata-page .study-info .study-info-row:last-child {
    border-bottom: 0;
}

.study-metadata-page .page-header .study-tabs .nav-link {
    padding: .8rem 1rem calc(.8rem - 3px);
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--study-text-secondary);
    font-size: .9375rem;
    font-weight: 500;
}

.study-metadata-page .page-header .study-tabs .nav-link:hover,
.study-metadata-page .page-header .study-tabs .nav-link:focus {
    color: var(--study-link);
    background: transparent;
    border-bottom-color: var(--study-border);
}

.study-metadata-page .page-header .study-tabs .nav-link.active,
.study-metadata-page .page-header .study-tabs .nav-link.active:hover,
.study-metadata-page .page-header .study-tabs .nav-link.active:focus {
    color: var(--study-link);
    font-weight: 600;
    background: transparent;
    border-bottom-color: var(--study-link);
}

.study-metadata-page .page-header .study-tabs .nav-link:focus-visible {
    outline: 2px solid var(--study-link);
    outline-offset: -2px;
}

.study-metadata-page .study-tabs-nav::after {
    bottom: 0;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff);
}

/* description tab: section menu gets a divider from the text */
@media (min-width: 768px) {
    .study-metadata-page .display-template-page > .row > .col-md-3 {
        border-right: 1px solid var(--study-border-subtle);
    }
    .study-metadata-page .display-template-page > .row > .col-md-9 {
        padding-left: 1.75rem;
    }
}

.study-metadata-page .display-template-page .metadata-sidebar-container {
    padding-top: .5rem;
}

.study-metadata-page .display-template-page .metadata-sidebar-container .nav-link {
    color: var(--study-text-secondary);
    border-radius: 0 6px 6px 0;
}

.study-metadata-page .display-template-page .metadata-sidebar-container .nav-link:hover {
    color: var(--study-link);
    background: #f6f8fa;
}

.study-metadata-page .display-template-page .metadata-sidebar-container .nav-link.active {
    color: var(--study-link);
    border-left-color: var(--study-link);
    background: #e8f0fb;
}

.study-metadata-page .display-template-page h2 {
    color: var(--study-text);
    border-bottom-color: var(--study-border-subtle);
}

.study-metadata-page .display-template-page .field-title {
    color: var(--study-text-secondary);
}

@media (max-width: 767.98px) {
    .study-metadata-page .page-header > .container,
    .study-metadata-page .study-metadata-body-content {
        width: auto;
        margin-left: 8px;
        margin-right: 8px;
    }
    .study-metadata-page .page-header > .container {
        padding: 1rem 1rem 0;
    }
    .study-metadata-page .study-metadata-body-content {
        padding: 1rem;
    }
    .study-metadata-page .study-tabs-nav {
        margin: 1rem -1rem 0;
        padding: 0 .25rem;
    }
    .study-metadata-page .page-header .study-tabs .nav-link {
        padding: .7rem .8rem calc(.7rem - 3px);
    }
}

