/* Extra colour tokens used on this page */
:root {
  --yi-ruby: #fb7185;
  --yi-cyan: #22d3ee;
}

/* Page head / title */

.yi-page-head {
  padding-top: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--yi-line);
}

.yi-page-head-inner {
  max-width: var(--yi-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.yi-page-eyebrow {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--yi-text-soft);
}

.yi-page-title {
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0;
}

.yi-page-sub {
  font-size: 1.15rem;
  color: var(--yi-text-soft);
  margin: 0;
}

/* Brief explanation box above table */

.yi-brief {
  padding-top: 1.2rem;
  padding-bottom: 0.6rem;
}

.yi-brief-inner {
  max-width: var(--yi-width);
  margin: 0 auto;
  border-radius: var(--yi-radius);
  background: #020617;
  border: 1px solid rgba(31, 41, 55, 0.9);
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.yi-brief-main {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: 40rem;
}

.yi-brief-text {
  font-size: 1.1rem;
  color: var(--yi-text-soft);
}

.yi-brief-meta {
  font-size: 1.05rem;
  color: var(--yi-text-soft);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

/* green status dot + LAST UPDATE label */
.yi-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background-color: #22c55e;
  display: inline-block;
}

.yi-brief-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.9rem;
  color: var(--yi-text-soft);
}

.yi-brief-date {
  font-weight: 500;
}

/* small buttons on right side */

.yi-brief-actions{
  display: flex;
  flex-direction: column;  /* stack */
  align-items: flex-end;   /* right align */
  gap: 0.45rem;
  flex-wrap: nowrap;       /* optional: prevents odd wrapping */
}


.yi-brief-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--yi-border-soft);
  font-size: 1rem;
  font-weight: 500;
  background-color: var(--yi-accent);
  color: #0b1120;
  text-decoration: none;
  white-space: nowrap;
}

.yi-brief-btn:hover {
  text-decoration: none;
  background-color: #ea580c;
}

.yi-brief-btn-ghost {
  background-color: transparent;
  color: var(--yi-text-soft);
  border-color: var(--yi-border-soft);
}

.yi-brief-btn-ghost:hover {
  color: var(--yi-text-main);
  border-color: var(--yi-border-strong);
  background-color: rgba(15, 23, 42, 0.8);
}

.yi-brief-btn-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.yi-brief-btn-icon img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

/* Table section */

.yi-table-section {
  padding-top: 0.8rem;
}

.yi-table-header {
  max-width: var(--yi-width);
  margin: 0 auto 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.yi-table-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
}

.yi-table-sub {
  font-size: 1.05rem;
  color: var(--yi-text-soft);
  margin: 0;
}

.yi-table-toolbar {
  max-width: var(--yi-width);
  margin: 0 auto 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.yi-table-note {
  font-size: 0.95rem;
  color: var(--yi-text-soft);
}

/* Scroll wrapper + table */

.yi-table-scroll {
  max-width: var(--yi-width);
  margin: 0 auto;
  overflow-x: auto;
  border-radius: var(--yi-radius-lg);
  border: 1px solid rgba(31, 41, 55, 0.95);
  background: #020617;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.yi-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.yi-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: radial-gradient(circle at top left,
              rgba(249, 115, 22, 0.16) 0,
              transparent 50%),
              #020617;
}

/* headers centered */
.yi-table thead th {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 500;
  padding: 0.8rem 0.85rem;
  border-bottom: 1px solid var(--yi-line);
  color: var(--yi-text-soft);
  text-align: center;
  white-space: nowrap;
}

/* rank column header: small width, no label */
.yi-table thead th.col-rank {
  width: 3ch;
}

.yi-table thead th[data-sort-key] {
  cursor: pointer;
}

.yi-table thead th[data-sort-key].is-sorted {
  color: var(--yi-accent);
}

/* Body */

.yi-table tbody tr {
  transition: background-color 0.12s ease;
}

.yi-table tbody tr:nth-child(4n+3),
.yi-table tbody tr:nth-child(4n+4) {
  /* pair main+detail rows visually */
  background-color: rgba(15, 23, 42, 0.6);
}

/* data centered by default */
.yi-table tbody td {
  font-size: 1.05rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid rgba(31, 41, 55, 0.7);
  text-align: center;
}

/* rank cell: small, subtle */
.yi-table tbody td.col-rank {
  width: 3ch;
  font-size: 0.98rem;
  color: var(--yi-text-soft);
}

/* country name left-aligned with flag + expand button */
.yi-table tbody td.col-country {
  text-align: left;
  white-space: nowrap;
}

.yi-country-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.yi-country-name {
  margin-left: 0.1rem;
}

/* Non-resident embassy marker shown beside country name */
.yi-country-note-nonresident{
  margin-left: 0.45rem;
  font-style: italic;
  color: var(--yi-accent);
  font-size: 0.95em;
  opacity: 0.95;
}


/* expand toggle */
.yi-expand-toggle {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.yi-expand-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--yi-border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--yi-text-soft);
  transition:
    transform 0.12s ease,
    background-color 0.12s ease,
    color 0.12s ease,
    border-color 0.12s ease;
}

