.tf-figure:has(#tf-profile-content:not([hidden])) { overflow: clip; }

.tf-profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 16px;
}

.tf-profile-grid:has(.tf-profile-inspector:not([hidden])) {
    grid-template-columns: minmax(0, 1.4fr) minmax(340px, 1fr);
}

.tf-profile-plot, .tf-profile-inspector { min-width: 0; }
.tf-profile-legend { margin: 3px 0 12px; }

.tf-profile-guide {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px 15px;
    margin: 0 0 8px;
    padding-inline: 5px;
    color: var(--text-secondary);
    font: .75rem/1.4 var(--font-display);
}
.tf-profile-guide > :is(.tf-profile-guide-median, .tf-profile-guide-range) {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.tf-profile-guide > :is(.tf-profile-guide-median, .tf-profile-guide-range)::before {
    content: "";
    border-radius: 999px;
    background: #6684a2;
}
.tf-profile-guide-median::before { width: 7px; height: 7px; }
.tf-profile-guide-range::before { width: 15px; height: 3px; }
.tf-profile-line {
    display: grid;
    grid-template-columns: minmax(96px, 124px) minmax(0, 1fr) 86px;
    gap: 9px;
    align-items: center;
    padding-inline: 9px;
    border: 1px solid transparent;
}

.tf-profile-heading {
    position: sticky;
    top: 72px;
    z-index: 3;
    border-radius: 8px;
    background: var(--bg-card);
}

.tf-profile-head {
    min-height: 33px;
    padding-block: 6px;
    border-color: #dce7f2;
    border-radius: 8px 8px 0 0;
    background: #edf3f9;
    color: var(--text-secondary);
    font: 700 .77rem/1.15 var(--font-display);
}

.tf-profile-axis-title, .tf-profile-dataset-header { text-align: center; }
.tf-profile-axis {
    padding-block: 4px 5px;
    border-color: #dce7f2;
    border-top-color: transparent;
    border-radius: 0 0 8px 8px;
    background: #f8fafc;
}
.tf-profile-list { display: grid; gap: 3px; margin-top: 5px; }
.tf-profile-row {
    min-height: 45px;
    padding-block: 4px;
    border-radius: 6px;
    background: #eaf1f8;
}
.tf-profile-row:nth-child(even) { background: #c5d7e9; }
.tf-profile-row:is(:hover, :focus-within) { border-color: #a8c5e1; }
.tf-profile-row.is-selected {
    background: #b3d7ff;
    border-color: #689cce;
    box-shadow: inset 3px 0 var(--tf-blue);
}

.tf-profile-name {
    display: grid;
    align-self: stretch;
    align-content: center;
    justify-items: start;
    gap: 2px;
    min-width: 0;
    padding: 0 5px 0 2px;
    border: 0;
    background: transparent;
    color: var(--tf-deep);
    text-align: left;
    cursor: pointer;
    font: .86rem/1.2 var(--font-display);
}
.tf-profile-name > :is(strong, small) {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.tf-profile-name:hover strong { text-decoration: underline; }
.tf-profile-name small { color: var(--text-secondary); font: .7rem/1.2 var(--font-mono); }
.tf-profile-count {
    display: grid;
    align-self: stretch;
    place-items: center;
    white-space: nowrap;
    font: 700 .76rem/1 var(--font-mono);
}
.tf-profile-count-value {
    min-width: 48px;
    padding: 4px 7px;
    border-radius: 999px;
    background: #edf2f7;
    color: var(--tf-deep);
    text-align: center;
}
.tf-profile-row.is-selected .tf-profile-count-value { background: #dbeafb; }

.tf-profile-track {
    position: relative;
    min-height: 30px;
    min-width: 0;
    --tf-profile-gridline: #8ba8c438;
    background-image:
        linear-gradient(var(--tf-profile-gridline), var(--tf-profile-gridline)),
        linear-gradient(var(--tf-profile-gridline), var(--tf-profile-gridline)),
        linear-gradient(var(--tf-profile-gridline), var(--tf-profile-gridline));
    background-position: 25% center, center, 75% center;
    background-size: 1px 100%;
    background-repeat: no-repeat;
}
.tf-profile-baseline {
    position: absolute;
    inset-block: 0;
    width: 1px;
    background: #9bb3cb;
    pointer-events: none;
}
.tf-profile-interval {
    position: absolute;
    top: 15px;
    left: calc(var(--range-start) - 8px);
    z-index: 1;
    width: calc(var(--range-width) + 16px);
    height: 16px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    transform: translateY(-50%);
    cursor: pointer;
}
.tf-profile-range { position: absolute; inset: 0 8px; pointer-events: none; }
.tf-profile-interval.has-range .tf-profile-range::before {
    content: "";
    position: absolute;
    inset: 6px 0 auto;
    height: 4px;
    border-radius: 3px;
    background: var(--tissue-color);
    opacity: .6;
}
.tf-profile-range::after {
    content: "";
    position: absolute;
    top: 50%;
    left: var(--range-marker);
    width: 12px;
    height: 12px;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
    border: 1px solid #fff;
    border-radius: 50%;
    background: var(--tissue-color);
}
.tf-profile-interval:is(:hover, :focus-visible, [aria-pressed="true"]) { z-index: 2; }
.tf-profile-interval:is(:hover, [aria-pressed="true"]) .tf-profile-range::before { opacity: .9; }
.tf-profile-interval:is(:hover, [aria-pressed="true"]) .tf-profile-range::after {
    outline: 1px solid var(--tissue-color);
    outline-offset: 1px;
}
.tf-profile-unavailable {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    text-align: center;
    font: .73rem/1.1 var(--font-display);
}
.tf-profile-ticks {
    position: relative;
    min-height: 21px;
    color: var(--text-secondary);
    font: .69rem/1.2 var(--font-mono);
}
.tf-profile-ticks::before {
    position: absolute;
    inset: 2px 0 auto;
    height: 1px;
    background: #9fb5cb;
    content: "";
}
.tf-profile-ticks > span {
    position: absolute;
    inset-block-start: 2px;
    padding-top: 8px;
    transform: translateX(-50%);
    white-space: nowrap;
}
.tf-profile-ticks > span::before {
    position: absolute;
    top: 0;
    left: calc(50% - .5px);
    width: 1px;
    height: 5px;
    background: #9fb5cb;
    content: "";
}
.tf-profile-empty { padding: 14px 2px; }

.tf-profile-inspector {
    position: sticky;
    top: 72px;
    border: 1px solid var(--tf-rule);
    border-radius: 12px;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}
.tf-profile-inspector-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 13px 14px 15px;
}
.tf-profile-inspector-name {
    margin: 0;
    font: 740 1.25rem/1.2 var(--font-display);
    overflow-wrap: anywhere;
}
.tf-profile-title-link { color: var(--tf-blue); text-decoration: none; }
.tf-profile-title-link:is(:hover, :focus-visible) {
    text-decoration: underline;
    text-underline-offset: .14em;
}
.tf-profile-scope {
    min-width: 0;
    padding: 8px 9px;
    border: 1px solid var(--tf-rule);
    border-radius: 8px;
    background: var(--tf-wash);
    color: var(--text-secondary);
    font: .78rem/1.35 var(--font-display);
}
.tf-profile-scope-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 8px; }
.tf-profile-scope-head strong { color: var(--text-primary); }
.tf-profile-scope-head span { color: var(--tf-deep); font-weight: 650; white-space: nowrap; }
.tf-profile-scope-note { margin: 4px 0; }
.tf-profile-datasets {
    display: grid;
    gap: 2px;
    max-height: min(222px, 29dvh);
    overflow-y: auto;
    padding: 3px;
    margin: 0 -3px;
}
.tf-profile-dataset {
    display: grid;
    grid-template-columns: minmax(68px, 100px) minmax(0, 1fr) minmax(44px, auto);
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 5px 4px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    text-align: left;
    color: var(--text-primary);
    cursor: pointer;
    font: .72rem/1.2 var(--font-mono);
}
.tf-profile-dataset:is(:hover, [aria-pressed="true"]) { border-color: var(--tf-rule); background: #eaf3fd; }
.tf-profile-dataset strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--tf-deep); }
.tf-profile-number { text-align: right; }
.tf-profile-mini-track { position: relative; height: 7px; border-radius: 3px; background: var(--bg-secondary); }
.tf-profile-mini-bar { position: absolute; inset-block: 1px; border-radius: 2px; opacity: .7; }
.tf-profile-logo {
    min-width: 0;
    min-height: 66px;
    color: var(--text-secondary);
    font: .76rem/1.4 var(--font-display);
}

.tf-profile-logo .tf-logo-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
    gap: 8px 12px;
}

.tf-profile-logo .tf-logo-field { min-width: 0; }
.tf-profile-logo .tf-logo-scroll { overscroll-behavior-inline: contain; }
.tf-profile-logo .tf-logo-plot { max-height: 310px; }
.tf-profile-logo .tf-logo-inspection {
    justify-content: center;
    gap: 5px 10px;
    text-align: center;
}
.tf-profile-logo .tf-logo-bases { justify-content: center; gap: 4px 10px; }
.tf-profile-matrix { min-width: 0; }
.tf-profile-matrix-scroll { max-width: 100%; overscroll-behavior-inline: contain; }
.tf-profile-back { justify-self: start; }
.tf-profile-guide .tf-profile-logo-jump { margin-inline-start: auto; }

@media (min-width: 921px) {
    .tf-profile-inspector {
        max-block-size: calc(100dvh - 88px);
        overflow-y: auto;
        overscroll-behavior-y: contain;
    }

    .tf-profile-back, .tf-profile-logo-jump { display: none; }
}

@media (max-width: 920px) {
    .tf-profile-grid:has(.tf-profile-inspector:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
    .tf-profile-heading { position: static; }
    .tf-profile-inspector { position: static; scroll-margin-top: 90px; }
}
@media (max-width: 520px) {
    .tf-profile-line { grid-template-columns: 75px minmax(0, 1fr) 54px; gap: 6px; padding-inline: 5px; }
    .tf-profile-name { font-size: .78rem; }
    .tf-profile-name small { font-size: .62rem; }
    .tf-profile-count { font-size: .69rem; }
    .tf-profile-count-value { min-width: 0; }
    .tf-profile-ticks > span:nth-child(even) { display: none; }
    .tf-profile-track {
        background-image: linear-gradient(var(--tf-profile-gridline), var(--tf-profile-gridline));
        background-position: center;
    }
    .tf-profile-dataset { grid-template-columns: minmax(67px, 89px) minmax(0, 1fr) minmax(44px, auto); }
    .tf-profile-logo .tf-logo-inspection { display: grid; justify-content: stretch; }
    .tf-profile-logo .tf-logo-bases {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .tf-profile-logo .tf-logo-base { white-space: normal; overflow-wrap: anywhere; }
}
