/*!
 * Copyright 2023 The Go Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style
 * license that can be found in the LICENSE file.
 */

@import url("../shared/base.css");

html {
  scroll-padding-top: 4rem;
}

/* TODO(rfindley): refactor to share breadcrumb logic with telemetry.go.dev */
.ViewBreadcrumb {
  position: sticky;
  top: 0;
  z-index: 1000;
}

.ViewBreadcrumb ol {
  align-items: center;
  border-bottom: var(--border);
  display: inline-flex;
  gap: 1rem;
  list-style: none;
  margin-block-start: 0;
  margin-block-end: 0;
  padding-inline-start: 0;
  min-height: 3rem;
  width: calc(100% - 2rem);
  background-color: var(--color-background);
  padding: 0 1rem;
  font-size: 0.875rem;
  position: fixed;
  top: 0;
  transition: top 0.1s ease-in 0.1s;
}

.ViewBreadcrumb ol:empty {
  top: -3.0625rem;
}

.ViewBreadcrumb li:not(:last-child)::after {
  content: ">";
  margin-left: 1rem;
}

.ViewBreadcrumb li:last-child a {
  color: var(--color-text-subtle);
}

.Index {
  line-height: 1.5;
}

.Counters {
  border: var(--border);
  border-radius: 0.25rem;
  display: grid;
  gap: 1rem 2rem;
  margin-top: 1rem;
  overflow: auto;
  padding: 1rem;
  grid-template-areas:
    "meta count count"
    "stack stack stack"
    "summary summary summary";
  grid-auto-columns: 1fr 2fr 1fr;
}

.Meta {
  grid-area: meta;
  display: grid;
  grid-auto-rows: min-content;
  grid-template-columns: repeat(2, max-content);
  gap: 0.5rem;
}

.Stack {
  grid-area: stack;
  border-top: var(--border);
  padding-top: 1rem;
  gap: 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.Stack summary {
  display: block;
}

.Stack details .Count-entry:first-child::before {
  content: "⏵";
}

.Stack details[open] .Count-entry:first-child::before {
  content: "⏷";
}

.Count {
  grid-area: count;
  display: grid;
  flex-grow: 1;
  grid-auto-rows: min-content;
  grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
  gap: 0.5rem 1rem;
}

.Summary {
  border-top: var(--border);
  font-size: 0.875rem;
  grid-area: summary;
  line-height: 1.5;
  padding-top: 1rem;
}

.Meta .unknown,
.Count .unknown,
.Stack .unknown {
  color: var(--color-text-subtle);
}

.Count-entry {
  display: flex;
  gap: 0.25rem;
  justify-content: space-between;
}

.Count-entry > span:nth-child(odd) {
  overflow: hidden;
  white-space: nowrap;
}

.Count-entry:not(.unknown) > span:nth-child(even) {
  text-align: right;
  color: var(--color-code-comment);
}

.Count-entry > span:nth-child(odd)::after {
  content: " ----------------------------------------------------------------------------------------------- ";
  letter-spacing: 0.125rem;
}

h2::after {
  content: "⏷";
  padding-left: 0.5rem;
}

html[data-closed-sections*="index"] h2#index::after,
html[data-closed-sections*="config"] h2#config::after,
html[data-closed-sections*="files"] h2#files::after,
html[data-closed-sections*="charts"] h2#charts::after,
html[data-closed-sections*="reports"] h2#reports::after {
  content: "⏵";
}

html[data-closed-sections*="index"] h2#index ~ *,
html[data-closed-sections*="config"] h2#config ~ *,
html[data-closed-sections*="files"] h2#files ~ *,
html[data-closed-sections*="charts"] h2#charts ~ *,
html[data-closed-sections*="reports"] h2#reports ~ * {
  display: none;
}

div[data-chart-id] {
  min-height: 16rem;
}

/* Fix tooltip background for dark theme */
svg g[aria-label="tip"] g {
  fill: var(--color-background);
}
