/* ==========================================================================
   Election Fraud interactive — design tokens + shell + shared primitives.
   Roll Call editorial identity: Lyon Text (serif) + Graphik (sans), white paper.
   Color encodes data everywhere: blue = social, orange = public statement.
   Module-specific styles live in mosaic.css / chart.css / reader.css.
   ========================================================================== */

:root {
  /* Type */
  --ef-serif: 'Lyon Text', Georgia, 'Times New Roman', serif;
  --ef-sans: 'Graphik', 'Helvetica Neue', Arial, sans-serif;

  /* Ink & paper (matched to Roll Call article, NOT cream) */
  --ef-ink: #1a1a1a;
  --ef-ink-soft: #40454c;
  --ef-gray: #6b7280;
  --ef-gray-light: #9aa1ab;
  --ef-rule: #e7e8ea;
  --ef-rule-strong: #d3d5d9;
  --ef-paper: #ffffff;
  --ef-panel: #f6f7f8;

  /* Data colors (mandated) */
  --ef-social: #1DA1F2;
  --ef-statement: #f58231;
  --ef-social-tint: rgba(29, 161, 242, 0.10);
  --ef-statement-tint: rgba(245, 130, 49, 0.12);
  --ef-social-ink: #0c7abf;
  --ef-statement-ink: #c85f14;

  /* Layout */
  --ef-col: 720px;         /* reading measure */
  --ef-col-wide: 980px;    /* chart / controls */
  --ef-gap: clamp(1.5rem, 4vw, 3rem);
  --ef-radius: 3px;        /* Roll Call runs tight corners */
}

.ef-root {
  color: var(--ef-ink);
  background: var(--ef-paper);
  font-family: var(--ef-serif);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.ef-root *, .ef-root *::before, .ef-root *::after { box-sizing: border-box; }

/* Centered measures */
.ef-col { max-width: var(--ef-col); margin-inline: auto; padding-inline: clamp(1rem, 5vw, 2rem); }
.ef-col-wide { max-width: var(--ef-col-wide); margin-inline: auto; padding-inline: clamp(1rem, 5vw, 2rem); }

/* Section rhythm */
.ef-section { padding-block: var(--ef-gap); }
.ef-section + .ef-section { border-top: 1px solid var(--ef-rule); }

/* Eyebrow / section label — Graphik, tracked-out, uppercase (the utility voice) */
.ef-eyebrow {
  font-family: var(--ef-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ef-gray);
  margin: 0 0 0.75rem;
}
.ef-section-title {
  font-family: var(--ef-serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.5vw, 2.15rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
}

/* Intro prose */
.ef-intro p {
  font-size: clamp(1.05rem, 2.4vw, 1.2rem);
  line-height: 1.62;
  color: var(--ef-ink-soft);
  margin: 0 0 1.1rem;
}
.ef-intro p:first-of-type { color: var(--ef-ink); }

/* Utility text */
.ef-meta { font-family: var(--ef-sans); color: var(--ef-gray); font-size: 0.8rem; }
.ef-tabular { font-variant-numeric: tabular-nums; }

/* Inline external-link icon for use inside body copy — orange, sized to the text,
   matching the source-link icons in the cards. */
.ef-link-icon { color: var(--ef-statement); font-size: 0.8em; margin-left: 0.25em; vertical-align: baseline; }

/* Data-kind dots (legend + inline) */
.ef-dot { display: inline-block; width: 0.6em; height: 0.6em; border-radius: 50%; vertical-align: baseline; }
.ef-dot--social { background: var(--ef-social); }
.ef-dot--statement { background: var(--ef-statement); }

/* Links inherit editorial underline-on-hover */
.ef-root a { color: inherit; text-decoration: none; }
.ef-root a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Loading / error */
.ef-loading, .ef-error {
  font-family: var(--ef-sans);
  color: var(--ef-gray);
  text-align: center;
  padding: 3rem 1rem;
  font-size: 0.9rem;
}
.ef-error { color: var(--ef-statement-ink); }

/* Focus visibility (quality floor) */
.ef-root :focus-visible { outline: 2px solid var(--ef-social); outline-offset: 2px; border-radius: 2px; }

/* Shared tooltip (chart + mosaic) */
.ef-tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: var(--ef-ink);
  color: #fff;
  font-family: var(--ef-sans);
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 0.5rem 0.65rem;
  border-radius: var(--ef-radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transition: opacity 0.12s ease;
  max-width: 260px;
}
.ef-tooltip.is-visible { opacity: 1; }

/* Leave room for the fixed methodology footer. */
.ef-root { padding-bottom: 40px; }

/* Collage sits inside the header between eyebrow and headline. */
.ef-headline .ef-mosaic {
  margin: 0.25rem 0 1.4rem;
  border-radius: var(--ef-radius);
}

/* --------------------------------------------------------------------------
   Jump nav (below the byline).
   -------------------------------------------------------------------------- */
.ef-jump-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--ef-rule);
}
.ef-jump {
  font-family: var(--ef-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ef-ink) !important;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none !important;
}
.ef-jump::before {
  font-family: 'Font Awesome 7 Pro', 'Font Awesome 6 Pro', 'FontAwesome';
  font-weight: 900;
  content: '\f0c1'; /* link */
  color: var(--ef-statement);
  font-size: 0.9em;
}
.ef-jump:hover { color: var(--ef-statement-ink) !important; text-decoration: underline !important; text-underline-offset: 3px; }

