/* Fonts are bundled in ./fonts/ and referenced relatively: @font-face URLs
 * resolve against this stylesheet, so the package renders identically on an
 * air-gapped playout box — no network at render time. Licence in fonts/. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;          /* variable axis — one file covers every weight */
  font-display: block;           /* block, not swap: never flash a fallback on air */
  src: url('./fonts/Inter-Variable.woff2') format('woff2-variations');
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* The graphic's own root. `position: absolute; inset: 0` fills whatever box the
 * renderer hands us: in an iframe mount that is the frame, and inside a shadow
 * root or a positioned container it is that container. `position: fixed` would
 * escape to the browser viewport in the second case. The package never styles
 * `body` — the renderer owns the document, not the graphic. */
.election-bars-root {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.election {
  position: absolute;
  bottom: 60px;
  left: 48px;
  right: 48px;
  font-family: 'Inter', sans-serif;
  opacity: 0;
  transform: translateY(30px);
}

.election.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.election.out {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.76, 0, 0.24, 1);
}

.election-container {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  max-width: 700px;
}

.election-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.election-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.election-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
}

.election-bars {
  padding: 16px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.election-row {
  display: flex;
  align-items: center;
  gap: 16px;
  opacity: 0;
  transform: translateX(-20px);
}

.election-row.show {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.election-party {
  width: 100px;
  flex-shrink: 0;
}

.election-party-name {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.election-party-votes {
  font-size: 10px;
  color: #64748b;
  margin-top: 1px;
}

.election-bar-wrapper {
  flex: 1;
  position: relative;
  height: 28px;
}

.election-bar-track {
  width: 100%;
  height: 100%;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
}

.election-bar-fill {
  height: 100%;
  border-radius: 6px;
  width: 0;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* The percentage label — floats at the bar's edge */
.election-pct {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  left: 0;
  transition: left 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-variant-numeric: tabular-nums;
}

/* Inside the bar (white on color) */
.election-pct.inside {
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  justify-content: flex-end;
  padding-right: 10px;
  /* Label is positioned at left = barWidth, but needs to sit inside */
  transform: translateX(-100%);
  width: auto;
  min-width: 44px;
}

/* Outside the bar (dark text to the right) */
.election-pct.outside {
  color: #0f172a;
  padding-left: 8px;
}