.yi-expand-icon::before {
  content: "▾";
  line-height: 1;
}

.yi-main-row.is-open .yi-expand-icon {
  transform: rotate(-180deg);
  background-color: var(--yi-accent-soft);
  color: var(--yi-accent);
  border-color: var(--yi-accent);
}

/* numeric cells */
.yi-table tbody td.col-num {
  font-variant-numeric: tabular-nums;
}

.yi-table-loading,
.yi-table-error {
  text-align: center;
  font-size: 1.05rem;
  color: var(--yi-text-soft);
}

/* Selected main row highlight */
.yi-main-row.yi-row-selected {
  background: rgba(249, 115, 22, 0.18) !important;
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.5);
}

/* Flag icon before country name */

.yi-flag-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.yi-flag {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid rgba(15, 23, 42, 0.8);
}

/* Expandable detail row */

.yi-expand-row {
  display: none;
  background: rgba(15, 23, 42, 0.96);
}

.yi-expand-row.is-open {
  display: table-row;
}

.yi-expand-cell {
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid rgba(31, 41, 55, 0.8);
}

/* 2x2 grid of panels */
.yi-expand-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.yi-panel {
  border-radius: var(--yi-radius);
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: radial-gradient(circle at top left,
              rgba(148, 163, 184, 0.12) 0,
              transparent 55%),
              #020617;
  padding: 0.75rem 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.yi-panel-title {
  font-size: 1rem;
  font-weight: 600;
}

/* Panel 1: line chart skeleton */

/* Panel 1: line chart */

.yi-panel-chart .yi-chart-shell {
  position: relative;
  border-radius: var(--yi-radius);
  border: 1px dashed rgba(55, 65, 81, 0.9);
  min-height: 150px;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
}

/* was a faded placeholder – now draw for real */
.yi-line-chart {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 1;
}

.yi-chart-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--yi-text-soft);
  pointer-events: none;
}


/* Panel 2: donuts */


.yi-panel-donuts {
  position: relative;
  gap: 0.6rem;
  justify-content: center;      /* keep the donut group centred vertically */
  padding-top: 1.6rem;          /* make room for the title at the very top */
}

/* Anchor the title to the TOP CENTRE of the panel */
.yi-panel-donuts .yi-panel-title {
  position: absolute;
  top: 0.5rem;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
}
.yi-donut-group {
  display: flex;
  justify-content: center;   /* centre the pair of donuts as a group */
  align-items: center;
  gap: 3rem;                 /* horizontal space between the two donuts */
  width: 100%;
}


.yi-donut {
  position: relative;              /* <-- keep donut centre inside the box */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.yi-donut-ring {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  position: relative;
  background: conic-gradient(rgba(55,65,81,0.9) 0 100%);
}

.yi-donut-ring::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 999px;
  background: #020617;
}