/* Small note block (e.g. below the chart). */
.ef-note-text {
  font-family: var(--ef-serif);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ef-gray);
  margin: 0;
}

/* --------------------------------------------------------------------------
   Fixed footer + methodology modal (siblings of .ef-root).
   -------------------------------------------------------------------------- */
.ef-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: #303B4B;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
/* Content lines up with the article column; Methodology left, Download truly
   centered, Back to Top right. */
.ef-footer-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 0.75rem;
  min-height: 25px;
  padding-block: 0.28rem;
}
.ef-footer-methodology { justify-self: start; }
.ef-footer-download { justify-self: center; }
.ef-footer-top { justify-self: end; }
.ef-footer-link {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--ef-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  padding: 0;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.ef-footer-link:hover { color: var(--ef-statement); text-decoration: underline; text-underline-offset: 2px; }

.ef-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.ef-modal[hidden] { display: none; }
.ef-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.ef-modal-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--ef-paper);
  border-radius: var(--ef-radius);
  width: min(90vw, 640px);
  max-height: 90vh;
  overflow: hidden; /* the body scrolls, not the dialog → header + close stay pinned */
  padding: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.ef-modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  z-index: 3;
  border: 0;
  background: transparent;
  font-size: 1.7rem;
  line-height: 1;
  color: var(--ef-gray);
  cursor: pointer;
  padding: 0.1rem 0.3rem;
}
.ef-modal-close:hover { color: var(--ef-ink); }
/* Headline sits fixed at the top; the body below it scrolls. */
.ef-modal-title {
  flex: 0 0 auto;
  background: var(--ef-paper);
  font-family: var(--ef-serif);
  font-weight: 600;
  font-size: 1.3rem;
  margin: 0;
  padding: 1.15rem 3rem 0.75rem 1.5rem; /* right room for the × */
  border-bottom: 1px solid var(--ef-rule);
  color: var(--ef-ink);
}
.ef-modal-body { flex: 1 1 auto; overflow-y: auto; padding: 1.1rem 1.5rem 1.5rem; }
.ef-modal-body p { font-family: var(--ef-serif); font-size: 0.98rem; line-height: 1.6; color: var(--ef-ink-soft); margin: 0 0 0.9rem; }

/* Share buttons (below the byline). */
.ef-share { display: flex; list-style: none; margin: 0.85rem 0 0; padding: 0; }
.ef-share li { margin: 0 0.5rem 0 0; padding: 0; }
.ef-share-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #b5b5b5;
  padding: 0.45rem;
}
.ef-share-link:hover { background: #999999; }
.ef-share-link svg { width: 1.05rem; height: 1.05rem; fill: #fff; }

@media (prefers-reduced-motion: reduce) {
  .ef-root *, .ef-root *::before, .ef-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Methodology modal typography. */
.ef-modal-sub {
  font-family: var(--ef-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ef-gray);
  margin: 1.4rem 0 0.5rem;
}
.ef-modal-sub:first-child { margin-top: 0; }
.ef-modal-body ul { margin: 0.4rem 0 0.9rem; padding-left: 1.2rem; }
.ef-modal-body li { font-family: var(--ef-serif); font-size: 0.95rem; line-height: 1.55; color: var(--ef-ink-soft); margin-bottom: 0.2rem; }
.ef-modal-body em { color: var(--ef-ink); font-style: italic; }

/* Footer left group (Methodology + Download Data). */
.ef-footer-left { display: flex; align-items: center; gap: 1.25rem; min-width: 0; }

/* Mobile: declutter the footer so the links don't bleed together. */
@media (max-width: 600px) {
  .ef-footer-inner { gap: 0.75rem; }
  .ef-footer-left { gap: 0.85rem; }
  .ef-footer-link { font-size: 0.68rem; letter-spacing: 0.02em; }
  .ef-hide-mobile { display: none; }
}
