:root {
  --ink: #1a1a2e;
  --muted: #5b6472;
  --line: #e2e6ed;
  --bg: #f7f8fa;
  --blue: #1d3a8a;
  /* Measured against the pale pill backgrounds below, not against white:
     #2e7d32 on #e3f4e4 came to 4.47, just under the 4.5 AA needs for the
     small text in a status pill. */
  --for: #2b7530;
  --against: #c62828;
  /* Only ever a graphical mark (a bar, a line, a swatch), so 3:1 is the bar it
     has to clear — but 3.45 was uncomfortably close, and the chart lines read
     better a shade darker. */
  --abstain: #7a7a7a;
  --radius: 8px;
  --maxw: 880px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1rem; }

a { color: var(--blue); }

/* Header */
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1rem; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--ink); }
.nav a { margin-left: 1.25rem; text-decoration: none; }

/* Disclaimer */
.disclaimer { background: #fff5e0; border-bottom: 1px solid #f0d9a0; font-size: 0.9rem; }
.disclaimer .container { padding: 0.6rem 1rem; color: #6b4b00; }

main { padding: 1.5rem 1rem 3rem; }

h1 { font-size: 1.8rem; line-height: 1.2; }
.lede { font-size: 1.1rem; color: var(--muted); }
.meta { color: var(--muted); font-size: 0.88rem; }
.breadcrumb a { text-decoration: none; }

/* Search */
.search { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; margin: 1.25rem 0; }
.search input[type=search] { flex: 1; min-width: 200px; padding: 0.55rem 0.7rem;
  border: 1px solid var(--line); border-radius: var(--radius); }
.search.advanced { gap: 1rem; }
.search label { display: block; font-size: 0.85rem; color: var(--muted); }

/* Buttons */
button, .button {
  background: var(--blue); color: #fff; border: 0; border-radius: var(--radius);
  padding: 0.55rem 1.1rem; font-size: 1rem; cursor: pointer; text-decoration: none;
  display: inline-block;
}
button:disabled, .button:disabled { background: #b6bdc9; cursor: not-allowed; }
.link-danger { background: none; color: var(--against); padding: 0; }

/* Law list */
.law-list { list-style: none; padding: 0; display: grid; gap: 1rem; }
.law-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.law-card a { display: block; padding: 1rem 1.2rem; text-decoration: none; color: inherit; }
.law-card h3 { margin: 0.3rem 0; }
/* The facts under a card's excerpt: promulgation, closing, participation. Laid
   out inline so three short items read as one line rather than three stacked
   paragraphs, and wrap rather than overflow on a phone. */
.card-facts { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }

/* Status pill */
.status { display: inline-block; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 0.15rem 0.5rem; border-radius: 999px; background: #eef; }
.status-open { background: #e3f4e4; color: var(--for); }
.status-closed { background: #fde7e7; color: var(--against); }
.status-scheduled { background: #fff0d6; color: #8a5a00; }
.status-draft { background: #eceff3; color: var(--muted); }
/* Imported-law review states */
.status-nouveau { background: #fff0d6; color: #8a5a00; }
.status-importe { background: #e3f4e4; color: var(--for); }
.status-ignore { background: #eceff3; color: var(--muted); }

/* Law page blocks */
.block { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.2rem; margin: 1rem 0; }
.block h2 { margin-top: 0; }
.arguments { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.arguments-for { border-left: 4px solid var(--for); }
.arguments-against { border-left: 4px solid var(--against); }
.attribution { font-size: 0.85rem; color: var(--muted); }
.official-ref { color: var(--muted); }

/* Ballot */
fieldset { border: 1px solid var(--line); border-radius: var(--radius); }
.choice { display: block; padding: 0.35rem 0; }
.vote-confirm { color: var(--for); font-size: 0.9rem; }
.closed-note { color: var(--muted); }
/* Why a vote was refused, shown in place of the button doing nothing. Amber
   rather than red: nothing has gone wrong, the vote simply was not taken. */
.vote-notice {
  background: #fff5e0; border: 1px solid #f0d9a0; border-radius: var(--radius);
  color: #6b4b00; padding: 0.6rem 0.8rem; margin: 0 0 0.9rem; font-size: 0.92rem;
}

/* Optional demographics */
.demographics-optional { margin: 0.75rem 0; }
.demographics-optional summary { cursor: pointer; color: var(--blue); }
.demo-field { display: grid; gap: 0.3rem; max-width: 280px; margin: 0.6rem 0; font-size: 0.92rem; }
.demo-field select { padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; }

/* Results bars */
.bar-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 0.6rem;
  align-items: center; margin: 0.4rem 0; }
.bar { background: var(--line); border-radius: 999px; height: 14px; overflow: hidden; }
.bar-fill { display: block; height: 100%; }
.bar-fill.for { background: var(--for); }
.bar-fill.against { background: var(--against); }
.bar-fill.abstain { background: var(--abstain); }
.bar-pct { font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.total { margin-top: 0.75rem; }
.downloads a { margin-right: 1rem; }

/* Tables */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); }
.evolution td { font-variant-numeric: tabular-nums; }
.admin-table .actions { display: flex; gap: 0.75rem; align-items: center; }
.admin-table .actions form { margin: 0; }

/* Forms */
.law-form { display: grid; gap: 1rem; max-width: 640px; }
.law-form label { display: grid; gap: 0.3rem; font-weight: 600; }
.law-form input, .law-form textarea, .law-form select, .search select {
  padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; width: 100%;
}
.law-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.law-form .checkbox { display: flex; gap: 0.5rem; align-items: center; font-weight: 400; }
.law-form .checkbox input { width: auto; }

.pagination { display: flex; gap: 1rem; align-items: center; margin: 1.5rem 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: 0.88rem; margin-top: 2rem; }
.site-footer .container { padding: 1.25rem 1rem; }

@media (max-width: 640px) {
  .arguments, .law-form .form-row { grid-template-columns: 1fr; }
}


/* --- Administration: use the full window width ---------------------------- */
/* The admin edits long legal text and JSON side by side, so the reading-width
   cap that suits public pages only gets in the way here. */
body.admin-wide .container { max-width: none; padding: 0 1.5rem; }
body.admin-wide .law-form { max-width: none; }
body.admin-wide .admin-table { width: 100%; }
body.admin-wide textarea { width: 100%; resize: vertical; }

/* Provenance strip above the law form. */
.sources {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.7rem 0.9rem; font-size: 0.92rem; line-height: 1.7;
}
.sources a { white-space: nowrap; }

/* Drafting actions sit above the title, where you reach for them first. */
.draft-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.6rem 0 0.2rem; }
.draft-actions button { font-size: 0.95rem; }

/* Save next to the drafting actions. */
.form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.draft-actions button.secondary,
.form-actions button.secondary {
  background: #fff; color: var(--blue); border: 1px solid var(--blue);
}
.draft-actions button.secondary:hover,
.form-actions button.secondary:hover { background: #eef2fb; }


/* --- Accessibility ------------------------------------------------------- */

/* A visible focus ring everywhere, so the site is usable from the keyboard.
   :focus-visible only shows it for keyboard navigation, never on a mouse click. */
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Skip straight to the content past the header and the disclaimer banner. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--blue);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 10;
}
.skip-link:focus {
  left: 0;
}

/* Wide tables scroll inside their own box rather than pushing the page sideways. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Bar widths are painted by /static/app.js from data-pct: with no JavaScript the
   percentages and counts beside each bar still carry the whole result. */
.bar-fill {
  width: 0;
}

/* Who wrote the presentation, and what that is worth (charter: state the limits).
   A `<details>`: three paragraphs between the arguments and the ballot is a lot
   of page for something read once, so the explanation folds away — but the
   summary line keeps the admission itself, so nothing about the limitation is
   behind a click. Native, so it opens with JavaScript off. */
.provenance { border-left: 3px solid #c9d6f0; background: #fafbfe; border-radius: var(--radius);
  padding: 0.7rem 1rem; margin: 1.5rem 0; font-size: 0.92rem; color: var(--muted); }

/* The whole line is the target, chevron included. `list-style: none` removes the
   default triangle in Firefox and modern Chrome; the ::-webkit- rule covers the
   older WebKit that ignores it. */
.provenance > summary { cursor: pointer; list-style: none; position: relative;
  padding-right: 1.5rem; color: var(--ink); font-weight: 600; }
.provenance > summary::-webkit-details-marker { display: none; }

/* Drawn from two borders rather than set as a character: `⌄` is missing from
   enough font stacks to render as a blank or a tofu box, and this is the only
   thing telling the reader there is anything to open. */
.provenance > summary::after { content: ""; position: absolute; right: 0.25rem;
  top: 0.35em; width: 0.45em; height: 0.45em; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(45deg);
  transition: transform 0.15s ease; }
.provenance[open] > summary::after { transform: rotate(-135deg); top: 0.55em; }
.provenance > p { margin: 0.75rem 0 0; }
.provenance .wish { color: var(--ink); }

/* Sits under the form buttons and explains what the second one does. */
.form-hint { margin-top: 0.5rem; }

/* Public record of edits made to a law after publication (charter: transparency). */
.revised-note { background: #eef2fb; border: 1px solid #c9d6f0; border-radius: var(--radius);
  padding: 0.75rem 1rem; font-size: 0.9rem; }
.revision-value { max-width: 22rem; font-size: 0.85rem; color: var(--muted);
  overflow-wrap: anywhere; }
table.revisions td { vertical-align: top; }

/* Triage controls on the imports listing: status, procedure, sort. Inline on a
   wide screen, stacked on a phone. */
.import-filters { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-end;
  margin: 1rem 0 1.5rem; }
.import-filters label { display: flex; flex-direction: column; font-size: 0.85rem;
  color: var(--muted); gap: 0.2rem; }
.import-filters select { min-width: 11rem; }
.seance-count { text-align: right; font-variant-numeric: tabular-nums; }

/* The argument editor. Replaces two JSON textareas that asked an administrator
   to be a programmer: one missing bracket and the whole block was unreadable. */
.arguments-editor { border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem; margin: 1.25rem 0; }
.arguments-editor legend { font-weight: 600; padding: 0 0.4rem; }
.argument-row { border-left: 3px solid var(--line); padding: 0.6rem 0 0.6rem 0.85rem;
  margin-bottom: 0.85rem; position: relative; }
.argument-row:last-child { margin-bottom: 0.5rem; }
.argument-row label { display: block; font-size: 0.85rem; color: var(--muted);
  margin-bottom: 0.4rem; }
.argument-row textarea, .argument-row input { width: 100%; }
/* Author and source side by side on a wide screen, stacked on a phone. */
.argument-meta { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.argument-meta label { flex: 1 1 14rem; }
.remove-argument { background: none; border: 0; padding: 0.1rem 0; cursor: pointer;
  font-size: 0.82rem; text-decoration: underline; }
.add-argument { font-size: 0.9rem; }

/* Archiving and purging: the two-step replacement for one-click deletion. */
.danger-zone { border: 1px solid #f0c9c9; background: #fdf5f5; border-radius: var(--radius);
  padding: 1rem 1.25rem; margin-top: 2rem; }
.danger-zone h2 { margin-top: 0; font-size: 1.05rem; }
.confirm-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.5rem; }
.button.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }

/* Legal pages: long prose, read once, so a comfortable measure matters more
   than density. `.unfilled` marks a mandatory field nobody has filled in — it
   has to look wrong, because a plausible-looking placeholder would be worse. */
.legal { max-width: 44rem; }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-bottom: 0.4rem; }
.legal .lede { font-size: 1.05rem; color: var(--muted); }
.legal table code { font-size: 0.85em; }
.unfilled { color: var(--against); font-style: italic; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }

/* ---- Evolution curve (server-rendered SVG, no JS) ------------------------ */
.chart { margin: 0 0 0.75rem; }
.evolution-chart { display: block; max-width: 100%; height: auto; }
.evolution-chart .grid { stroke: var(--line); stroke-width: 1; }
.evolution-chart .axis-line { stroke: #c9cfd8; stroke-width: 1; }
.evolution-chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.evolution-chart .line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.evolution-chart .area { stroke: none; opacity: 0.10; }
.evolution-chart .dot { stroke: #fff; stroke-width: 1.5; }
.line-for, .dot-for { stroke: var(--for); }
.line-against, .dot-against { stroke: var(--against); }
.line-abstain, .dot-abstain { stroke: var(--abstain); }
.dot-for { fill: var(--for); }
.dot-against { fill: var(--against); }
.dot-abstain { fill: var(--abstain); }
.area-for { fill: var(--for); }
.area-against { fill: var(--against); }
.area-abstain { fill: var(--abstain); }

.chart-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem;
  font-size: 0.88rem; color: var(--muted); margin: 0.25rem 0 0; }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.swatch { width: 0.85rem; height: 0.2rem; border-radius: 2px; display: inline-block; }
.swatch-for { background: var(--for); }
.swatch-against { background: var(--against); }
.swatch-abstain { background: var(--abstain); }
.chart-data { margin-top: 0.75rem; }
.chart-data summary { cursor: pointer; font-size: 0.9rem; color: var(--blue); }

/* Visible to screen readers, not on screen. For table captions and the like,
   where the heading above already gives a sighted reader the context. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* The rest of « Ce que ça change en pratique ». Deliberately quiet: it is the
   same content as above the fold, not an aside, so it gets a divider and a
   control rather than a box that would read as a footnote. */
.more-audiences { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 0.75rem; }
.more-audiences > summary { cursor: pointer; color: var(--blue); font-size: 0.95rem; }
.more-audiences > summary:hover { text-decoration: underline; }
.more-audiences > p:first-of-type { margin-top: 0.75rem; }

/* Admin preview of an unpublished law. */
.preview-bar { background: #1d3a8a; color: #fff; padding: 0.6rem 0; font-size: 0.9rem; }
.preview-bar a { color: #fff; }
.preview-bar .container { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; }

/* ---- Keyboard and pointer targets ---------------------------------------
   The universal :focus-visible rule above already draws the ring; what is left
   is the ballot, where the radio itself is a small target inside a large label.

   Radio and checkbox targets are small; give the whole label a hit area and a
   ring, so the choice is selectable without precision aiming. */
.choice { display: block; padding: 0.35rem 0.5rem; border-radius: var(--radius); }
.choice:hover { background: #eef2fb; }
.choice:focus-within { outline: 3px solid var(--blue); outline-offset: 1px; }

/* Honour a stated preference for less movement. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
