/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */

/* Offset anchor scroll position so fragment targets clear the sticky navbar (h-14 = 3.5rem). */
html {
  scroll-padding-top: 3.5rem;
}

/* Collapsible section chevron */
.collapsible-section > summary {
  list-style: none;
}
.collapsible-section > summary::-webkit-details-marker {
  display: none;
}
.collapsible-chevron {
  display: inline-block;
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 0.15s ease;
}
.collapsible-section[open] > summary .collapsible-chevron {
  transform: rotate(90deg);
}

/* Section anchor link — hidden until heading is hovered */
.section-anchor {
  opacity: 0;
  transition: opacity 0.15s ease;
  font-size: 1rem;
  text-decoration: none;
}
.collapsible-section > summary:hover .section-anchor {
  opacity: 1;
}

/* Subsection anchor link — same behaviour for h3 subheadings */
.subsection-heading:hover .section-anchor {
  opacity: 1;
}

/* Accuracy trend chart row: stacks on mobile, side-by-side on desktop.
   Column widths driven by per-element CSS variables set inline in the
   view, only applied when the row is in lg+ viewports. */
@media (min-width: 1024px) {
  .trend-chart-row .trend-chart-major {
    flex: 0 0 var(--trend-chart-major-basis, 50%);
    min-width: 0;
  }
  .trend-chart-row .trend-chart-minor {
    flex: 0 0 var(--trend-chart-minor-basis, 50%);
    min-width: 0;
  }
}

/* Icon-as-toggle control on the /ballots/:id trend chart. The SVG shape
   itself is the clickable toggle — no surrounding checkbox. Off state
   is grey outline; on state is fuchsia (#d946ef), chosen to avoid any
   UK political-party colour. */
.trend-toggle {
  user-select: none;
  color: #9ca3af; /* off: gray-400 — matches the icon outline/fill */
}
.trend-toggle[aria-pressed="true"] {
  color: #374151; /* on: gray-700 — clearly darker, reads as active */
}
.trend-toggle:focus-visible {
  outline: 2px solid #d946ef;
  outline-offset: 2px;
  border-radius: 3px;
}
.trend-toggle .shape-disc circle,
.trend-toggle .shape-triangle polygon {
  fill: #9ca3af;
  stroke: none;
}
.trend-toggle .shape-ring circle,
.trend-toggle .shape-square rect {
  stroke: #9ca3af;
}
.trend-toggle[aria-pressed="true"] .shape-disc circle,
.trend-toggle[aria-pressed="true"] .shape-triangle polygon {
  fill: #d946ef;
}
.trend-toggle[aria-pressed="true"] .shape-ring circle,
.trend-toggle[aria-pressed="true"] .shape-square rect {
  stroke: #d946ef;
}

/* Shared grid layout for the Party / Classification / Share / Bar
   tables used by both the notional-results panel and the predecessor-
   actual detail fragment. Defined globally because the predecessor
   fragment is fetched stand-alone via XHR and has no accompanying
   <style> block of its own. */
.notional-grid {
  display: grid;
  grid-template-columns: 1fr auto 80px minmax(80px, 200px);
  border-top: 1px solid #e5e7eb;
}
.notional-grid-row {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
}
.notional-grid-header > div {
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
.notional-grid-row > div {
  border-bottom: 1px solid #f3f4f6;
}
/* Full-width items span all columns */
.notional-grid-row > .grid-full {
  grid-column: 1 / -1;
}
/* <details> uses subgrid */
.notional-grid-row > details.grid-full {
  display: grid;
  grid-template-columns: subgrid;
}
/* <summary> uses subgrid so cells align with columns */
.notional-grid-row > details.grid-full > summary.notional-summary {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  list-style: none;
  cursor: pointer;
}
.notional-grid-row > details.grid-full > summary.notional-summary::-webkit-details-marker {
  display: none;
}
.notional-grid-row > details.grid-full > summary.notional-summary::marker {
  display: none;
  content: "";
}
/* Disclosure chevron */
.notional-summary > .notional-name::before {
  content: "\203A";
  display: inline-block;
  font-size: 1.5rem;
  line-height: 1;
  color: #9ca3af;
  margin-right: 0.25rem;
  transition: transform 0.15s ease;
}
details[open] > .notional-summary > .notional-name::before {
  transform: rotate(90deg);
}
/* Summary cell borders */
.notional-summary > div {
  border-bottom: 1px solid #f3f4f6;
}
/* Sub-table container spans all columns via grid-full */
.notional-grid-row > details.grid-full > .grid-full {
  grid-column: 1 / -1;
}
.notional-sub {
  border-bottom: 1px solid #e5e7eb;
}
/* Hover highlight */
.notional-summary:hover > div {
  background: #f9fafb;
}
/* Open state highlight */
details[open] > .notional-summary > div {
  background: #f0f9ff;
}
/* Alternate row shading */
.notional-grid-row:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.03);
}
/* Predecessor sub-row highlight — mirrors overlap-map-highlight.
   Colour comes from --color-focus (Area::COLOR_FOCUS) injected by the
   layout, mixed down to a 12% tint. */
.notional-pred-row.notional-map-highlight > td {
  background-color: color-mix(in srgb, var(--color-focus) 12%, transparent) !important;
}