.yi-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.yi-donut-main {
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

.yi-donut-label {
  font-size: 0.9rem;
  color: var(--yi-text-soft);
  text-align: center;
  margin-top: 0.1rem;
}

/* Static labels under each donut */

.yi-donut-labels {
  font-size: 0.85rem;
  color: var(--yi-text-soft);
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.1rem;
}

.yi-donut-percents {
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 0.1rem;
}

.yi-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.yi-dot-ruby {
  background-color: var(--yi-ruby);
}

.yi-dot-cyan {
  background-color: var(--yi-cyan);
}

/* Panel 3: mission metrics */

.yi-panel-metrics {
  flex-direction: row;
  justify-content: space-between;
  align-items: stretch;
  gap: 0.9rem;
}

.yi-metric {
  flex: 1;
  border-radius: var(--yi-radius);
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: radial-gradient(circle at top left,
              rgba(249, 115, 22, 0.16) 0,
              transparent 60%),
              rgba(15, 23, 42, 0.9);
  padding: 0.75rem 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.yi-metric-value {
  font-size: 1.4rem;
  font-weight: 600;
}

.yi-metric-label {
  font-size: 0.9rem;
  color: var(--yi-text-soft);
  text-align: center;
}

/* Panel 4: consular mini-table */

.yi-panel-consular {
  gap: 0.6rem;
}

.yi-mini-table {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.yi-mini-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
}

.yi-mini-cell {
  font-size: 0.9rem;
  text-align: center;
}

.yi-mini-header .yi-mini-cell {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--yi-accent); /* same accent feel as sorted Total header */
}

/* honorary-only indicator */
.yi-honorary-flag {
  color: var(--yi-accent);
  font-size: 0.85em;
  margin-left: 0.12em;
  vertical-align: super;
}

/* Responsive */

@media (max-width: 880px) {
  .yi-brief-inner {
    align-items: flex-start;
  }
  .yi-donut-group {
    flex-direction: column;  /* stack donuts on small screens */
    gap: 1.2rem;
  }
  

  .yi-brief-meta {
    white-space: normal;
  }

  .yi-expand-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .yi-panel-metrics {
    flex-direction: column;
  }

  .yi-donut-group {
    grid-template-columns: minmax(0, 1fr);
  }

  .yi-donut-percents {
    gap: 1.6rem;
  }
}

@media (max-width: 720px) {
  .yi-table {
    min-width: 640px;
  }
}


/* ===== Display 1: split staff chart + HoM mini-chart ===== */
.yi-chart-stack {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.yi-chart-shell-staff {
  min-height: 160px;
}

.yi-chart-shell-hom {
  min-height: 72px;
  border-style: solid;
  border-color: rgba(55, 65, 81, 0.65);
}

.yi-hom-chart {
  width: 100%;
  height: 100%;
  display: block;
}

/* Tooltip for HoM change nodes */
.yi-hom-tooltip {
  position: absolute;
  display: none;
  max-width: 210px;
  padding: 0.55rem 0.6rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.95);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  color: var(--yi-text-main);
  pointer-events: none;
}

.yi-hom-tooltip-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.yi-hom-tooltip-rank {
  font-size: 0.9rem;
  color: var(--yi-text-soft);
  margin-bottom: 0.25rem;
}

.yi-hom-tooltip-since {
  font-size: 0.88rem;
  color: var(--yi-text-soft);
}

.yi-hom-tooltip-since strong {
  color: var(--yi-text-main);
  font-weight: 600;
}

/* ===== Display 3: HoM metric formatting ===== */
.yi-metric-label-top {
  font-size: 0.85rem;
  color: var(--yi-text-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.25rem;
  text-align: center;
}

.yi-metric-sub {
  font-size: 0.9rem;
  color: var(--yi-text-soft);
  display: inline-flex;
  gap: 0.35rem;
  align-items: baseline;
  justify-content: center;
  text-align: center;
}

.yi-metric-sub-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: rgba(148,163,184,0.85);
}

.yi-metric-sub-value {
  font-weight: 600;
  color: var(--yi-text-main);
}


/* ===== v3 override: keep expandable row size unchanged =====
   v2 stacked two .yi-chart-shell blocks, each inheriting min-height:150px
   from .yi-panel-chart .yi-chart-shell. We constrain the stack to the
   original height and make the HoM strip very low.
*/
.yi-chart-stack{
  height: 165px;           /* slight increase vs original */
  gap: 0.35rem;
}

.yi-chart-stack .yi-chart-shell{
  min-height: 0 !important;
}

.yi-chart-shell-staff{
  flex: 1 1 auto;
}

.yi-chart-shell-hom{
  flex: 0 0 40px;          /* slightly taller for title */
  border-style: solid;
  border-width: 1px;
  border-color: rgba(148,163,184,0.22);
}

.yi-chart-shell-hom .yi-chart-overlay{
  font-size: 0.82rem;
  opacity: 0.85;
}


/* v4: bump Display 2 height slightly (donut panel) */
.yi-panel-donuts{
  min-height: 165px;
}


/* Mini title inside small chart shells */
.yi-mini-title{
  position: absolute;
  top: 6px;
  left: 10px;
  right: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(148,163,184,0.85);
  text-align: left;
  pointer-events: none;
  z-index: 2;
}


/* v4: smaller Display 3/4 data */
.yi-panel-metrics .yi-metric-value{
  font-size: 1.35rem;
}

.yi-panel-consular .yi-mini-cell{
  font-size: 0.92rem;
}


/* Staff chart hover tooltip */
.yi-staff-tooltip{
  position: absolute;
  display: none;
  width: 210px;
  padding: 0.55rem 0.6rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.95);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  color: var(--yi-text-main);
  pointer-events: none;
  z-index: 10;
}

.yi-staff-tooltip-date{
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.yi-staff-tooltip-row{
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--yi-text-soft);
  margin-top: 0.2rem;
}

.yi-staff-tooltip-row.is-strong{
  color: var(--yi-text-main);
}

.yi-staff-tooltip-val{
  font-weight: 600;
  color: inherit;
}


/* Last update button (non-clickable, matches Methodology style) */
.yi-brief-lastupdate{
  pointer-events: none;
  opacity: 0.95;
}


/* v5: allow HoM tooltip to overflow into the upper (staff) chart area */
.yi-chart-stack{
  position: relative;
  overflow: visible;
}

.yi-chart-shell-staff{
  position: relative;
  z-index: 1;
}

.yi-chart-shell-hom{
  overflow: visible !important; /* overrides .yi-chart-shell overflow:hidden */
  position: relative;
  z-index: 5;
}

.yi-hom-tooltip{
  z-index: 20;
}


/* Vertically center single-number metrics */
.yi-metric-center{
  justify-content: center;
}


/* v5: center Consular network panel content */
.yi-panel-consular{
  justify-content: center;
  align-items: center;
}

.yi-panel-consular .yi-panel-title{
  align-self: center;
  text-align: center;
}

.yi-panel-consular .yi-mini-table{
  width: 100%;
}

/* --- Nav dropdown fix: remove hover "gap" + allow click/focus to hold open --- */
#mainav li ul{
  margin: 0; /* overrides any submenu margin that creates a hover gap */
}

#mainav li:hover > ul,
#mainav li:focus-within > ul{
  display: block;
}
