/* Blog: bilingual text, the post list and the "family tree" explorer. Uses the site's colour variables, so the dark theme applies. */
html[data-lang="vi"] .t-en,
html:not([data-lang="vi"]) .t-vi {
  display: none !important;
}

.lang-switch {
  display: inline-flex;
  gap: 6px;
}

/* post list */
.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.blog-entry {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 27px;
  margin-bottom: 34px;
}
.blog-cover {
  display: block;
  align-self: start;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  aspect-ratio: 1200 / 630;
}
.blog-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.blog-entry h2 {
  margin-bottom: 6px;
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.35;
}
.blog-entry h2 a {
  color: var(--heading);
}
.blog-entry h2 a:hover {
  color: var(--accent);
}
.blog-entry p {
  margin-bottom: 10px;
}
.blog-entry .research-tags {
  margin-top: 0;
}
html[data-theme="dark"] .blog-cover .cover-light,
html:not([data-theme="dark"]) .blog-cover .cover-dark {
  display: none;
}

/* post */
.post-heading h1 {
  max-width: 24ch;
}
.post-heading .page-intro {
  font-size: 1rem;
}
.post-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  padding-top: 14px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.post-body > section {
  margin-bottom: 56px;
}
.post-body h2 {
  margin-bottom: 14px;
  font-size: 1.75rem;
}
.post-prose {
  max-width: 760px;
}
.post-prose p,
.post-prose li {
  font-size: 1rem;
}
.post-prose li + li {
  margin-top: 6px;
}
.post-note {
  max-width: 760px;
  margin-top: 26px;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
  font-size: 0.9rem;
}
.ft-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 28px;
}
.ft-stats div {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.ft-stats dt {
  color: var(--heading);
  font-size: 1.75rem;
  white-space: nowrap;
  font-weight: 300;
  line-height: 1.15;
}
.ft-stats dd {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* explorer */
.ft-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 14px;
}
.ft-controls .search-field {
  position: relative;
  flex: 1 1 320px;
}
.ft-count {
  color: var(--muted);
  font-size: 0.85rem;
}
.ft-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ft-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.85fr) 1.6fr;
  gap: 18px;
  align-items: start;
}
.ft-tree,
.ft-panel,
.ft-chart {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}
.ft-tree {
  max-height: 720px;
  overflow: auto;
  padding: 8px 6px;
}
.ft-tree ul {
  margin: 0;
  padding: 0 0 0 14px;
  list-style: none;
}
.ft-tree > ul {
  padding-left: 0;
}
.ft-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}
.ft-row:hover {
  background: var(--surface-soft);
}
.ft-row[aria-current="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 400;
}
.ft-caret {
  flex: none;
  width: 14px;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}
.ft-dot {
  display: inline-block;
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.ft-name {
  flex: 1;
  min-width: 0;
}
.ft-n {
  flex: none;
  min-width: 24px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}
.ft-row.is-leaf {
  font-size: 0.84rem;
}
.ft-y {
  color: var(--muted);
  font-size: 0.75rem;
}
.ft-row.is-empty {
  opacity: 0.45;
}
.ft-panel {
  min-height: 420px;
  padding: 20px 22px;
}
.ft-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}
.ft-crumbs button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
.ft-panel h3 {
  margin-bottom: 6px;
  font-size: 1.45rem;
  font-weight: 300;
}
.ft-desc {
  margin-bottom: 8px;
  font-size: 0.94rem;
}
.ft-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
}
.ft-metrics b {
  color: var(--heading);
  font-weight: 500;
}
.ft-spark {
  display: block;
  width: 100%;
  height: 70px;
  margin: 4px 0 12px;
}
.ft-spark rect {
  fill: var(--accent);
}
.ft-spark text {
  fill: var(--muted);
  font-size: 11px;
}
.ft-children {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 16px;
}
.ft-children .filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ft-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}
.ft-list li {
  border-bottom: 1px solid var(--border);
}
.ft-item {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  width: 100%;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}
.ft-item:hover {
  background: var(--surface-soft);
}
.ft-item .yr {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ft-item strong {
  color: var(--heading);
  font-weight: 400;
}
.ft-item small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.78rem;
}
.ft-more {
  margin-top: 12px;
}
.ft-cite {
  padding: 10px 14px;
  border-radius: 4px;
  background: var(--surface-soft);
  font-size: 0.88rem;
}
.ft-src {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0 12px;
}
.ft-panel mark,
.ft-tree mark {
  padding: 0 2px;
  border-radius: 2px;
  background: rgba(230, 159, 0, 0.35);
  color: inherit;
}

/* charts */
.ft-chart {
  overflow-x: auto;
  padding: 14px 10px 8px;
}
.ft-chart svg {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
}
.ft-chart text {
  fill: var(--muted);
  font-size: 12px;
}
.ft-chart .lab {
  fill: var(--heading);
}
.ft-chart .grid {
  stroke: var(--border);
  stroke-width: 1;
}
.ft-chart circle {
  stroke: var(--surface);
  stroke-width: 1.5;
  cursor: pointer;
}
.ft-chart circle.dim {
  opacity: 0.18;
}
.ft-chart rect.bar {
  stroke: var(--surface);
  stroke-width: 1;
  cursor: pointer;
}
.ft-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 10px 4px 2px;
  font-size: 0.84rem;
}
.ft-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ft-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}
.ft-tip {
  position: fixed;
  z-index: 90;
  max-width: 340px;
  padding: 7px 10px;
  border-radius: 4px;
  background: var(--footer-bg);
  color: var(--footer-text);
  font-size: 0.82rem;
  pointer-events: none;
}
.ft-matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 0.84rem;
}
.ft-matrix th {
  padding: 6px;
  color: var(--heading);
  font-weight: 400;
  text-align: left;
}
.ft-matrix thead th {
  vertical-align: bottom;
  text-align: center;
}
.ft-matrix td {
  padding: 0;
}
.ft-matrix td button {
  position: relative;
  width: 100%;
  min-width: 54px;
  padding: 9px 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--heading);
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.ft-matrix td button::before {
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: var(--f, 0);
  content: "";
}
.ft-matrix td button span {
  position: relative;
}
.ft-matrix td button.is-strong {
  color: var(--badge-text);
}
.ft-matrix td button[aria-pressed="true"] {
  outline: 2px solid var(--heading);
  outline-offset: 1px;
}

@media (max-width: 860px) {
  .ft-grid {
    grid-template-columns: 1fr;
  }
  .ft-tree {
    max-height: 360px;
  }
}
@media (max-width: 700px) {
  .blog-entry {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .ft-panel {
    padding: 16px;
  }
  .ft-stats dt {
    font-size: 1.4rem;
  }
}
.blog-entry.text-only {
  grid-template-columns: minmax(0, 1fr);
}
.ft-note {
  max-width: 760px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}
.ft-matrix-wrap {
  overflow-x: auto;
}
.ft-tabs .filter-chip {
  white-space: nowrap;
}
