/* Shared visual foundations for every Conexão Política election experience. */
@font-face {
  font-family: "Cortex Interface";
  src: url("../fonts/inter-latin-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

.cpx-tool,
.cpx-engagement-tool,
.cpx-election {
  --cpx-font-interface: "Cortex Interface", Arial, sans-serif;
  --cpx-primary: #07194f;
  --cpx-primary-strong: #041135;
  --cpx-accent: #00a8e8;
  --cpx-accent-soft: #e7f7fd;
  --cpx-surface: #fff;
  --cpx-paper: #f5f7fa;
  --cpx-ink: #172033;
  --cpx-muted: #5d6b82;
  --cpx-line: #d9e0eb;
  --cpx-radius-sm: 8px;
  --cpx-radius-md: 12px;
  --cpx-radius-lg: 18px;
  --cpx-shadow-soft: 0 8px 24px rgba(7, 25, 79, .07);
  color: var(--cpx-ink);
  font-family: var(--cpx-font-interface);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.cpx-election-nav {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  width: 100%;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--cpx-line, #d9e0eb);
  border-radius: var(--cpx-radius-md, 12px);
  background: var(--cpx-paper, #f5f7fa);
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: nowrap;
}

.cpx-election-nav::-webkit-scrollbar { display: none; }

.cpx-election-nav a {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--cpx-radius-sm, 8px);
  color: var(--cpx-muted, #5d6b82);
  font-family: var(--cpx-font-interface);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  text-align: center;
  transition: color .16s ease, background .16s ease, box-shadow .16s ease;
}

.cpx-election-nav a:hover { color: var(--cpx-primary); background: #fff; }

.cpx-election-nav svg {
  flex: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cpx-election-nav a[aria-current="page"] {
  color: #fff;
  background: var(--cpx-primary);
  box-shadow: 0 2px 7px rgba(7, 25, 79, .16);
}

.cpx-election-nav a[aria-current="page"]:hover { color: #fff; background: var(--cpx-primary-strong); }

.cpx-election-app-nav { display: none; }

.cpx-count .cpx-election-nav {
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--cpx-line);
  border-radius: var(--cpx-radius-md);
  background: var(--cpx-paper);
}

.cpx-count .cpx-election-nav a { min-height: 40px; padding: 0 14px; }

.cpx-tool-header h1,
.cpx-count.cpx-tool .cpx-count-heading h1,
.cpx-directory-page .cpx-directory-hero h1 {
  color: var(--cpx-primary);
  font-family: var(--cpx-font-interface);
  font-size: clamp(32px, 4.4vw, 52px);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.05;
}

.cpx-directory-page > .cpx-election-nav,
.cpx-profile > .cpx-election-nav {
  width: min(100% - 48px, 1120px);
  margin: 18px auto 24px;
}

.cpx-tool-header,
.cpx-results-query,
.cpx-my-election-form,
.cpx-ballot-setup,
.cpx-compare-filter,
.cpx-compare-workspace > div,
.cpx-compare-workspace > aside,
.cpx-ballot-paper,
.cpx-ballot-picker,
.cpx-tool-card {
  border-radius: var(--cpx-radius-md, 12px);
}

.cpx-tool-status,
.cpx-empty-state,
.cpx-loading-state {
  border-radius: var(--cpx-radius-sm, 8px);
}

.cpx-tool :is(input, select, textarea),
.cpx-election :is(input, select, textarea) {
  border-radius: var(--cpx-radius-sm, 8px);
  font-family: var(--cpx-font-interface);
}

.cpx-tool button,
.cpx-election button { border-radius: var(--cpx-radius-sm, 8px); font-family: var(--cpx-font-interface); }

.cpx-tool :is(a, button, input, select, textarea):focus-visible,
.cpx-election :is(a, button, input, select, textarea):focus-visible {
  outline: 3px solid var(--cpx-accent, #00a8e8);
  outline-offset: 2px;
}

/* Use the same election masthead treatment on the candidate directory/profile. */
.cpx-directory-page .cpx-tool-heading-bar,
.cpx-profile .cpx-profile-edition {
  position: relative;
  background: var(--cpx-primary, #07194f);
  color: #fff;
}

.cpx-directory-page .cpx-tool-heading-bar::before,
.cpx-profile .cpx-profile-edition::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--cpx-accent, #00a8e8);
  content: "";
}

.cpx-directory-page .cpx-tool-heading-bar {
  min-height: 54px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.cpx-profile .cpx-profile-edition {
  border-bottom: 3px solid var(--cpx-accent, #00a8e8);
}

.cpx-profile .cpx-profile-actions button {
  min-height: 36px;
  border-radius: var(--cpx-radius-sm, 8px);
}

@media (max-width: 700px) {
  .cpx-tool,
  .cpx-engagement-tool {
    padding-top: 10px;
  }

  .cpx-election-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    overflow: visible;
    white-space: normal;
    text-align: center;
  }

  .cpx-directory-page > .cpx-election-nav,
  .cpx-profile > .cpx-election-nav {
    width: calc(100% - 32px);
    margin-top: 12px;
    margin-bottom: 16px;
  }

  .cpx-election-nav a {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 48px;
    gap: 2px;
    padding: 4px 2px;
    font-size: clamp(9px, 2.8vw, 11px);
    white-space: nowrap;
    text-align: center;
  }

  .cpx-election-nav svg { display: block; width: 16px; height: 16px; }

  body:has(.cpx-election-app-nav) { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

  .cpx-election-app-nav {
    position: fixed;
    z-index: 10000;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    min-height: 60px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--cpx-line, #d9e0eb);
    background: rgba(255,255,255,.98);
    box-shadow: 0 -4px 16px rgba(7,25,79,.08);
    font-family: var(--cpx-font-interface, Arial, sans-serif);
    backdrop-filter: blur(12px);
  }

  .cpx-election-app-nav a {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 8px;
    color: var(--cpx-muted, #5d6b82);
    font-size: 10px;
    font-weight: 650;
    line-height: 1.1;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  .cpx-election-app-nav a[aria-current="page"] { color: var(--cpx-primary, #07194f); }
  .cpx-election-app-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

  .cpx-hub-hero {
    gap: 20px;
    padding: 26px 20px;
    border-radius: var(--cpx-radius-lg, 18px);
  }

  .cpx-hub-hero h1 {
    max-width: 14ch;
    margin: 10px 0 14px;
    font-size: clamp(34px, 9.3vw, 40px);
    line-height: 1.02;
    letter-spacing: -.04em;
  }

  .cpx-hub-countdown {
    margin-top: 8px !important;
  }

  .cpx-hub-hero-copy > p:not(.cpx-tool-eyebrow):not(.cpx-hub-countdown) {
    font-size: 15px;
    line-height: 1.55;
  }

  .cpx-hub-actions {
    gap: 8px;
    margin-top: 20px;
  }

  .cpx-hub-actions .cpx-button {
    min-height: 46px;
  }

  .cpx-hub-date {
    grid-template-columns: auto 1fr;
    justify-items: start;
    gap: 2px 14px;
    padding: 16px;
    text-align: left;
  }

  .cpx-hub-date > span:first-child {
    align-self: end;
  }

  .cpx-hub-date strong {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    font-size: 52px;
  }

  .cpx-hub-date > span:nth-of-type(2) {
    align-self: start;
  }

  .cpx-hub-date small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cpx-election-nav a,
  .cpx-tool button,
  .cpx-button,
  .cpx-hub-card {
    scroll-behavior: auto;
    transition-duration: .01ms !important;
  }
}
